Skip to content

Instantly share code, notes, and snippets.

@lukego
Created June 27, 2017 11:02
Show Gist options
  • Save lukego/478943a4ebc0bb4e9ab1a003275ffb31 to your computer and use it in GitHub Desktop.
Save lukego/478943a4ebc0bb4e9ab1a003275ffb31 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
with stdenv;
let
a = runCommand "a" {} "mkdir -p $out/lib/mydir; touch $out/lib/mydir/a";
b = runCommand "b" {} "mkdir -p $out/lib/mydir; touch $out/lib/mydir/b";
in
runCommand "c" { buildInputs = [ a b ]; } ''
echo "Where can I find lib/mydir...?"
''
@lukego
Copy link
Author

lukego commented Jun 27, 2017

with import <nixpkgs> {};
with stdenv;

let
  a = runCommand "a" {} "mkdir -p $out; touch $out/a";
  b = runCommand "b" {} "mkdir -p $out; touch $out/b";
  c = runCommand "b" { inputs = [a b]; } ''
    mkdir $out
    for i in $inputs; do
      for f in $i/*; do
        ln -s $f $out/
      done
    done
  '';
in
runCommand "z" { input = c; } ''
  echo "All inputs:"
  ls -l $input
''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment