Add customize volume

This commit is contained in:
Jill 2024-04-17 23:48:40 +02:00
parent 50704483fd
commit 9bec8cf40f
Signed by: KokaKiwi
GPG key ID: 09A5A2688F13FAC1
6 changed files with 42 additions and 23 deletions

View file

@ -230,7 +230,7 @@ module.exports = {
* Specify a directory where files should be stored. * Specify a directory where files should be stored.
* It will be created automatically if it does not already exist. * 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 /* CryptPad offers the ability to archive data for a configurable period
* before deleting it, allowing a means of recovering data in the event * 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 * To set the location of this archive directory to a custom value, change
* the path below: * the path below:
*/ */
archivePath: '/data/archive', archivePath: '/cryptpad/data/archive',
/* CryptPad allows logged in users to request that particular documents be /* CryptPad allows logged in users to request that particular documents be
* stored by the server indefinitely. This is called 'pinning'. * stored by the server indefinitely. This is called 'pinning'.
* Pin requests are stored in a pin-store. The location of this store is * Pin requests are stored in a pin-store. The location of this store is
* defined here. * defined here.
*/ */
pinPath: '/data/pins', pinPath: '/cryptpad/data/pins',
/* if you would like the list of scheduled tasks to be stored in /* if you would like the list of scheduled tasks to be stored in
a custom location, change the path below: 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 /* if you would like users' authenticated blocks to be stored in
a custom location, change the path below: 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 /* CryptPad allows logged in users to upload encrypted files. Files/blobs
* are stored in a 'blob-store'. Set its location here. * 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 /* CryptPad stores incomplete blobs in a 'staging' area until they are
* fully uploaded. Set its location here. * 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 /* 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 * 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 * Debugging

View file

@ -91,7 +91,13 @@ in buildNpmPackage rec {
ln -s $onlyOffice www/common/onlyoffice/dist ln -s $onlyOffice www/common/onlyoffice/dist
''; '';
postBuild = ''
rm -rf customize
'';
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out mkdir -p $out
cp -R . $out/ cp -R . $out/
@ -101,6 +107,8 @@ in buildNpmPackage rec {
makeWrapper ${lib.getExe nodejs} $out/bin/cryptpad-server \ makeWrapper ${lib.getExe nodejs} $out/bin/cryptpad-server \
--chdir $out \ --chdir $out \
--add-flags server.js --add-flags server.js
runHook postInstall
''; '';
meta = { meta = {

View file

@ -1,10 +1,10 @@
let { name ? "deuxfleurs/cryptpad"
, tag ? "nix-latest"
}: let
sources = import ./nix/sources.nix; sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs {}; pkgs = import sources.nixpkgs {};
in rec { in rec {
cryptpad = pkgs.callPackage ./default.nix { cryptpad = pkgs.callPackage ./default.nix {};
withOnlyOffice = false;
};
docker = pkgs.callPackage ./docker.nix { docker = pkgs.callPackage ./docker.nix {
inherit cryptpad; inherit cryptpad;
}; };

View file

@ -2,11 +2,12 @@ services:
app: app:
image: cryptpad:nix-latest image: cryptpad:nix-latest
environment: environment:
CRYPTPAD_CONFIG: '/config.js' CRYPTPAD_CONFIG: '/cryptpad/config.js'
ports: ports:
- '3000:3000' - '3000:3000'
- '3001:3001' - '3001:3001'
- '3003:3003' - '3003:3003'
volumes: volumes:
- ./config.js:/config.js:ro - ./config.js:/cryptpad/config.js:ro
- ./_data:/data - ./_customize:/cryptpad/customize:ro
- ./_data:/cryptpad/data

View file

@ -1,17 +1,27 @@
{ pkgs ? import <nixpkgs> {} { pkgs ? import <nixpkgs> {}
, name ? "cryptpad" , name ? "cryptpad"
, tag ? "nix-latest" , tag ? "nix-latest"
, withOnlyOffice ? true , withOnlyOffice ? true
, cryptpad ? pkgs.callPackage ./default.nix {
inherit withOnlyOffice; , cryptpad ? pkgs.callPackage ./default.nix { inherit withOnlyOffice; }
} }: let
}: cryptpad' = cryptpad.overrideAttrs {
pkgs.dockerTools.buildImage { postInstall = ''
ln -sf /cryptpad/customize $out/customize
'';
};
in pkgs.dockerTools.buildImage {
inherit name tag; inherit name tag;
config = { config = {
Cmd = [ Cmd = [
(pkgs.lib.getExe cryptpad) (pkgs.lib.getExe cryptpad')
]; ];
Volumes = {
"/cryptpad/customize" = {};
};
}; };
} }

View file

@ -186,7 +186,7 @@ let
, sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile) , sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem , system ? builtins.currentSystem
, pkgs ? mkPkgs sources system , pkgs ? mkPkgs sources system
}: rec { }: {
# The sources, i.e. the attribute set of spec name to spec # The sources, i.e. the attribute set of spec name to spec
inherit sources; inherit sources;