summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-08-04 22:22:43 +0200
committertv <tv@krebsco.de>2020-08-05 11:16:45 +0200
commitec91d1b83cfad151033433159a04eb7b5381bc73 (patch)
tree4da4eefa1d14a8cd5cca42e9d78a81262ff1fe03 /lib
parent4227cadb6823bd4b945b8ea9e766f22b95d26468 (diff)
krebs.secret: restart units on secret change
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix3
-rw-r--r--lib/types.nix6
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 5a948bbf3..f02959bba 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -8,6 +8,9 @@ let
krebs = import ./krebs lib;
krops = import ../submodules/krops/lib;
shell = import ./shell.nix { inherit lib; };
+ systemd = {
+ encodeName = replaceChars ["/"] ["\\x2f"];
+ };
types = nixpkgs-lib.types // import ./types.nix { inherit lib; };
xml = import ./xml.nix { inherit lib; };
diff --git a/lib/types.nix b/lib/types.nix
index 66b01fd12..1eb4d947c 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -238,7 +238,7 @@ rec {
secret-file = submodule ({ config, ... }: {
options = {
name = mkOption {
- type = filename;
+ type = pathname;
default = config._module.args.name;
};
path = mkOption {
@@ -257,8 +257,8 @@ rec {
default = "root";
};
service = mkOption {
- type = filename;
- default = "secret.service";
+ type = systemd.unit-name;
+ default = "secret-${lib.systemd.encodeName config.name}.service";
};
source-path = mkOption {
type = str;