configuration.nix 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. {
  2. config,
  3. pkgs,
  4. lib,
  5. ...
  6. }:
  7. {
  8. imports = [ ./hardware-configuration.nix ];
  9. boot.loader.systemd-boot.enable = true;
  10. boot.loader.efi.canTouchEfiVariables = true;
  11. boot.kernelParams = [ "intel_pstate=enable" ];
  12. powerManagement = {
  13. enable = true;
  14. #cpuFreqGovernor = "powersave";
  15. powertop.enable = true;
  16. };
  17. services.thermald.enable = true;
  18. services.power-profiles-daemon.enable = false;
  19. services.tlp = {
  20. enable = true;
  21. settings = {
  22. TLP_ENABLE = 1;
  23. TLP_DEFAULT_MODE = "BAT";
  24. MAX_LOST_WORK_SECS_ON_AC = 15;
  25. MAX_LOST_WORK_SECS_ON_BAT = 60;
  26. CPU_HWP_ON_AC = "balance_performance";
  27. CPU_HWP_ON_BAT = "power";
  28. CPU_MAX_PERF_ON_BAT = 40;
  29. CPU_BOOST_ON_BAT = 0;
  30. SCHED_POWERSAVE_ON_AC = 0;
  31. SCHED_POWERSAVE_ON_BAT = 1;
  32. ENERGY_PERF_POLICY_ON_AC = "balance-performance";
  33. ENERGY_PERF_POLICY_ON_BAT = "power";
  34. DISK_DEVICES = "nvme0n1 sda";
  35. DISK_APM_LEVEL_ON_AC = "254 254";
  36. DISK_APM_LEVEL_ON_BAT = "128 128";
  37. SATA_LINKPWR_ON_AC = "med_power_with_dipm max_performance";
  38. SATA_LINKPWR_ON_BAT = "med_power_with_dipm min_power";
  39. PCIE_ASPM_ON_BAT = "powersave";
  40. WIFI_PWR_ON_AC = "off";
  41. WIFI_PWR_ON_BAT = "on";
  42. WOL_DISABLE = "Y";
  43. SOUND_POWER_SAVE_ON_AC = 0;
  44. SOUND_POWER_SAVE_ON_BAT = 1;
  45. RUNTIME_PM_ON_AC = "on";
  46. RUNTIME_PM_ON_BAT = "auto";
  47. USB_AUTOSUSPEND = 1;
  48. USB_BLACKLIST = "0bda:8153";
  49. RESTORE_DEVICE_STATE_ON_STARTUP = 1;
  50. };
  51. };
  52. hardware.graphics.enable = true;
  53. networking.hostName = "egalmoth"; # Define your hostname.
  54. networking.networkmanager.enable = true;
  55. time.timeZone = "Europe/London";
  56. networking.useDHCP = false;
  57. networking.interfaces.enp45s0.useDHCP = true;
  58. networking.interfaces.wlp46s0.useDHCP = true;
  59. services.xserver.enable = true;
  60. services.xserver.exportConfiguration = true;
  61. services.xserver.displayManager.lightdm.greeters.slick.enable = true;
  62. programs.seahorse.enable = true;
  63. services.gnome.gnome-keyring.enable = true;
  64. security.pam.services.login.enableGnomeKeyring = true;
  65. security.pam.services.passwd.enableGnomeKeyring = true;
  66. services.displayManager.sessionPackages = [ pkgs.sway ];
  67. services.displayManager.defaultSession = "none+i3";
  68. #services.xserver.displayManager.defaultSession = "sway";
  69. services.xserver.windowManager.i3.enable = true;
  70. services.upower.enable = true;
  71. services.xserver.xkb.layout = "gb";
  72. services.printing.enable = true;
  73. services.printing.drivers = [
  74. pkgs.gutenprint
  75. pkgs.hplipWithPlugin
  76. ];
  77. nixpkgs.config.allowUnfreePredicate =
  78. pkg:
  79. builtins.elem (lib.getName pkg) [
  80. "corefonts"
  81. "hplip"
  82. "zoom"
  83. ];
  84. hardware.sane.enable = true;
  85. services.udev.packages = [
  86. (pkgs.writeTextFile {
  87. name = "epson_udev";
  88. text = ''
  89. ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="084a", MODE="0664", GROUP="lp", ENV{libsane_matched}="yes"
  90. '';
  91. destination = "/etc/udev/rules.d/99-printer.rules";
  92. })
  93. ];
  94. services.libinput = {
  95. enable = true;
  96. touchpad = {
  97. clickMethod = "clickfinger";
  98. naturalScrolling = true;
  99. tappingButtonMap = "lmr";
  100. };
  101. };
  102. services.dbus.enable = true;
  103. security.rtkit.enable = true;
  104. services.pipewire = {
  105. enable = true;
  106. alsa.enable = true;
  107. pulse.enable = true;
  108. };
  109. users.users.djm = {
  110. isNormalUser = true;
  111. description = "David Morgan";
  112. extraGroups = [
  113. "wheel"
  114. "networkmanager"
  115. "scanner"
  116. "lp"
  117. "plocate"
  118. "cdrom"
  119. "disk"
  120. ];
  121. shell = pkgs.zsh;
  122. openssh.authorizedKeys.keys = [
  123. "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCurCpxZCHtByB5wXzsjTXwMyDSB4+B8rq5XY6EGss58NwD8jc5cII4i+QUbCOGTiAggSZUSC9YIP24hjpOeNT/IYs5m7Qn1B9MtBAiUSrIYew8eDwnMLlPzN+k2x9zCrJeCHIvGJaFHPXTh1Lf5Jt2fPVGW9lksE/XUVOe6ht4N/b+nqqszXFhc8Ug6le2bC1YeTCVEf8pjlh/I7DkDBl6IB8uEXc3X2vxxbV0Z4vlBrFkkAywcD3j5VlS/QYfBr4BICNmq/sO3fMkbMbtAPwuFxeL4+h6426AARQZiSS0qVEc8OoFRBVx3GEH5fqVAWfB1geyLzei22HbjUcT9+xN davidmo@gendros"
  124. "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK9UDTaVnUOU/JknrNdihlhhGOk53LmHq9I1ASri3aga djm@gaius"
  125. ];
  126. };
  127. security.sudo.extraConfig = ''
  128. djm ALL=(ALL) NOPASSWD: ALL
  129. '';
  130. security.doas = {
  131. enable = true;
  132. extraRules = [
  133. {
  134. users = [ "djm" ];
  135. noPass = true;
  136. keepEnv = true;
  137. }
  138. ];
  139. };
  140. services.locate = {
  141. enable = true;
  142. package = pkgs.plocate;
  143. localuser = null;
  144. };
  145. environment.systemPackages = with pkgs; [
  146. acpi
  147. acpitool
  148. alsa-utils
  149. bemenu
  150. #dbus-sway-environment
  151. firefox
  152. foot
  153. ghostscript
  154. git
  155. i3
  156. imagemagick
  157. lm_sensors
  158. playerctl
  159. rofi
  160. st
  161. sway
  162. wayland
  163. wayst
  164. wezterm
  165. wl-clipboard
  166. wget
  167. xclip
  168. xorg.xkill
  169. xurls
  170. xst
  171. zoom-us
  172. libreoffice
  173. onlyoffice-bin
  174. ];
  175. programs.nix-ld.enable = true;
  176. programs.nix-ld.libraries = with pkgs; [ xorg.libxcb ];
  177. fonts.packages = with pkgs; [
  178. corefonts
  179. iosevka-comfy.comfy
  180. iosevka-bin
  181. jetbrains-mono
  182. meslo-lgs-nf
  183. ];
  184. programs.zsh.enable = true;
  185. programs.sway = {
  186. enable = true;
  187. wrapperFeatures.gtk = true;
  188. };
  189. programs.gnupg.agent = {
  190. enable = true;
  191. enableSSHSupport = true;
  192. };
  193. programs.vim = {
  194. enable = true;
  195. defaultEditor = true;
  196. };
  197. services.openssh.enable = true;
  198. i18n.defaultLocale = "en_GB.UTF-8";
  199. system.stateVersion = "21.05"; # Did you read the comment?
  200. }