1
0

default.nix 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. { config
  2. , lib
  3. , pkgs
  4. , outputs
  5. , ...
  6. }:
  7. let
  8. age = config.age;
  9. in
  10. {
  11. imports = [
  12. # TODO: auto-import via `outputs.modules.nixos`
  13. outputs.modules.global.nix-config
  14. ./system
  15. ./services
  16. ./users
  17. ]
  18. ++ (builtins.attrValues outputs.modules.nixos);
  19. security.sudo.wheelNeedsPassword = false;
  20. # Services configuration
  21. services = {
  22. openssh = {
  23. enable = true;
  24. openFirewall = true;
  25. settings = {
  26. PasswordAuthentication = false;
  27. PermitRootLogin = "no";
  28. X11Forwarding = false;
  29. };
  30. };
  31. nullmailer = {
  32. enable = true;
  33. setSendmail = true;
  34. remotesFile = config.age.secrets."odin/services/nullmailer".path;
  35. config = {
  36. me = "odin.t5.st";
  37. defaulthost = "odin.t5.st";
  38. defaultdomain = "odin.t5.st";
  39. allmailfrom = "[email protected]";
  40. adminaddr = "[email protected]";
  41. };
  42. };
  43. };
  44. # # Container runtime
  45. # virtualisation = {
  46. # docker = {
  47. # enable = true;
  48. # storageDriver = "btrfs";
  49. # autoPrune = {
  50. # enable = true;
  51. # dates = "weekly";
  52. # flags = [ "--all" "--force" "--volumes" ];
  53. # };
  54. # };
  55. # };
  56. containers.grist-latest = {
  57. autoStart = false;
  58. privateNetwork = true;
  59. hostAddress = "192.168.1.1";
  60. localAddress = "192.168.1.2";
  61. specialArgs = { inherit outputs; };
  62. config = import ./containers/grist.nix;
  63. };
  64. containers.gogs = {
  65. autoStart = false;
  66. privateNetwork = true;
  67. hostAddress = "192.168.1.1";
  68. localAddress = "192.168.1.3";
  69. specialArgs = { inherit outputs; };
  70. bindMounts = {
  71. "/run/secrets/gogs-admin" = {
  72. hostPath = config.age.secrets."odin/services/gogs-admin".path;
  73. isReadOnly = true;
  74. };
  75. };
  76. config = import ./containers/gogs.nix;
  77. };
  78. services.caddy.virtualHosts.grist = {
  79. hostName = "grist.{$DOMAIN}";
  80. extraConfig = ''
  81. encode gzip zstd
  82. reverse_proxy 192.168.1.2:8484
  83. '';
  84. };
  85. programs.fish = {
  86. enable = true;
  87. vendor = {
  88. completions.enable = true;
  89. config.enable = true;
  90. functions.enable = true;
  91. };
  92. };
  93. environment.shells = [
  94. config.programs.fish.package
  95. ];
  96. # System packages
  97. # nixos-container create grist --flake .#grist --host-address "192.168.1.1" --local-address
  98. environment.systemPackages = with pkgs; [
  99. # System utilities
  100. git
  101. htop
  102. btop
  103. iotop
  104. powertop
  105. lsof
  106. pciutils
  107. usbutils
  108. # Network tools
  109. curl
  110. wget
  111. rsync
  112. # File system tools
  113. btrfs-progs
  114. xfsprogs
  115. smartmontools
  116. hdparm
  117. # # Container tools
  118. # docker-compose
  119. # Monitoring
  120. lm_sensors
  121. nvme-cli
  122. ];
  123. # System identification
  124. networking.hostName = "odin";
  125. networking.useDHCP = lib.mkDefault true;
  126. # Time synchronization
  127. services.timesyncd.enable = true;
  128. time.timeZone = "Europe/Vienna";
  129. # System state version
  130. system.stateVersion = "25.05";
  131. }