diff options
-rw-r--r-- | lib/default.nix | 28 | ||||
-rw-r--r-- | modules/private/gitolite/default.nix | 16 | ||||
-rw-r--r-- | modules/private/ssh/default.nix | 11 |
3 files changed, 19 insertions, 36 deletions
diff --git a/lib/default.nix b/lib/default.nix index 6b3dfdf..86832d4 100644 --- a/lib/default.nix +++ b/lib/default.nix | |||
@@ -17,7 +17,8 @@ rec { | |||
17 | json = lib.importJSON path; | 17 | json = lib.importJSON path; |
18 | in rec { | 18 | in rec { |
19 | version = json.tag; | 19 | version = json.tag; |
20 | name = "${json.meta.name}-${version}"; | 20 | pname = json.meta.name; |
21 | name = "${pname}-${version}"; | ||
21 | src = fetchFromGitHub json.github; | 22 | src = fetchFromGitHub json.github; |
22 | }; | 23 | }; |
23 | 24 | ||
@@ -26,7 +27,8 @@ rec { | |||
26 | json = lib.importJSON path; | 27 | json = lib.importJSON path; |
27 | in rec { | 28 | in rec { |
28 | version = json.tag; | 29 | version = json.tag; |
29 | name = "${json.meta.name}-${version}"; | 30 | pname = json.meta.name; |
31 | name = "${pname}-${version}"; | ||
30 | src = fetchgit json.git; | 32 | src = fetchgit json.git; |
31 | }; | 33 | }; |
32 | 34 | ||
@@ -35,30 +37,12 @@ rec { | |||
35 | json = lib.importJSON path; | 37 | json = lib.importJSON path; |
36 | in rec { | 38 | in rec { |
37 | version = json.tag; | 39 | version = json.tag; |
38 | name = "${json.meta.name}-${version}"; | 40 | pname = json.meta.name; |
41 | name = "${pname}-${version}"; | ||
39 | src = builtins.fetchGit { | 42 | src = builtins.fetchGit { |
40 | url = json.git.url; | 43 | url = json.git.url; |
41 | ref = "master"; | 44 | ref = "master"; |
42 | rev = json.git.rev; | 45 | rev = json.git.rev; |
43 | }; | 46 | }; |
44 | }; | 47 | }; |
45 | |||
46 | wrap = { paths ? [], vars ? {}, file ? null, script ? null, name ? "wrap" }: | ||
47 | assert file != null || script != null || | ||
48 | abort "wrap needs 'file' or 'script' argument"; | ||
49 | with rec { | ||
50 | set = n: v: "--set ${pkgs.lib.escapeShellArg n} " + | ||
51 | "${pkgs.lib.escapeShellArg v}"; | ||
52 | args = (map (p: "--prefix PATH : ${p}/bin") paths) ++ | ||
53 | (builtins.attrValues (pkgs.lib.mapAttrs set vars)); | ||
54 | }; | ||
55 | runCommand name | ||
56 | { | ||
57 | f = if file == null then writeScript name script else file; | ||
58 | buildInputs = [ makeWrapper ]; | ||
59 | } | ||
60 | '' | ||
61 | makeWrapper "$f" "$out" ${toString args} | ||
62 | ''; | ||
63 | |||
64 | } // (if builtins.pathExists ./private then callPackage ./private {} else {}) | 48 | } // (if builtins.pathExists ./private then callPackage ./private {} else {}) |
diff --git a/modules/private/gitolite/default.nix b/modules/private/gitolite/default.nix index 9f5c179..1549c94 100644 --- a/modules/private/gitolite/default.nix +++ b/modules/private/gitolite/default.nix | |||
@@ -28,14 +28,14 @@ in { | |||
28 | }; | 28 | }; |
29 | 29 | ||
30 | system.activationScripts.gitolite = let | 30 | system.activationScripts.gitolite = let |
31 | gitolite_ldap_groups = pkgs.mylibs.wrap { | 31 | deps = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.coreutils ]; |
32 | name = "gitolite_ldap_groups.sh"; | 32 | gitolite_ldap_groups = pkgs.runCommand "gitolite_ldap_groups.sh" { |
33 | file = ./gitolite_ldap_groups.sh; | 33 | buildInputs = [ pkgs.makeWrapper ]; |
34 | vars = { | 34 | } '' |
35 | LDAP_PASS = config.myEnv.tools.gitolite.ldap.password; | 35 | makeWrapper "${./gitolite_ldap_groups.sh}" "$out" \ |
36 | }; | 36 | --prefix PATH : ${lib.makeBinPath deps} \ |
37 | paths = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.coreutils ]; | 37 | --set LDAP_PASS ${pkgs.lib.escapeShellArg config.myEnv.tools.gitolite.ldap.password} |
38 | }; | 38 | ''; |
39 | in { | 39 | in { |
40 | deps = [ "users" ]; | 40 | deps = [ "users" ]; |
41 | text = '' | 41 | text = '' |
diff --git a/modules/private/ssh/default.nix b/modules/private/ssh/default.nix index 1699104..aea3ac0 100644 --- a/modules/private/ssh/default.nix +++ b/modules/private/ssh/default.nix | |||
@@ -77,12 +77,11 @@ in | |||
77 | substituteAll ${./ldap_authorized_keys.sh} $out | 77 | substituteAll ${./ldap_authorized_keys.sh} $out |
78 | chmod a+x $out | 78 | chmod a+x $out |
79 | ''; | 79 | ''; |
80 | ldap_authorized_keys = | 80 | ldap_authorized_keys = pkgs.runCommand "ldap_authorized_keys" { |
81 | pkgs.mylibs.wrap { | 81 | buildInputs = [ pkgs.makeWrapper ]; |
82 | name = "ldap_authorized_keys"; | 82 | } '' |
83 | file = fullScript; | 83 | makeWrapper "${fullScript}" "$out" --prefix PATH : ${lib.makeBinPath deps} |
84 | paths = deps; | 84 | ''; |
85 | }; | ||
86 | in { | 85 | in { |
87 | enable = true; | 86 | enable = true; |
88 | mode = "0755"; | 87 | mode = "0755"; |