1
0

nix-config.nix 1.6 KB

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