summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/writers.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-03-08 14:20:38 +0100
committermakefu <github@syntax-fehler.de>2017-03-08 14:20:38 +0100
commit8ad08b30961ba5515f88e81dc47f7d5013f92970 (patch)
tree94919cec986021c5c59ff5b222089cc06565b1f8 /krebs/5pkgs/writers.nix
parent3a3a436b49d555c57079f806f33908ac2430099b (diff)
parent3374fe9566a366451ea59f325ecb1e2da7046322 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/writers.nix')
-rw-r--r--krebs/5pkgs/writers.nix28
1 files changed, 27 insertions, 1 deletions
diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix
index 65ee14485..d14090323 100644
--- a/krebs/5pkgs/writers.nix
+++ b/krebs/5pkgs/writers.nix
@@ -2,6 +2,32 @@
with import <stockholm/lib>;
{
nixpkgs.config.packageOverrides = _: {
+
+ # Combine a list of derivations using symlinks. Paths in later derivations
+ # take precedence over earlier ones.
+ #
+ # Example: create wrapper but retain all other files (man pages etc.)
+ #
+ # {
+ # nixpkgs.config.packageOverrides = super: {
+ # hello = pkgs.concat "hello" [
+ # super.hello
+ # (pkgs.writeDashBin "hello" ''
+ # echo OMG
+ # echo exec ${super.hello}/bin/hello "$@"
+ # '')
+ # ];
+ # };
+ # }
+ #
+ concat = name: xs: pkgs.runCommand name {} ''
+ mkdir $out
+ ${flip concatMapStrings xs (x: ''
+ cp --remove-destination -vrs ${x}/* $out
+ find $out -type d -exec chmod -v u+rwx {} +
+ '')}
+ '';
+
execve = name: { filename, argv ? null, envp ? {}, destination ? "" }: let
in pkgs.writeC name { inherit destination; } /* c */ ''
#include <unistd.h>
@@ -96,7 +122,7 @@ with import <stockholm/lib>;
assert types.package.check link;
{
install = /* sh */ ''
- ${optionalString (dirOf path != "/") /* sh */ ''
+ ${optionalString (path != "") /* sh */ ''
${pkgs.coreutils}/bin/mkdir -p $out${dirOf path}
''}
${pkgs.coreutils}/bin/ln -s ${link} $out${path}