Browse Source

Add writeSubstitutedFile

Signed-off-by: Magic_RB <magic_rb@redalder.org>
master
Magic_RB 1 month ago
parent
commit
d8e553000c
Signed by: Magic_RB GPG Key ID: 08D5287CC5DDCA0E
2 changed files with 19 additions and 0 deletions
  1. +1
    -0
      flake.nix
  2. +18
    -0
      lib/write-substituted-file.nix

+ 1
- 0
flake.nix View File

@ -29,6 +29,7 @@
makeBootloader = callPackage ./lib/make-bootloader;
runInVm = callPackage ./lib/vm/run-in-vm.nix;
writeSubstitutedShellScript = callPackage ./lib/write-substituted-shell-script.nix {};
writeSubstitutedFile = callPackage ./lib/write-substituted-file.nix {};
};
giteaSystem = import ./examples/gitea self.lib;


+ 18
- 0
lib/write-substituted-file.nix View File

@ -0,0 +1,18 @@
{ runCommandNoCCLocal
, runtimeShell
, busybox
}:
{
name
, file
, substitutes
}:
runCommandNoCCLocal name ({
nativeBuildInputs = [ busybox ];
} // substitutes)
''
TMPFILE=$(mktemp)
substituteAll ${file} $TMPFILE
touch $out
cat $TMPFILE >> $out
''

Loading…
Cancel
Save