diff options
author | tv <tv@krebsco.de> | 2016-06-07 23:32:28 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-06-07 23:34:16 +0200 |
commit | a431e036e335d688aa8e59e039dd86fa1eefdc2a (patch) | |
tree | c74428a52c27c5d126ab057138d326aa62db29e6 | |
parent | 567800c98e7f17ead15aa99f388d4a91c2f58653 (diff) |
krebs.git: move assert to etcDir's type
-rw-r--r-- | krebs/3modules/git.nix | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/krebs/3modules/git.nix b/krebs/3modules/git.nix index 4fec38579..db0b6b0ab 100644 --- a/krebs/3modules/git.nix +++ b/krebs/3modules/git.nix @@ -63,7 +63,11 @@ let description = "Directory used to store repositories."; }; etcDir = mkOption { - type = types.str; + type = mkOptionType { + name = "${types.absolute-pathname.name} starting with `/etc/'"; + check = x: types.absolute-pathname.check x && hasPrefix "/etc/" x; + merge = mergeOneOption; + }; default = "/etc/git"; }; repos = mkOption { @@ -314,7 +318,7 @@ let system.activationScripts.git-init = "${init-script}"; # TODO maybe put all scripts here and then use PATH? - environment.etc."${etc-base}".source = + environment.etc.${removePrefix "/etc/" cfg.etcDir}.source = scriptFarm "git-ssh-authorizers" { authorize-command = makeAuthorizeScript (map (rule: [ (map getName (toList rule.user)) @@ -642,9 +646,5 @@ let ''; }; - etc-base = - assert (hasPrefix "/etc/" cfg.etcDir); - removePrefix "/etc/" cfg.etcDir; - in out |