mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-24 07:26:51 +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;
|
|
}
|