Skip to content

Conversation

awwpotato
Copy link
Contributor

@awwpotato awwpotato commented Jul 28, 2025

This allows people interacting with our flake to benefit more from caching (mostly testbeds). On the first interaction with out flake the user will be prompted with the below messages, which is slightly annoying but worth it imo because people directly interacting with the flake probably care about better caching of the testbeds.

do you want to allow configuration setting 'extra-substituters' to be set to 'https://nix-community.cachix.org' (y/N)?
do you want to permanently mark this value as trusted (y/N)?
do you want to allow configuration setting 'extra-trusted-public-keys' to be set to ' nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' (y/N)?
do you want to permanently mark this value as trusted (y/N)?

cc @MattSturgeon @trueNAHO @danth

Submission Checklist

Notify Maintainers

@stylix-automation stylix-automation bot added the topic: flake /flake.nix, /flake.lock, and /flake/ subsystems label Jul 28, 2025
@awwpotato awwpotato added the backport: release-25.05 Changes to release-25.05 stable branch label Jul 28, 2025
@awwpotato awwpotato changed the title flake: add nix-community and stylix cachix as substituters flake: add nix-community cachix as substituters Jul 28, 2025
@awwpotato awwpotato marked this pull request as draft July 28, 2025 22:16
@awwpotato

This comment was marked as outdated.

@awwpotato awwpotato marked this pull request as ready for review July 30, 2025 00:45
Copy link
Member

@trueNAHO trueNAHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the first interaction with out flake the user will be prompted with the below messages, which is slightly annoying but worth it imo because people directly interacting with the flake probably care about better caching of the testbeds.

do you want to allow configuration setting 'extra-substituters' to be set to 'https://nix-community.cachix.org' (y/N)?
do you want to permanently mark this value as trusted (y/N)?
do you want to allow configuration setting 'extra-trusted-public-keys' to be set to ' nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' (y/N)?
do you want to permanently mark this value as trusted (y/N)?

How to trust https://nix-community.cachix.org without setting nix.settings.trusted-users:

do you want to allow configuration setting 'extra-substituters' to be set to 'https://nix-community.cachix.org' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? n
do you want to allow configuration setting 'extra-trusted-public-keys' to be set to 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? n
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user

The following NixOS declaration does not resolve the issue:

nix.settings = {
  substituters = [ "https://nix-community.cachix.org" ];

  trusted-public-keys = [
    "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
  ];
};


nixConfig = {
extra-substituters = [ "https://nix-community.cachix.org" ];
extra-trusted-public-keys = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subjective nitpick:

Suggested change
extra-trusted-public-keys = [
extra-trusted-public-keys = [

@MattSturgeon
Copy link
Member

How to trust https://nix-community.cachix.org without setting nix.settings.trusted-users:

The following NixOS declaration does not resolve the issue:

nix.settings = {
  substituters = [ "https://nix-community.cachix.org" ];

  trusted-public-keys = [
    "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
  ];
};

I used to define trusted-substituters:

https://github.com/MattSturgeon/nix-config/blob/2544e5126be716c00400b15229bfd371945e813d/modules/common/nix.nix#L41-L47

See https://nix.dev/manual/nix/2.24/command-ref/conf-file.html#conf-trusted-substituters

I recently refactored to just explicitly add all the substituters I need to my nixos config, but if you want to trust a substituter without always using it, the settings is trusted-substituters.

@trueNAHO
Copy link
Member

trueNAHO commented Jul 31, 2025

How to trust https://nix-community.cachix.org without setting nix.settings.trusted-users:

The following NixOS declaration does not resolve the issue:

nix.settings = {
  substituters = [ "https://nix-community.cachix.org" ];

  trusted-public-keys = [
    "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
  ];
};

I used to define trusted-substituters:

https://github.com/MattSturgeon/nix-config/blob/2544e5126be716c00400b15229bfd371945e813d/modules/common/nix.nix#L41-L47

See https://nix.dev/manual/nix/2.24/command-ref/conf-file.html#conf-trusted-substituters

I recently refactored to just explicitly add all the substituters I need to my nixos config, but if you want to trust a substituter without always using it, the settings is trusted-substituters.

I am still getting the same error:

$ sudo nixos-rebuild switch
$ reboot
$ cd "$STYLIX"
$ direnv block
$ cd -
$ cd -
$ rm ~/.local/share/nix/trusted-settings.json
$ nix develop
do you want to allow configuration setting 'extra-substituters' to be set to 'https://nix-community.cachix.org' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y
do you want to allow configuration setting 'extra-trusted-public-keys' to be set to 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user

Here is more context:

  • NixOS configuration:

    nix.settings = {
      substituters = [ "https://nix-community.cachix.org" ];
    
      trusted-public-keys = [
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
    
      trusted-substituters = [ "https://nix-community.cachix.org" ];
    };
  • ~/.local/share/nix/trusted-settings.json:

    • {
        "extra-substituters": {
          "https://nix-community.cachix.org": true
        },
        "extra-trusted-public-keys": {
          "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=": true
        }
      }
  • /etc/nix/nix.conf:

    • allowed-users = *
      auto-optimise-store = true
      builders =
      cores = 0
      experimental-features = ca-derivations flakes impure-derivations nix-command
      max-jobs = auto
      require-sigs = true
      sandbox = true
      sandbox-fallback = false
      substituters = https://nix-community.cachix.org https://cache.nixos.org/
      system-features = nixos-test benchmark big-parallel kvm
      trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
      trusted-substituters = https://nix-community.cachix.org
      trusted-users = root
      extra-sandbox-paths =

Sorry for not figuring this out. I hope not having updated my NixOS config in half a year has nothing to do with it...

@MattSturgeon
Copy link
Member

Firstly, you have nix-comnunity in both substituters and trusted-substituters. That should be unnecessary.

Your actual error is:

warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user

And your nix.conf shows:

trusted-users = root

So the issue here is that you are not marking your user as a "trusted" user that is allowed to modify restricted settings.

You can either hard-code adding the extra trusted public key in your NixOS config, or add your user to nix.settings.trusted-users (maybe there's an option to trust admin users by default?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: release-25.05 Changes to release-25.05 stable branch topic: flake /flake.nix, /flake.lock, and /flake/ subsystems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants