From 5d1b54c8bfc6bb2a0a82de70b20c5c2c64476f49 Mon Sep 17 00:00:00 2001 From: William Date: Sun, 15 Feb 2026 14:20:57 -0300 Subject: [PATCH] common aspects reworked into base aspect --- .../{common/programs.nix => base/base.nix} | 34 ++++++++++++------- aspects/{common => base}/boot.nix | 2 +- aspects/{common => base}/console.nix | 2 +- aspects/{common => base}/firewall.nix | 2 +- aspects/{common => base}/locale.nix | 2 +- aspects/{common => base}/nix.nix | 2 +- aspects/{common => base}/security.nix | 2 +- aspects/base/ssh.nix | 32 +++++++++++++++++ aspects/common/openssh.nix | 14 -------- aspects/common/services.nix | 12 ------- aspects/common/tailscale.nix | 11 ------ aspects/hosts/alexandria.nix | 16 ++------- aspects/hosts/io.nix | 16 ++------- aspects/hosts/rotterdam.nix | 16 ++------- aspects/hosts/trantor.nix | 21 +++--------- 15 files changed, 72 insertions(+), 112 deletions(-) rename aspects/{common/programs.nix => base/base.nix} (56%) rename aspects/{common => base}/boot.nix (92%) rename aspects/{common => base}/console.nix (75%) rename aspects/{common => base}/firewall.nix (76%) rename aspects/{common => base}/locale.nix (93%) rename aspects/{common => base}/nix.nix (96%) rename aspects/{common => base}/security.nix (81%) create mode 100644 aspects/base/ssh.nix delete mode 100644 aspects/common/openssh.nix delete mode 100644 aspects/common/services.nix delete mode 100644 aspects/common/tailscale.nix diff --git a/aspects/common/programs.nix b/aspects/base/base.nix similarity index 56% rename from aspects/common/programs.nix rename to aspects/base/base.nix index ccdf185..08841b2 100644 --- a/aspects/common/programs.nix +++ b/aspects/base/base.nix @@ -1,16 +1,22 @@ -{ ... }: +{ inputs, ... }: { - flake.modules.nixos.common-programs = + flake.modules.nixos.base = { lib, pkgs, ... }: { + imports = with inputs.self.modules.nixos; [ + boot + console + firewall + locale + nix + security + ssh + ]; environment = { systemPackages = with pkgs; [ - ### Dev Tools ### git - ### System Utilities ### fastfetch nixos-firewall-tool - nvd sysz wget yazi @@ -26,14 +32,16 @@ command-not-found.enable = false; fish = { enable = true; - interactiveShellInit = '' - set fish_greeting - if set -q SSH_CONNECTION; and not set -q IN_NIX_SHELL; or not set -q TMUX - export TERM=xterm-256color - clear - fastfetch - end - ''; + }; + }; + + services = { + dbus.implementation = "broker"; + irqbalance.enable = true; + fstrim.enable = true; + tailscale = { + enable = true; + extraUpFlags = [ "--operator=user" ]; }; }; }; diff --git a/aspects/common/boot.nix b/aspects/base/boot.nix similarity index 92% rename from aspects/common/boot.nix rename to aspects/base/boot.nix index b74b68c..ec8593d 100644 --- a/aspects/common/boot.nix +++ b/aspects/base/boot.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.nixos.common-boot = + flake.modules.nixos.boot = { pkgs, ... }: { boot = { diff --git a/aspects/common/console.nix b/aspects/base/console.nix similarity index 75% rename from aspects/common/console.nix rename to aspects/base/console.nix index 128b914..6bb7be4 100644 --- a/aspects/common/console.nix +++ b/aspects/base/console.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.nixos.common-console = + flake.modules.nixos.console = { ... }: { console = { diff --git a/aspects/common/firewall.nix b/aspects/base/firewall.nix similarity index 76% rename from aspects/common/firewall.nix rename to aspects/base/firewall.nix index 0e5297d..68ffa6e 100644 --- a/aspects/common/firewall.nix +++ b/aspects/base/firewall.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.nixos.common-firewall = + flake.modules.nixos.firewall = { ... }: { networking = { diff --git a/aspects/common/locale.nix b/aspects/base/locale.nix similarity index 93% rename from aspects/common/locale.nix rename to aspects/base/locale.nix index a6b5754..4d0c716 100644 --- a/aspects/common/locale.nix +++ b/aspects/base/locale.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.nixos.common-locale = + flake.modules.nixos.locale = { ... }: { time.timeZone = "America/Bahia"; diff --git a/aspects/common/nix.nix b/aspects/base/nix.nix similarity index 96% rename from aspects/common/nix.nix rename to aspects/base/nix.nix index 7fa6e49..16397a9 100644 --- a/aspects/common/nix.nix +++ b/aspects/base/nix.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.nixos.common-nix = + flake.modules.nixos.nix = { inputs, ... }: { imports = [ inputs.nixos-cli.nixosModules.nixos-cli ]; diff --git a/aspects/common/security.nix b/aspects/base/security.nix similarity index 81% rename from aspects/common/security.nix rename to aspects/base/security.nix index 2ad04a0..310e345 100644 --- a/aspects/common/security.nix +++ b/aspects/base/security.nix @@ -1,6 +1,6 @@ { ... }: { - flake.modules.nixos.common-security = + flake.modules.nixos.security = { ... }: { security.sudo = { diff --git a/aspects/base/ssh.nix b/aspects/base/ssh.nix new file mode 100644 index 0000000..03fa556 --- /dev/null +++ b/aspects/base/ssh.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + flake.modules.nixos.ssh = + { ... }: + { + services.openssh = { + enable = true; + settings.PermitRootLogin = "no"; + extraConfig = '' + PrintLastLog no + ''; + }; + programs = { + bash.interactiveShellInit = '' + if { [ -n "$SSH_CONNECTION" ] && [ -z "$IN_NIX_SHELL" ]; } || [ -z "$TMUX" ]; then + export TERM=xterm-256color + clear + fastfetch + fi + ''; + fish.interactiveShellInit = '' + set fish_greeting + if set -q SSH_CONNECTION; and not set -q IN_NIX_SHELL; or not set -q TMUX + export TERM=xterm-256color + clear + fastfetch + end + ''; + }; + }; +} diff --git a/aspects/common/openssh.nix b/aspects/common/openssh.nix deleted file mode 100644 index b8179f2..0000000 --- a/aspects/common/openssh.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.common-openssh = - { ... }: - { - services.openssh = { - enable = true; - settings.PermitRootLogin = "no"; - extraConfig = '' - PrintLastLog no - ''; - }; - }; -} diff --git a/aspects/common/services.nix b/aspects/common/services.nix deleted file mode 100644 index e05dcf0..0000000 --- a/aspects/common/services.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.common-services = - { ... }: - { - services = { - dbus.implementation = "broker"; - irqbalance.enable = true; - fstrim.enable = true; - }; - }; -} diff --git a/aspects/common/tailscale.nix b/aspects/common/tailscale.nix deleted file mode 100644 index 74381ac..0000000 --- a/aspects/common/tailscale.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.common-tailscale = - { ... }: - { - services.tailscale = { - enable = true; - extraUpFlags = [ "--operator=user" ]; - }; - }; -} diff --git a/aspects/hosts/alexandria.nix b/aspects/hosts/alexandria.nix index dedbed9..d05639d 100644 --- a/aspects/hosts/alexandria.nix +++ b/aspects/hosts/alexandria.nix @@ -16,21 +16,11 @@ ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_alexandria) ] ++ (with inputs.self.modules.nixos; [ + # system aspects + base 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 aspects user root diff --git a/aspects/hosts/io.nix b/aspects/hosts/io.nix index ee610fa..6163244 100644 --- a/aspects/hosts/io.nix +++ b/aspects/hosts/io.nix @@ -19,21 +19,11 @@ }) ] ++ (with inputs.self.modules.nixos; [ + # system aspects + base 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 aspects user root diff --git a/aspects/hosts/rotterdam.nix b/aspects/hosts/rotterdam.nix index 4a91769..77ffe54 100644 --- a/aspects/hosts/rotterdam.nix +++ b/aspects/hosts/rotterdam.nix @@ -19,21 +19,11 @@ }) ] ++ (with inputs.self.modules.nixos; [ + # system aspects + base 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 aspects user root diff --git a/aspects/hosts/trantor.nix b/aspects/hosts/trantor.nix index 4b8b4b2..e7934ab 100644 --- a/aspects/hosts/trantor.nix +++ b/aspects/hosts/trantor.nix @@ -12,30 +12,17 @@ inputs.self.overlays.default ]; } - - # Factory-generated ephemeral module + ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_trantor) (inputs.self.factory.ephemeral { rootDevice = "/dev/disk/by-id/scsi-360b207ed25d84372a95d1ecf842f8e20-part2"; }) - - ((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_trantor) ] ++ (with inputs.self.modules.nixos; [ + # system aspects + base 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 aspects user root