From db683560ac745eb123118558d4ca675b974da86d Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Tue, 9 Aug 2022 19:25:55 +0200 Subject: [PATCH] Make AWS copy work on NixOS --- home/programs/custom-nix-cache.nix | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/home/programs/custom-nix-cache.nix b/home/programs/custom-nix-cache.nix index d985f8c..a01292c 100644 --- a/home/programs/custom-nix-cache.nix +++ b/home/programs/custom-nix-cache.nix @@ -10,6 +10,10 @@ in #!/usr/bin/env nix-shell #!nix-shell -i bash -p sqlite + # Make sure the files are available to root on NixOS and macOS + sudo mkdir ${cache.rootDir}/.aws 2> /dev/null + sudo cp "$HOME/.aws/credentials" ${cache.rootDir}/.aws/ + uncachedHashes=$(echo 'SELECT DISTINCT hashPart FROM NARs WHERE present = 0;' | sudo sqlite3 "${cache.database}") signingKey="$HOME/.config/nifoc-nix/${cache.signingKey}" @@ -50,16 +54,7 @@ in ''; }; - xdg.configFile."nifoc-nix/${cache.signingKey}" = { + xdg.configFile."nifoc-nix/${cache.signingKey}" = lib.mkIf cache.enabled { text = cache.signingKeyValue; }; - - home.activation = lib.mkIf cache.enabled { - customNixCacheActivation = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - echo -n 'Copying AWS configuration: ' - $DRY_RUN_CMD sudo mkdir ${cache.rootDir}/.aws 2> /dev/null - $DRY_RUN_CMD sudo cp "$HOME/.aws/credentials" ${cache.rootDir}/.aws/ - echo 'Done' - ''; - }; }