diff --git a/.circleci/config.yml b/.circleci/config.yml index 4583ed2..3a43455 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,8 +12,17 @@ jobs: sudo chown circleci /nix bash <(curl https://nixos.org/nix/install) echo '. /home/circleci/.nix-profile/etc/profile.d/nix.sh' >> $BASH_ENV - sudo mkdir -p /etc/nix && echo "sandbox = true" | sudo tee -a /etc/nix/nix.conf + sudo mkdir -p /etc/nix && + + # Enable sandbox + echo "sandbox = true" | sudo tee -a /etc/nix/nix.conf + + # Keep derivations and their outputs for better caching + echo "keep-outputs = true" | sudo tee -a /etc/nix/nix.conf + echo "keep-derivations = true" | sudo tee -a /etc/nix/nix.conf + - checkout + - restore_cache: # Match on the latest cache for this branch keys: @@ -41,11 +50,14 @@ jobs: - run: name: Create cache command: | + nix-store --gc cache_path=~/.nix-build-cache-export.gz store_list=~/.store-list echo "Listing paths" - nix-instantiate \ - | xargs nix-store -qR --include-outputs \ + find /nix/store \ + -maxdepth 1 -mindepth 1 \ + -not -name '\.links' -print \ + | sort \ > $store_list echo "Generating cache file" cat $store_list \ diff --git a/script/test b/script/test index 2dfd93e..474afec 100755 --- a/script/test +++ b/script/test @@ -10,10 +10,7 @@ export NIX_PATH="nixpkgs=./nix" echo "Building" -nix build --no-link - -echo "Testing shell" - -nix-shell --run "echo -n" +# Build and create a root +nix build echo "all good"