vm + cleanup

This commit is contained in:
Henri Dohmen 2026-02-06 20:06:09 +01:00
parent 53ecce03bd
commit 17b4945451
Signed by: hd
GPG key ID: AB79213B044674AE
5 changed files with 77 additions and 52 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

View file

@ -111,7 +111,21 @@
"c2" "c2"
"fw" "fw"
] ]
); )
// {
"test-vm" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
inherit specialArgs;
modules = [
{
imports = [
./mod
./host/test-vm
];
}
];
};
};
colmenaHive = colmena.lib.makeHive { colmenaHive = colmena.lib.makeHive {
meta = { meta = {

38
host/test-vm/default.nix Normal file
View file

@ -0,0 +1,38 @@
{ pkgs, ... }:
{
networking.hostName = "test-vm";
services.syncthing.enable = false;
hd.common.users.enable = false; # default user depends on age
users = {
mutableUsers = false;
users."hd" = {
description = "Henri";
isNormalUser = true;
createHome = true;
home = "/home/hd";
extraGroups = [ "wheel" ];
shell = pkgs.fish;
packages = [ ];
password = "";
};
users.root.hashedPassword = "!";
};
boot = {
loader = {
efi.canTouchEfiVariables = true;
grub = {
enable = true;
efiSupport = true;
device = "nodev";
};
};
kernelPackages = pkgs.linuxPackages_6_12;
initrd.systemd.network.wait-online.enable = false;
};
# ====== DON'T CHANGE ======
system.stateVersion = "24.11";
}

View file

@ -6,6 +6,15 @@
... ...
}: }:
with lib; with lib;
let
mkCommonOption =
name:
mkOption {
type = types.bool;
default = config.hd.common.enable;
description = "Enables" ++ name;
};
in
{ {
options.hd.common.enable = mkOption { options.hd.common.enable = mkOption {
type = types.bool; type = types.bool;
@ -14,45 +23,12 @@ with lib;
}; };
options.hd.common = { options.hd.common = {
locale = { locale.enable = mkCommonOption "locale settings";
enable = mkOption { nix.enable = mkCommonOption "nix settings";
type = types.bool; security.enable = mkCommonOption "security settings";
default = config.hd.common.enable; shell.enable = mkCommonOption "shell utilities";
description = "Enable locale settings"; users.enable = mkCommonOption "default users";
}; secrets.enable = mkCommonOption "agenix secrets";
};
nix = {
enable = mkOption {
type = types.bool;
default = config.hd.common.enable;
description = "Enable Nix-related configuration";
};
};
security = {
enable = mkOption {
type = types.bool;
default = config.hd.common.enable;
description = "Enable security-related configuration";
};
};
shell = {
enable = mkOption {
type = types.bool;
default = config.hd.common.enable;
description = "Enable basic shell utilities";
};
};
users = {
enable = mkOption {
type = types.bool;
default = config.hd.common.enable;
description = "Enable default user accounts";
};
};
}; };
imports = [ imports = [

View file

@ -55,16 +55,12 @@ in
group = config.services.syncthing.group; group = config.services.syncthing.group;
}; };
services.syncthing = lib.mkIf cfg.enable ( services.syncthing = lib.mkIf cfg.enable ({
assert lib.assertMsg (builtins.elem this var.syncthing.device-names.all) settings = {
"${this} is not in devices in mod/syncthing.nix"; inherit folders;
{ devices = var.syncthing.devices;
settings = { };
inherit folders; key = lib.optionalAttrs is-managed config.age.secrets.syncthing-key.path;
devices = var.syncthing.devices; cert = lib.optionalAttrs is-managed "${../pki/syncthing + "/${this}.cert"}";
}; });
key = lib.optionalAttrs is-managed config.age.secrets.syncthing-key.path;
cert = lib.optionalAttrs is-managed "${../pki/syncthing + "/${this}.cert"}";
}
);
} }