From f5c44965a887e7e951041727ba86805a8638e735 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 6 Feb 2026 22:36:22 -0300 Subject: [PATCH] add aspects/server/ NixOS modules Server-specific NixOS configuration: boot, nix, tailscale Co-Authored-By: Claude Opus 4.5 --- aspects/server/boot.nix | 10 ++++++++++ aspects/server/nix.nix | 18 ++++++++++++++++++ aspects/server/tailscale.nix | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 aspects/server/boot.nix create mode 100644 aspects/server/nix.nix create mode 100644 aspects/server/tailscale.nix diff --git a/aspects/server/boot.nix b/aspects/server/boot.nix new file mode 100644 index 0000000..68397f2 --- /dev/null +++ b/aspects/server/boot.nix @@ -0,0 +1,10 @@ +# aspects/server/boot.nix +{ inputs, ... }: +{ + flake.modules.nixos.server-boot = { config, lib, pkgs, ... }: { + # Import parent aspect for inheritance + imports = [ inputs.self.modules.nixos.common-boot ]; + + boot.kernelPackages = pkgs.linuxPackages_hardened; + }; +} diff --git a/aspects/server/nix.nix b/aspects/server/nix.nix new file mode 100644 index 0000000..b22565c --- /dev/null +++ b/aspects/server/nix.nix @@ -0,0 +1,18 @@ +# aspects/server/nix.nix +{ inputs, ... }: +{ + flake.modules.nixos.server-nix = { config, lib, pkgs, ... }: { + # Import parent aspect for inheritance + imports = [ inputs.self.modules.nixos.common-nix ]; + + environment.etc."channels/nixpkgs".source = inputs.nixpkgs-stable.outPath; + + nix = { + registry.nixpkgs.flake = inputs.nixpkgs-stable; + nixPath = [ + "nixpkgs=/etc/channels/nixpkgs" + "/nix/var/nix/profiles/per-user/root/channels" + ]; + }; + }; +} diff --git a/aspects/server/tailscale.nix b/aspects/server/tailscale.nix new file mode 100644 index 0000000..433494c --- /dev/null +++ b/aspects/server/tailscale.nix @@ -0,0 +1,18 @@ +# aspects/server/tailscale.nix +{ inputs, ... }: +{ + flake.modules.nixos.server-tailscale = { config, lib, pkgs, ... }: { + # Import parent aspect for inheritance + imports = [ inputs.self.modules.nixos.common-tailscale ]; + + services.tailscale = { + extraSetFlags = [ "--advertise-exit-node" ]; + useRoutingFeatures = "server"; + }; + + boot.kernel.sysctl = { + "net.ipv4.ip_forward" = 1; + "net.ipv6.conf.all.forwarding" = 1; + }; + }; +}