Skip to content

Commit

Permalink
flake.nix: fix nixConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Oct 11, 2023
1 parent ccc213e commit 1c4ef8c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
25 changes: 11 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,16 @@
formatter = pkgs.nixpkgs-fmt;
legacyPackages = pkgs;
}))

{
# Allows the user to use our cache when using `nix run <thisFlake>`.
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://thiagokokada-nix-configs.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"thiagokokada-nix-configs.cachix.org-1:MwFfYIvEHsVOvUPSEpvJ3mA69z/NnY6LQqIQJFvNwOc="
];
};
}
]; # END recursiveMergeAttrs

nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://thiagokokada-nix-configs.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"thiagokokada-nix-configs.cachix.org-1:MwFfYIvEHsVOvUPSEpvJ3mA69z/NnY6LQqIQJFvNwOc="
];
};
}
2 changes: 1 addition & 1 deletion home-manager/meta/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# sudo echo "trusted-users = @wheel" >> /etc/nix/nix.conf
nix = {
package = lib.mkDefault pkgs.nix;
settings = import ../../shared/nix-conf.nix // flake.outputs.nixConfig;
settings = import ../../shared/nix-conf.nix // (import ../../shared/cachix.nix);
};

# Set custom nixpkgs config (e.g.: allowUnfree), both for this
Expand Down
8 changes: 5 additions & 3 deletions nixos/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ in
daemonCPUSchedPolicy = "idle";
}
{
settings = {
settings = let
cachix = import ../../shared/cachix.nix;
in {
# For some reason when nix is running as daemon,
# extra-{substituters,trusted-public-keys} doesn't work
substituters = [ "https://cache.nixos.org/" ] ++ flake.outputs.nixConfig.extra-substituters;
trusted-public-keys = flake.outputs.nixConfig.extra-trusted-public-keys;
substituters = [ "https://cache.nixos.org/" ] ++ cachix.extra-substituters;
trusted-public-keys = cachix.extra-trusted-public-keys;
};
}
];
Expand Down
10 changes: 10 additions & 0 deletions shared/cachix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
extra-substituters = [
"https://nix-community.cachix.org"
"https://thiagokokada-nix-configs.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"thiagokokada-nix-configs.cachix.org-1:MwFfYIvEHsVOvUPSEpvJ3mA69z/NnY6LQqIQJFvNwOc="
];
}

0 comments on commit 1c4ef8c

Please sign in to comment.