This commit is contained in:
William 2026-02-12 18:50:38 -03:00
parent 7309074f25
commit 8f98f7d420
45 changed files with 932 additions and 723 deletions

View file

@ -1,9 +1,11 @@
{ ... }:
{
flake.modules.nixos.ai = { inputs, pkgs, ... }: {
flake.modules.nixos.ai =
{ inputs, pkgs, ... }:
{
environment.systemPackages =
(with pkgs; [claude-desktop]) ++
(with inputs.nix-ai-tools.packages.${pkgs.system}; [
(with pkgs; [ claude-desktop ])
++ (with inputs.nix-ai-tools.packages.${pkgs.system}; [
claude-code
claudebox
opencode

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.nixos.bluetooth = { config, lib, pkgs, ... }: {
flake.modules.nixos.bluetooth =
{
config,
lib,
pkgs,
...
}:
{
hardware.bluetooth.enable = true;
};
}

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.cli-btop = { config, lib, pkgs, ... }: {
flake.modules.homeManager.cli-btop =
{
config,
lib,
pkgs,
...
}:
{
programs.btop = {
enable = true;
settings = {

View file

@ -1,6 +1,14 @@
{ ... }:
{
flake.modules.homeManager.cli-comma = { config, lib, pkgs, inputs, ... }: {
flake.modules.homeManager.cli-comma =
{
config,
lib,
pkgs,
inputs,
...
}:
{
imports = [ inputs.nix-index-database.homeModules.nix-index ];
programs.nix-index-database.comma.enable = true;

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.cli-direnv = { config, lib, pkgs, ... }: {
flake.modules.homeManager.cli-direnv =
{
config,
lib,
pkgs,
...
}:
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.cli-helix = { config, lib, pkgs, ... }: {
flake.modules.homeManager.cli-helix =
{
config,
lib,
pkgs,
...
}:
{
home.sessionVariables = {
EDITOR = "hx";
};

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.cli-base = { config, lib, pkgs, ... }: {
flake.modules.homeManager.cli-base =
{
config,
lib,
pkgs,
...
}:
{
home = {
packages = with pkgs; [ hm-cli ];
sessionVariables = {

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.cli-starship = { config, lib, pkgs, ... }: {
flake.modules.homeManager.cli-starship =
{
config,
lib,
pkgs,
...
}:
{
programs.starship = {
enable = true;
enableBashIntegration = true;

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.cli-tmux = { config, lib, pkgs, ... }: {
flake.modules.homeManager.cli-tmux =
{
config,
lib,
pkgs,
...
}:
{
programs.tmux = {
enable = true;
clock24 = true;

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-boot = { pkgs, ... }: {
flake.modules.nixos.common-boot =
{ pkgs, ... }:
{
boot = {
loader = {
timeout = 1;

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-console = { ... }: {
flake.modules.nixos.common-console =
{ ... }:
{
console = {
useXkbConfig = true;
earlySetup = true;

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-firewall = { ... }: {
flake.modules.nixos.common-firewall =
{ ... }:
{
networking = {
firewall.enable = true;
nftables.enable = true;

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-locale = { ... }: {
flake.modules.nixos.common-locale =
{ ... }:
{
time.timeZone = "America/Bahia";
i18n = {

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-nix = { inputs, ... }: {
flake.modules.nixos.common-nix =
{ inputs, ... }:
{
imports = [ inputs.nixos-cli.nixosModules.nixos-cli ];
nix = {

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-openssh = { ... }: {
flake.modules.nixos.common-openssh =
{ ... }:
{
services.openssh = {
enable = true;
settings.PermitRootLogin = "no";

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-services = { ... }: {
flake.modules.nixos.common-services =
{ ... }:
{
services = {
dbus.implementation = "broker";
irqbalance.enable = true;

View file

@ -1,6 +1,8 @@
{ ... }:
{
flake.modules.nixos.common-tailscale = { ... }: {
flake.modules.nixos.common-tailscale =
{ ... }:
{
services.tailscale = {
enable = true;
extraUpFlags = [ "--operator=user" ];

View file

@ -54,12 +54,15 @@ let
sharedData = import ../data/services.nix;
# Enrich services with host IP information
enrichServices = hosts: services:
map (svc:
enrichServices =
hosts: services:
map (
svc:
let
hostInfo = hosts.${svc.host} or { };
in
svc // {
svc
// {
lanIP = hostInfo.lanIP or null;
tailscaleIP = hostInfo.tailscaleIP or null;
}
@ -94,9 +97,11 @@ in
lib = {
# Nginx virtual host utilities
mkNginxVHosts = { domains }:
mkNginxVHosts =
{ domains }:
let
mkVHostConfig = domain: vhostConfig:
mkVHostConfig =
domain: vhostConfig:
lib.recursiveUpdate {
useACMEHost = domain;
forceSSL = true;
@ -107,7 +112,8 @@ in
# Split DNS utilities for unbound
# Generates unbound view config from a list of DNS entries
mkSplitDNS = entries:
mkSplitDNS =
entries:
let
tailscaleData = map (e: ''"${e.domain}. IN A ${e.tailscaleIP}"'') entries;
lanData = map (e: ''"${e.domain}. IN A ${e.lanIP}"'') entries;

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.nixos.desktop-boot = { config, lib, pkgs, ... }: {
flake.modules.nixos.desktop-boot =
{
config,
lib,
pkgs,
...
}:
{
boot = {
plymouth.enable = true;
initrd.systemd.enable = true;

View file

@ -4,7 +4,14 @@
}:
{
flake.modules = {
nixos.desktop-desktop = { config, lib, pkgs, ... }: {
nixos.desktop-desktop =
{
config,
lib,
pkgs,
...
}:
{
imports = [
inputs.niri-flake.nixosModules.niri
inputs.nix-flatpak.nixosModules.nix-flatpak
@ -160,7 +167,15 @@
};
};
homeManager.desktop-desktop = { config, lib, pkgs, inputs, ... }: {
homeManager.desktop-desktop =
{
config,
lib,
pkgs,
inputs,
...
}:
{
imports = [ inputs.vicinae.homeManagerModules.default ];
fonts.fontconfig.enable = true;

View file

@ -1,6 +1,14 @@
{ ... }:
{
flake.modules.homeManager.desktop-niri = { config, lib, pkgs, inputs, hostname ? null, ... }:
flake.modules.homeManager.desktop-niri =
{
config,
lib,
pkgs,
inputs,
hostname ? null,
...
}:
let
isRotterdam = hostname == "rotterdam";
in

View file

@ -1,6 +1,13 @@
{ inputs, ... }:
{
flake.modules.nixos.desktop-nix = { config, lib, pkgs, ... }: {
flake.modules.nixos.desktop-nix =
{
config,
lib,
pkgs,
...
}:
{
environment.etc."channels/nixpkgs".source = inputs.nixpkgs.outPath;
nix = {

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.nixos.desktop-services = { config, lib, pkgs, ... }: {
flake.modules.nixos.desktop-services =
{
config,
lib,
pkgs,
...
}:
{
services = {
printing.enable = true;
udev.packages = with pkgs; [ yubikey-personalization ];

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.nixos.dev = { config, lib, pkgs, ... }: {
flake.modules.nixos.dev =
{
config,
lib,
pkgs,
...
}:
{
environment.systemPackages = with pkgs; [
android-tools
bat

View file

@ -3,7 +3,8 @@
{ inputs, ... }:
{
# Base module with options (for external flakes or direct use)
flake.modules.nixos.ephemeral = { lib, config, ... }:
flake.modules.nixos.ephemeral =
{ lib, config, ... }:
let
cfg = config.ephemeral;
in
@ -89,18 +90,19 @@
# Factory function that generates configured modules
flake.factory.ephemeral =
{ rootDevice
, rootSubvolume ? "@root"
, retentionDays ? 30
, persistentStoragePath ? "/persistent"
, persistentFiles ? [
{
rootDevice,
rootSubvolume ? "@root",
retentionDays ? 30,
persistentStoragePath ? "/persistent",
persistentFiles ? [
"/etc/machine-id"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
]
, persistentDirectories ? [
],
persistentDirectories ? [
"/etc/NetworkManager/system-connections"
"/etc/nixos"
"/var/lib/bluetooth"
@ -111,9 +113,10 @@
"/var/lib/systemd/timers"
"/var/lib/tailscale"
"/var/log"
]
],
}:
{ ... }: {
{ ... }:
{
imports = [
inputs.impermanence.nixosModules.impermanence
inputs.self.modules.nixos.ephemeral

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.nixos.fwupd = { config, lib, pkgs, ... }: {
flake.modules.nixos.fwupd =
{
config,
lib,
pkgs,
...
}:
{
services.fwupd.enable = true;
};
}

View file

@ -1,7 +1,9 @@
{ ... }:
{
flake.modules.nixos.gaming-flatpak = { pkgs, ... }: {
flake.modules.nixos.gaming-flatpak =
{ pkgs, ... }:
{
services.flatpak.packages = [
"com.github.k4zmu2a.spacecadetpinball"
"com.steamgriddb.SGDBoop"

View file

@ -1,7 +1,9 @@
{ ... }:
{
flake.modules.nixos.gaming-hardware = { ... }: {
flake.modules.nixos.gaming-hardware =
{ ... }:
{
hardware = {
xpadneo.enable = true;
steam-hardware.enable = true; # Allow steam client to manage controllers

View file

@ -1,7 +1,9 @@
{ ... }:
{
flake.modules.nixos.gaming-launchers = { pkgs, ... }: {
flake.modules.nixos.gaming-launchers =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
clonehero
heroic

View file

@ -2,13 +2,17 @@
{
flake.modules = {
nixos.gaming-mangohud = { pkgs, ... }: {
nixos.gaming-mangohud =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
mangohud
];
};
homeManager.gaming-mangohud = { config, ... }: {
homeManager.gaming-mangohud =
{ config, ... }:
{
programs.mangohud = {
enable = true;
enableSessionWide = true;

View file

@ -1,7 +1,9 @@
{ ... }:
{
flake.modules.nixos.gaming-steam = { pkgs, ... }: {
flake.modules.nixos.gaming-steam =
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
steam-run
];

View file

@ -34,8 +34,7 @@ in
# LAN-only DNS records
local-zone = ''"baduhai.dev." transparent'';
local-data = map (e: ''"${e.domain}. IN A ${e.lanIP}"'')
(lib.filter (e: e.lanIP != null) services);
local-data = map (e: ''"${e.domain}. IN A ${e.lanIP}"'') (lib.filter (e: e.lanIP != null) services);
};
forward-zone = [

View file

@ -9,9 +9,7 @@ let
services = inputs.self.services;
# Get all unique domains from shared services on trantor (host = "trantor")
localDomains = lib.unique (
map (s: s.domain) (lib.filter (s: s.host == "trantor") services)
);
localDomains = lib.unique (map (s: s.domain) (lib.filter (s: s.host == "trantor") services));
# Generate ACME cert configs for all local domains
acmeCerts = lib.genAttrs localDomains (domain: {

View file

@ -1,4 +1,5 @@
{ inputs, self, ... }:
{
flake.nixosConfigurations.alexandria = inputs.nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.nixos.libvirtd = { config, lib, pkgs, ... }: {
flake.modules.nixos.libvirtd =
{
config,
lib,
pkgs,
...
}:
{
virtualisation = {
libvirtd.enable = true;
spiceUSBRedirection.enable = true;

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.nixos.networkmanager = { config, lib, pkgs, ... }: {
flake.modules.nixos.networkmanager =
{
config,
lib,
pkgs,
...
}:
{
networking.networkmanager = {
enable = true;
wifi.backend = "iwd";

View file

@ -1,7 +1,14 @@
# aspects/server/boot.nix
{ ... }:
{
flake.modules.nixos.server-boot = { config, lib, pkgs, ... }: {
flake.modules.nixos.server-boot =
{
config,
lib,
pkgs,
...
}:
{
boot.kernelPackages = pkgs.linuxPackages_hardened;
};
}

View file

@ -1,7 +1,14 @@
# aspects/server/nix.nix
{ inputs, ... }:
{
flake.modules.nixos.server-nix = { config, lib, pkgs, ... }: {
flake.modules.nixos.server-nix =
{
config,
lib,
pkgs,
...
}:
{
environment.etc."channels/nixpkgs".source = inputs.nixpkgs-stable.outPath;
nix = {

View file

@ -1,7 +1,14 @@
# aspects/server/tailscale.nix
{ ... }:
{
flake.modules.nixos.server-tailscale = { config, lib, pkgs, ... }: {
flake.modules.nixos.server-tailscale =
{
config,
lib,
pkgs,
...
}:
{
services.tailscale = {
extraSetFlags = [ "--advertise-exit-node" ];
useRoutingFeatures = "server";

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.shell-bash = { config, lib, pkgs, ... }: {
flake.modules.homeManager.shell-bash =
{
config,
lib,
pkgs,
...
}:
{
programs.bash = {
enable = true;
historyFile = "~/.cache/bash_history";

View file

@ -1,6 +1,13 @@
{ ... }:
{
flake.modules.homeManager.shell-fish = { config, lib, pkgs, ... }: {
flake.modules.homeManager.shell-fish =
{
config,
lib,
pkgs,
...
}:
{
programs.fish = {
enable = true;
interactiveShellInit = ''

View file

@ -18,7 +18,8 @@
};
src =
srcs.${pkgs.stdenv.hostPlatform.system} or (throw "Unsupported system: ${pkgs.stdenv.hostPlatform.system}");
srcs.${pkgs.stdenv.hostPlatform.system}
or (throw "Unsupported system: ${pkgs.stdenv.hostPlatform.system}");
claudeNativeStub = ''
// Stub implementation of claude-native using KeyboardKey enum values

View file

@ -4,19 +4,20 @@ let
packageDir = builtins.readDir ./.;
# Filter to .nix files, excluding overlays.nix
isPackageFile = name:
name != "overlays.nix" && builtins.match ".*\\.nix$" name != null;
isPackageFile = name: name != "overlays.nix" && builtins.match ".*\\.nix$" name != null;
# Extract package name from filename (e.g., "foo-bar.nix" -> "foo-bar")
toPackageName = filename:
builtins.head (builtins.match "(.+)\\.nix$" filename);
toPackageName = filename: builtins.head (builtins.match "(.+)\\.nix$" filename);
packageNames = map toPackageName (builtins.filter isPackageFile (builtins.attrNames packageDir));
in
{
flake.overlays.default = final: prev:
builtins.listToAttrs (map (name: {
flake.overlays.default =
final: prev:
builtins.listToAttrs (
map (name: {
inherit name;
value = inputs.self.packages.${final.system}.${name};
}) packageNames);
}) packageNames
);
}

View file

@ -8,9 +8,12 @@
terranix.terranixConfigurations.cloudflare-kernelpanicspace = {
terraformWrapper.package = pkgs.opentofu;
modules = [
({ config, ... }: {
(
{ config, ... }:
{
# Terraform config goes here
})
}
)
];
};
};

View file

@ -8,9 +8,12 @@
terranix.terranixConfigurations.oci-terminus = {
terraformWrapper.package = pkgs.opentofu;
modules = [
({ config, ... }: {
(
{ config, ... }:
{
# Terraform config goes here
})
}
)
];
};
};