nix.nix 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. { config, lib, inputs, ... }:
  2. with lib;
  3. {
  4. system.stateVersion = "24.05";
  5. nixpkgs.config.allowUnfree = mkDefault true;
  6. virtualisation.vmVariant.virtualisation = {
  7. cores = mkDefault 2;
  8. memorySize = mkDefault 4096;
  9. };
  10. environment = {
  11. sessionVariables.NIXPKGS_ALLOW_UNFREE = mkDefault "1";
  12. };
  13. nix = {
  14. # channel.enable = false;
  15. distributedBuilds = mkIf (config.nix.buildMachines != []) true;
  16. nixPath = [
  17. "nixpkgs=${inputs.nixpkgs}"
  18. ];
  19. registry = {
  20. # nix-config.flake = inputs.self;
  21. nixpkgs.flake = inputs.nixpkgs;
  22. home-manager.flake = inputs.home-manager;
  23. agenix.flake = inputs.agenix;
  24. };
  25. settings = {
  26. auto-optimise-store = true;
  27. builders-use-substitutes = true;
  28. experimental-features = [ "nix-command" "flakes" ];
  29. max-jobs = if config.nix.distributedBuilds then 0 else "auto";
  30. substituters = mkIf (!config.services.nix-serve.enable) (mkBefore [
  31. "https://nix.bad.net.ru/?priority=30"
  32. # "https://nix.notbad.dynv6.net/?priority=31"
  33. # "https://nix.badbayan.duckdns.org/?priority=31"
  34. ]);
  35. trusted-public-keys = mkBefore [
  36. "nix.bad.net.ru-1:jlTx0ty3f/d1Tb2D0Pj1O0l30/c7VpCmYLQ9Fc++xoM="
  37. "nix.notbad.dynv6.net-1:eN+lRGq8gGz5/PoGaAVYTnZStnEcIRHvhg+ZIn9I1TA="
  38. "nix.badbayan.duckdns.org-1:qI75l0GHxICLk1ftwwL1rPqcml+krIzOtZdrRs9Zrlk="
  39. ];
  40. trusted-users = [
  41. "root"
  42. "@wheel"
  43. ];
  44. warn-dirty = false;
  45. };
  46. gc = {
  47. automatic = true;
  48. dates = "weekly";
  49. options = "--delete-older-than 14d";
  50. };
  51. extraOptions = ''
  52. min-free = ${toString (1024 * 1024 * 1024)}
  53. max-free = ${toString (1024 * 1024 * 1024 * 4)}
  54. '';
  55. };
  56. }