home.nix 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. {
  2. config,
  3. inputs,
  4. lib,
  5. pkgs,
  6. system,
  7. ...
  8. }: let
  9. mkService = lib.recursiveUpdate {
  10. Unit.PartOf = ["graphical-session.target"];
  11. Unit.After = ["graphical-session.target"];
  12. Install.WantedBy = ["graphical-session.target"];
  13. };
  14. in {
  15. imports = [
  16. ../shared/home.nix
  17. # ../../modules/home-manager/emacs
  18. ];
  19. colorscheme = {
  20. slug = "Skeet";
  21. name = "Skeet";
  22. author = "Ludovico";
  23. colors =
  24. inputs.nix-colors.colorSchemes.catppuccin-mocha.colors
  25. // {
  26. blue = "1e5799";
  27. pink = "f300ff";
  28. yellow = "e0ff00";
  29. gray = "595959";
  30. };
  31. };
  32. fonts.fontconfig.enable = true;
  33. # lv.emacs.enable = true;
  34. home = let
  35. # Borrowed from fuf's dotfiles
  36. apply-hm-env = pkgs.writeShellScript "apply-hm-env" ''
  37. ${lib.optionalString (config.home.sessionPath != []) ''
  38. export PATH=${builtins.concatStringsSep ":" config.home.sessionPath}:$PATH
  39. ''}
  40. ${builtins.concatStringsSep "\n" (lib.mapAttrsToList (k: v: ''
  41. export ${k}=${toString v}
  42. '')
  43. config.home.sessionVariables)}
  44. ${config.home.sessionVariablesExtra}
  45. exec "$@"
  46. '';
  47. in {
  48. packages = lib.attrValues {
  49. inherit (pkgs) pamixer jq;
  50. inherit (inputs.self.packages.${system}) gBar;
  51. # runs processes as systemd transient services
  52. run-as-service = pkgs.writeShellScriptBin "run-as-service" ''
  53. exec ${pkgs.systemd}/bin/systemd-run \
  54. --slice=app-manual.slice \
  55. --property=ExitType=cgroup \
  56. --user \
  57. --wait \
  58. bash -lc "exec ${apply-hm-env} $@"
  59. '';
  60. sharenix = pkgs.writeShellScriptBin "sharenix" ''${builtins.readFile ./scripts/sharenix}'';
  61. };
  62. sessionVariables = {
  63. EDITOR = "nvim";
  64. NIXOS_OZONE_WL = "1";
  65. XCURSOR_THEME = "${config.gtk.cursorTheme.name}";
  66. XCURSOR_SIZE = "24";
  67. DIRENV_LOG_FORMAT = "";
  68. SDL_VIDEODRIVER = "wayland";
  69. # needs qt5.qtwayland in systemPackages
  70. QT_QPA_PLATFORM = "wayland";
  71. QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
  72. QT_QPA_PLATFORMTHEME = "gtk3";
  73. # Fix for some Java AWT applications (e.g. Android Studio),
  74. # use this if they aren't displayed properly:
  75. _JAVA_AWT_WM_NONREPARENTING = "1";
  76. };
  77. file.".doom.d" = {
  78. source = ./config/doom.d;
  79. recursive = true;
  80. onChange = builtins.readFile ./config/doom.d/doom.sh;
  81. };
  82. };
  83. programs = {
  84. chromium = {
  85. enable = true;
  86. package = pkgs.ungoogled-chromium; # with ungoogled, you can't install extensions from the settings below
  87. extensions = [
  88. {id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";} # uBlock Origin
  89. {id = "nngceckbapebfimnlniiiahkandclblb";} # Bitwarden
  90. {
  91. id = "dcpihecpambacapedldabdbpakmachpb";
  92. updateUrl = "https://raw.githubusercontent.com/iamadamdev/bypass-paywalls-chrome/master/src/updates/updates.xml";
  93. }
  94. {
  95. id = "ilcacnomdmddpohoakmgcboiehclpkmj";
  96. updateUrl = "https://raw.githubusercontent.com/FastForwardTeam/releases/main/update/update.xml";
  97. }
  98. ];
  99. };
  100. emacs = {
  101. enable = true;
  102. package = inputs.emacs-overlay.packages.${system}.emacs-git;
  103. extraPackages = epkgs: [
  104. epkgs.vterm
  105. ];
  106. };
  107. vscode = {
  108. enable = true;
  109. package = pkgs.vscodium;
  110. enableUpdateCheck = false;
  111. enableExtensionUpdateCheck = false;
  112. extensions = with pkgs.vscode-extensions;
  113. [
  114. # Theme & flair
  115. catppuccin.catppuccin-vsc
  116. pkief.material-icon-theme
  117. # Nix
  118. # bbenoist.nix
  119. jnoortheen.nix-ide
  120. kamadorueda.alejandra
  121. # Python
  122. ms-python.python
  123. # Go
  124. golang.go
  125. # Lua
  126. sumneko.lua
  127. # Rust
  128. rust-lang.rust-analyzer
  129. serayuzgur.crates
  130. # Misc
  131. usernamehw.errorlens
  132. eamodio.gitlens
  133. esbenp.prettier-vscode
  134. ]
  135. ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
  136. {
  137. publisher = "leonardssh";
  138. name = "vscord";
  139. version = "5.1.10";
  140. sha256 = "1nw3zvlw0bx9yih4z3i20irdw02zz444ncf84xjvjn6h5hw47i3x";
  141. }
  142. ];
  143. userSettings = import ./config/vscode/settings.nix;
  144. };
  145. obs-studio = {
  146. enable = true;
  147. plugins = with inputs.nixpkgs-wayland.packages.${system}; [obs-wlrobs];
  148. };
  149. neovim = {
  150. enable = true;
  151. vimAlias = true;
  152. viAlias = true;
  153. vimdiffAlias = true;
  154. coc = {
  155. enable = true;
  156. settings = {
  157. # Disable coc suggestion
  158. definitions.languageserver.enable = false;
  159. suggest.autoTrigger = "none";
  160. # :CocInstall coc-discord-rpc
  161. # coc-discord-rpc
  162. rpc = {
  163. checkIdle = false;
  164. detailsViewing = "In {workspace_folder}";
  165. detailsEditing = "{workspace_folder}";
  166. lowerDetailsEditing = "Working on {file_name}";
  167. };
  168. # ...
  169. };
  170. };
  171. plugins = with pkgs.vimPlugins; [
  172. catppuccin-nvim
  173. vim-nix
  174. plenary-nvim
  175. dashboard-nvim
  176. lualine-nvim
  177. nvim-tree-lua
  178. bufferline-nvim
  179. nvim-colorizer-lua
  180. impatient-nvim
  181. telescope-nvim
  182. indent-blankline-nvim
  183. # nvim-treesitter
  184. (nvim-treesitter.withPlugins (plugins:
  185. with plugins; [
  186. tree-sitter-bash
  187. tree-sitter-c
  188. tree-sitter-cpp
  189. tree-sitter-css
  190. tree-sitter-go
  191. tree-sitter-html
  192. tree-sitter-javascript
  193. tree-sitter-json
  194. tree-sitter-lua
  195. tree-sitter-nix
  196. tree-sitter-python
  197. tree-sitter-rust
  198. tree-sitter-scss
  199. tree-sitter-toml
  200. tree-sitter-tsx
  201. tree-sitter-typescript
  202. tree-sitter-yaml
  203. ]))
  204. comment-nvim
  205. vim-fugitive
  206. nvim-web-devicons
  207. lsp-format-nvim
  208. which-key-nvim
  209. gitsigns-nvim
  210. neogit
  211. # Cmp
  212. cmp-nvim-lsp
  213. cmp-buffer
  214. cmp-path
  215. cmp-cmdline
  216. nvim-cmp
  217. nvim-lspconfig
  218. luasnip
  219. cmp_luasnip
  220. ];
  221. extraPackages = with pkgs; [
  222. alejandra
  223. lua-language-server
  224. stylua # Lua
  225. rust-analyzer
  226. gcc
  227. (ripgrep.override {withPCRE2 = true;})
  228. fd
  229. ];
  230. # https://github.com/fufexan/dotfiles/blob/main/home/editors/neovim/default.nix#L41
  231. extraConfig = let
  232. luaRequire = module:
  233. builtins.readFile (builtins.toString
  234. ./config/neovim/lua
  235. + "/${module}.lua");
  236. luaConfig = builtins.concatStringsSep "\n" (map luaRequire [
  237. "cmp"
  238. # "copilot"
  239. "colorizer"
  240. "keybind"
  241. "settings"
  242. "theme"
  243. "ui"
  244. "which-key"
  245. ]);
  246. in ''
  247. set guicursor=n-v-c-i:block
  248. lua << EOF
  249. ${luaConfig}
  250. EOF
  251. '';
  252. };
  253. spicetify = let
  254. spicePkgs = inputs.spicetify.packages.${system}.default;
  255. in {
  256. enable = true;
  257. spotifyPackage = inputs.self.packages.${system}.spotify;
  258. theme = spicePkgs.themes.catppuccin-mocha;
  259. colorScheme = "flamingo";
  260. enabledExtensions = with spicePkgs.extensions; [
  261. fullAppDisplay
  262. shuffle
  263. hidePodcasts
  264. adblock
  265. ];
  266. # enabledCustomApps = ["marketplace"];
  267. };
  268. foot = {
  269. enable = true;
  270. settings = import ./config/foot.nix {
  271. inherit (config) colorscheme;
  272. };
  273. };
  274. wezterm = {
  275. enable = true;
  276. colorSchemes = import ./config/wezterm/colorscheme.nix {
  277. inherit (config) colorscheme;
  278. };
  279. extraConfig = import ./config/wezterm/config.nix {
  280. inherit (config) colorscheme;
  281. };
  282. };
  283. fuzzel = {
  284. enable = true;
  285. settings = import ./config/fuzzel.nix {
  286. inherit (config) colorscheme;
  287. inherit config;
  288. };
  289. };
  290. tmux = {
  291. enable = true;
  292. customPaneNavigationAndResize = true;
  293. keyMode = "vi";
  294. mouse = true;
  295. prefix = "C-a";
  296. extraConfig = import ./config/tmux.nix;
  297. plugins = [
  298. {
  299. plugin = pkgs.tmuxPlugins.catppuccin;
  300. extraConfig = ''
  301. set -g @catppuccin_window_tabs_enabled on
  302. set -g @catppuccin_flavour 'mocha'
  303. set -g @catppuccin_left_separator "█"
  304. set -g @catppuccin_right_separator "█"
  305. set -g @catppuccin_date_time "%Y-%m-%d %H:%M"
  306. '';
  307. }
  308. ];
  309. };
  310. firefox = {
  311. enable = true;
  312. profiles.ludovico =
  313. {
  314. isDefault = true;
  315. name = "Ludovico";
  316. extensions = with config.nur.repos.rycee.firefox-addons; [
  317. bitwarden
  318. istilldontcareaboutcookies
  319. ublock-origin
  320. ];
  321. bookmarks = import ./config/firefox/bookmarks.nix;
  322. search = import ./config/firefox/search.nix {inherit pkgs;};
  323. settings = import ./config/firefox/settings.nix;
  324. }
  325. // (let
  326. inherit (config.nur.repos.federicoschonborn) firefox-gnome-theme;
  327. in {
  328. userChrome = ''@import "${firefox-gnome-theme}/userChrome.css";'';
  329. userContent = ''@import "${firefox-gnome-theme}/userContent.css";'';
  330. extraConfig = builtins.readFile "${firefox-gnome-theme}/configuration/user.js";
  331. });
  332. };
  333. i3status-rust = {
  334. enable = true;
  335. bars = {
  336. bottom = {
  337. blocks = [
  338. {
  339. block = "cpu";
  340. format = " $icon $utilization ";
  341. }
  342. {
  343. block = "memory";
  344. format = " $icon $mem_used_percents.eng(w:1) ";
  345. }
  346. {
  347. block = "disk_space";
  348. path = "/";
  349. info_type = "available";
  350. alert_unit = "GB";
  351. interval = 20;
  352. warning = 20.0;
  353. alert = 10.0;
  354. format = " $icon ROOT: $available.eng(w:2) ";
  355. }
  356. {
  357. block = "net";
  358. device = "wg0";
  359. format = " $icon VPN Connected ";
  360. inactive_format = " $icon VPN Disconnected ";
  361. missing_format = "  VPN Disconnected ";
  362. }
  363. {
  364. block = "net";
  365. device = "wlp4s0";
  366. format = " $icon Connected ";
  367. inactive_format = " $icon Disconnected ";
  368. missing_format = " $icon Disconnected ";
  369. }
  370. {
  371. block = "sound";
  372. # driver = "pulseaudio";
  373. format = " $icon $volume ";
  374. show_volume_when_muted = true;
  375. }
  376. {
  377. block = "battery";
  378. device = "BAT1";
  379. format = " $icon $percentage ";
  380. }
  381. {
  382. block = "time";
  383. format = " $icon $timestamp.datetime(f:'%a %d/%m %R') ";
  384. }
  385. ];
  386. settings = {
  387. theme = {
  388. theme = "solarized-dark";
  389. overrides = let
  390. inherit (config) colorscheme;
  391. in
  392. with colorscheme.colors; {
  393. idle_bg = "#${base00}";
  394. idle_fg = "#${base05}";
  395. info_bg = "#${base0C}";
  396. info_fg = "#${base00}";
  397. good_bg = "#${base0B}";
  398. good_fg = "#${base00}";
  399. warning_bg = "#${base0A}";
  400. warning_fg = "#${base00}";
  401. critical_bg = "#${base08}";
  402. critical_fg = "#${base00}";
  403. separator = "<span font='12'></span>";
  404. };
  405. };
  406. icons = {
  407. icons = "awesome6";
  408. overrides = {
  409. tux = "";
  410. upd = "";
  411. noupd = "";
  412. };
  413. };
  414. };
  415. };
  416. };
  417. };
  418. # waybar = {
  419. # enable = true;
  420. # settings = import ./config/waybar/settings.nix {
  421. # inherit pkgs;
  422. # inherit lib;
  423. # };
  424. # style = import ./config/waybar/style.nix {inherit (config) colorscheme;};
  425. # };
  426. };
  427. services = {
  428. gammastep = {
  429. enable = true;
  430. provider = "geoclue2";
  431. tray = true;
  432. };
  433. emacs = {
  434. enable = true;
  435. package = inputs.emacs-overlay.packages.${system}.emacs-git;
  436. };
  437. dunst = {
  438. enable = true;
  439. package = inputs.nixpkgs-wayland.packages.${system}.dunst;
  440. iconTheme = {
  441. name = "Papirus";
  442. size = "32x32";
  443. package = pkgs.papirus-icon-theme;
  444. };
  445. settings = import ./config/dunst.nix {inherit (config) colorscheme;};
  446. };
  447. };
  448. wayland.windowManager.hyprland = {
  449. enable = true;
  450. recommendedEnvironment = true;
  451. systemdIntegration = true;
  452. extraConfig = import ./config/hyprland.nix {
  453. inherit (config) colorscheme;
  454. inherit pkgs;
  455. inherit lib;
  456. inherit config;
  457. };
  458. };
  459. wayland.windowManager.sway = let
  460. inherit (config) colorscheme;
  461. in {
  462. enable = true;
  463. # package = inputs.swayfx.packages.${pkgs.system}.default;
  464. config = {
  465. colors = import ./config/sway/colors.nix {inherit colorscheme;};
  466. keybindings = import ./config/sway/keybindings.nix {inherit config lib pkgs;};
  467. bars = import ./config/sway/bars.nix {inherit colorscheme;};
  468. window = import ./config/sway/windows.nix;
  469. input = {
  470. "type:touchpad" = {
  471. dwt = "enabled";
  472. tap = "enabled";
  473. natural_scroll = "enabled";
  474. };
  475. "type:keyboard" = {
  476. xkb_options = "ctrl:nocaps";
  477. repeat_delay = "200";
  478. repeat_rate = "30";
  479. };
  480. };
  481. floating = {
  482. border = 2;
  483. titlebar = true;
  484. criteria = [
  485. {window_role = "pop-up";}
  486. {window_role = "bubble";}
  487. {window_role = "dialog";}
  488. {window_type = "dialog";}
  489. {app_id = "lutris";}
  490. {app_id = "thunar";}
  491. {app_id = "pavucontrol";}
  492. {class = ".*.exe";} # Wine apps
  493. {class = "steam_app.*";} # Steam games
  494. {class = "^Steam$";} # Steam itself
  495. ];
  496. };
  497. gaps = {
  498. inner = 2;
  499. outer = 2;
  500. };
  501. fonts = {
  502. names = ["Iosevka Nerd Font"];
  503. size = 10.0;
  504. };
  505. startup = let
  506. _ = lib.getExe;
  507. in [
  508. {command = "${_ pkgs.dunst}";}
  509. {command = "systemctl --user restart swaybg.service";}
  510. {command = "systemctl --user restart xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-hyprland";}
  511. {
  512. command = ''
  513. ${_ pkgs.swayidle} -w \
  514. timeout 300 '${_ pkgs.swaylock} -f -c 000000' \
  515. timeout 600 'swaymsg "output * power off"' \
  516. resume 'swaymsg "output * power on"' \
  517. before-sleep '${_ pkgs.swaylock} -f -c 000000'
  518. '';
  519. }
  520. ];
  521. modifier = "Mod4";
  522. };
  523. extraConfig = ''
  524. output * adaptive_sync on
  525. titlebar_border_thickness 1
  526. title_align center
  527. titlebar_padding 2
  528. # # SwayFX stuff
  529. # # Blur
  530. # blur enable
  531. # blur_xray disable
  532. # blur_passes 3
  533. # blur_radius 3
  534. #
  535. # # window corner radius in px
  536. # corner_radius 3
  537. #
  538. # shadows off
  539. # shadows_on_csd off
  540. # shadow_blur_radius 20
  541. # shadow_color #0000007F
  542. #
  543. # # inactive window fade amount. 0.0 = no dimming, 1.0 = fully dimmed
  544. # default_dim_inactive 0.0
  545. # dim_inactive_colors.unfocused #000000FF
  546. # dim_inactive_colors.urgent #900000FF
  547. # Treat Scratchpad as minimized
  548. # scratchpad_minimize enable
  549. '';
  550. extraSessionCommands = ''
  551. export XDG_CURRENT_DESKTOP=sway
  552. export SDL_VIDEODRIVER=wayland
  553. export QT_QPA_PLATFORM=wayland
  554. export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
  555. export _JAVA_AWT_WM_NONREPARENTING=1
  556. '';
  557. wrapperFeatures = {
  558. base = true;
  559. gtk = true;
  560. };
  561. systemd.enable = true;
  562. };
  563. xdg = {
  564. configFile = {
  565. "gBar/style.css".text = builtins.readFile ./config/gBar/style.css;
  566. "gBar/config".text = builtins.readFile ./config/gBar/config;
  567. "MangoHud/MangoHud.conf".text = ''
  568. gpu_stats
  569. cpu_stats
  570. fps
  571. frame_timing = 0
  572. throttling_status = 0
  573. position=top-right
  574. '';
  575. };
  576. userDirs = {
  577. enable = true;
  578. };
  579. };
  580. # https://github.com/nix-community/home-manager/issues/2064
  581. systemd.user.targets.tray = {
  582. Unit = {
  583. Description = "Home Manager System Tray";
  584. Requires = ["graphical-session-pre.target"];
  585. };
  586. };
  587. # User Services
  588. systemd.user.services = let
  589. _ = lib.getExe;
  590. in {
  591. swaybg = mkService {
  592. Unit.Description = "Images Wallpaper Daemon";
  593. Service = {
  594. ExecStart = "${_ pkgs.swaybg} -i ${../../assets/wallpaper/wolf.jpeg}";
  595. Restart = "on-failure";
  596. };
  597. };
  598. # mpvpaper = mkService {
  599. # Unit.Description = "Video Wallpaper Daemon";
  600. # Service = {
  601. # ExecStart = "${lib.getExe pkgs.mpvpaper} -o \"no-audio --loop-playlist shuffle\" eDP-1 ${../../assets/wallpaper/wallpaper.mp4}";
  602. # Restart = "on-failure";
  603. # };
  604. # };
  605. wl-clip-persist = mkService {
  606. Unit.Description = "Keep Wayland clipboard even after programs close";
  607. Service = {
  608. ExecStart = "${_ pkgs.wl-clip-persist} --clipboard both";
  609. Restart = "on-failure";
  610. };
  611. };
  612. };
  613. programs.home-manager.enable = true;
  614. }