mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +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;
|
|
}
|