wip: copy to some remote cache

bare
Hung 2023-03-23 21:50:49 -07:00
parent fa4f674853
commit b0b8d2cc3a
5 changed files with 31 additions and 25 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
result

View File

@ -175,11 +175,11 @@
}, },
"flake-utils_4": { "flake-utils_4": {
"locked": { "locked": {
"lastModified": 1676283394, "lastModified": 1678901627,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -330,11 +330,11 @@
"rust-overlay": "rust-overlay_2" "rust-overlay": "rust-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1679587834, "lastModified": 1679605987,
"narHash": "sha256-x55B7l1Sp/oMrPecwZFcDiqYh1uL+h19nkw274mgKys=", "narHash": "sha256-EWkCsAQiC7B3v9FqNmtxYARX3EDAA1hD8b+9s19cuCs=",
"owner": "tweag", "owner": "tweag",
"repo": "nickel", "repo": "nickel",
"rev": "7284ce50a312c0a96b188e4c81e6e258b9521075", "rev": "985d19c12387f2175f902b449fc9503c4ee4d5be",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -412,11 +412,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1673800717, "lastModified": 1678872516,
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -428,11 +428,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1678470307, "lastModified": 1678898370,
"narHash": "sha256-OEeMUr3ueLIXyW/OaFUX5jUdimyQwMg/7e+/Q0gC/QE=", "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0c4800d579af4ed98ecc47d464a5e7b0870c4b1f", "rev": "ac718d02867a84b42522a0ece52d841188208f2c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -502,11 +502,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1678376203, "lastModified": 1678976941,
"narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=", "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "1a20b9708962096ec2481eeb2ddca29ed747770a", "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -570,11 +570,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1678501303, "lastModified": 1679106165,
"narHash": "sha256-92s2NOlcvydz0Cxi1OOq/bs7SQc38TaqzuzdHsRANhA=", "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "1c8200cdc4c830d937fbf8b19e1f3e83daf3370a", "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -589,11 +589,11 @@
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_5"
}, },
"locked": { "locked": {
"lastModified": 1679537973, "lastModified": 1679624450,
"narHash": "sha256-R6borgcKeyMIjjPeeYsfo+mT8UdS+OwwbhhStdCfEjg=", "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "fbc7ae3f14d32e78c0e8d7865f865cc28a46b232", "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -1,4 +1,5 @@
accept-flake-config = true accept-flake-config = true
experimental-features = nix-command flakes experimental-features = nix-command flakes
post-build-hook = /etc/nix/upload-to-cache.sh post-build-hook = /etc/nix/upload-to-cache.sh
trusted-users = root htran hungtran hwtr

View File

@ -17,6 +17,10 @@ if [ -f /etc/nix/nix.conf ]; then
fi fi
sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/ sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/
sudo cp "${SCRIPT_DIR}/upload-to-cache.sh" /etc/nix/ sudo cp "${SCRIPT_DIR}/upload-to-cache.sh" /etc/nix/
sudo chmod +x /etc/nix/*.sh
# Reload nix daemon so that new changes are applied.
sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemon
# Mason is bad: it puts binaries onto xdg.data # Mason is bad: it puts binaries onto xdg.data
# let's make mason starts fresh, just in case we introduce RPATH hacks # let's make mason starts fresh, just in case we introduce RPATH hacks

8
scripts/upload-to-cache.sh Normal file → Executable file
View File

@ -1,11 +1,11 @@
#!/bin/sh #!/usr/bin/env sh
set -eux
set -eu
set -f # disable globbing (/nix/store may contain glob chars) set -f # disable globbing (/nix/store may contain glob chars)
export IFS=' ' export IFS=' '
PATH=/nix/var/nix/profiles/default/bin:$PATH
# $OUT_PATHS when invoked by nix.settings.post-build-hook will be # $OUT_PATHS when invoked by nix.settings.post-build-hook will be
# space-separated paths to /nix/store/ # space-separated paths to /nix/store/
echo "Uploading paths" $OUT_PATHS echo "Uploading paths" $OUT_PATHS
exec nix copy --to "s3://example-nix-cache" $OUT_PATHS nix copy --to "ssh-ng://10.100.200.230" $OUT_PATHS