aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-06-13 17:35:16 +0200
committerlassulus <lassulus@lassul.us>2018-06-13 20:59:54 +0200
commit2090f5d655413bef38b675316f982d730c73a240 (patch)
treecb472190104b2b4b351dedaa386f2265302e6212 /pkgs
parent4d86790456c4656ca67acbaef2d702436ff5edb4 (diff)
pkgs: get functions via reclass/rec-lib
To import the writers outside of an overlay
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/default.nix38
1 files changed, 19 insertions, 19 deletions
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 <unistd.h>
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";
};
}