Skip to content

Instantly share code, notes, and snippets.

@phaer
Created December 5, 2022 21:38
Show Gist options
  • Save phaer/355640e192321aecd5406dea67a74ff2 to your computer and use it in GitHub Desktop.
Save phaer/355640e192321aecd5406dea67a74ff2 to your computer and use it in GitHub Desktop.
nix: writeScript without stdenv
{ name ? "hello"
, text ? "echo 'Hello World'"
, pkgs ? import <nixpkgs> {}
}:
builtins.derivation {
inherit name;
inherit (pkgs) system;
builder = "${pkgs.busybox}/bin/busybox";
args = [
"sh"
"-c"
''
echo "${text}" > $out
$builder chmod +x $out
''
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment