krebs builders: turn file into module

This commit is contained in:
tv 2017-02-09 15:31:25 +01:00
parent c34f8a33dc
commit a4683911af
2 changed files with 277 additions and 272 deletions

View File

@ -1,8 +1,9 @@
{ config, pkgs, ... }: { pkgs, ... }:
with import <stockholm/lib>; with import <stockholm/lib>;
rec { {
nixpkgs.config.packageOverrides = _: {
execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let
in writeC name { inherit destination; } /* c */ '' in pkgs.writeC name { inherit destination; } /* c */ ''
#include <unistd.h> #include <unistd.h>
static char *const filename = ${toC filename}; static char *const filename = ${toC filename};
@ -26,7 +27,8 @@ rec {
} }
''; '';
execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; }); execveBin = name: cfg:
pkgs.execve name (cfg // { destination = "/bin/${name}"; });
makeScriptWriter = interpreter: name: text: makeScriptWriter = interpreter: name: text:
assert (with types; either absolute-pathname filename).check name; assert (with types; either absolute-pathname filename).check name;
@ -66,7 +68,7 @@ rec {
strip --strip-unneeded "$exe" strip --strip-unneeded "$exe"
''; '';
writeDash = makeScriptWriter "${pkgs.dash}/bin/dash"; writeDash = pkgs.makeScriptWriter "${pkgs.dash}/bin/dash";
writeDashBin = name: writeDashBin = name:
assert types.filename.check name; assert types.filename.check name;
@ -289,5 +291,6 @@ rec {
cp src.py "$out" cp src.py "$out"
''; '';
writeSed = makeScriptWriter "${pkgs.gnused}/bin/sed -f"; writeSed = pkgs.makeScriptWriter "${pkgs.gnused}/bin/sed -f";
};
} }

View File

@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }@args: { config, lib, pkgs, ... }@args:
with import <stockholm/lib>; with import <stockholm/lib>;
{ {
imports = [
./builders.nix
];
nixpkgs.config.packageOverrides = oldpkgs: let nixpkgs.config.packageOverrides = oldpkgs: let
# This callPackage will try to detect obsolete overrides. # This callPackage will try to detect obsolete overrides.
@ -15,7 +18,6 @@ with import <stockholm/lib>;
else override; else override;
in {} in {}
// import ./builders.nix args
// mapAttrs (_: flip callPackage {}) // mapAttrs (_: flip callPackage {})
(filterAttrs (_: dir: pathExists (dir + "/default.nix")) (filterAttrs (_: dir: pathExists (dir + "/default.nix"))
(subdirsOf ./.)) (subdirsOf ./.))