nix-config.nix 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. warn-dirty = false
  34. experimental-features = nix-command flakes impure-derivations
  35. auto-optimise-store = true
  36. ''
  37. + lib.optionalString (pkgs.system == "aarch64-darwin") ''
  38. extra-platforms = x86_64-darwin aarch64-darwin x86_64-linux aarch64-linux
  39. '';
  40. gc = {
  41. automatic = true;
  42. options = "--delete-older-than 7d";
  43. };
  44. # Map registries to channels
  45. # Very useful when using legacy commands
  46. nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
  47. # TODO: Conditionally add the optimise attribute if it exists
  48. # } // lib.mkIf (lib.hasAttr "nix.optimise.automatic" config) {
  49. # optimise = {
  50. # automatic = lib.mkDefault true;
  51. # };
  52. };
  53. nixpkgs = {
  54. overlays = [
  55. outputs.overlays.additions
  56. outputs.overlays.modifications
  57. outputs.overlays.unstable-packages
  58. ];
  59. config = {
  60. allowUnfree = true;
  61. allowUnsupportedSystem = true;
  62. };
  63. };
  64. }