mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 19:55:53 +03:00
31 lines
696 B
Nix
31 lines
696 B
Nix
{ lib, stdenvNoCC, coreutils }:
|
|
|
|
{ name, extension ? "tgz", contents # { target = source, ... }
|
|
}:
|
|
|
|
let
|
|
|
|
transforms = builtins.concatStringsSep " " (lib.mapAttrsToList
|
|
(target: source: ''--transform "s,${source},${target},"'') contents);
|
|
|
|
sources = builtins.concatStringsSep " "
|
|
(lib.mapAttrsToList (_target: source: "${source}") contents);
|
|
|
|
in stdenvNoCC.mkDerivation {
|
|
name = "${name}.${extension}";
|
|
phases = [ "buildPhase" ];
|
|
|
|
nativeBuildInputs = [ coreutils ];
|
|
|
|
buildPhase = ''
|
|
tar -vczf $out \
|
|
--owner=0 --group=0 --mode=u+rw,uga+r \
|
|
--absolute-names \
|
|
--hard-dereference \
|
|
${transforms} \
|
|
${sources}
|
|
'';
|
|
|
|
preferLocalBuild = true;
|
|
}
|