Advertisement
Guest User

/etc/nixos/configuration.nix

a guest
Feb 2nd, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.86 KB | Source Code | 0 0
  1. { config, pkgs, lib, ... }:
  2. let
  3. home-manager = builtins.fetchTarball
  4. "https://github.com/nix-community/home-manager/archive/master.tar.gz";
  5. user = "YourUserName";
  6. extraUserGroups = [ "networkmanager" "wheel" "audio" "jackaudio" ];
  7. hostname = "YourHostName";
  8. gitUser = "YourGitUsername";
  9. email = "YourGitEmail";
  10. timezone = "YourRegion/YourCity";
  11. defaultLocale = "en_US.UTF-8";
  12. bookmarks = [
  13. "file:///home/${user}/Downloads"
  14. ];
  15. cursorTheme = {
  16. name = "Bibata-Modern-TokyoNight";
  17. package = pkgs.nur.repos.ataraxiasjel.bibata-cursors-tokyonight;
  18. };
  19. cursorSize = "24";
  20. gtk-theme = {
  21. name = "Tokyonight-Dark-BL";
  22. package = pkgs.tokyo-night-gtk;
  23. };
  24. iconTheme = {
  25. name = "Adwaita";
  26. package = pkgs.gnome.adwaita-icon-theme;
  27. };
  28. font = {
  29. name = "JetBrainsMono Nerd Font";
  30. package = pkgs.nerdfonts;
  31. };
  32. patched_waybar = pkgs.waybar.overrideAttrs (oldAttrs: {
  33. mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
  34. });
  35. in {
  36. imports = [ ./hardware-configuration.nix (import "${home-manager}/nixos") ];
  37.  
  38. home-manager = {
  39. useGlobalPkgs = true;
  40. users.${user} = {
  41.  
  42. # TODO ADD MIME TYPES
  43.  
  44. # Disable auto generation of home user folders ex. Documents, Music, Public, Downloads
  45. xdg.userDirs = {
  46. enable = false;
  47. createDirectories = false;
  48. };
  49.  
  50. home = {
  51.  
  52. # For ssh connection using kitty term
  53. sessionVariables = {
  54. TERM="xterm";
  55. };
  56.  
  57. file = {
  58. # Ranger
  59. "/home/${user}/.config/ranger/rc.conf".text = ''
  60. set preview_images true
  61. set preview_images_method kitty
  62. '';
  63. };
  64. # Set your version (check your configuration,nix file) and do not change later
  65. stateVersion = "23.05";
  66. };
  67.  
  68. # Librewolf, but need to manually install theme, extensions
  69. # Extensions: ublock, keepassxc, darkreader, xbrowsersync, tempmail, ISDCAC, unpaywall, libredirect
  70. programs.librewolf = {
  71. enable = true;
  72. package = pkgs.librewolf-wayland;
  73. settings = {
  74. "webgl.disabled" = false;
  75.  
  76. "privacy.resistFingerprinting" = false;
  77. "privacy.clearOnShutdown.history" = false;
  78. "privacy.clearOnShutdown.cookies" = false;
  79. "privacy.clearOnShutdown.openWindows" = false;
  80. "privacy.clearOnShutdown.sessions" = false;
  81. "privacy.clearOnShutdown.downloads" = false;
  82.  
  83. "network.cookie.lifetimePolicy" = 0;
  84.  
  85. "browser.startup.page" = 3;
  86. "browser.download.useDownloadDir" = true;
  87. "browser.fullscreen.autohide" = false;
  88. "browser.toolbars.bookmarks.visibility" = "always";
  89. "browser.quitShortcut.disabled" = true;
  90.  
  91. "ui.use_activity_cursor" = true;
  92. "findbar.highlightAll" = true;
  93.  
  94. # Don't allow websites to prevent use of right-click, clipboard
  95. "dom.event.contextmenu.enabled" = true;
  96. "dom.event.clipboardevents.enabled" = true;
  97.  
  98. # Perf
  99. "gfx.webrender.all" = true;
  100. "media.ffmpeg.vaapi.enabled" = true;
  101. "media.ffvpx.enabled" = false;
  102. "media.rdd-vpx.enabled" = false;
  103. };
  104. };
  105.  
  106. # Neovim
  107. programs.neovim = {
  108. enable = true;
  109. defaultEditor = true;
  110. plugins = with pkgs.vimPlugins; [ vim-nix vim-be-good neo-tree-nvim ];
  111. extraConfig = ''
  112. set number relativenumber
  113. set autoindent smartindent
  114. set clipboard=unnamedplus
  115. '';
  116. };
  117.  
  118. # Wofi
  119. programs.wofi = {
  120. enable = true;
  121. settings = {
  122. show = "drun";
  123. allow_images = true;
  124. image_size = 40;
  125. term = "kitty";
  126. insensitive = true;
  127. location = "center";
  128. no_actions = true;
  129. promt = "Search...";
  130. width = 400; # 600
  131. height = 500; # 500
  132. filter_rate = 100;
  133. allow_markup = true;
  134. halign = "fill";
  135. orientation = "vertical";
  136. content_halign = "fill";
  137. gtk_dark = true;
  138. };
  139. style = ''
  140. * {
  141. font-family: ${font.name};
  142. font-size: "17px";
  143. border-radius: 10px;
  144. border: none;
  145. }
  146.  
  147. window {
  148. border: 3px solid #90cdfa;
  149. background: #1e2030;
  150. border-radius: 15px;
  151. }
  152. #input {
  153. margin: 1.5em;
  154. margin-bottom: 0em;
  155. padding: 1em;
  156. border: none;
  157. font-weight: bold;
  158. background: #1e2030;
  159. color: #c4d3da;
  160. border-radius: 15px;
  161. }
  162.  
  163. #input:focus {
  164. border: 1px solid #90cdfa;
  165. }
  166.  
  167. #inner-box {
  168. margin: 1.5em;
  169. margin-top: 0.5em;
  170. }
  171.  
  172. #outer-box {
  173. margin-bottom: 0.5em;
  174. }
  175.  
  176. #scroll {
  177. margin-top: 5px 0;
  178. display: none;
  179. }
  180.  
  181. #text {
  182. margin-left: 0.5em;
  183. color: #c4d3da;
  184. }
  185.  
  186. #text:selected {
  187. color: #16161e;
  188. }
  189.  
  190. #entry {
  191. margin-top: 0.5em;
  192. border-radius: 15px;
  193. }
  194.  
  195. #entry:selected {
  196. background: linear-gradient(90deg, #90cdfa 0%, #b69bf1 80%);
  197. }
  198. '';
  199. };
  200.  
  201. # Waybar
  202. programs.waybar = {
  203. enable = true;
  204. package = patched_waybar;
  205. settings = {
  206. mainBar = {
  207. layer = "top";
  208. height = 10;
  209. modules-left = [ "custom/launcher" "hyprland/workspaces" ];
  210. clock = {
  211. format = "<b>{:%I:%M}</b>";
  212. format-alt = "<b>{:%a.%d,%b}</b>";
  213. tooltip-format = ''
  214. <big>{:%B %Y}</big>
  215. <tt><small>{calendar}</small></tt>'';
  216. };
  217. modules-right =
  218. [ "tray" "backlight" "pulseaudio" "battery" "clock" ];
  219. "custom/launcher" = {
  220. format = "";
  221. on-click = "wofi";
  222. on-click-right = "nwg-bar";
  223. tooltip = false;
  224. };
  225. "hyprland/workspaces" = {
  226. format = "{icon}";
  227. on-click = "activate";
  228. on-scroll-up = "hyprctl dispatch workspace e+1";
  229. on-scroll-down = "hyprctl dispatch workspace e-1";
  230. all-outputs = false;
  231. };
  232. backlight = {
  233. device = "amdgpu_b10";
  234. format = "<span color='#d9b172'>{icon}</span> {percent}%";
  235. format-icons = [ "" "" "" "" "" "" "" "" "" ];
  236. tooltip = false;
  237. };
  238. battery = {
  239. "interval" = 5;
  240. "states" = {
  241. "warning" = 20;
  242. "critical" = 10;
  243. };
  244. "format" = "󰂄 {capacity}%";
  245. "format-charging" = " {capacity}%";
  246. "max-length" = 25;
  247. "tooltip" = false;
  248. };
  249. pulseaudio = {
  250. on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
  251. format = "<span color='#f7768e'></span> {volume}%";
  252. format-muted = "<span color='#f7768e'>ﱝ</span>";
  253. format-bluetooth = " {volume}";
  254. format-bluetooth-muted = " ";
  255. format-icons = {
  256. headphone = "";
  257. hands-free = "";
  258. headset = "";
  259. phone = "";
  260. portable = "";
  261. car = "";
  262. default = [ "奔" "墳" ];
  263. };
  264. on-click-right = "pavucontrol";
  265. };
  266. tray = {
  267. icon-size = 20;
  268. reverse-direction = true;
  269. spacing = 6;
  270. };
  271. };
  272. };
  273. style = ''
  274. * {
  275. border: 0;
  276. font-family: 'JetBrainsMono Nerd Font';
  277. font-size: 15.5px;
  278. font-feature-settings: '"zero", "ss01", "ss02", "ss03", "ss04", "ss05", "cv31"';
  279. min-height: 27px;
  280. /* height: 30px; */
  281. }
  282.  
  283. window#waybar {
  284. background: transparent;
  285. }
  286.  
  287. #custom-launcher, #workspaces {
  288. border-radius: 10px;
  289. background-color: #191a24;
  290. color: #c0caf5;
  291. margin-top: 15px;
  292. margin-right: 15px;
  293. padding-top: 1px;
  294. padding-left: 10px;
  295. padding-right: 10px;
  296. }
  297.  
  298. #custom-launcher {
  299. font-size: 20px;
  300. margin-left: 15px;
  301. padding-right: 20px;
  302. }
  303.  
  304. #workspaces button {
  305. background: #191a24;
  306. color: #c0caf5;
  307. }
  308.  
  309. #workspaces button.active {
  310. color: #2ac3de;
  311. }
  312.  
  313. #clock, #backlight, #custom-cava,#temperature, #cpu, #pulseaudio, #network, #battery , #tray, #memory ,#custom-playerctl, #bluetooth{
  314. border-radius: 10px;
  315. background-color: #191a24;
  316. color: #c0caf5;
  317. margin-top: 15px;
  318. padding-left: 9px;
  319. padding-right: 9px;
  320. margin-right: 15px;
  321. }
  322.  
  323. @keyframes blink {
  324. to {
  325. background-color: #ffffff;
  326. color: black;
  327. }
  328. }
  329.  
  330. #battery.warning:not(.charging) {
  331. background: #f38ba8;
  332. color: white;
  333. animation-name: blink;
  334. animation-duration: 0.5s;
  335. animation-timing-function: linear;
  336. animation-iteration-count: infinite;
  337. animation-direction: alternate;
  338. }
  339.  
  340. #tray{
  341. padding-right: 8px;
  342. padding-left: 10px;
  343. }
  344.  
  345. '';
  346. };
  347. # Notifications
  348. services.mako = {
  349. enable = true;
  350. anchor = "top-right";
  351. textColor = "#ebdbb8ff";
  352. backgroundColor = "#282828bb";
  353. borderColor = "#6699ff";
  354. borderRadius = 6;
  355. borderSize = 1;
  356. defaultTimeout = 10000;
  357. icons = true;
  358. margin = "5";
  359. padding = "8";
  360. progressColor = "source #383838ff";
  361. extraConfig =
  362. # Notification sound
  363. "on-notify=exec ${pkgs.mpv}/bin/mpv ${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/message.oga --volume=150";
  364. };
  365.  
  366. # Set dark or your theme for gnome apps
  367. dconf.settings."org/gnome/desktop/interface" = {
  368. color-scheme = "prefer-dark";
  369. gtk-theme = gtk-theme.name;
  370. };
  371.  
  372. gtk = {
  373. enable = true;
  374. iconTheme = iconTheme;
  375. theme = gtk-theme;
  376. cursorTheme = cursorTheme;
  377. font = font;
  378. gtk3 = {
  379. bookmarks = bookmarks;
  380. extraConfig = { gtk-application-prefer-dark-theme = 1; };
  381. };
  382. gtk4.extraConfig = { gtk-application-prefer-dark-theme = 1; };
  383. };
  384.  
  385. # Hyprland
  386. wayland.windowManager.hyprland = {
  387. enable = true;
  388. extraConfig = ''
  389. # Main panel & notifications
  390. exec-once = waybar & mako
  391.  
  392. # Wallpapers
  393. exec-once = swaybg -i ~/Sync/archive/background
  394.  
  395. # Cursor styling
  396. exec-once = hyprctl setcursor "Bibata-Modern-TokyoNight" 24
  397.  
  398. # Polkit
  399. exec-once = ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1
  400.  
  401. # NetworkManager & Blueman applets
  402. exec-once = blueman-applet
  403. exec-once = nm-applet
  404.  
  405. # Auto-lock & auto-suspend
  406. exec-once = swayidle timeout 600 'swaylock -f -c 000000'
  407. exec-once = swayidle timeout 1200 'systemctl suspend'
  408.  
  409. # Social
  410. exec-once = cinny
  411.  
  412. # Window rules
  413. windowrulev2 = stayfocused, title:^()$,class:^(steam)$
  414. windowrulev2 = minsize 1 1, title:^()$,class:^(steam)$
  415.  
  416. windowrulev2=float,title:(kitty-float)
  417. windowrulev2=size 374 458,move onscreen cursor, title:(kitty-float)
  418. windowrulev2=move onscreen cursor -20% -20%, title:(kitty-float)
  419.  
  420. windowrule=float,^(pavucontrol)$
  421. windowrule=float,^(blueberry)$
  422. windowrule=float,^(KeePassXC - Browser Access Request)$
  423. windowrule=float,class:^(unison)$
  424. windowrule=float,class:^(org.rncbc.qjackctl)$
  425.  
  426. #MONITORS
  427. #pc main
  428. monitor=HDMI-A-1,1920x1080@75,-1920x0,1
  429. #laptop
  430. monitor=eDP-1,1920x1080@60,auto,1
  431.  
  432. input {
  433. kb_layout = us,ru
  434. kb_options = grp:win_space_toggle
  435. numlock_by_default=true
  436.  
  437. follow_mouse=1
  438.  
  439. touchpad {
  440. disable_while_typing = yes
  441. natural_scroll=no
  442. }
  443. }
  444.  
  445. animations {
  446. enabled=0
  447. }
  448.  
  449. xwayland {
  450. force_zero_scaling = true
  451. }
  452.  
  453. general {
  454. sensitivity=1.0
  455. gaps_in = 5
  456. gaps_out = 10
  457. border_size = 3
  458. col.active_border= 0xffa3e49f 0xff63b2b8 0xff82599c 45deg # ORRRR #rgba(cba6f7ff) rgba(89b4faff) rgba(94e2d5ff) 10deg
  459. col.inactive_border= 0xff6e738d # OR 0xff45475a
  460. apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
  461. }
  462.  
  463. decoration {
  464. drop_shadow = true
  465. shadow_range=100
  466. shadow_render_power=5
  467. col.shadow= 0x33000000
  468. col.shadow_inactive=0x22000000
  469. rounding=15
  470. }
  471.  
  472. dwindle {
  473. pseudotile = 1
  474. preserve_split = 1
  475. force_split= 0
  476. }
  477.  
  478. misc {
  479. disable_hyprland_logo = true
  480. animate_manual_resizes = true
  481. }
  482.  
  483. gestures {
  484. workspace_swipe = yes
  485. workspace_swipe_fingers = 3
  486. }
  487.  
  488. bind = SUPER, C, killactive,
  489. bind = SUPER, M, exit,
  490. bind = SUPER, V, togglefloating,
  491. bind = SUPER SHIFT, F, fullscreen
  492.  
  493. bind = SUPER, P, pseudo, # dwindle
  494. bind = SUPER, J, togglesplit, # dwindle
  495.  
  496. bind = Alt,Tab,cyclenext,
  497. bind = Alt,Tab,bringactivetotop,
  498.  
  499. bind = SUPER SHIFT, H, movewindow, l
  500. bind = SUPER SHIFT, L, movewindow, r
  501. bind = SUPER SHIFT, K, movewindow, u
  502. bind = SUPER SHIFT, J, movewindow, d
  503.  
  504. bind = SUPER, Q, exec, kitty -1
  505. bind = SUPER, T, exec, kitty -1 -T kitty-float
  506. bindr= SUPER, R, exec, pkill wofi || wofi -S drun
  507.  
  508. #bind = SUPER, SPACE, notify-send "System Locale: $(localectl status)"
  509.  
  510. bind = SUPER, E, exec, nautilus --new-window
  511. bind = SUPER, F, exec, librewolf
  512. bind = SUPER, B, exec, keepassxc
  513. bind = SUPER, W, exec, librewolf --new-window https://iv.datura.network/feed/subscriptions
  514. bind = SUPER, S, exec, com.github.KRTirtho.Spotube
  515. bind = SUPER, X, exec, zim
  516. bind = SUPER, D, exec, codium
  517. bind = SUPER, Z, exec, unison
  518.  
  519. bind = ,Print, exec, grim -g "$(slurp)" - | wl-copy && notify-send "Screenshot copied to clipboard" -a "ss"
  520. #shotman -c region
  521. bind = SUPER, L, exec, swaylock -f -c 000000
  522. bind = SUPER, ESCAPE, exec, nwg-bar
  523.  
  524. bind = SUPER, left, movefocus, l
  525. bind = SUPER, right, movefocus, r
  526. bind = SUPER, up, movefocus, u
  527. bind = SUPER, down, movefocus, d
  528.  
  529. bind = SUPER, 1, workspace, 1
  530. bind = SUPER, 2, workspace, 2
  531. bind = SUPER, 3, workspace, 3
  532. bind = SUPER, 4, workspace, 4
  533. bind = SUPER, 5, workspace, 5
  534. bind = SUPER, 6, workspace, 6
  535. bind = SUPER, 7, workspace, 7
  536. bind = SUPER, 8, workspace, 8
  537. bind = SUPER, 9, workspace, 9
  538. bind = SUPER, 0, workspace, 10
  539.  
  540. bind = SUPER SHIFT, 1, movetoworkspace, 1
  541. bind = SUPER SHIFT, 2, movetoworkspace, 2
  542. bind = SUPER SHIFT, 3, movetoworkspace, 3
  543. bind = SUPER SHIFT, 4, movetoworkspace, 4
  544. bind = SUPER SHIFT, 5, movetoworkspace, 5
  545. bind = SUPER SHIFT, 6, movetoworkspace, 6
  546. bind = SUPER SHIFT, 7, movetoworkspace, 7
  547. bind = SUPER SHIFT, 8, movetoworkspace, 8
  548. bind = SUPER SHIFT, 9, movetoworkspace, 9
  549. bind = SUPER SHIFT, 0, movetoworkspace, 10
  550.  
  551. bind = SUPER, mouse_down, workspace, e+1
  552. bind = SUPER, mouse_up, workspace, e-1
  553.  
  554. bindm = SUPER, mouse:272, movewindow
  555. bindm = SUPER, mouse:273, resizewindow
  556.  
  557. bind=SUPER,g,togglegroup
  558.  
  559. # Volume and Media Control
  560. bind = , XF86AudioRaiseVolume, exec, pamixer -i 5
  561. bind = , XF86AudioLowerVolume, exec, pamixer -d 5
  562. bind = , XF86AudioMicMute, exec, pamixer --default-source -m
  563. bind = , XF86AudioMute, exec, pamixer -t
  564. bind = , XF86AudioPlay, exec, playerctl play-pause
  565. bind = , XF86AudioPause, exec, playerctl play-pause
  566. bind = , XF86AudioNext, exec, playerctl next
  567. bind = , XF86AudioPrev, exec, playerctl previous
  568.  
  569. # Screen brightness
  570. bind = , XF86MonBrightnessUp, exec, brightnessctl s +5%
  571. bind = , XF86MonBrightnessDown, exec, brightnessctl s 5%-
  572. '';
  573. };
  574.  
  575. # Kitty terminal
  576. programs.kitty = {
  577. enable = true;
  578. theme = "Tokyo Night"; # see: kitten themes
  579. font = font;
  580. shellIntegration.enableFishIntegration = true;
  581. settings = {
  582. confirm_os_window_close = 0;
  583. shell = "fish";
  584. window_padding_width = 15;
  585. };
  586. };
  587.  
  588. # Fish shell
  589. programs.fish = {
  590. enable = true;
  591. interactiveShellInit = ''
  592. set fish_greeting
  593. fish_config prompt choose pythonista
  594. ssh-add ~/.ssh/id_ed25519
  595. clear
  596. '';
  597. shellAliases = {
  598. la = "ls -la";
  599. cls = "clear";
  600. cfg = "vim /etc/nixos/configuration.nix";
  601. upd = ''
  602. cd /etc/nixos/ && sudo git pull && sudo git push && sudo git commit -a -m "Update" && sudo git push && cd ~'';
  603. bld = "clear && sudo nixos-rebuild switch --upgrade";
  604. opt =
  605. "nixfmt /etc/nixos/configuration.nix && upd && cln && bld && updatewallpapers";
  606. cln = "sudo nix-collect-garbage -d && sudo nix-store --optimise";
  607. vpnon = "sudo protonvpn c";
  608. vpnoff = "sudo protonvpn d";
  609. updwallpapers = "pkill swaybg && swaybg -i ~/Sync/archive/background & disown";
  610. gcp = ''git commit -a -m "Update" && git push'';
  611. gps = "git push";
  612. gpl = "git pull";
  613. gs = "git status";
  614. gl = "git log";
  615. gd = "git diff origin/HEAD";
  616. vi = "nvim";
  617. vim = "nvim";
  618. xo = "xdg-open";
  619. ra = "ranger";
  620. monitor2on = "hyprctl keyword monitor DVI-D-1, preferred,auto,1";
  621. monitor2off = "hyprctl keyword monitor DVI-D-1, disable";
  622. uni-laptop = "unison laptop -text";
  623. uni-ssd = "unison ssd -text";
  624. };
  625. plugins = [
  626. {
  627. name = "done";
  628. src = pkgs.fishPlugins.done.src;
  629. }
  630. {
  631. name = "fishPlugins.puffer";
  632. src = pkgs.fishPlugins.puffer;
  633. }
  634. ];
  635. };
  636.  
  637. # Git
  638. programs.git = {
  639. enable = true;
  640. userName = gitUser;
  641. userEmail = email;
  642. ignores = [
  643. "out/"
  644. "target/"
  645. "!.mvn/wrapper/maven-wrapper.jar"
  646. "!**/src/main/**/target/"
  647. "!**/src/test/**/target"
  648. ".idea/"
  649. "*.iws"
  650. "*.iml"
  651. "*.ipr"
  652. ".vscode/"
  653. ];
  654. aliases = {
  655. lg =
  656. "log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
  657. br =
  658. "branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
  659. };
  660. extraConfig = {
  661. color.ui = true;
  662. core.editor = "vim";
  663. push.autoSetupRemote = true;
  664. init.defaultBranch = "main";
  665. credential.helper = "${
  666. pkgs.git.override { withLibsecret = true; }
  667. }/bin/git-credential-libsecret";
  668. safe.directory = "/etc/nixos";
  669. };
  670. };
  671. };
  672. };
  673.  
  674. # Packages
  675. environment.systemPackages = with pkgs; [
  676. # CLI tools
  677. uwufetch
  678. fastfetch
  679. nitch
  680.  
  681. tldr
  682. ncdu
  683. btop
  684. nvtop-amd
  685. fzf
  686. nixfmt
  687. patool
  688. bc
  689. feh
  690. mpv
  691. cryptsetup
  692. # GUI apps
  693. keepassxc
  694. transmission-gtk
  695. unison
  696. zim
  697. gnome.nautilus # or pcmanfm, thunar, nnn, ranger, yazi, fff, lf
  698. # Games
  699. osu-lazer-bin
  700. bottles
  701. #steam
  702. #gamemode
  703. # Social
  704. cinny-desktop
  705. # Development
  706. vscodium-fhs
  707. # For vim
  708. wl-clipboard # allows copying to system clipboard
  709. # Other DE Specific
  710. networkmanagerapplet
  711. swaybg
  712. swayidle
  713. swaylock
  714. nwg-bar # replace with wofi?
  715. polkit_gnome # switch to lxsession?
  716. pavucontrol
  717. brightnessctl
  718. libnotify # for notifications
  719. xdg-utils
  720. sound-theme-freedesktop
  721. # volume control + previous/next song via FN keys
  722. pamixer
  723. playerctl
  724. # Screenshot
  725. grim
  726. slurp
  727. ];
  728.  
  729. programs = {
  730. seahorse.enable = true;
  731. dconf.enable = true;
  732. ssh.startAgent = true;
  733.  
  734. # sets JAVA_HOME
  735. java = {
  736. enable = true;
  737. package = pkgs.jdk17;
  738. };
  739.  
  740. hyprland = {
  741. enable = true;
  742. xwayland.enable = true;
  743. };
  744. };
  745.  
  746. nixpkgs.config = {
  747. #pulseaudio = true;
  748. allowUnfree = true;
  749. permittedInsecurePackages = [ "electron-25.9.0" ];
  750. packageOverrides = pkgs: {
  751. nur = import (builtins.fetchTarball
  752. "https://github.com/nix-community/NUR/archive/master.tar.gz") {
  753. inherit pkgs;
  754. };
  755. };
  756. };
  757.  
  758. # Fonts
  759. fonts = {
  760. fontDir.enable = true;
  761. packages = with pkgs; [ nerdfonts ];
  762. };
  763.  
  764. # Session variables
  765. environment.sessionVariables = {
  766. MOZ_ENABLE_WAYLAND = "1";
  767. _JAVA_AWT_WM_NONEREPARENTING = "1";
  768. TERM = "xterm";
  769. XCURSOR_THEME = cursorTheme.name;
  770. XCURSOR_SIZE = cursorSize;
  771. GTK_THEME = gtk-theme.name;
  772.  
  773. GDK_BACKEND = "wayland,x11";
  774. CLUTTER_BACKEND = "wayland";
  775. SDL_VIDEODRIVER = "wayland";
  776. EGL_PLATFORM = "wayland";
  777. WLR_NO_HARDWARE_CURSORS = "1";
  778.  
  779. XDG_SESSION_TYPE = "wayland";
  780. XDG_SESSION_DESKTOP = "Hyprland";
  781. XDG_CURRENT_DESKTOP = "Hyprland";
  782. };
  783.  
  784. # Docker
  785. virtualisation.docker.enable = true;
  786.  
  787. security = {
  788. polkit.enable = true;
  789. rtkit.enable = true;
  790. pam.services = {
  791.  
  792. # Auto unlock gnome keyring
  793. greetd.enableGnomeKeyring = true;
  794.  
  795. # Fix swaylock not accepting user password
  796. swaylock = { };
  797. };
  798. };
  799.  
  800. # Services
  801. services = {
  802. flatpak.enable = true;
  803. gvfs.enable = true;
  804. dbus.enable = true;
  805. blueman.enable = true;
  806. system76-scheduler.settings.cfsProfiles.enable = true;
  807. gnome.gnome-keyring.enable = true;
  808.  
  809. pipewire = {
  810. enable = true;
  811. alsa.enable = true;
  812. alsa.support32Bit = true;
  813. pulse.enable = true;
  814. jack.enable = true;
  815. };
  816.  
  817. # SSH server
  818. openssh = {
  819. enable = true;
  820. settings.PasswordAuthentication = false;
  821. settings.KbdInteractiveAuthentication = false;
  822. settings.PermitRootLogin = "yes";
  823. };
  824.  
  825. # PostgreSQL
  826. postgresql = {
  827. enable = true;
  828. enableTCPIP = true; # default port = 5432
  829. authentication = pkgs.lib.mkOverride 10 ''
  830. #type database DBuser auth-method
  831. local all all trust
  832. host all all 127.0.0.1/32 md5
  833. '';
  834. settings.listen_addresses = pkgs.lib.mkForce "*";
  835. };
  836.  
  837. # Display manager
  838. greetd = {
  839. enable = true;
  840. settings = rec {
  841. initial_session = {
  842. user = user;
  843. command = "Hyprland";
  844. };
  845. default_session = initial_session;
  846. };
  847. };
  848.  
  849. # Battery usage optimisation
  850. tlp = {
  851. enable = true;
  852. settings = {
  853. CPU_SCALING_GOVERNOR_ON_AC = "performance";
  854. CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
  855. CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
  856. CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
  857. CPU_MIN_PERF_ON_AC = 0;
  858. CPU_MAX_PERF_ON_AC = 100;
  859. CPU_MIN_PERF_ON_BAT = 0;
  860. CPU_MAX_PERF_ON_BAT = 20;
  861. CPU_BOOST_ON_AC = 1; # ???
  862. CPU_BOOST_ON_BAT = 0; # ???
  863. USB_AUTOSUSPEND = 0;
  864. RUNTIME_PM_BLACKLIST = "06:00.3 06:00.4";
  865. };
  866. };
  867. };
  868.  
  869. # XDG Portals
  870. xdg.portal = {
  871. enable = true;
  872. extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
  873. };
  874.  
  875. # Sound
  876. sound.enable = true;
  877.  
  878. # Hardware
  879. hardware = {
  880. pulseaudio = {
  881. enable = false;
  882. # support32Bit = true;
  883. };
  884. bluetooth = {
  885. enable = true;
  886. powerOnBoot = true;
  887. /* # bluetooth fix
  888. settings = {
  889. General = {
  890. Name = "Hello";
  891. ControllerMode = "dual";
  892. FastConnectable = "true";
  893. Experimental = "true";
  894. };
  895. Policy = { AutoEnable = "true"; };
  896. };
  897. */
  898. };
  899. opengl = {
  900. enable = true;
  901. driSupport32Bit = true;
  902. };
  903. };
  904.  
  905. # Boot
  906. boot = {
  907. supportedFilesystems = [ "ntfs" ];
  908. loader = {
  909. systemd-boot.enable = true;
  910. efi.canTouchEfiVariables = true;
  911. };
  912. };
  913.  
  914. # Network
  915. networking = {
  916. hostName = hostname;
  917. networkmanager.enable = true;
  918. };
  919.  
  920. # Timezone
  921. time.timeZone = timezone;
  922.  
  923. # Locale
  924. i18n.defaultLocale = defaultLocale;
  925.  
  926. # User
  927. users.users.${user} = {
  928. isNormalUser = true;
  929. extraGroups = extraUserGroups;
  930. };
  931.  
  932. # Auto upgrades
  933. system.autoUpgrade = {
  934. enable = true;
  935. channel = "https://channels.nixos.org/nixos-unstable";
  936. dates = "weekly";
  937. };
  938.  
  939. nix = {
  940. optimise.automatic = true;
  941.  
  942. # Garbage collection
  943. gc = {
  944. automatic = true;
  945. dates = "weekly";
  946. options = "--delete-older-than 7d";
  947. };
  948. };
  949. system.stateVersion = "23.05"; # initial build version
  950. }
  951.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement