diff --git a/config.js b/config.js index f85e9c0..f481d86 100644 --- a/config.js +++ b/config.js @@ -230,7 +230,7 @@ module.exports = { * Specify a directory where files should be stored. * It will be created automatically if it does not already exist. */ - filePath: '/data/files', + filePath: '/cryptpad/data/files', /* CryptPad offers the ability to archive data for a configurable period * before deleting it, allowing a means of recovering data in the event @@ -239,41 +239,41 @@ module.exports = { * To set the location of this archive directory to a custom value, change * the path below: */ - archivePath: '/data/archive', + archivePath: '/cryptpad/data/archive', /* CryptPad allows logged in users to request that particular documents be * stored by the server indefinitely. This is called 'pinning'. * Pin requests are stored in a pin-store. The location of this store is * defined here. */ - pinPath: '/data/pins', + pinPath: '/cryptpad/data/pins', /* if you would like the list of scheduled tasks to be stored in a custom location, change the path below: */ - taskPath: '/data/tasks', + taskPath: '/cryptpad/data/tasks', /* if you would like users' authenticated blocks to be stored in a custom location, change the path below: */ - blockPath: '/data/block', + blockPath: '/cryptpad/data/block', /* CryptPad allows logged in users to upload encrypted files. Files/blobs * are stored in a 'blob-store'. Set its location here. */ - blobPath: '/data/blob', + blobPath: '/cryptpad/data/blob', /* CryptPad stores incomplete blobs in a 'staging' area until they are * fully uploaded. Set its location here. */ - blobStagingPath: '/data/blobstage', + blobStagingPath: '/cryptpad/data/blobstage', - decreePath: '/data/decrees', + decreePath: '/cryptpad/data/decrees', /* CryptPad supports logging events directly to the disk in a 'logs' directory * Set its location here, or set it to false (or nothing) if you'd rather not log */ - logPath: '/data/logs', + logPath: '/cryptpad/data/logs', /* ===================== * Debugging diff --git a/default.nix b/default.nix index 1bab94c..ce694aa 100644 --- a/default.nix +++ b/default.nix @@ -91,7 +91,13 @@ in buildNpmPackage rec { ln -s $onlyOffice www/common/onlyoffice/dist ''; + postBuild = '' + rm -rf customize + ''; + installPhase = '' + runHook preInstall + mkdir -p $out cp -R . $out/ @@ -101,6 +107,8 @@ in buildNpmPackage rec { makeWrapper ${lib.getExe nodejs} $out/bin/cryptpad-server \ --chdir $out \ --add-flags server.js + + runHook postInstall ''; meta = { diff --git a/deuxfleurs.nix b/deuxfleurs.nix index 8b38d06..22d97b5 100644 --- a/deuxfleurs.nix +++ b/deuxfleurs.nix @@ -1,10 +1,10 @@ -let +{ name ? "deuxfleurs/cryptpad" +, tag ? "nix-latest" +}: let sources = import ./nix/sources.nix; pkgs = import sources.nixpkgs {}; in rec { - cryptpad = pkgs.callPackage ./default.nix { - withOnlyOffice = false; - }; + cryptpad = pkgs.callPackage ./default.nix {}; docker = pkgs.callPackage ./docker.nix { inherit cryptpad; }; diff --git a/docker-compose.yml b/docker-compose.yml index 12aa041..2044f28 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,12 @@ services: app: image: cryptpad:nix-latest environment: - CRYPTPAD_CONFIG: '/config.js' + CRYPTPAD_CONFIG: '/cryptpad/config.js' ports: - '3000:3000' - '3001:3001' - '3003:3003' volumes: - - ./config.js:/config.js:ro - - ./_data:/data + - ./config.js:/cryptpad/config.js:ro + - ./_customize:/cryptpad/customize:ro + - ./_data:/cryptpad/data diff --git a/docker.nix b/docker.nix index 9dce71e..16bb134 100644 --- a/docker.nix +++ b/docker.nix @@ -1,17 +1,27 @@ { pkgs ? import {} + , name ? "cryptpad" , tag ? "nix-latest" + , withOnlyOffice ? true -, cryptpad ? pkgs.callPackage ./default.nix { - inherit withOnlyOffice; -} -}: -pkgs.dockerTools.buildImage { + +, cryptpad ? pkgs.callPackage ./default.nix { inherit withOnlyOffice; } +}: let + cryptpad' = cryptpad.overrideAttrs { + postInstall = '' + ln -sf /cryptpad/customize $out/customize + ''; + }; +in pkgs.dockerTools.buildImage { inherit name tag; config = { Cmd = [ - (pkgs.lib.getExe cryptpad) + (pkgs.lib.getExe cryptpad') ]; + + Volumes = { + "/cryptpad/customize" = {}; + }; }; } diff --git a/nix/sources.nix b/nix/sources.nix index fe3dadf..9e7db84 100644 --- a/nix/sources.nix +++ b/nix/sources.nix @@ -186,7 +186,7 @@ let , sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile) , system ? builtins.currentSystem , pkgs ? mkPkgs sources system - }: rec { + }: { # The sources, i.e. the attribute set of spec name to spec inherit sources;