From a431e036e335d688aa8e59e039dd86fa1eefdc2a Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Jun 2016 23:32:28 +0200 Subject: krebs.git: move assert to etcDir's type --- krebs/3modules/git.nix | 12 ++++++------ 1 file 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 -- cgit v1.2.3