configuration.nix 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. { config, pkgs, ... }:
  2. {
  3. imports = [ ./hardware-configuration.nix ];
  4. boot.tmp.cleanOnBoot = true;
  5. networking.hostName = "djmuk1";
  6. networking.firewall = {
  7. enable = true;
  8. allowedTCPPorts = [ 113 ];
  9. };
  10. services.openssh = {
  11. enable = true;
  12. settings = {
  13. PermitRootLogin = "no";
  14. PasswordAuthentication = false;
  15. KbdInteractiveAuthentication = false;
  16. };
  17. extraConfig = ''
  18. #AllowTcpForwarding yes
  19. X11Forwarding no
  20. AllowAgentForwarding no
  21. AllowStreamLocalForwarding no
  22. AuthenticationMethods publickey
  23. AllowUsers djm
  24. '';
  25. };
  26. services.sshguard.enable = true;
  27. services.oidentd.enable = true;
  28. services.locate = {
  29. enable = true;
  30. package = pkgs.plocate;
  31. localuser = null;
  32. };
  33. users.users.djm = {
  34. isNormalUser = true;
  35. home = "/home/djm";
  36. description = "David Morgan";
  37. extraGroups = [
  38. "wheel"
  39. "plocate"
  40. ];
  41. shell = pkgs.zsh;
  42. openssh.authorizedKeys.keys = [
  43. "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCurCpxZCHtByB5wXzsjTXwMyDSB4+B8rq5XY6EGss58NwD8jc5cII4i+QUbCOGTiAggSZUSC9YIP24hjpOeNT/IYs5m7Qn1B9MtBAiUSrIYew8eDwnMLlPzN+k2x9zCrJeCHIvGJaFHPXTh1Lf5Jt2fPVGW9lksE/XUVOe6ht4N/b+nqqszXFhc8Ug6le2bC1YeTCVEf8pjlh/I7DkDBl6IB8uEXc3X2vxxbV0Z4vlBrFkkAywcD3j5VlS/QYfBr4BICNmq/sO3fMkbMbtAPwuFxeL4+h6426AARQZiSS0qVEc8OoFRBVx3GEH5fqVAWfB1geyLzei22HbjUcT9+xN davidmo@gendros"
  44. "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK9UDTaVnUOU/JknrNdihlhhGOk53LmHq9I1ASri3aga djm@gaius"
  45. ];
  46. };
  47. security.sudo.extraConfig = ''
  48. djm ALL=(ALL) NOPASSWD: ALL
  49. '';
  50. security.doas = {
  51. enable = true;
  52. extraRules = [
  53. {
  54. users = [ "djm" ];
  55. noPass = true;
  56. keepEnv = true;
  57. }
  58. ];
  59. };
  60. programs.zsh.enable = true;
  61. programs.vim = {
  62. enable = true;
  63. defaultEditor = true;
  64. };
  65. environment.systemPackages = with pkgs; [
  66. #procmail
  67. wget
  68. ];
  69. nix.settings.trusted-users = [
  70. "root"
  71. "djm"
  72. ];
  73. i18n.defaultLocale = "en_GB.UTF-8";
  74. swapDevices = [ {
  75. device = "/var/lib/swapfile";
  76. size = 2*1024;
  77. } ];
  78. system.stateVersion = "23.11";
  79. }