refactor: simplify host setup

This commit is contained in:
Nickolaj Jepsen 2025-12-13 21:41:52 +01:00
parent 15fb616845
commit d1d4082d56
27 changed files with 147 additions and 90 deletions

View file

@ -2,6 +2,7 @@ _: {
options.fireproof.base = {};
imports = [
./fireproof.nix
./defaults.nix
./gc.nix
./home-manager.nix

View file

@ -0,0 +1,12 @@
{lib, ...}: {
options.fireproof = {
hostname = lib.mkOption {
type = lib.types.str;
description = "The hostname of the machine";
};
username = lib.mkOption {
type = lib.types.str;
description = "The primary username for the machine";
};
};
}

View file

@ -1,10 +1,12 @@
{
lib,
config,
options,
username,
...
}:
with lib; {
with lib; let
inherit (config.fireproof) username;
in {
options.fireproof = {
home-manager = lib.mkOption {
type = options.home-manager.users.type.nestedTypes.elemType;

View file

@ -1,9 +1,11 @@
{username, ...}: {
{config, ...}: {
nixpkgs.config.allowUnfree = true;
nix.settings = {
trusted-users = [
"root"
"@wheel"
username
config.fireproof.username
];
experimental-features = "nix-command flakes";

View file

@ -1,4 +1,5 @@
{hostname, ...}: let
{config, ...}: let
inherit (config.fireproof) hostname;
hostSecrets = ../../secrets/hosts + ("/" + hostname);
publicKey = builtins.readFile (hostSecrets + "/id_ed25519.pub");
in {