diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-05-06 10:49:28 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-05-06 10:49:28 +0200 |
commit | 99a4f51166617f7e873bf9ef8ba5516586241995 (patch) | |
tree | bbe2197a852b62d8fdf4434dc2c4934274340d10 | |
parent | 653e45f1926c09c9242dfb3582f3d8f86604c66d (diff) | |
download | infrastructure-99a4f51166617f7e873bf9ef8ba5516586241995.tar.gz infrastructure-99a4f51166617f7e873bf9ef8ba5516586241995.zip |
Simplify the build
-rw-r--r-- | app/cryptpad/build/README.md | 18 | ||||
-rw-r--r-- | app/cryptpad/build/common.nix | 11 | ||||
m--------- | app/cryptpad/build/cryptpad | 0 | ||||
-rw-r--r-- | app/cryptpad/build/default.nix | 79 | ||||
-rw-r--r-- | app/cryptpad/build/docker.nix | 3 | ||||
-rw-r--r-- | app/cryptpad/build/shell.nix | 13 | ||||
-rw-r--r-- | app/cryptpad/config/config.js | 2 |
7 files changed, 4 insertions, 122 deletions
diff --git a/app/cryptpad/build/README.md b/app/cryptpad/build/README.md index 417b066..d5f5a5d 100644 --- a/app/cryptpad/build/README.md +++ b/app/cryptpad/build/README.md @@ -1,16 +1,2 @@ -Currently there is now way to cleanly package Bower on Nix. -So we have to manually package cryptpad. - -To update, you have to: - -```bash -nix-shell -cd cryptpad -git pull -git checkout <tag> -bower update -npm install -cd .. -nix-build -nix-build docker.nix -``` +docker load < $(nix-build docker.nix) +docker push superboum/cryptpad:??? diff --git a/app/cryptpad/build/common.nix b/app/cryptpad/build/common.nix index 7ed1d55..639d9a1 100644 --- a/app/cryptpad/build/common.nix +++ b/app/cryptpad/build/common.nix @@ -5,15 +5,4 @@ url ="https://github.com/NixOS/nixpkgs/archive/2f06b87f64bc06229e05045853e0876666e1b023.tar.gz"; sha256 = "sha256:1d7zg96xw4qsqh7c89pgha9wkq3rbi9as3k3d88jlxy2z0ns0cy2"; }; - cryptpadSrc = builtins.fetchGit { - url = "https://github.com/xwiki-labs/cryptpad"; - ref = "refs/tags/4.14.1"; - rev = "5979aafdee90aab232658374b11aca8331fd0421"; - }; - bower2nixSrc = builtins.fetchGit { - url = ""; - ref = ""; - rev = ""; - } - nodejs = "nodejs-slim-16_x"; } diff --git a/app/cryptpad/build/cryptpad b/app/cryptpad/build/cryptpad deleted file mode 160000 -Subproject 5979aafdee90aab232658374b11aca8331fd042 diff --git a/app/cryptpad/build/default.nix b/app/cryptpad/build/default.nix deleted file mode 100644 index 96795bc..0000000 --- a/app/cryptpad/build/default.nix +++ /dev/null @@ -1,79 +0,0 @@ -let - common = import ./common.nix; - pkgs = import common.pkgsSrc {}; - nodejs = pkgs.${common.nodejs}; - - bower2nix = - bowerNix = pkgs.stdenv.mkDerivation { - name = "cryptpad-bower-ifd"; - src = common.cryptpadSrc; - - buildPhase = '' - ${pkgs.nodePackages.bower2nix}/bin/bower2nix bower.json bower.nix - ''; - - installPhase = '' - cp bower.nix $out - ''; - - dontFixup = true; - }; - bower = pkgs.buildBowerComponents { - name = "cryptpad-bower"; - generated = bowerNix; - src = common.cryptpadSrc; - }; - - npmNix = pkgs.stdenv.mkDerivation { - name = "cryptpad-npm-ifd"; - src = common.cryptpadSrc; - - buildPhase = '' - ${pkgs.nodePackages.node2nix}/bin/node2nix -l package-lock.json - ''; - - installPhase = '' - mkdir -p $out/ - cp *.nix $out/ - ''; - - dontFixup = true; - }; - npm = (import npmNix { - inherit pkgs nodejs; - }).nodeDependencies; - -in - pkgs.stdenv.mkDerivation { - name = "cryptpad"; - src = common.cryptpadSrc; - - installPhase = '' - mkdir -p $out/{bin,opt} - - # copy the source code - cp -r customize.dist lib server.js www $out/opt/ - - # mount node_modules - ln -s ${npm}/lib/node_modules $out/opt/node_modules - - # mount bower, based on the .bowerrc file at the git repo root - ln -s ${bower} $out/opt/www/bower_components - - # cryptpad is bugged with absolute path, this is a workaround to use absolute path as relative path - ln -s / $out/opt/root - - # start script - cat > $out/bin/cryptpad <<EOF - #!${pkgs.bash}/bin/bash - cd $out/opt/ - export PATH="${npm}/bin:$PATH" - ${nodejs}/bin/node server.js - EOF - - chmod +x $out/bin/cryptpad - ''; - - dontFixup = true; - } - diff --git a/app/cryptpad/build/docker.nix b/app/cryptpad/build/docker.nix index 818bbd1..362e9ff 100644 --- a/app/cryptpad/build/docker.nix +++ b/app/cryptpad/build/docker.nix @@ -1,11 +1,10 @@ let common = import ./common.nix; - app = import ./default.nix; pkgs = import common.pkgsSrc {}; in pkgs.dockerTools.buildImage { name = "superboum/cryptpad"; config = { - Cmd = [ "${app}/bin/backup-psql" ]; + Cmd = [ "${pkgs.cryptpad}/bin/cryptpad" ]; }; } diff --git a/app/cryptpad/build/shell.nix b/app/cryptpad/build/shell.nix deleted file mode 100644 index d47a050..0000000 --- a/app/cryptpad/build/shell.nix +++ /dev/null @@ -1,13 +0,0 @@ -let - common = import ./common.nix; - pkgs = import common.pkgsSrc {}; - nodejs = pkgs.${common.nodejs}; -in - pkgs.mkShell { - buildInputs = [ - nodejs - pkgs.nodePackages.npm - pkgs.nodePackages.bower - ]; - } - diff --git a/app/cryptpad/config/config.js b/app/cryptpad/config/config.js index 89b179f..0803f80 100644 --- a/app/cryptpad/config/config.js +++ b/app/cryptpad/config/config.js @@ -75,7 +75,7 @@ module.exports = { * all addresses, including IPv6, set this to '::'. * */ - //httpAddress: '::', + httpAddress: '::', /* httpPort specifies on which port the nodejs server should listen. * By default it will serve content over port 3000, which is suitable |