Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Last active June 10, 2019 18:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverca22/590cbb3e6b0ad1959e720d73c36e1e95 to your computer and use it in GitHub Desktop.
Save cleverca22/590cbb3e6b0ad1959e720d73c36e1e95 to your computer and use it in GitHub Desktop.
native secret download
[clever@amd-nixos:~/nix-tests]$ nix repl --allow-unsafe-native-code-during-evaluation
Welcome to Nix version 2.0. Type :? for help.

nix-repl> import ./secret-download.nix
{ ... }; }

nix-repl> import ./secret-download.nix
{ downloader = «derivation /nix/store/vkvj32swicvjc3hya36p06q9lb60sp7g-downloader.drv»; foo = { ... }; }

nix-repl> (import ./secret-download.nix).foo
{ val1 = 25; val2 = "uid=1000(clever) gid=100(users) groups=100(users),1(wheel),72(vboxusers),131(docker),500(wireshark)"; }
with import <nixpkgs> {};
rec {
downloader = writeScript "downloader" ''
#!${stdenv.shell}
echo "{val1 = 5 * 5; val2 = \"$(id)\"; } "
'';
foo = builtins.exec [ downloader ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment