1
0

nix-config.nix 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {
  2. lib,
  3. pkgs,
  4. config,
  5. outputs,
  6. ...
  7. }:
  8. {
  9. nix = {
  10. package = pkgs.nix;
  11. settings = {
  12. substituters = [
  13. "https://cache.nixos.org"
  14. "https://cachix.cachix.org"
  15. "https://devenv.cachix.org"
  16. "https://nix-community.cachix.org"
  17. ];
  18. trusted-public-keys = [
  19. "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
  20. "cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM="
  21. "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
  22. "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
  23. ];
  24. trusted-users = [
  25. "root"
  26. "@wheel"
  27. "@admin"
  28. ];
  29. };
  30. extraOptions =
  31. ''
  32. warn-dirty = false
  33. experimental-features = nix-command flakes impure-derivations
  34. auto-optimise-store = true
  35. ''
  36. + lib.optionalString (pkgs.system == "aarch64-darwin") ''
  37. extra-platforms = x86_64-darwin aarch64-darwin x86_64-linux aarch64-linux
  38. '';
  39. gc = {
  40. automatic = true;
  41. options = "--delete-older-than 7d";
  42. };
  43. # Map registries to channels
  44. # Very useful when using legacy commands
  45. nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
  46. # TODO: Conditionally add the optimise attribute if it exists
  47. # } // lib.mkIf (lib.hasAttr "nix.optimise.automatic" config) {
  48. # optimise = {
  49. # automatic = lib.mkDefault true;
  50. # };
  51. };
  52. nixpkgs = {
  53. overlays = [
  54. outputs.overlays.additions
  55. outputs.overlays.modifications
  56. outputs.overlays.unstable-packages
  57. ];
  58. config = {
  59. allowUnfree = true;
  60. allowUnsupportedSystem = true;
  61. };
  62. };
  63. }