From 2090f5d655413bef38b675316f982d730c73a240 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 13 Jun 2018 17:35:16 +0200 Subject: pkgs: get functions via rec To import the writers outside of an overlay --- pkgs/default.nix | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'pkgs/default.nix') diff --git a/pkgs/default.nix b/pkgs/default.nix index 2286d28..277755a 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,8 +1,8 @@ with import ../lib; -pkgs: oldpkgs: { +pkgs: oldpkgs: rec { execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: - pkgs.writeC name { inherit destination; } /* c */ '' + writeC name { inherit destination; } /* c */ '' #include static char *const filename = ${toC filename}; @@ -27,11 +27,11 @@ pkgs: oldpkgs: { ''; execveBin = name: cfg: - pkgs.execve name (cfg // { destination = "/bin/${name}"; }); + execve name (cfg // { destination = "/bin/${name}"; }); makeScriptWriter = { interpreter, check ? null }: name: text: assert (with types; either absolute-pathname filename).check name; - pkgs.write (baseNameOf name) { + write (baseNameOf name) { ${optionalString (types.absolute-pathname.check name) name} = { inherit check; executable = true; @@ -110,7 +110,7 @@ pkgs: oldpkgs: { writeBash = name: text: assert (with types; either absolute-pathname filename).check name; - pkgs.write (baseNameOf name) { + write (baseNameOf name) { ${optionalString (types.absolute-pathname.check name) name} = { executable = true; text = "#! ${pkgs.bash}/bin/bash\n${text}"; @@ -119,7 +119,7 @@ pkgs: oldpkgs: { writeBashBin = name: assert types.filename.check name; - pkgs.writeBash "/bin/${name}"; + writeBash "/bin/${name}"; writeC = name: { destination ? "" }: text: pkgs.runCommand name { inherit text; @@ -137,13 +137,13 @@ pkgs: oldpkgs: { strip --strip-unneeded "$exe" ''; - writeDash = pkgs.makeScriptWriter { + writeDash = makeScriptWriter { interpreter = "${pkgs.dash}/bin/dash"; }; writeDashBin = name: assert types.filename.check name; - pkgs.writeDash "/bin/${name}"; + writeDash "/bin/${name}"; writeEximConfig = name: text: pkgs.runCommand name { inherit text; @@ -259,9 +259,9 @@ pkgs: oldpkgs: { writeJq = name: text: assert (with types; either absolute-pathname filename).check name; - pkgs.write (baseNameOf name) { + write (baseNameOf name) { ${optionalString (types.absolute-pathname.check name) name} = { - check = pkgs.writeDash "jqcheck.sh" '' + check = writeDash "jqcheck.sh" '' exec ${pkgs.jq}/bin/jq -f "$1" < /dev/null ''; inherit text; @@ -288,31 +288,31 @@ pkgs: oldpkgs: { let py = pkgs.python2.withPackages(ps: attrVals deps ps); in - pkgs.makeScriptWriter { + makeScriptWriter { interpreter = "${py}/bin/python"; - check = pkgs.writeDash "python2check.sh" '' + check = writeDash "python2check.sh" '' exec ${pkgs.python2Packages.flake8}/bin/flake8 --show-source "$1" ''; } name; - writePython2Bin = name: - pkgs.writePython2 "/bin/${name}"; + writePython2Bin = d: name: + writePython2 d "/bin/${name}"; writePython3 = name: deps: let py = pkgs.python3.withPackages(ps: attrVals deps ps); in - pkgs.makeScriptWriter { + makeScriptWriter { interpreter = "${py}/bin/python"; - check = pkgs.writeDash "python3check.sh" '' + check = writeDash "python3check.sh" '' exec ${pkgs.python3Packages.flake8}/bin/flake8 --show-source "$1" ''; } name; - writePython3Bin = name: - pkgs.writePython3 "/bin/${name}"; + writePython3Bin = d: name: + writePython3 d "/bin/${name}"; - writeSed = pkgs.makeScriptWriter { + writeSed = makeScriptWriter { interpreter = "${pkgs.gnused}/bin/sed -f"; }; } -- cgit v1.2.3