Improve custom cache upload script
This commit is contained in:
parent
db683560ac
commit
abcf83a3ad
1 changed files with 4 additions and 3 deletions
|
@ -14,7 +14,8 @@ in
|
||||||
sudo mkdir ${cache.rootDir}/.aws 2> /dev/null
|
sudo mkdir ${cache.rootDir}/.aws 2> /dev/null
|
||||||
sudo cp "$HOME/.aws/credentials" ${cache.rootDir}/.aws/
|
sudo cp "$HOME/.aws/credentials" ${cache.rootDir}/.aws/
|
||||||
|
|
||||||
uncachedHashes=$(echo 'SELECT DISTINCT hashPart FROM NARs WHERE present = 0;' | sudo sqlite3 "${cache.database}")
|
minTimestamp=$(expr $(date +%s) - 3600)
|
||||||
|
uncachedHashes=$(echo "SELECT DISTINCT hashPart FROM NARs WHERE present = 0 AND timestamp >= $minTimestamp;" | sudo sqlite3 "${cache.database}")
|
||||||
signingKey="$HOME/.config/nifoc-nix/${cache.signingKey}"
|
signingKey="$HOME/.config/nifoc-nix/${cache.signingKey}"
|
||||||
|
|
||||||
for uncachedHash in $uncachedHashes; do
|
for uncachedHash in $uncachedHashes; do
|
||||||
|
@ -35,10 +36,10 @@ in
|
||||||
if [ "$1" = "--list" ]; then
|
if [ "$1" = "--list" ]; then
|
||||||
echo "$storePath"
|
echo "$storePath"
|
||||||
else
|
else
|
||||||
nix store sign --key-file $signingKey $storePath
|
sudo -H nix store sign --key-file $signingKey $storePath
|
||||||
|
|
||||||
echo "Uploading $storePath ..."
|
echo "Uploading $storePath ..."
|
||||||
nix copy --to '${cache.s3Url}' $storePath
|
sudo -H nix copy --to '${cache.s3Url}' $storePath
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue