Closed minizilla closed 1 year ago
I try to specify custom nix store location with store = ~/nix using extra_nix_config, it confirmed that the config in /etc/nix/nix.conf appended.
store = ~/nix
extra_nix_config
/etc/nix/nix.conf
$ cat /etc/nix/nix.conf max-jobs = auto trusted-users = root runner access-tokens = github.com=*** store = ~/nix experimental-features = nix-command flakes build-users-group = nixbld
However nix command seems to ignore the custom nix store location. For example, I try to cache nix store in ~/nix.
~/nix
The caching is works by specifying --store ~/nix when running nix develop.
--store ~/nix
nix develop
steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Nix uses: cachix/install-nix-action@v20 - name: Cache Nix uses: actions/cache@v3 with: path: ~/nix key: ${{ runner.os }}-nix-${{ hashFiles('flake.nix', 'flake.lock') }} - name: Nix develop run: nix --store ~/nix develop . --command echo "ok"
But the caching doesn't work if specifying custom store using store = ~/nix in extra_nix_config.
steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Nix uses: cachix/install-nix-action@v20 with: extra_nix_config: store = ~/nix - name: Cache Nix uses: actions/cache@v3 with: path: ~/nix key: ${{ runner.os }}-nix-${{ hashFiles('flake.nix', 'flake.lock') }} - name: Test run: nix develop . --command echo "ok"
@minizilla, try using the full path to the store. /home/<user>/nix or maybe /root/nix depending on your setup. Does that work?
/home/<user>/nix
/root/nix
Yes it works using /home/runner/nix.
/home/runner/nix
I try to specify custom nix store location with
store = ~/nix
usingextra_nix_config
, it confirmed that the config in/etc/nix/nix.conf
appended.However nix command seems to ignore the custom nix store location. For example, I try to cache nix store in
~/nix
.The caching is works by specifying
--store ~/nix
when runningnix develop
.But the caching doesn't work if specifying custom store using
store = ~/nix
inextra_nix_config
.