diff options
author | Preston Pan <ret2pop@gmail.com> | 2025-01-16 02:11:26 -0800 |
---|---|---|
committer | Preston Pan <ret2pop@gmail.com> | 2025-01-16 02:11:26 -0800 |
commit | 1a3486d77574c06b395ab6cda41084f5ed24a3f4 (patch) | |
tree | 69d1051bd14a0c3cb374f84a8c06cb655eba509b | |
parent | 2dff9d2b61244fed49136028d0e0f6ae3ae759cf (diff) |
modularized nix configuration; builds correctly
37 files changed, 1044 insertions, 2988 deletions
diff --git a/nix/flake.nix b/nix/flake.nix index 555a8c1..787b3a7 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -38,7 +38,7 @@ imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; } ) - ./systems/installer/iso.nix + ./systems/installer/default.nix ]; }; @@ -46,15 +46,14 @@ system = "x86_64-linux"; specialArgs = attrs; modules = [ - { nixpkgs.overlays = [ nur.overlays.default ]; } - { home-manager.extraSpecialArgs = attrs; } lanzaboote.nixosModules.lanzaboote disko.nixosModules.disko home-manager.nixosModules.home-manager sops-nix.nixosModules.sops - ./systems/desktop/configuration.nix - ./systems/desktop/sda-simple.nix - ./systems/desktop/home.nix + { nixpkgs.overlays = [ nur.overlays.default ]; } + { home-manager.extraSpecialArgs = attrs; } + + ./systems/continuity/default.nix ]; }; diff --git a/nix/modules/configuration.nix b/nix/modules/configuration.nix index 46deabb..286d485 100644 --- a/nix/modules/configuration.nix +++ b/nix/modules/configuration.nix @@ -1,6 +1,11 @@ { config, pkgs, lib, ... }: { - imports = []; + imports = [ + ./xserver.nix + ./ssh.nix + ./pipewire.nix + ./tor.nix + ]; documentation = { enable = lib.mkDefault config.monorepo.profiles.documentation.enable; @@ -197,10 +202,6 @@ usbguard.enable = false; dbus.apparmor = "enabled"; - tor = import ./tor.nix; - xserver = import ./xserver.nix; - pipewire = import ./pipewire.nix; - openssh = import ./ssh.nix; kanata.enable = true; # Misc. @@ -228,7 +229,7 @@ hostPlatform = lib.mkDefault "x86_64-linux"; config = { allowUnfree = true; - cudaSupport = lib.mkDefault false; + cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable; }; }; @@ -273,9 +274,11 @@ }; environment.systemPackages = with pkgs; [ - tree restic sbctl + git + vim + curl ]; users.users = { diff --git a/nix/modules/default.nix b/nix/modules/default.nix index db5f82e..9d06837 100644 --- a/nix/modules/default.nix +++ b/nix/modules/default.nix @@ -2,184 +2,40 @@ { imports = [ ./configuration.nix + ./home/home.nix + ./vars.nix ]; options = { monorepo = { - vars = import ./vars.nix; - profiles = { + cuda.enable = lib.mkEnableOption "Enables CUDA support"; documentation.enable = lib.mkEnableOption "Enables documentation on system."; secureBoot.enable = lib.mkEnableOption "Enables secure boot. See sbctl."; pipewire.enable = lib.mkEnableOption "Enables pipewire low latency audio setup"; tor.enable = lib.mkEnableOption "Enables tor along with torsocks"; - - - home = { - enable = lib.mkEnableOption "Enables home manager desktop configuration"; - # Programs - lang-c.enable = lib.mkEnableOption "Enables C language support"; - lang-shell.enable = lib.mkEnableOption "Enables sh language support"; - lang-rust.enable = lib.mkEnableOption "Enables Rust language support"; - lang-python.enable = lib.mkEnableOption "Enables python language support"; - lang-sol.enable = lib.mkEnableOption "Enables solidity language support"; - lang-openscad.enable = lib.mkEnableOption "Enables openscad language support"; - lang-js.enable = lib.mkEnableOption "Enables javascript language support"; - lang-nix.enable = lib.mkEnableOption "Enables nix language support"; - - crypto.enable = lib.mkEnableOption "Enables various cryptocurrency wallets"; - art.enable = lib.mkEnableOption "Enables various art programs"; - music.enable = lib.mkEnableOption "Enables mpd"; - - hyprland = { - enable = lib.mkEnableOption "Enables hyprland"; - monitors = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ - "HDMI-A-1" - "eDP-1" - "DP-2" - "DP-3" - "LVDS-1" - ]; - example = []; - description = "Hyprland monitors"; - }; - }; - email = { - email = lib.mkOption { - type = lib.types.str; - default = "ret2pop@gmail.com"; - example = "john@example.com"; - description = "Email address and imaps/smtps account"; - }; - imapsServer = lib.mkOption { - type = lib.types.str; - default = "imap.gmail.com"; - example = "imap.example.com"; - description = "imaps server address"; - }; - smtpsServer = lib.mkOption { - type = lib.types.str; - default = "smtp.gmail.com"; - example = "smtp.example.com"; - description = "smtp server address"; - }; - enable = lib.mkEnableOption "Enables email"; - }; - }; + home.enable = lib.mkEnableOption "Enables home user"; }; }; }; config = { + home-manager.users."${config.monorepo.vars.userName}" = { + programs.home-manager.enable = config.monorepo.profiles.home.enable; + }; + environment.systemPackages = lib.mkIf config.monorepo.profiles.documentation.enable (with pkgs; [ linux-manual man-pages man-pages-posix ]); - home-manager.users."${config.monorepo.vars.userName}".home.packages = lib.flatten [ - (lib.mkIf config.monorepo.home.email.enable [ pkgs.mu ]) - (lib.mkIf config.monorepo.home.lang-c.enable (with pkgs; [ - autobuild - clang - gdb - gnumake - bear - clang-tools - ])) - - (lib.mkIf config.monorepo.home.lang-js.enable (with pkgs; [ - nodejs - bun - yarn - typescript - vscode-langservers-extracted - ])) - - (lib.mkIf config.monorepo.home.lang-rust.enable (with pkgs; [ - cargo - rust-analyzer - rustfmt - ])) - - (lib.mkIf config.monorepo.home.lang-python.enable (with pkgs; [ - poetry - python3 - python312Packages.jedi - ])) - - (lib.mkIf config.monorepo.home.lang-sol.enable (with pkgs; [ - solc - ])) - - (lib.mkIf config.monorepo.home.lang-openscad.enable (with pkgs; [ - openscad - openscad-lsp - ])) - - (lib.mkIf config.monorepo.home.lang-sh.enable (with pkgs; [ - bash-language-server - ])) - - (lib.mkIf config.monorepo.home.lang-nix.enable (with pkgs; [ - nil - nixd - nixfmt-rfc-style - ])) - - (lib.mkIf config.monorepo.home.crypto.enable (with pkgs; [ - bitcoin - electrum - monero-cli - monero-gui - ])) - - (lib.mkIf config.monorepo.home.art.enable (with pkgs; [ - inkscape - krita - ])) - - (lib.mkIf config.monorepo.home.music.enable (with pkgs; [ - mpc-cli - sox - ])) - - (lib.mkIf config.monorepo.tor.enable (with pkgs; [ - tor-browser - torsocks - ])) - - (lib.mkIf config.monorepo.pipewire.enable (with pkgs; [ - helvum - ])) - ]; - monorepo = { profiles = { documentation.enable = lib.mkDefault true; pipewire.enable = lib.mkDefault true; tor.enable = lib.mkDefault true; - home = { - enable = lib.mkDefault true; - music.enable = lib.mkDefault config.monorepo.profiles.pipewire.enable; - hyprland.enable = lib.mkDefault true; - email.enable = lib.mkDefault true; - - # Programming - lang-c.enable = lib.mkDefault true; - lang-rust.enable = lib.mkDefault true; - lang-python.enable = lib.mkDefault true; - lang-sol.enable = lib.mkDefault true; - lang-sh.enable = lib.mkDefault true; - lang-openscad.enable = lib.mkDefault true; - lang-js.enable = lib.mkDefault true; - lang-nix.enable = lib.mkDefault true; - - crypto.enable = lib.mkDefault true; - art.enable = lib.mkDefault true; - }; + home.enable = lib.mkDefault true; }; }; }; diff --git a/nix/modules/home/default.nix b/nix/modules/home/default.nix new file mode 100644 index 0000000..b2d3ef5 --- /dev/null +++ b/nix/modules/home/default.nix @@ -0,0 +1,169 @@ +{ lib, config, pkgs, ... }: +{ + imports = [ + ../vars.nix + ./fcitx.nix + ./secrets.nix + ./emacs.nix + ./firefox.nix + ./git.nix + ./hyprland.nix + ./mpv.nix + ./yt-dlp.nix + ./wofi.nix + ./kitty.nix + ./waybar.nix + ./zsh.nix + ./mbsync.nix + ./msmtp.nix + ./gammastep.nix + ./mpd.nix + ./mako.nix + ./user.nix + ]; + + options = { + monorepo.profiles = { + enable = lib.mkEnableOption "Enables home manager desktop configuration"; + # Programs + lang-c.enable = lib.mkEnableOption "Enables C language support"; + lang-sh.enable = lib.mkEnableOption "Enables sh language support"; + lang-rust.enable = lib.mkEnableOption "Enables Rust language support"; + lang-python.enable = lib.mkEnableOption "Enables python language support"; + lang-sol.enable = lib.mkEnableOption "Enables solidity language support"; + lang-openscad.enable = lib.mkEnableOption "Enables openscad language support"; + lang-js.enable = lib.mkEnableOption "Enables javascript language support"; + lang-nix.enable = lib.mkEnableOption "Enables nix language support"; + + crypto.enable = lib.mkEnableOption "Enables various cryptocurrency wallets"; + art.enable = lib.mkEnableOption "Enables various art programs"; + music.enable = lib.mkEnableOption "Enables mpd"; + + hyprland = { + enable = lib.mkEnableOption "Enables hyprland"; + monitors = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + "HDMI-A-1" + "eDP-1" + "DP-2" + "DP-3" + "LVDS-1" + ]; + example = []; + description = "Hyprland monitors"; + }; + }; + email = { + email = lib.mkOption { + type = lib.types.str; + default = "ret2pop@gmail.com"; + example = "john@example.com"; + description = "Email address and imaps/smtps account"; + }; + imapsServer = lib.mkOption { + type = lib.types.str; + default = "imap.gmail.com"; + example = "imap.example.com"; + description = "imaps server address"; + }; + smtpsServer = lib.mkOption { + type = lib.types.str; + default = "smtp.gmail.com"; + example = "smtp.example.com"; + description = "smtp server address"; + }; + enable = lib.mkEnableOption "Enables email"; + }; + }; + }; + + config = { + home.packages = (if config.monorepo.profiles.email.enable then [ pkgs.mu ] else []) + ++ + (if config.monorepo.profiles.lang-c.enable then (with pkgs; [ + autobuild + clang + gdb + gnumake + bear + clang-tools + ]) else []) + ++ + (if config.monorepo.profiles.lang-js.enable then (with pkgs; [ + nodejs + bun + yarn + typescript + vscode-langservers-extracted + ]) else []) + ++ + (if config.monorepo.profiles.lang-rust.enable then (with pkgs; [ + cargo + rust-analyzer + rustfmt + ]) else []) + ++ + (if config.monorepo.profiles.lang-python.enable then (with pkgs; [ + poetry + python3 + python312Packages.jedi + ]) else []) + ++ + (if config.monorepo.profiles.lang-sol.enable then (with pkgs; [ + solc + ]) else []) + ++ + (if config.monorepo.profiles.lang-openscad.enable then (with pkgs; [ + openscad + openscad-lsp + ]) else []) + ++ + (if config.monorepo.profiles.lang-sh.enable then (with pkgs; [ + bash-language-server + ]) else []) + ++ + (if config.monorepo.profiles.lang-nix.enable then (with pkgs; [ + nil + nixd + nixfmt-rfc-style + ]) else []) + ++ + (if config.monorepo.profiles.crypto.enable then (with pkgs; [ + bitcoin + electrum + monero-cli + monero-gui + ]) else []) + ++ + (if config.monorepo.profiles.art.enable then (with pkgs; [ + inkscape + krita + ]) else []) + ++ + (if config.monorepo.profiles.music.enable then (with pkgs; [ + mpc-cli + sox + ]) else []); + + monorepo.profiles = { + enable = lib.mkDefault true; + music.enable = lib.mkDefault true; + hyprland.enable = lib.mkDefault true; + email.enable = lib.mkDefault true; + + # Programming + lang-c.enable = lib.mkDefault true; + lang-rust.enable = lib.mkDefault true; + lang-python.enable = lib.mkDefault true; + lang-sol.enable = lib.mkDefault true; + lang-sh.enable = lib.mkDefault true; + lang-openscad.enable = lib.mkDefault true; + lang-js.enable = lib.mkDefault true; + lang-nix.enable = lib.mkDefault true; + + crypto.enable = lib.mkDefault true; + art.enable = lib.mkDefault true; + }; + }; +} diff --git a/nix/modules/home/emacs.nix b/nix/modules/home/emacs.nix index f269c01..190adee 100644 --- a/nix/modules/home/emacs.nix +++ b/nix/modules/home/emacs.nix @@ -1,85 +1,88 @@ { lib, config, pkgs, ... }: { - enable = lib.mkDefault config.monorepo.profiles.home.enable; - package = pkgs.emacs29-pgtk; - extraConfig = '' + programs.emacs = + { + enable = true; + package = pkgs.emacs29-pgtk; + extraConfig = '' (setq debug-on-error t) (org-babel-load-file (expand-file-name "~/monorepo/config/emacs.org"))''; - extraPackages = epkgs: [ - epkgs.all-the-icons - epkgs.auctex - epkgs.catppuccin-theme - epkgs.chatgpt-shell - epkgs.company - epkgs.company-solidity - epkgs.counsel - epkgs.dashboard - epkgs.doom-modeline - epkgs.elfeed - epkgs.elfeed-org - epkgs.elfeed-tube - epkgs.elfeed-tube-mpv - epkgs.ellama - epkgs.elpher - epkgs.ement - epkgs.emmet-mode - epkgs.emms - epkgs.enwc - epkgs.evil - epkgs.evil-collection - epkgs.evil-commentary - epkgs.evil-org - epkgs.f - epkgs.flycheck - epkgs.general - epkgs.gptel - epkgs.gruvbox-theme - epkgs.htmlize - epkgs.irony-eldoc - epkgs.ivy - epkgs.ivy-pass - epkgs.latex-preview-pane - epkgs.lsp-ivy - epkgs.lsp-mode - epkgs.lyrics-fetcher - epkgs.magit - epkgs.magit-delta - epkgs.mu4e - epkgs.nix-mode - epkgs.org-fragtog - epkgs.org-journal - epkgs.org-roam - epkgs.org-roam-ui - epkgs.org-superstar - epkgs.page-break-lines - epkgs.password-store - epkgs.pdf-tools - epkgs.pinentry - epkgs.platformio-mode - epkgs.projectile - epkgs.rustic - epkgs.scad-mode - epkgs.simple-httpd - epkgs.solidity-flycheck - epkgs.solidity-mode - epkgs.sudo-edit - epkgs.treemacs - epkgs.treemacs-evil - epkgs.treemacs-magit - epkgs.treemacs-projectile - epkgs.treesit-auto - epkgs.typescript-mode - epkgs.unicode-fonts - epkgs.use-package - epkgs.vterm - epkgs.web-mode - epkgs.websocket - epkgs.which-key - epkgs.writegood-mode - epkgs.writeroom-mode - epkgs.yaml-mode - epkgs.yasnippet - epkgs.yasnippet-snippets - ]; + extraPackages = epkgs: [ + epkgs.all-the-icons + epkgs.auctex + epkgs.catppuccin-theme + epkgs.chatgpt-shell + epkgs.company + epkgs.company-solidity + epkgs.counsel + epkgs.dashboard + epkgs.doom-modeline + epkgs.elfeed + epkgs.elfeed-org + epkgs.elfeed-tube + epkgs.elfeed-tube-mpv + epkgs.ellama + epkgs.elpher + epkgs.ement + epkgs.emmet-mode + epkgs.emms + epkgs.enwc + epkgs.evil + epkgs.evil-collection + epkgs.evil-commentary + epkgs.evil-org + epkgs.f + epkgs.flycheck + epkgs.general + epkgs.gptel + epkgs.gruvbox-theme + epkgs.htmlize + epkgs.irony-eldoc + epkgs.ivy + epkgs.ivy-pass + epkgs.latex-preview-pane + epkgs.lsp-ivy + epkgs.lsp-mode + epkgs.lyrics-fetcher + epkgs.magit + epkgs.magit-delta + epkgs.mu4e + epkgs.nix-mode + epkgs.org-fragtog + epkgs.org-journal + epkgs.org-roam + epkgs.org-roam-ui + epkgs.org-superstar + epkgs.page-break-lines + epkgs.password-store + epkgs.pdf-tools + epkgs.pinentry + epkgs.platformio-mode + epkgs.projectile + epkgs.rustic + epkgs.scad-mode + epkgs.simple-httpd + epkgs.solidity-flycheck + epkgs.solidity-mode + epkgs.sudo-edit + epkgs.treemacs + epkgs.treemacs-evil + epkgs.treemacs-magit + epkgs.treemacs-projectile + epkgs.treesit-auto + epkgs.typescript-mode + epkgs.unicode-fonts + epkgs.use-package + epkgs.vterm + epkgs.web-mode + epkgs.websocket + epkgs.which-key + epkgs.writegood-mode + epkgs.writeroom-mode + epkgs.yaml-mode + epkgs.yasnippet + epkgs.yasnippet-snippets + ]; + }; } diff --git a/nix/modules/home/fcitx.nix b/nix/modules/home/fcitx.nix new file mode 100644 index 0000000..05dd8f7 --- /dev/null +++ b/nix/modules/home/fcitx.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: +{ + i18n.inputMethod = { + enabled = "fcitx5"; + fcitx5.addons = with pkgs; [ + fcitx5-gtk + fcitx5-chinese-addons + fcitx5-configtool + fcitx5-mozc + fcitx5-rime + ]; + }; +} diff --git a/nix/modules/home/firefox.nix b/nix/modules/home/firefox.nix index ea239c0..e5a4bd5 100644 --- a/nix/modules/home/firefox.nix +++ b/nix/modules/home/firefox.nix @@ -1,259 +1,261 @@ { lib, config, pkgs, ... }: { - enable = lib.mkDefault config.monorepo.profiles.home.enable; - policies = { - EnableTrackingProtection = true; - OfferToSaveLogins = false; - }; - package = pkgs.firefox-wayland; - profiles = { - default = { - id = 0; - name = "default"; - isDefault = true; - - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - tree-style-tab - firefox-color - vimium - ] - ++ (lib.optional - config.monorepo.profiles.home.crypto.enable pkgs.nur.repos.rycee.firefox-addons.metamask); + programs.firefox = { + enable = true; + policies = { + EnableTrackingProtection = true; + OfferToSaveLogins = false; + }; + package = pkgs.firefox-wayland; + profiles = { + default = { + id = 0; + name = "default"; + isDefault = true; - settings = { - media = { - memory_cache_max_size = 65536; - cache_readahead_limit = 7200; - cache_resume_threshold = 3600; - peerconnection.ice = { - proxy_only_if_behind_proxy = true; - default_address_only = true; - }; - }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + tree-style-tab + firefox-color + vimium + ] + ++ (lib.optional + config.monorepo.profiles.crypto.enable pkgs.nur.repos.rycee.firefox-addons.metamask); - gfx = { - content.skia-font-cache-size = 20; - canvas.accelerated = { - cache-items = 4096; - cache-size = 512; + settings = { + media = { + memory_cache_max_size = 65536; + cache_readahead_limit = 7200; + cache_resume_threshold = 3600; + peerconnection.ice = { + proxy_only_if_behind_proxy = true; + default_address_only = true; + }; }; - }; - network = { - http = { - max-connections = 1800; - max-persistent-connections-per-server = 10; - max-urgent-start-excessive-connections-per-host = 5; - referer.XOriginTrimmingPolicy = 2; + gfx = { + content.skia-font-cache-size = 20; + canvas.accelerated = { + cache-items = 4096; + cache-size = 512; + }; }; - buffer.cache = { - size = 262144; - count = 128; - }; + network = { + http = { + max-connections = 1800; + max-persistent-connections-per-server = 10; + max-urgent-start-excessive-connections-per-host = 5; + referer.XOriginTrimmingPolicy = 2; + }; - dns = { - max_high_priority_threads = 8; - disablePrefetch = true; - }; + buffer.cache = { + size = 262144; + count = 128; + }; - pacing.requests.enabled = false; - dnsCacheExpiration = 3600; - ssl_tokens_cache_capacity = 10240; - prefetch-next = false; - predictor.enabled = false; - cookie.sameSite.noneRequiresSecure = true; - IDN_show_punycode = true; - auth.subresource-http-auth-allow = 1; - captive-portal-service.enabled = false; - connectivity-service.enabled = false; - }; + dns = { + max_high_priority_threads = 8; + disablePrefetch = true; + }; - browser = { - download = { - always_ask_before_handling_new_types = true; - manager.addToRecentDocs = false; - open_pdf_attachments_inline = true; - start_downloads_in_tmp_dir = true; + pacing.requests.enabled = false; + dnsCacheExpiration = 3600; + ssl_tokens_cache_capacity = 10240; + prefetch-next = false; + predictor.enabled = false; + cookie.sameSite.noneRequiresSecure = true; + IDN_show_punycode = true; + auth.subresource-http-auth-allow = 1; + captive-portal-service.enabled = false; + connectivity-service.enabled = false; }; - urlbar = { - suggest.quicksuggest.sponsored = false; - suggest.quicksuggest.nonsponsored = false; - suggest.calculator = true; - update2.engineAliasRefresh = true; - unitConversion.enabled = true; - trending.featureGate = false; - }; + browser = { + download = { + always_ask_before_handling_new_types = true; + manager.addToRecentDocs = false; + open_pdf_attachments_inline = true; + start_downloads_in_tmp_dir = true; + }; - search = { - separatePrivateDefault.ui.enabled = true; - suggest.enabled = false; - }; + urlbar = { + suggest.quicksuggest.sponsored = false; + suggest.quicksuggest.nonsponsored = false; + suggest.calculator = true; + update2.engineAliasRefresh = true; + unitConversion.enabled = true; + trending.featureGate = false; + }; - newtabpage.activity-stream = { - feeds = { - topsites = false; - section.topstories = false; + search = { + separatePrivateDefault.ui.enabled = true; + suggest.enabled = false; + }; + + newtabpage.activity-stream = { + feeds = { + topsites = false; + section.topstories = false; + telemetry = false; + }; + asrouter.userprefs.cfr = { + addons = false; + features = false; + }; telemetry = false;< |