configuration.nix 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.defaultEditor = true;
  62. environment.systemPackages = with pkgs; [
  63. #procmail
  64. vim
  65. wget
  66. ];
  67. nix.settings.trusted-users = [
  68. "root"
  69. "djm"
  70. ];
  71. i18n.defaultLocale = "en_GB.UTF-8";
  72. swapDevices = [ {
  73. device = "/var/lib/swapfile";
  74. size = 2*1024;
  75. } ];
  76. system.stateVersion = "23.11";
  77. }