Skip to content

Commit 37ad887

Browse files
committed
Add local path to nixpkgs to avoid constant nixpkgs download
1 parent 0ff0514 commit 37ad887

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

manage

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ state_file="$here/${deployment}.nixops"
5858

5959
source "$here/nixpkgs-version.sh"
6060

61-
export NIX_PATH=nixpkgs="$nixpkgs_snapshot":"$repo_root":.
61+
function colon(){
62+
echo ${1:+${1}:}
63+
}
64+
export NIX_PATH=nixpkgs="$(colon $nixpkgs_cache)$(colon $nixpkgs_snapshot)$repo_root":.
6265
export NIXOPS_STATE="$state_file"
6366
export NIXOPS_DEPLOYMENT="$deployment"
6467

nixpkgs-version.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
# 1. Choose a channel and click on it.
77
# 2. Get the URL of the `nixexprs.tar.xz` file for the channel.
88
# 4. Paste the URL below for `url`.
9-
# 5. Get SHA256 hash of URL contents with `nix-prefetch-url --unpack <url>`.
9+
# 5. Get SHA256 hash and cache path of URL contents with `nix-prefetch-url --unpack <url>`.
1010

1111
{
12-
url = "https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.03pre101896.4a524cf/nixexprs.tar.xz";
13-
sha256 = "1wrm9k0plpzz0wi94ry1xv1v3aq4vs20v5dzxv4azn4i8vhf7wmg";
12+
url = "https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-18.03pre126798.42b9b8f7c86/nixexprs.tar.xz";
13+
sha256 = "0yf4z49zm7bc55cgdhdzfqqyrlnkckg2hfmwd78w4i9sw89nbxp3";
14+
cache = "/nix/store/6k4mwhwnq72dgn83ahgws33fsy31ff13-nixexprs.tar.xz";
1415
}

nixpkgs-version.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
44

55
nixpkgs_snapshot=$(eval echo "$(nix-instantiate --eval -E "(import \"$here/nixpkgs-version.nix\").url")")
6+
nixpkgs_cache=$(eval echo "$(nix-instantiate --eval -E "(import \"$here/nixpkgs-version.nix\").cache")")
67
export nixpkgs_snapshot
8+
export nixpkgs_cache
79
export nixops_version="nixops"
810

911
# Or you can use a more recent build of nixops:

0 commit comments

Comments
 (0)