From bfa2521ed09c33f32b4f0405c3117e3a0381c2f6 Mon Sep 17 00:00:00 2001 From: William Date: Sun, 15 Feb 2026 12:53:05 -0300 Subject: [PATCH] re-work cli aspect for nixos and homeModules --- aspects/cli/btop.nix | 38 ++++++++----- aspects/cli/cli.nix | 28 +++++++++ aspects/cli/comma.nix | 2 +- aspects/cli/direnv.nix | 2 +- aspects/cli/helix.nix | 106 +++++++++++++++++++---------------- aspects/cli/hm-cli.nix | 2 +- aspects/cli/starship.nix | 2 +- aspects/cli/tmux.nix | 40 ++++++++----- aspects/common/programs.nix | 3 - aspects/hosts/alexandria.nix | 49 ++++++++-------- aspects/hosts/io.nix | 76 ++++++++++++------------- aspects/hosts/rotterdam.nix | 86 ++++++++++++++-------------- aspects/hosts/trantor.nix | 60 +++++++++----------- 13 files changed, 264 insertions(+), 230 deletions(-) create mode 100644 aspects/cli/cli.nix diff --git a/aspects/cli/btop.nix b/aspects/cli/btop.nix index 2b9c3fc..220a462 100644 --- a/aspects/cli/btop.nix +++ b/aspects/cli/btop.nix @@ -1,20 +1,28 @@ { ... }: { - flake.modules.homeManager.cli-btop = - { - config, - lib, - pkgs, - ... - }: - { - programs.btop = { - enable = true; - settings = { - theme_background = false; - proc_sorting = "cpu direct"; - update_ms = 500; + flake.modules = { + nixos.btop = + { pkgs, ... }: + { + environment.systemPackages = with pkgs; [ btop ]; + }; + + homeManager.btop = + { + config, + lib, + pkgs, + ... + }: + { + programs.btop = { + enable = true; + settings = { + theme_background = false; + proc_sorting = "cpu direct"; + update_ms = 500; + }; }; }; - }; + }; } diff --git a/aspects/cli/cli.nix b/aspects/cli/cli.nix new file mode 100644 index 0000000..8a11616 --- /dev/null +++ b/aspects/cli/cli.nix @@ -0,0 +1,28 @@ +{ inputs, ... }: + +{ + flake.modules = { + nixos.cli = + { ... }: + { + imports = with inputs.self.modules.nixos; [ + btop + helix + tmux + ]; + }; + homeManager.cli = + { ... }: + { + imports = with inputs.self.modules.nixos; [ + btop + comma + direnv + helix + hm-cli + starship + tmux + ]; + }; + }; +} diff --git a/aspects/cli/comma.nix b/aspects/cli/comma.nix index 71ddb9c..169144f 100644 --- a/aspects/cli/comma.nix +++ b/aspects/cli/comma.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.homeManager.cli-comma = + flake.modules.homeManager.comma = { config, lib, diff --git a/aspects/cli/direnv.nix b/aspects/cli/direnv.nix index 60ea7ad..2cfb2ef 100644 --- a/aspects/cli/direnv.nix +++ b/aspects/cli/direnv.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.homeManager.cli-direnv = + flake.modules.homeManager.direnv = { config, lib, diff --git a/aspects/cli/helix.nix b/aspects/cli/helix.nix index fe0cf74..a21641a 100644 --- a/aspects/cli/helix.nix +++ b/aspects/cli/helix.nix @@ -1,57 +1,67 @@ { ... }: { - flake.modules.homeManager.cli-helix = - { - config, - lib, - pkgs, - ... - }: - { - home.sessionVariables = { - EDITOR = "hx"; + flake.modules = { + nixos.helix = + { pkgs, ... }: + { + environment.systemPackages = with pkgs; [ + helix + ]; }; - programs.helix = { - enable = true; - settings = { - editor = { - file-picker.hidden = false; - idle-timeout = 0; - line-number = "relative"; - cursor-shape = { - normal = "underline"; - insert = "bar"; - select = "underline"; - }; - soft-wrap.enable = true; - auto-format = true; - indent-guides.render = true; - }; - keys.normal = { - space = { - o = "file_picker_in_current_buffer_directory"; - esc = [ - "collapse_selection" - "keep_primary_selection" - ]; - }; - }; + homeManager.helix = + { + config, + lib, + pkgs, + ... + }: + { + home.sessionVariables = { + EDITOR = "hx"; }; - languages = { - language = [ - { - name = "nix"; + + programs.helix = { + enable = true; + settings = { + editor = { + file-picker.hidden = false; + idle-timeout = 0; + line-number = "relative"; + cursor-shape = { + normal = "underline"; + insert = "bar"; + select = "underline"; + }; + soft-wrap.enable = true; auto-format = true; - formatter.command = "nixfmt"; - } - { - name = "typst"; - auto-format = true; - formatter.command = "typstyle -c 1000 -i"; - } - ]; + indent-guides.render = true; + }; + keys.normal = { + space = { + o = "file_picker_in_current_buffer_directory"; + esc = [ + "collapse_selection" + "keep_primary_selection" + ]; + }; + }; + }; + languages = { + language = [ + { + name = "nix"; + auto-format = true; + formatter.command = "nixfmt"; + } + { + name = "typst"; + auto-format = true; + formatter.command = "typstyle -c 1000 -i"; + } + ]; + }; }; }; - }; + }; } diff --git a/aspects/cli/hm-cli.nix b/aspects/cli/hm-cli.nix index 7064a3f..97d79e4 100644 --- a/aspects/cli/hm-cli.nix +++ b/aspects/cli/hm-cli.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.homeManager.cli-base = + flake.modules.homeManager.hm-cli = { config, lib, diff --git a/aspects/cli/starship.nix b/aspects/cli/starship.nix index 7ba3a54..3ac5e4f 100644 --- a/aspects/cli/starship.nix +++ b/aspects/cli/starship.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.homeManager.cli-starship = + flake.modules.homeManager.starship = { config, lib, diff --git a/aspects/cli/tmux.nix b/aspects/cli/tmux.nix index 1238501..4937574 100644 --- a/aspects/cli/tmux.nix +++ b/aspects/cli/tmux.nix @@ -1,19 +1,29 @@ { ... }: { - flake.modules.homeManager.cli-tmux = - { - config, - lib, - pkgs, - ... - }: - { - programs.tmux = { - enable = true; - clock24 = true; - terminal = "xterm-256color"; - mouse = true; - keyMode = "vi"; + flake.modules = { + nixos.tmux = + { pkgs, ... }: + { + environment.systemPackages = with pkgs; [ + tmux + ]; }; - }; + + homeManager.tmux = + { + config, + lib, + pkgs, + ... + }: + { + programs.tmux = { + enable = true; + clock24 = true; + terminal = "xterm-256color"; + mouse = true; + keyMode = "vi"; + }; + }; + }; } diff --git a/aspects/common/programs.nix b/aspects/common/programs.nix index b53b293..ccdf185 100644 --- a/aspects/common/programs.nix +++ b/aspects/common/programs.nix @@ -8,13 +8,10 @@ ### Dev Tools ### git ### System Utilities ### - btop fastfetch - helix nixos-firewall-tool nvd sysz - tmux wget yazi ]; diff --git a/aspects/hosts/alexandria.nix b/aspects/hosts/alexandria.nix index 7da2c39..dedbed9 100644 --- a/aspects/hosts/alexandria.nix +++ b/aspects/hosts/alexandria.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ inputs, lib, ... }: { flake.nixosConfigurations.alexandria = inputs.nixpkgs-stable.lib.nixosSystem { @@ -13,39 +13,34 @@ inputs.self.overlays.default ]; } + ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_alexandria) + ] + ++ (with inputs.self.modules.nixos; [ + cli # Common aspects (always included) - inputs.self.modules.nixos.common-boot - inputs.self.modules.nixos.common-console - inputs.self.modules.nixos.common-firewall - inputs.self.modules.nixos.common-locale - inputs.self.modules.nixos.common-nix - inputs.self.modules.nixos.common-openssh - inputs.self.modules.nixos.common-programs - inputs.self.modules.nixos.common-security - inputs.self.modules.nixos.common-services - inputs.self.modules.nixos.common-tailscale + common-boot + common-console + common-firewall + common-locale + common-nix + common-openssh + common-programs + common-security + common-services + common-tailscale # User aspects - inputs.self.modules.nixos.user - inputs.self.modules.nixos.root + user + root # Server aspects - inputs.self.modules.nixos.server-boot - inputs.self.modules.nixos.server-nix - inputs.self.modules.nixos.server-tailscale + server-boot + server-nix + server-tailscale # Other aspects - inputs.self.modules.nixos.fwupd - inputs.self.modules.nixos.podman - - # Host-specific files (from _alexandria/) - ./_alexandria/hardware-configuration.nix - ./_alexandria/jellyfin.nix - ./_alexandria/nextcloud.nix - ./_alexandria/nginx.nix - ./_alexandria/unbound.nix - ./_alexandria/vaultwarden.nix - ]; + fwupd + ]); }; } diff --git a/aspects/hosts/io.nix b/aspects/hosts/io.nix index c6c3dbf..ee610fa 100644 --- a/aspects/hosts/io.nix +++ b/aspects/hosts/io.nix @@ -1,4 +1,5 @@ -{ inputs, self, ... }: +{ inputs, lib, ... }: + { flake.nixosConfigurations.io = inputs.nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -12,48 +13,43 @@ inputs.self.overlays.default ]; } - - # Common aspects (always included) - inputs.self.modules.nixos.common-boot - inputs.self.modules.nixos.common-console - inputs.self.modules.nixos.common-firewall - inputs.self.modules.nixos.common-locale - inputs.self.modules.nixos.common-nix - inputs.self.modules.nixos.common-openssh - inputs.self.modules.nixos.common-programs - inputs.self.modules.nixos.common-security - inputs.self.modules.nixos.common-services - inputs.self.modules.nixos.common-tailscale - - # User aspects - inputs.self.modules.nixos.user - inputs.self.modules.nixos.root - - # Desktop aspects - inputs.self.modules.nixos.desktop-boot - inputs.self.modules.nixos.desktop-desktop - inputs.self.modules.nixos.desktop-nix - inputs.self.modules.nixos.desktop-services - - # Other aspects based on tags - inputs.self.modules.nixos.ai - inputs.self.modules.nixos.bluetooth - inputs.self.modules.nixos.dev - inputs.self.modules.nixos.libvirtd - inputs.self.modules.nixos.networkmanager - inputs.self.modules.nixos.podman - - # Factory-generated ephemeral module + ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_io) (inputs.self.factory.ephemeral { rootDevice = "/dev/mapper/cryptroot"; }) + ] + ++ (with inputs.self.modules.nixos; [ + cli - # Host-specific files (from _io/) - ./_io/hardware-configuration.nix - ./_io/disko.nix - ./_io/boot.nix - ./_io/programs.nix - ./_io/services.nix - ]; + # Common aspects (always included) + common-boot + common-console + common-firewall + common-locale + common-nix + common-openssh + common-programs + common-security + common-services + common-tailscale + + # User aspects + user + root + + # Desktop aspects + desktop-boot + desktop-desktop + desktop-nix + desktop-services + + # Other aspects + ai + bluetooth + dev + libvirtd + networkmanager + podman + ]); }; } diff --git a/aspects/hosts/rotterdam.nix b/aspects/hosts/rotterdam.nix index 76ffbb0..4a91769 100644 --- a/aspects/hosts/rotterdam.nix +++ b/aspects/hosts/rotterdam.nix @@ -1,4 +1,5 @@ -{ inputs, ... }: +{ inputs, lib, ... }: + { flake.nixosConfigurations.rotterdam = inputs.nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -12,53 +13,48 @@ inputs.self.overlays.default ]; } - - # Common aspects (always included) - inputs.self.modules.nixos.common-boot - inputs.self.modules.nixos.common-console - inputs.self.modules.nixos.common-firewall - inputs.self.modules.nixos.common-locale - inputs.self.modules.nixos.common-nix - inputs.self.modules.nixos.common-openssh - inputs.self.modules.nixos.common-programs - inputs.self.modules.nixos.common-security - inputs.self.modules.nixos.common-services - inputs.self.modules.nixos.common-tailscale - - # User aspects - inputs.self.modules.nixos.user - inputs.self.modules.nixos.root - - # Desktop aspects - inputs.self.modules.nixos.desktop-boot - inputs.self.modules.nixos.desktop-desktop - inputs.self.modules.nixos.desktop-nix - inputs.self.modules.nixos.desktop-services - - # Other aspects based on tags - inputs.self.modules.nixos.ai - inputs.self.modules.nixos.bluetooth - inputs.self.modules.nixos.dev - inputs.self.modules.nixos.fwupd - inputs.self.modules.nixos.gaming-steam - inputs.self.modules.nixos.gaming-hardware - inputs.self.modules.nixos.gaming-flatpak - inputs.self.modules.nixos.gaming-launchers - inputs.self.modules.nixos.libvirtd - inputs.self.modules.nixos.networkmanager - inputs.self.modules.nixos.podman - - # Factory-generated ephemeral module + ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_rotterdam) (inputs.self.factory.ephemeral { rootDevice = "/dev/mapper/cryptroot"; }) + ] + ++ (with inputs.self.modules.nixos; [ + cli - # Host-specific files (from _rotterdam/) - ./_rotterdam/hardware-configuration.nix - ./_rotterdam/boot.nix - ./_rotterdam/hardware.nix - ./_rotterdam/programs.nix - ./_rotterdam/services.nix - ]; + # Common aspects (always included) + common-boot + common-console + common-firewall + common-locale + common-nix + common-openssh + common-programs + common-security + common-services + common-tailscale + + # User aspects + user + root + + # Desktop aspects + desktop-boot + desktop-desktop + desktop-nix + desktop-services + + # Other aspects based on tags + ai + bluetooth + dev + fwupd + gaming-steam + gaming-hardware + gaming-flatpak + gaming-launchers + libvirtd + networkmanager + podman + ]); }; } diff --git a/aspects/hosts/trantor.nix b/aspects/hosts/trantor.nix index 3de68a9..4b8b4b2 100644 --- a/aspects/hosts/trantor.nix +++ b/aspects/hosts/trantor.nix @@ -1,4 +1,4 @@ -{ inputs, self, ... }: +{ inputs, lib, ... }: { flake.nixosConfigurations.trantor = inputs.nixpkgs-stable.lib.nixosSystem { system = "aarch64-linux"; @@ -13,42 +13,36 @@ ]; } - # Common aspects (always included) - inputs.self.modules.nixos.common-boot - inputs.self.modules.nixos.common-console - inputs.self.modules.nixos.common-firewall - inputs.self.modules.nixos.common-locale - inputs.self.modules.nixos.common-nix - inputs.self.modules.nixos.common-openssh - inputs.self.modules.nixos.common-programs - inputs.self.modules.nixos.common-security - inputs.self.modules.nixos.common-services - inputs.self.modules.nixos.common-tailscale - - # User aspects - inputs.self.modules.nixos.user - inputs.self.modules.nixos.root - - # Server aspects - inputs.self.modules.nixos.server-boot - inputs.self.modules.nixos.server-nix - inputs.self.modules.nixos.server-tailscale - # Factory-generated ephemeral module (inputs.self.factory.ephemeral { rootDevice = "/dev/disk/by-id/scsi-360b207ed25d84372a95d1ecf842f8e20-part2"; }) - # Host-specific files (from _trantor/) - ./_trantor/hardware-configuration.nix - ./_trantor/disko.nix - ./_trantor/boot.nix - ./_trantor/fail2ban.nix - ./_trantor/forgejo.nix - ./_trantor/networking.nix - ./_trantor/nginx.nix - ./_trantor/openssh.nix - ./_trantor/unbound.nix - ]; + ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_trantor) + ] + ++ (with inputs.self.modules.nixos; [ + cli + + # Common aspects (always included) + common-boot + common-console + common-firewall + common-locale + common-nix + common-openssh + common-programs + common-security + common-services + common-tailscale + + # User aspects + user + root + + # Server aspects + server-boot + server-nix + server-tailscale + ]); }; }