improvements

This commit is contained in:
Henri Dohmen 2025-12-30 20:58:52 +01:00
parent 91def25bca
commit be09397818
Signed by: hd
GPG key ID: AB79213B044674AE
6 changed files with 70 additions and 54 deletions

View file

@ -1 +1,32 @@
# My NixOS Configuration
# Nix Configurations
Repository structure:
- **host/**
One subdirectory per NixOS host, each containing its host-specific configuration.
- **mod/**
NixOS modules.
- **mod/common/**: Modules enabled by default on all hosts.
- **mod/desktop/**: Modules enabled on desktop hosts (i.e. hosts with `hd.desktop.enable = true`).
- **home/**
Home Manager modules. Home Manager is integrated into the system configuration via the `home` option defined in `mod/desktop/default.nix`.
- **bin/**
Helper scripts for generating parts of the configuration.
- **dotfiles/**
Raw configuration files deployed using Home Manager.
- **devshells/**
Nix development shells.
- **pki/**
Certificates used by the configuration.
- **secrets/**
Age-encrypted secrets managed and deployed via agenix.
- **var/**
Shared constants and values used across the configuration.

View file

@ -62,53 +62,27 @@
;
secrets = lib'.walk-dir ./secrets;
};
overlays = _: {
nixpkgs.overlays = [
vscode-extensions.overlays.default
colmena.overlay
mkDesktop =
host:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = specialArgs // {
inherit host;
};
modules = [
(./host + "/${host}")
./home
./mod
];
};
in
{
nixosConfigurations = {
"solo" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = specialArgs // {
host = "solo";
};
modules = [
./host/solo
./home
./mod
overlays
];
};
"c2" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = specialArgs // {
host = "c2";
};
modules = [
./host/c2
./home
./mod
overlays
];
};
"fw" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = specialArgs // {
host = "fw";
};
modules = [
./host/fw
./home
./mod
overlays
];
};
# if you add a host, make sure to add it to var/default.nix as well
"solo" = mkDesktop "solo";
"c2" = mkDesktop "c2";
"fw" = mkDesktop "fw";
};
colmenaHive = colmena.lib.makeHive {
@ -126,7 +100,6 @@
imports = [
./host/roam
./mod
overlays
];
};
};

View file

@ -59,6 +59,7 @@ with lib;
inputs.agenix.nixosModules.default
./locale.nix
./nix.nix
./overlays.nix
./security.nix
./shell.nix
./users.nix

7
mod/common/overlays.nix Normal file
View file

@ -0,0 +1,7 @@
{ inputs, ... }:
{
nixpkgs.overlays = with inputs; [
vscode-extensions.overlays.default
colmena.overlay
];
}

View file

@ -13,7 +13,7 @@ let
is-server = this == "roam";
devices = lib.attrNames var.syncthing.all;
desktop-devices = (lib.intersectLists var.desktops devices);
desktop-devices = (lib.intersectLists var.nixos-desktops devices);
folders = folders-all // (if config.hd.desktop.enable then folders-desktop else { });

View file

@ -8,19 +8,23 @@ let
var = outputs;
};
load-var = x: import x inputs';
# watch out for cycles
outputs = rec {
"lan-dns" = load-var ./lan-dns.nix;
"ssh-keys" = load-var ./ssh-keys.nix;
"wg" = load-var ./wg.nix;
"syncthing" = load-var ./syncthing.nix;
desktops = [
# We list the hosts here manually instead of getting them from the flake.
# This way, var can be used standalone
nixos-desktops = [
"c2"
"fw"
"solo"
];
servers = [ "roam" ];
clients = desktops ++ servers;
nixos-servers = [ "roam" ];
nixos-hosts = nixos-desktops ++ nixos-servers;
"lan-dns" = load-var ./lan-dns.nix;
"ssh-keys" = load-var ./ssh-keys.nix;
"wg" = load-var ./wg.nix;
"syncthing" = load-var ./syncthing.nix;
};
in
outputs