From 0edb13f3fc16e6456e5deb4e006595491a6b197e Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Mar 2017 21:48:25 +0100 Subject: concat: init --- krebs/5pkgs/writers.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'krebs/5pkgs/writers.nix') diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix index 65ee14485..e1dbed5c7 100644 --- a/krebs/5pkgs/writers.nix +++ b/krebs/5pkgs/writers.nix @@ -2,6 +2,32 @@ with import ; { 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 -- cgit v1.2.3 From 218c58ef333e6968caa846612bdee162517b3b53 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Mar 2017 22:26:07 +0100 Subject: writers.link: mkdir when path is absolute --- krebs/5pkgs/writers.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/5pkgs/writers.nix') diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix index e1dbed5c7..d14090323 100644 --- a/krebs/5pkgs/writers.nix +++ b/krebs/5pkgs/writers.nix @@ -122,7 +122,7 @@ with import ; 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} -- cgit v1.2.3