diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-06-12 09:59:45 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-06-18 18:14:17 +0000 |
commit | c5571a126859eb658ffd7340cb580f7d91f12bb6 (patch) | |
tree | 577573c3bf14d9849246d52daece719a10eaf138 /nixpkgs/nixos/modules/services/web-apps/cryptpad.nix | |
parent | 828bd4e8ddcbcd354ddfd99f55af69ee8ff5d9e7 (diff) | |
parent | 98e3b90b6c8f400ae5438ef868eb992a64b75ce5 (diff) | |
download | nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.gz nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.bz2 nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.lz nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.xz nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.tar.zst nixlib-c5571a126859eb658ffd7340cb580f7d91f12bb6.zip |
Merge commit '98e3b90b6c8f400ae5438ef868eb992a64b75ce5'
Diffstat (limited to 'nixpkgs/nixos/modules/services/web-apps/cryptpad.nix')
-rw-r--r-- | nixpkgs/nixos/modules/services/web-apps/cryptpad.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/web-apps/cryptpad.nix b/nixpkgs/nixos/modules/services/web-apps/cryptpad.nix new file mode 100644 index 000000000000..69a89107d310 --- /dev/null +++ b/nixpkgs/nixos/modules/services/web-apps/cryptpad.nix @@ -0,0 +1,54 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.cryptpad; +in +{ + options.services.cryptpad = { + enable = mkEnableOption "the Cryptpad service"; + + package = mkOption { + default = pkgs.cryptpad; + defaultText = "pkgs.cryptpad"; + type = types.package; + description = " + Cryptpad package to use. + "; + }; + + configFile = mkOption { + type = types.path; + default = "${cfg.package}/lib/node_modules/cryptpad/config/config.example.js"; + defaultText = "\${cfg.package}/lib/node_modules/cryptpad/config/config.example.js"; + description = '' + Path to the JavaScript configuration file. + + See <link + xlink:href="https://github.com/xwiki-labs/cryptpad/blob/master/config/config.example.js"/> + for a configuration example. + ''; + }; + }; + + config = mkIf cfg.enable { + systemd.services.cryptpad = { + description = "Cryptpad Service"; + wantedBy = [ "multi-user.target" ]; + after = [ "networking.target" ]; + serviceConfig = { + DynamicUser = true; + Environment = [ + "CRYPTPAD_CONFIG=${cfg.configFile}" + "HOME=%S/cryptpad" + ]; + ExecStart = "${cfg.package}/bin/cryptpad"; + PrivateTmp = true; + Restart = "always"; + StateDirectory = "cryptpad"; + WorkingDirectory = "%S/cryptpad"; + }; + }; + }; +} |