Open deliciouslytyped opened 4 years ago
Current working WIP:
generate default.nix
with mvnix-init -S 'pkgs.fetchFromGitHub { owner = "sismics"; repo = "docs"; rev = "v1.7"; sha256 = "0d789fi15hjjjd02g98iqsmbkxdd4jsx4k1z3w5s7lw90mvnzhjc"; }'
default.nix modifications: (see also https://github.com/icetan/mavenix/issues/36 )
mvnix-update
docs-web-pom.patch:
diff --git a/docs-web/pom.xml b/docs-web/pom.xml
index 363552c9..2406e9d1 100644
--- a/docs-web/pom.xml
+++ b/docs-web/pom.xml
@@ -309,18 +309,12 @@
<phase>generate-sources</phase>
<configuration>
<target name="building">
- <!-- npm install -->
- <exec executable="cmd" dir="${project.basedir}/src/main/webapp" osfamily="windows" failonerror="true">
- <arg line="/c npm install" />
- </exec>
- <exec executable="npm" dir="${project.basedir}/src/main/webapp" osfamily="unix" failonerror="true">
- <arg line="install" />
- </exec>
<!-- grunt -->
<exec executable="cmd" dir="${project.basedir}/src/main/webapp" osfamily="windows" failonerror="true">
<arg line="/c grunt --apiurl=api" />
</exec>
- <exec executable="grunt" dir="${project.basedir}/src/main/webapp" osfamily="unix" failonerror="true">
+ <exec executable="node" dir="${project.basedir}/src/main/webapp" osfamily="unix" failonerror="true">
+ <arg line="./node_modules/grunt/bin/grunt" />
<arg line="--apiurl=api" />
</exec>
</target>
default.nix:
# This file has been modified from the one generated by mavenix:
# `mvnix-init -S 'pkgs.fetchFromGitHub { owner = "sismics"; repo = "docs"; rev = "v1.7"; sha256 = "0d789fi15hjjjd02g98iqsmbkxdd4jsx4k1z3w5s7lw90mvnzhjc"; }'`
let
node_modules = packagefile: lockfile: pkgs: pkgs.runCommand "teedy-nodedeps" { buildInputs = [ pkgs.nodePackages.node2nix ]; } ''
mkdir -p $out
lockfile=${lockfile}
cp ${packagefile} $lockfile $out
pushd $out
node2nix -d --nodejs-12 -l $(basename $lockfile)
'';
src' = pkgs: pkgs.fetchFromGitHub { owner = "sismics"; repo = "docs"; rev = "v1.7"; sha256 = "0d789fi15hjjjd02g98iqsmbkxdd4jsx4k1z3w5s7lw90mvnzhjc"; };
src = pkgs: pkgs.runCommand "sismics-docs-patched" { patches = [ ./docs-web-pom.patch ]; } ''
cp -r ${src' pkgs} $out
chmod -R +w $out
cd $out
patchPhase
node_modules=${((pkgs.callPackage (node_modules ((src' pkgs) + "/docs-web/src/main/webapp/package.json") ((src' pkgs) + "/docs-web/src/main/webapp/package-lock.json") pkgs) {}).shell.nodeDependencies) + "/lib/node_modules"}
cp -r $node_modules docs-web/src/main/webapp/
'';
settings = pkgs: pkgs.writeText "settings.xml" ''
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>prod</activeProfile>
</activeProfiles>
</settings>
'';
mavenix-src = fetchTarball { url = "https://github.com/icetan/mavenix/tarball/v2.3.3"; sha256 = "1l653ac3ka4apm7s4qrbm4kx7ij7n2zk3b67p9l0nki8vxxi8jv7"; };
in {
pkgs ? (import mavenix-src {}).pkgs,
mavenix ? import mavenix-src { inherit pkgs; },
doCheck ? false,
}:
mavenix.buildMaven {
inherit doCheck;
src = src pkgs;
infoFile = ./mavenix.lock;
buildInputs = with pkgs; [ nodejs ];
settings = settings pkgs;
}
Here is an example container configuration, usable with extra-container create ./container.nix
(https://github.com/erikarvstedt/extra-container):
{
containers.teedy = {
privateNetwork = true;
hostAddress = "10.250.0.1";
localAddress = "10.250.0.9";
autoStart = true;
bindMounts = []; #TODO
config = {pkgs, config, ...}: {
networking.nameservers = [ "192.168.0.1" ]; #TODO
networking.useHostResolvConf = false;
networking.firewall = {
allowPing = true;
allowedTCPPorts = [ 80 8080 443 ]; #TODO 443 only
};
systemd.services.teedy-setup = {
script = ''
mkdir /var/docs || true #TODO
chown ${config.services.tomcat.user}:${config.services.tomcat.group} /var/docs
'';
requiredBy = [ "tomcat.service" ];
before = [ "tomcat.service" ];
serviceConfig = { Type = "oneshot"; };
};
services.tomcat = {
enable = true;
webapps = [ "${builtins.toPath "${pkgs.callPackage ./default.nix {}}/share/java/docs-web-1.7.war" }" ]; #The outer cast is to deal with toString shenanigans in the tomcat module
};
};
};
}
Hello, I'm a bot and I thank you in the name of the community for opening this issue.
To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.
The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.
If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.
Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.
@deliciouslytyped Have you made any more progress with this? If not, I think that packaging teedy from the GitHub releases might be an easier starting point.
I basically have it running afaik, I just haven't spent time to try pr-ing it. It's probably just what I have above.
I marked this as stale due to inactivity. → More info
Hey @deliciouslytyped are you still using the package, I'd like to give a try to package it in the near future, do you have any recommandation ? I'll try and make a PR from it (it might be a lot of work for my first contribution)
I think I'm still running it yes, but I haven't messed with it for a while.
Thanks for your answer, and are you running the latest version or some older versions ?
So I take it, I can use the following instructions with some tweaks on the versions to build and try to use it, if I end up making a package out of it, would you be interested in helping maintain it as well, if such a package lands in Nixpkgs ? Or you would still roll with your own thing on your own ?
Current working WIP:
- generate
default.nix
withmvnix-init -S 'pkgs.fetchFromGitHub { owner = "sismics"; repo = "docs"; rev = "v1.7"; sha256 = "0d789fi15hjjjd02g98iqsmbkxdd4jsx4k1z3w5s7lw90mvnzhjc"; }'
- default.nix modifications: (see also passing maven flags, and postUnpack nix-community/mavenix#36 )
- add a settings file to enable the production profile
- add nodejs to buildInputs (for grunt)
- patch the docs-web pom.xml to run grunt without npm
- shenanigans for patching node_modules from node2nix into the src derivation (see also Is it possible to install dev dependencies as well? svanderburg/node2nix#149 and expose function to create
node_modules
only svanderburg/node2nix#8 )
mvnix-update
docs-web-pom.patch:
diff --git a/docs-web/pom.xml b/docs-web/pom.xml index 363552c9..2406e9d1 100644 --- a/docs-web/pom.xml +++ b/docs-web/pom.xml @@ -309,18 +309,12 @@ <phase>generate-sources</phase> <configuration> <target name="building"> - <!-- npm install --> - <exec executable="cmd" dir="${project.basedir}/src/main/webapp" osfamily="windows" failonerror="true"> - <arg line="/c npm install" /> - </exec> - <exec executable="npm" dir="${project.basedir}/src/main/webapp" osfamily="unix" failonerror="true"> - <arg line="install" /> - </exec> <!-- grunt --> <exec executable="cmd" dir="${project.basedir}/src/main/webapp" osfamily="windows" failonerror="true"> <arg line="/c grunt --apiurl=api" /> </exec> - <exec executable="grunt" dir="${project.basedir}/src/main/webapp" osfamily="unix" failonerror="true"> + <exec executable="node" dir="${project.basedir}/src/main/webapp" osfamily="unix" failonerror="true"> + <arg line="./node_modules/grunt/bin/grunt" /> <arg line="--apiurl=api" /> </exec> </target>
default.nix:
# This file has been modified from the one generated by mavenix: # `mvnix-init -S 'pkgs.fetchFromGitHub { owner = "sismics"; repo = "docs"; rev = "v1.7"; sha256 = "0d789fi15hjjjd02g98iqsmbkxdd4jsx4k1z3w5s7lw90mvnzhjc"; }'` let node_modules = packagefile: lockfile: pkgs: pkgs.runCommand "teedy-nodedeps" { buildInputs = [ pkgs.nodePackages.node2nix ]; } '' mkdir -p $out lockfile=${lockfile} cp ${packagefile} $lockfile $out pushd $out node2nix -d --nodejs-12 -l $(basename $lockfile) ''; src' = pkgs: pkgs.fetchFromGitHub { owner = "sismics"; repo = "docs"; rev = "v1.7"; sha256 = "0d789fi15hjjjd02g98iqsmbkxdd4jsx4k1z3w5s7lw90mvnzhjc"; }; src = pkgs: pkgs.runCommand "sismics-docs-patched" { patches = [ ./docs-web-pom.patch ]; } '' cp -r ${src' pkgs} $out chmod -R +w $out cd $out patchPhase node_modules=${((pkgs.callPackage (node_modules ((src' pkgs) + "/docs-web/src/main/webapp/package.json") ((src' pkgs) + "/docs-web/src/main/webapp/package-lock.json") pkgs) {}).shell.nodeDependencies) + "/lib/node_modules"} cp -r $node_modules docs-web/src/main/webapp/ ''; settings = pkgs: pkgs.writeText "settings.xml" '' <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <activeProfiles> <activeProfile>prod</activeProfile> </activeProfiles> </settings> ''; mavenix-src = fetchTarball { url = "https://github.com/icetan/mavenix/tarball/v2.3.3"; sha256 = "1l653ac3ka4apm7s4qrbm4kx7ij7n2zk3b67p9l0nki8vxxi8jv7"; }; in { pkgs ? (import mavenix-src {}).pkgs, mavenix ? import mavenix-src { inherit pkgs; }, doCheck ? false, }: mavenix.buildMaven { inherit doCheck; src = src pkgs; infoFile = ./mavenix.lock; buildInputs = with pkgs; [ nodejs ]; settings = settings pkgs; }
Here is an example container configuration, usable with
extra-container create ./container.nix
(https://github.com/erikarvstedt/extra-container):{ containers.teedy = { privateNetwork = true; hostAddress = "10.250.0.1"; localAddress = "10.250.0.9"; autoStart = true; bindMounts = []; #TODO config = {pkgs, config, ...}: { networking.nameservers = [ "192.168.0.1" ]; #TODO networking.useHostResolvConf = false; networking.firewall = { allowPing = true; allowedTCPPorts = [ 80 8080 443 ]; #TODO 443 only }; systemd.services.teedy-setup = { script = '' mkdir /var/docs || true #TODO chown ${config.services.tomcat.user}:${config.services.tomcat.group} /var/docs ''; requiredBy = [ "tomcat.service" ]; before = [ "tomcat.service" ]; serviceConfig = { Type = "oneshot"; }; }; services.tomcat = { enable = true; webapps = [ "${builtins.toPath "${pkgs.callPackage ./default.nix {}}/share/java/docs-web-1.7.war" }" ]; #The outer cast is to deal with toString shenanigans in the tomcat module }; }; }; }
Is there any progress? I'd love to have this package in nixpkgs! I do not know how to package it myself but if possible i'd like to assist
Not yet sorry, I haven't found the time to dive deeper in what is currently working.
Project description Teedy is an open source, lightweight document management system for individuals and businesses.
Metadata
I'm evaluating options for a document repository for sharing lecture notes and such, see also #79284, so I intend to at least try packaging this if the coming days allow.