|
1 | 1 | inputs: |
2 | 2 | { lib, pkgs, config, ... }: |
3 | 3 | let |
4 | | - inherit (import ./shared.nix inputs) |
5 | | - commonNixSettingsModule |
6 | | - restrictedNixSettingsModule |
7 | | - mkPreferable |
8 | | - mkMorePreferable |
9 | | - ; |
| 4 | + # Stronger than mkDefault (1000), weaker than mkForce (50) and the "default override priority" |
| 5 | + # (100). |
| 6 | + mkPreferable = lib.mkOverride 750; |
| 7 | + |
| 8 | + # Stronger than the "default override priority", as the upstream module uses that, and weaker than mkForce (50). |
| 9 | + mkMorePreferable = lib.mkOverride 75; |
| 10 | + |
| 11 | + # The settings configured in this module must be generally settable by users both trusted and |
| 12 | + # untrusted by the Nix daemon. Settings that require being a trusted user belong in the |
| 13 | + # `restrictedSettingsModule` below. |
| 14 | + commonNixSettingsModule = { config, pkgs, lib, ... }: { |
| 15 | + nix.package = inputs.nix.packages."${pkgs.stdenv.system}".default; |
| 16 | + |
| 17 | + nix.registry.nixpkgs = { |
| 18 | + exact = true; |
| 19 | + |
| 20 | + from = { |
| 21 | + type = "indirect"; |
| 22 | + id = "nixpkgs"; |
| 23 | + }; |
| 24 | + |
| 25 | + # NOTE(cole-h): The NixOS module exposes a `flake` option that is a fancy wrapper around |
| 26 | + # setting `to` -- we don't want to clobber this if users have set it on their own |
| 27 | + to = lib.mkIf (config.nix.registry.nixpkgs.flake or null == null) (mkPreferable { |
| 28 | + type = "tarball"; |
| 29 | + url = "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1.0.tar.gz"; |
| 30 | + }); |
| 31 | + }; |
| 32 | + |
| 33 | + nix.settings = { |
| 34 | + bash-prompt-prefix = "(nix:$name)\\040"; |
| 35 | + extra-experimental-features = [ "nix-command" "flakes" ]; |
| 36 | + extra-nix-path = [ "nixpkgs=flake:nixpkgs" ]; |
| 37 | + extra-substituters = [ "https://cache.flakehub.com" ]; |
| 38 | + }; |
| 39 | + }; |
| 40 | + |
| 41 | + # The settings configured in this module require being a user trusted by the Nix daemon. |
| 42 | + restrictedNixSettingsModule = { ... }: { |
| 43 | + nix.settings = restrictedNixSettings; |
| 44 | + }; |
| 45 | + |
| 46 | + # Nix settings that require being a trusted user to configure. |
| 47 | + restrictedNixSettings = { |
| 48 | + always-allow-substitutes = true; |
| 49 | + netrc-file = "/nix/var/determinate/netrc"; |
| 50 | + upgrade-nix-store-path-url = "https://install.determinate.systems/nix-upgrade/stable/universal"; |
| 51 | + extra-trusted-public-keys = [ |
| 52 | + "cache.flakehub.com-3:hJuILl5sVK4iKm86JzgdXW12Y2Hwd5G07qKtHTOcDCM=" |
| 53 | + "cache.flakehub.com-4:Asi8qIv291s0aYLyH6IOnr5Kf6+OF14WVjkE6t3xMio=" |
| 54 | + "cache.flakehub.com-5:zB96CRlL7tiPtzA9/WKyPkp3A2vqxqgdgyTVNGShPDU=" |
| 55 | + "cache.flakehub.com-6:W4EGFwAGgBj3he7c5fNh9NkOXw0PUVaxygCVKeuvaqU=" |
| 56 | + "cache.flakehub.com-7:mvxJ2DZVHn/kRxlIaxYNMuDG1OvMckZu32um1TadOR8=" |
| 57 | + "cache.flakehub.com-8:moO+OVS0mnTjBTcOUh2kYLQEd59ExzyoW1QgQ8XAARQ=" |
| 58 | + "cache.flakehub.com-9:wChaSeTI6TeCuV/Sg2513ZIM9i0qJaYsF+lZCXg0J6o=" |
| 59 | + "cache.flakehub.com-10:2GqeNlIp6AKp4EF2MVbE1kBOp9iBSyo0UPR9KoR0o1Y=" |
| 60 | + ]; |
| 61 | + }; |
10 | 62 | in |
11 | 63 | { |
12 | 64 | imports = [ |
|
0 commit comments