feat: add host device type metadata

This commit is contained in:
2026-04-21 01:42:32 +02:00
parent 4008fde198
commit 2572022349
6 changed files with 13 additions and 32 deletions
+3 -4
View File
@@ -3,13 +3,12 @@
flake.modules.nixos.openssh =
{
config,
hostType ? "desktop",
lib,
host ? {
isServer = false;
},
...
}:
let
isServer = hostType == "server";
hostUserNames = builtins.attrNames (
lib.filterAttrs (_: user: user.isNormalUser or false) config.users.users
);
@@ -17,7 +16,7 @@
{
services.openssh = {
enable = true;
openFirewall = host.isServer;
openFirewall = isServer;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
+1 -6
View File
@@ -9,13 +9,8 @@ in
{
flake.modules.nixos.orion =
{ pkgs, ... }:
let
host = {
isServer = true;
};
in
{
_module.args.host = host;
_module.args.hostType = "server";
imports = [
inputs.home-manager.nixosModules.home-manager
+1 -6
View File
@@ -14,13 +14,8 @@ in
pkgs,
...
}:
let
host = {
isServer = false;
};
in
{
_module.args.host = host;
_module.args.hostType = "desktop";
imports = [
nixosModules.desktopBase
+1 -6
View File
@@ -10,13 +10,8 @@ in
{
flake.modules.nixos.zenith =
{ ... }:
let
host = {
isServer = false;
};
in
{
_module.args.host = host;
_module.args.hostType = "laptop";
imports = [
nixosModules.desktopBase
+3 -5
View File
@@ -8,15 +8,13 @@ in
{
flake.modules.nixos.sopsHost =
{
hostType ? "desktop",
lib,
host ? {
isServer = false;
},
...
}:
let
useHostSshKey = host.isServer;
useAdminKeyFile = !host.isServer;
useHostSshKey = hostType == "server";
useAdminKeyFile = hostType != "server";
adminKeyDir = builtins.dirOf sopsAdminKeyPath;
in
{
+4 -5
View File
@@ -24,18 +24,17 @@ let
{ accountName }:
{
config,
host ? {
isServer = false;
},
hostType ? "desktop",
lib,
pkgs,
...
}:
let
account = accounts.${accountName};
isServer = hostType == "server";
in
{
sops.secrets = lib.optionalAttrs (!host.isServer) {
sops.secrets = lib.optionalAttrs (!isServer) {
"hashed-password-${accountName}".neededForUsers = true;
};
@@ -51,7 +50,7 @@ let
"networkmanager"
];
}
// lib.optionalAttrs (!host.isServer) {
// lib.optionalAttrs (!isServer) {
hashedPasswordFile = config.sops.secrets."hashed-password-${accountName}".path;
};