nix-config.nix 1.8 KB

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