summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-04-11 20:53:31 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-04-25 00:04:56 +0200
commitd84743b430fd52936ce201ef1b0c574080c026aa (patch)
tree08d833dc039324fa081936167b82c253e836b6e5
parent486611ba08a23e1a45e55cb6b72b441ff1cfa6b5 (diff)
downloadNUR-d84743b430fd52936ce201ef1b0c574080c026aa.tar.gz
NUR-d84743b430fd52936ce201ef1b0c574080c026aa.tar.zst
NUR-d84743b430fd52936ce201ef1b0c574080c026aa.zip
Adjust some library functions
-rw-r--r--lib/default.nix28
1 files changed, 6 insertions, 22 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 6b3dfdf4..86832d47 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 {})