default.nix 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. { config, lib, pkgs, inputs, ... }:
  2. {
  3. imports = with inputs.self.modules; [
  4. ./hardware-configuration.nix
  5. users.aya
  6. ];
  7. roles.desktop = "gnome";
  8. nix.gc.automatic = lib.mkForce false;
  9. boot = {
  10. loader = {
  11. grub = {
  12. enable = true;
  13. device = "/dev/sda";
  14. };
  15. timeout = 2;
  16. };
  17. kernelPackages = pkgs.linuxPackages_6_6;
  18. kernelParams = [ "acpi_backlight=native" "mem_sleep_default=s2idle" ];
  19. };
  20. environment.persistence."/system/persist" = {
  21. directories = [
  22. "/etc/NetworkManager"
  23. "/var/db/sudo"
  24. "/var/lib"
  25. "/var/log"
  26. ];
  27. files = [
  28. "/etc/machine-id"
  29. { file = "/root/.ssh/id_ed25519";
  30. parentDirectory = {
  31. defaultPerms.mode = "0700";
  32. mode = "0700";
  33. };
  34. }
  35. ];
  36. };
  37. fileSystems = {
  38. "/".options = [ "size=256M" "mode=755" ];
  39. "/home".options = [ "compress=zstd" ];
  40. "/nix".options = [ "compress=zstd" "noatime" ];
  41. "/system" = {
  42. neededForBoot = true;
  43. options = [ "compress=zstd" ];
  44. };
  45. };
  46. age = {
  47. identityPaths = [ "/system/persist/root/.ssh/id_ed25519" ];
  48. secrets = with inputs.self.modules; {
  49. makai-wg0.file = secrets.makai-wg0;
  50. yama-wg0-makai.file = secrets.yama-wg0-makai;
  51. };
  52. };
  53. networking = {
  54. hostName = "makai";
  55. networkmanager.enable = true;
  56. wireguard.interfaces = {
  57. wg0 = {
  58. ips = [ "10.0.0.2/24" ];
  59. listenPort = 51820;
  60. privateKeyFile = config.age.secrets.makai-wg0.path;
  61. peers = [
  62. { # yama
  63. publicKey = "Tan9IHvGvzeHFBSg3ZnhqNuJFYtAB+hfybbh9SPWRwk=";
  64. presharedKeyFile = config.age.secrets.yama-wg0-makai.path;
  65. endpoint = "notbad.dynv6.net:51820";
  66. allowedIPs = [ "10.0.0.1/32" ];
  67. dynamicEndpointRefreshSeconds = 10;
  68. }
  69. ];
  70. };
  71. };
  72. };
  73. environment.sessionVariables = {
  74. LIBVA_DRIVER_NAME = "i965";
  75. };
  76. services = {
  77. # btrfs.autoScrub = {
  78. # enable = true;
  79. # fileSystems = [ "/system" ];
  80. # };
  81. dnsmasq.enable = true;
  82. logind.lidSwitch = "suspend-then-hibernate";
  83. yggdrasil.enable = true;
  84. };
  85. systemd.sleep.extraConfig = ''
  86. SuspendState=freeze
  87. HibernateDelaySec=20m
  88. '';
  89. zramSwap.enable = true;
  90. }