/default.nix Secret
Created
October 18, 2020 14:20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
sources = import ./nix/sources.nix; | |
pkgs = import sources.nixpkgs { config = {}; overlays = []; }; | |
paths = [ pkgs.hello ]; | |
in { | |
closure = pkgs.runCommand "closure" { | |
buildInputs = with pkgs; [ nix mktorrent ]; | |
closureInfo = pkgs.closureInfo { rootPaths = paths; }; | |
} '' | |
export NIX_STATE_DIR=$NIX_BUILD_TOP/state | |
nix-store --load-db < $closureInfo/registration | |
nix copy --to file:///$NIX_BUILD_TOP/cache $(cat $closureInfo/store-paths) | |
ls $NIX_BUILD_TOP/cache -lh | |
mktorrent --output=whatever.torrent --no-date --web-seed=http://whatever $NIX_BUILD_TOP/cache | |
mkdir -p $out | |
mv -vi whatever.torrent $out/ | |
# option 1 | |
cat > $out/upload <<EOF | |
#!/bin/sh | |
nix sign-paths --key-file "\$2" -r ${toString paths} | |
nix copy --to "\$1" ${toString paths} | |
EOF | |
chmod +x $out/upload | |
# option 2 | |
mv -vi $NIX_BUILD_TOP/cache $out/ | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment