default.nix 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. {
  2. modulesPath,
  3. pkgs,
  4. inputs,
  5. lib,
  6. config,
  7. username,
  8. ...
  9. }:
  10. {
  11. imports = [
  12. (modulesPath + "/installer/scan/not-detected.nix")
  13. inputs.nh.nixosModules.default
  14. ./core/dnscrypt
  15. ./core/stubby
  16. ./core/security
  17. ./core/users
  18. ./core/fonts
  19. ./core/gnome
  20. ./graphical/games
  21. ./graphical/greetd
  22. ./graphical/thunar
  23. ./graphical/qemu
  24. ];
  25. nixpkgs.config.allowUnfree = true;
  26. time.timeZone = "Asia/Tokyo";
  27. programs.command-not-found.enable = false; # Not working without channel
  28. environment = {
  29. pathsToLink = [ "/share/fish" ];
  30. systemPackages = with pkgs; [
  31. teavpn2
  32. dosfstools
  33. gptfdisk
  34. iputils
  35. usbutils
  36. utillinux
  37. binutils
  38. coreutils
  39. curl
  40. direnv
  41. dnsutils
  42. fd
  43. sbctl # For debugging and troubleshooting Secure boot.
  44. pavucontrol
  45. git
  46. bottom
  47. jq
  48. moreutils
  49. neovim
  50. nix-index
  51. nmap
  52. skim
  53. ripgrep
  54. tealdeer
  55. whois
  56. wl-clipboard
  57. wget
  58. unzip
  59. # Utils for nixpkgs stuff
  60. nixpkgs-review
  61. ];
  62. sessionVariables = {
  63. NIXOS_OZONE_WL = "0";
  64. NIXPKGS_ALLOW_UNFREE = "1";
  65. EDITOR = "nvim";
  66. VISUAL = "nvim";
  67. TERM = "screen-256color";
  68. BROWSER = "firefox";
  69. XCURSOR_SIZE = "24";
  70. DIRENV_LOG_FORMAT = "";
  71. QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
  72. # Fix for some Java AWT applications (e.g. Android Studio),
  73. # use this if they aren't displayed properly:
  74. "_JAVA_AWT_WM_NONREPARENTING" = "1";
  75. FLAKE = "${config.users.users.${username}.home}/.config/nixos"; # For NH ( https://github.com/viperML/nh/ )
  76. };
  77. };
  78. programs = {
  79. dconf.enable = true;
  80. };
  81. security = {
  82. rtkit.enable = true;
  83. sudo = {
  84. enable = true;
  85. extraConfig = ''
  86. # rollback results in sudo lectures after each reboot
  87. Defaults lecture = never
  88. # Show asterisk when typing password
  89. Defaults pwfeedback
  90. '';
  91. };
  92. doas = {
  93. enable = false;
  94. extraRules = [
  95. {
  96. users = [ "airi" ];
  97. keepEnv = true;
  98. persist = true;
  99. }
  100. ];
  101. };
  102. pam = {
  103. services.swaylock.text = "auth include login";
  104. };
  105. };
  106. services = {
  107. # Service that makes Out of Memory Killer more effective
  108. earlyoom.enable = true;
  109. dbus.packages = [ pkgs.gcr ];
  110. # Enable periodic SSD TRIM of mounted partitions in background
  111. fstrim.enable = true;
  112. pipewire = {
  113. enable = lib.mkForce true;
  114. alsa.enable = true;
  115. alsa.support32Bit = true;
  116. pulse.enable = true;
  117. wireplumber.enable = true;
  118. };
  119. # Location for gammastep
  120. geoclue2 = {
  121. enable = true;
  122. appConfig.gammastep = {
  123. isAllowed = true;
  124. isSystem = false;
  125. };
  126. };
  127. };
  128. nh = {
  129. enable = true;
  130. clean.enable = true;
  131. clean.extraArgs = "--keep-since 3d --keep 3";
  132. };
  133. nix = {
  134. nixPath = [ "nixpkgs=flake:nixpkgs" ]; # https://ayats.org/blog/channels-to-flakes/
  135. package = inputs.nix-super.packages.${pkgs.system}.nix;
  136. settings = {
  137. # Prevent impurities in builds
  138. sandbox = true;
  139. experimental-features = [
  140. "auto-allocate-uids"
  141. "ca-derivations"
  142. # "configurable-impure-env"
  143. "flakes"
  144. "no-url-literals"
  145. "nix-command"
  146. "parse-toml-timestamps"
  147. "read-only-local-store"
  148. "recursive-nix"
  149. ];
  150. accept-flake-config = true;
  151. auto-optimise-store = true;
  152. keep-derivations = true;
  153. keep-outputs = true;
  154. # Whether to warn about dirty Git/Mercurial trees.
  155. warn-dirty = false;
  156. # Give root user and wheel group special Nix privileges.
  157. trusted-users = [
  158. "root"
  159. "@wheel"
  160. ];
  161. allowed-users = [ "@wheel" ];
  162. substituters = [
  163. # Lower priority value = higher priority
  164. "https://cache.nixos.org?priority=1"
  165. "https://cache.garnix.io?priority=30"
  166. "https://dotfiles-pkgs.cachix.org?priority=20"
  167. "https://sforza-config.cachix.org?priority=10"
  168. "https://nixpkgs-unfree.cachix.org"
  169. "https://numtide.cachix.org"
  170. "https://nyx.chaotic.cx/"
  171. ];
  172. trusted-public-keys = [
  173. "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
  174. "dotfiles-pkgs.cachix.org-1:0TnsAyYE0P2BXv9s7gqqCpkf2SNt4cXKPh/66enbwnk="
  175. "sforza-config.cachix.org-1:qQiEQ1JU25VqhRXi1Qr/kA8RT01pd7oeKHr5OORUolM="
  176. "nixpkgs-unfree.cachix.org-1:hqvoInulhbV4nJ9yJOEr+4wxhDV4xq2d1DK7S6Nj6rs="
  177. "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
  178. "nyx.chaotic.cx-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8="
  179. "chaotic-nyx.cachix.org-1:HfnXSw4pj95iI/n17rIDy40agHj12WfF+Gqk6SonIT8="
  180. ];
  181. };
  182. registry = {
  183. system.flake = inputs.nixpkgs;
  184. default.flake = inputs.nixpkgs;
  185. nixpkgs.flake = inputs.nixpkgs;
  186. };
  187. # Improve nix store disk usage
  188. # Disable this because i'm using nh.
  189. # gc = {
  190. # automatic = true;
  191. # options = "--delete-older-than 3d";
  192. # };
  193. optimise.automatic = true;
  194. };
  195. system.stateVersion = "23.11";
  196. }