Guest User

configuration.nix

a guest
Jan 31st, 2026
46
0
6 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.73 KB | None | 0 0
  1. # Edit this configuration file to define what should be installed on
  2. # your system. Help is available in the configuration.nix(5) man page
  3. # and in the NixOS manual (accessible by running ‘nixos-help’).
  4.  
  5. { config, pkgs, ... }:
  6.  
  7. {
  8. imports =
  9. [ # Include the results of the hardware scan.
  10. ./hardware-configuration.nix
  11. <nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix> # Brother Printer support??
  12. # ./packages.nix
  13. ];
  14.  
  15. nix = {
  16. nixPath = [
  17. "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
  18. #"nixos-config=/run/media/<REDACTED>/672e0118-6d85-4f88-9130-93d013a22a00/<REDACTED>/NixOS/hosts/legion/configuration.nix"
  19. "nixos-config=/home/<REDACTED>/NixOS/hosts/legion/configuration.nix"
  20. #"nixos-config=/etc/nixos/configuration.nix"
  21. "/nix/var/nix/profiles/per-user/root/channels"
  22. ];
  23. };
  24.  
  25. # System mounts
  26. fileSystems."/mnt/nas/OldNas" = {
  27. device = "//192.168.1.194/OldNas";
  28. fsType = "cifs";
  29. options = [
  30. "noperm"
  31. "defaults"
  32. "users"
  33. "credentials=/home/<REDACTED>/.smbcredentials"
  34. "guid=1000"
  35. "noauto"
  36. "x-systemd.automount"
  37. ];
  38. };
  39.  
  40. fileSystems."/mnt/nas/media" = {
  41. device = "//192.168.1.194/media";
  42. fsType = "cifs";
  43. options = [
  44. "noperm"
  45. "defaults"
  46. "users"
  47. "credentials=/home/<REDACTED>/.smbcredentials"
  48. "uid=1000"
  49. "noauto"
  50. "x-systemd.automount"
  51. ];
  52. };
  53.  
  54. fileSystems."/mnt/nas/tvshows" = {
  55. device = "//192.168.1.194/TV-Shows";
  56. fsType = "cifs";
  57. options = [
  58. "noperm"
  59. "defaults"
  60. "users"
  61. "credentials=/home/<REDACTED>/.smbcredentials"
  62. "uid=1000"
  63. "noauto"
  64. "x-systemd.automount"
  65. ];
  66. };
  67.  
  68. fileSystems."/mnt/nas/media2" = {
  69. device = "//192.168.1.194/media2";
  70. fsType = "cifs";
  71. options = [
  72. "noperm"
  73. "defaults"
  74. "users"
  75. "credentials=/home/<REDACTED>/.smbcredentials"
  76. "uid=1000"
  77. "noauto"
  78. "x-systemd.automount"
  79. ];
  80. };
  81.  
  82.  
  83. # boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_6;
  84. boot.kernelModules = ["drivetemp"];
  85. # Enable experimental Feature
  86. nix.settings.experimental-features = ["nix-command" "flakes"];
  87. # Enable openGL
  88. hardware = {
  89. graphics = {
  90. enable = true;
  91. enable32Bit = true;
  92. extraPackages = [ pkgs.mesa ];
  93. };
  94. };
  95.  
  96. hardware = {
  97. sane = {
  98. enable = true;
  99. brscan4 = {
  100. enable = true;
  101. };
  102. };
  103. };
  104.  
  105. # Load nvidia driver for Xorg and Wayland
  106. services.xserver.videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc.
  107. hardware.nvidia-container-toolkit.enable = true;
  108. hardware.nvidia = {
  109.  
  110. # Modesetting is required.
  111. modesetting.enable = true;
  112.  
  113. # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
  114. # Enable this if you have graphical corruption issues or application crashes after waking
  115. # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
  116. # of just the bare essentials.
  117. powerManagement.enable = true;
  118.  
  119. # Fine-grained power management. Turns off GPU when not in use.
  120. # Experimental and only works on modern Nvidia GPUs (Turing or newer).
  121. powerManagement.finegrained = false;
  122.  
  123. # Use the NVidia open source kernel module (not to be confused with the
  124. # independent third-party "nouveau" open source driver).
  125. # Support is limited to the Turing and later architectures. Full list of
  126. # supported GPUs is at:
  127. # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
  128. # Only available from driver 515.43.04+
  129. # Currently alpha-quality/buggy, so false is currently the recommended setting.
  130. open = false;
  131.  
  132. # Enable the Nvidia settings menu,
  133. # accessible via `nvidia-settings`.
  134. nvidiaSettings = true;
  135.  
  136. # Optionally, you may need to select the appropriate driver version for your specific GPU.
  137. #package = config.boot.kernelPackages.nvidiaPackages.stable;
  138.  
  139.  
  140. };
  141.  
  142. # Bootloader.
  143. boot.loader.systemd-boot.enable = true;
  144. boot.loader.efi.canTouchEfiVariables = true;
  145.  
  146. # Enable AppImages
  147. boot.binfmt.registrations.appimage = {
  148. wrapInterpreterInShell = false;
  149. interpreter = "${pkgs.appimage-run}/bin/appimage-run";
  150. recognitionType = "magic";
  151. offset = 0;
  152. mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
  153. magicOrExtension = ''\x7fELF....AI\x02'';
  154. };
  155.  
  156. networking.hostName = "legion"; # Define your hostname.
  157. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
  158.  
  159. # Configure network proxy if necessary
  160. # networking.proxy.default = "http://user:password@proxy:port/";
  161. # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
  162.  
  163. # Enable networking
  164. networking.networkmanager.enable = true;
  165.  
  166. # Set your time zone.
  167. time.timeZone = "America/Chicago";
  168.  
  169. # Select internationalisation properties.
  170. i18n.defaultLocale = "en_US.UTF-8";
  171. console = {
  172. packages = [pkgs.terminus_font];
  173. font = "Lat2-Terminus16";
  174. useXkbConfig =true;
  175. };
  176.  
  177. i18n.extraLocaleSettings = {
  178. LC_ADDRESS = "en_US.UTF-8";
  179. LC_IDENTIFICATION = "en_US.UTF-8";
  180. LC_MEASUREMENT = "en_US.UTF-8";
  181. LC_MONETARY = "en_US.UTF-8";
  182. LC_NAME = "en_US.UTF-8";
  183. LC_NUMERIC = "en_US.UTF-8";
  184. LC_PAPER = "en_US.UTF-8";
  185. LC_TELEPHONE = "en_US.UTF-8";
  186. LC_TIME = "en_US.UTF-8";
  187. };
  188.  
  189.  
  190. # Enable Flatpaks
  191. services = {
  192. flatpak.enable = true;
  193. dbus.enable = true;
  194. picom.enable = true;
  195. };
  196.  
  197. # Enable the X11 windowing system.
  198. services.xserver.enable = true;
  199.  
  200. # Enable the KDE Plasma 5 Desktop Environment.
  201. #services.xserver.displayManager.sddm.wayland.enable = true;
  202. #services.xserver.displayManager.defaultSession = "plasma";
  203. #services.desktopManager.plasma6.enable = true;
  204. # GNOME Desktop
  205. # services.desktopManager.gnome.enable = true;
  206. # services.gnome.games.enable = true;
  207. # services.gnome.core-developer-tools.enable = true;
  208.  
  209. # Enable the Plasma 6 Desktop Enviroment
  210. # Enable the KDE Plasma Desktop Environment.
  211. services.displayManager.sddm.enable = true;
  212. services.displayManager.sddm.wayland.enable = true;
  213. # services.xserver.desktopManager.plasma5.enable = true;
  214. services.desktopManager.plasma6.enable = true;
  215. programs.dconf.enable = true;
  216. programs.partition-manager.enable = true;
  217. # Enable PolKit
  218. security.polkit.enable = true;
  219.  
  220.  
  221. # Configure keymap in X11
  222. services.xserver = {
  223.  
  224. xkb = {
  225. variant = "";
  226. layout = "us";
  227. };
  228. };
  229.  
  230. # Keyboard drivers
  231. hardware.keyboard.qmk.enable = true;
  232. services.udev.packages = [ pkgs.via ];
  233.  
  234. # Enable Bluetooth Services
  235. hardware.bluetooth.enable = true;
  236. hardware.bluetooth.powerOnBoot = true;
  237. hardware.bluetooth.settings = {
  238. General = {
  239. Enable = "Source,Sink,Media,Socket";
  240. };
  241. };
  242. # Enable CUPS to print documents.
  243. services.printing.enable = true;
  244.  
  245. # Enable sound with pipewire.
  246. #sound.enable = true;
  247. services.pulseaudio.enable = false;
  248. security.rtkit.enable = true;
  249. services.pipewire = {
  250. enable = true;
  251. alsa.enable = true;
  252. alsa.support32Bit = true;
  253. pulse.enable = true;
  254. wireplumber.enable = true;
  255. # If you want to use JACK applications, uncomment this
  256. jack.enable = true;
  257. # use the example session manager (no others are packaged yet so this is enabled by default,
  258. # no need to redefine it in your config for now)
  259. #media-session.enable = true;
  260. };
  261.  
  262. # Enable touchpad support (enabled default in most desktopManager).
  263. # services.xserver.libinput.enable = true;
  264.  
  265. # Define a user account. Don't forget to set a password with ‘passwd’.
  266. users.users.<REDACTED> = {
  267. isNormalUser = true;
  268. description = "<REDACTED>";
  269. extraGroups = [
  270. "networkmanager"
  271. "wheel"
  272. "adbusers"
  273. "libvirtd"
  274. "video"
  275. "render"
  276. "audio"
  277. "scanner"
  278. "lp"
  279. ];
  280.  
  281. packages = with pkgs; [
  282. chromium
  283. firefox
  284. kdePackages.kate
  285. # thunderbird
  286. ];
  287. };
  288.  
  289. fonts.packages = with pkgs; [
  290. noto-fonts
  291. ubuntu-classic
  292. noto-fonts-color-emoji
  293. liberation_ttf
  294. fira-code
  295. fira-code-symbols
  296. mplus-outline-fonts.githubRelease
  297. dina-font
  298. fira
  299. ];
  300.  
  301. # Enable Virtualization
  302.  
  303. virtualisation.libvirtd.enable = true;
  304. programs.virt-manager.enable = true;
  305.  
  306.  
  307. # services.flatpak.enable = true;
  308. xdg.portal.enable = true;
  309.  
  310. programs.steam = {
  311. enable = true;
  312. remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
  313. dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
  314. };
  315.  
  316. nixpkgs.config.permittedInsecurePackages = [
  317. "electron"
  318. ];
  319.  
  320.  
  321. # List packages installed in system profile. To search, run:
  322. # $ nix search wget
  323. environment.systemPackages = with pkgs; [
  324. # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  325. ## Backups
  326. borgbackup
  327. vorta
  328. pika-backup
  329.  
  330.  
  331. ## Printer Drivers
  332. brlaser
  333. xsane
  334. simple-scan
  335. # gscan2pdf
  336.  
  337. ## Keyboard drivers
  338. qmk
  339. via
  340.  
  341. ## Finance
  342.  
  343. hledger
  344. hledger-ui
  345. hledger-web
  346. hledger-iadd
  347. hledger-utils
  348. hledger-interest
  349. puffin
  350.  
  351. ## CLI Utils
  352. yt-dlp
  353. spotdl
  354. tmux
  355. wget
  356. curl
  357. micro
  358. gitFull
  359. mesa-demos
  360. # boinc
  361. boinctui
  362. htop
  363. btop
  364. # cgminer
  365. #oraclejre
  366. temurin-jre-bin-17
  367. pciutils
  368. # fwupd
  369. ctop
  370. dig
  371. hddtemp
  372. iotop
  373. # lm-sensors
  374. smartmontools
  375. hugo
  376. ncdu
  377. nvtopPackages.full
  378. nvitop
  379. pwgen
  380.  
  381. ## GUI programs
  382. firefox
  383. kdePackages.kate
  384. vscode-fhs
  385. kdePackages.yakuake
  386. bitwarden-desktop
  387. # libsForQt5.kdeconnect-kde
  388. kdePackages.kdeconnect-kde
  389. # k3b
  390. libation
  391. gpa
  392. kdePackages.kgpg
  393. remmina
  394. virt-viewer
  395. transmission_4-qt6
  396. # calibre
  397. chirp
  398.  
  399.  
  400. # Chat/Internet
  401. #fluffychat
  402. discord
  403.  
  404. # Productivity
  405. thunderbird
  406. libreoffice
  407. nextcloud-client
  408. # aichat
  409.  
  410. # KDE STUFF
  411. kmymoney
  412. #kdePackages = {
  413. kdePackages.kcalc
  414. kdePackages.akonadi
  415. kdePackages.akonadiconsole
  416. kdePackages.akonadi-search
  417. kdePackages.kontact
  418. kdePackages.kontactinterface
  419. kdePackages.kaddressbook
  420. kdePackages.kdepim-addons
  421. kdePackages.kdepim-addons
  422. kdePackages.k3b
  423. kdePackages.kup
  424. bup
  425. #};
  426. # logseq
  427.  
  428. ## Audio/Music
  429. audacity
  430. guitarix
  431. musescore
  432. carla
  433. #wireplumber
  434. calf
  435. sonixd
  436.  
  437. ## CD Ripping
  438. rubyripper
  439. abcde
  440. sound-juicer
  441. whipper
  442.  
  443. ## Video/Graphics
  444. gimp
  445. # blender
  446. vlc
  447. obs-studio
  448. # jellyfin-media-player
  449. kdePackages.kdenlive
  450. ffmpeg-full
  451.  
  452. ## Games
  453. # minecraft
  454. prismlauncher
  455. temurin-jre-bin
  456. # jdk21
  457. # znes2
  458. # nestopia-ue
  459. # kega-fusion
  460. # retroarchFull
  461.  
  462. ## Iphone Stuff
  463. libimobiledevice
  464. ifuse
  465.  
  466. # Piper & Wyoming
  467. wyoming-piper
  468. piper-tts
  469.  
  470. # # TUI Challange
  471. # aerc
  472. # mutt
  473. # carbonyl
  474. # browsh
  475. # toutui
  476. # jellyfin-tui
  477. # mc
  478. # todotxt-tui
  479. # wtf
  480. gpg-tui
  481. # caps-log
  482. # toot
  483.  
  484. # Distrobox
  485. distrobox
  486. distrobox-tui
  487. ];
  488.  
  489. ## Allow unfree packages
  490. nixpkgs.config.allowUnfree = true;
  491.  
  492. # Some programs need SUID wrappers, can be configured further or are
  493. # started in user sessions.
  494. programs.mtr.enable = true;
  495. programs.gnupg.agent = {
  496. enable = true;
  497. enableSSHSupport = true;
  498. };
  499.  
  500. # List services that you want to enable:
  501. programs.kdeconnect.enable = true;
  502. # programs.kdeconnect.package = pkgs.kdePackages.kdeconnect-kde;
  503.  
  504. services = {
  505.  
  506.  
  507. # Firmware Updater?
  508. fwupd = {
  509. enable = true;
  510. };
  511. # Enable SSH
  512. openssh = {
  513. enable = true;
  514. };
  515. # Enable Tailscale
  516. tailscale = {
  517. enable = true;
  518. # useRoutingFeatures = both;
  519. extraUpFlags = [
  520. "--ssh"
  521. "--accept-routes"
  522. ];
  523. };
  524. #Enable LLM Services
  525. ollama = {
  526. enable = true;
  527. acceleration = "cuda";
  528. openFirewall = true;
  529. # loadModels = [ "llama3.1:8b" ];
  530. loadModels = [ "DeepSeek-R1:8b" ];
  531. host = "<REDACTED>";
  532. };
  533. # Enable iPhone Tethering
  534. usbmuxd = {
  535. enable = true;
  536. package = pkgs.usbmuxd2;
  537. };
  538. boinc.enable = true;
  539. boinc.allowRemoteGuiRpc = true;
  540. boinc.extraEnvPackages = [pkgs.virtualbox pkgs.ocl-icd pkgs.linuxPackages.nvidia_x11 pkgs.libglvnd pkgs.brotli];
  541. boinc.dataDir = "/var/lib/boinc";
  542. };
  543.  
  544. ## Docker
  545. virtualisation.docker.enable = true;
  546. virtualisation.docker.autoPrune.enable = true;
  547. virtualisation.docker.autoPrune.dates = "weekly";
  548. #virtualisation.docker.enableNvidia = true;
  549. virtualisation.docker.enableOnBoot = true;
  550.  
  551.  
  552.  
  553. ## FIREWALL
  554. # Open ports in the firewall.
  555. # networking.firewall.allowedTCPPorts = [ ... ];
  556. # networking.firewall.allowedUDPPorts = [ ... ];
  557. # Or disable the firewall altogether.
  558. # networking.firewall.enable = false;
  559. networking.firewall = {
  560. enable = false;
  561. allowedTCPPortRanges = [
  562. { from = 1714; to = 1764; } # KDE Connect
  563. ];
  564. allowedUDPPortRanges = [
  565. { from = 1714; to = 1764; } # KDE Connect
  566. ];
  567. };
  568.  
  569. # Enable Automatic Upgrades
  570. system.autoUpgrade = {
  571. enable = true;
  572. persistent = true;
  573. };
  574.  
  575. # Garbage Collection and Store Optimization
  576. nix.settings.auto-optimise-store = true;
  577. nix.gc = {
  578. automatic = true;
  579. dates = "weekly";
  580. options = "--delete-older-than 30d";
  581. };
  582.  
  583. # This value determines the NixOS release from which the default
  584. # settings for stateful data, like file locations and database versions
  585. # on your system were taken. It‘s perfectly fine and recommended to leave
  586. # this value at the release version of the first install of this system.
  587. # Before changing this value read the documentation for this option
  588. # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  589. system.stateVersion = "23.05"; # Did you read the comment?
  590.  
  591. }
  592.  
Advertisement
Add Comment
Please, Sign In to add comment