diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2012-01-03T00·16+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2012-01-03T00·16+0000 |
commit | 48cea0d01ef48733ab38a73a20611f63aeb1b5cc (patch) | |
tree | fec81ee5b47b14d6a58ee0b0e86458072efbda4a /corepkgs/nar.nix | |
parent | 93e71e6ab68d9662441289a02448c47069beeb2a (diff) |
* Refactoring: Get rid of a few subdirectories in corepkgs/, and some
other simplifications. * Use <nix/...> to locate the corepkgs. This allows them to be overriden through $NIX_PATH. * Use bash's pipefail option in the NAR builder so that we don't need to create a temporary file.
Diffstat (limited to 'corepkgs/nar.nix')
-rw-r--r-- | corepkgs/nar.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/corepkgs/nar.nix b/corepkgs/nar.nix new file mode 100644 index 000000000000..70a4af2f9ddb --- /dev/null +++ b/corepkgs/nar.nix @@ -0,0 +1,30 @@ +with import <nix/config.nix>; + +let + + builder = builtins.toFile "nar.sh" + '' + export PATH=${nixBinDir}:${coreutils} + + echo "packing ‘$storePath’..." + mkdir $out + dst=$out/tmp.nar.bz2 + + set -o pipefail + nix-store --dump "$storePath" | ${bzip2} > $dst + + nix-hash --flat --type $hashAlgo --base32 $dst > $out/narbz2-hash + + mv $out/tmp.nar.bz2 $out/$(cat $out/narbz2-hash).nar.bz2 + ''; + +in + +{ system, storePath, hashAlgo }: + +derivation { + name = "nar"; + builder = shell; + args = [ "-e" builder ]; + inherit system storePath hashAlgo; +} |