aboutsummaryrefslogtreecommitdiff
path: root/app/cryptpad/build
diff options
context:
space:
mode:
Diffstat (limited to 'app/cryptpad/build')
-rw-r--r--app/cryptpad/build/README.md16
-rw-r--r--app/cryptpad/build/common.nix9
m---------app/cryptpad/build/cryptpad0
-rw-r--r--app/cryptpad/build/default.nix27
-rw-r--r--app/cryptpad/build/docker.nix11
-rw-r--r--app/cryptpad/build/shell.nix13
6 files changed, 76 insertions, 0 deletions
diff --git a/app/cryptpad/build/README.md b/app/cryptpad/build/README.md
new file mode 100644
index 0000000..417b066
--- /dev/null
+++ b/app/cryptpad/build/README.md
@@ -0,0 +1,16 @@
+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
+```
diff --git a/app/cryptpad/build/common.nix b/app/cryptpad/build/common.nix
new file mode 100644
index 0000000..61d02fa
--- /dev/null
+++ b/app/cryptpad/build/common.nix
@@ -0,0 +1,9 @@
+{
+ pkgsSrc = fetchTarball {
+ # Latest commit on https://github.com/NixOS/nixpkgs/tree/nixos-21.11
+ # As of 2022-04-15
+ url ="https://github.com/NixOS/nixpkgs/archive/2f06b87f64bc06229e05045853e0876666e1b023.tar.gz";
+ sha256 = "sha256:1d7zg96xw4qsqh7c89pgha9wkq3rbi9as3k3d88jlxy2z0ns0cy2";
+ };
+ nodejs = "nodejs-slim-16_x";
+}
diff --git a/app/cryptpad/build/cryptpad b/app/cryptpad/build/cryptpad
new file mode 160000
+Subproject 5979aafdee90aab232658374b11aca8331fd042
diff --git a/app/cryptpad/build/default.nix b/app/cryptpad/build/default.nix
new file mode 100644
index 0000000..2069a58
--- /dev/null
+++ b/app/cryptpad/build/default.nix
@@ -0,0 +1,27 @@
+let
+ common = import ./common.nix;
+ pkgs = import common.pkgsSrc {};
+ nodejs = pkgs.${common.nodejs};
+in
+ pkgs.stdenv.mkDerivation {
+ name = "cryptpad";
+ src = ./cryptpad;
+
+ installPhase = ''
+ mkdir -p $out/{bin,opt}
+
+ cp -r config customize.dist lib node_modules package.json package-lock.json server.js www $out/opt/
+ ln -s / $out/opt/root
+
+ cat > $out/bin/cryptpad <<EOF
+ cd $out/opt/
+ #!${pkgs.bash}/bin/bash
+ ${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
new file mode 100644
index 0000000..818bbd1
--- /dev/null
+++ b/app/cryptpad/build/docker.nix
@@ -0,0 +1,11 @@
+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" ];
+ };
+ }
diff --git a/app/cryptpad/build/shell.nix b/app/cryptpad/build/shell.nix
new file mode 100644
index 0000000..d47a050
--- /dev/null
+++ b/app/cryptpad/build/shell.nix
@@ -0,0 +1,13 @@
+let
+ common = import ./common.nix;
+ pkgs = import common.pkgsSrc {};
+ nodejs = pkgs.${common.nodejs};
+in
+ pkgs.mkShell {
+ buildInputs = [
+ nodejs
+ pkgs.nodePackages.npm
+ pkgs.nodePackages.bower
+ ];
+ }
+