feat: add host device type metadata
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,13 +14,8 @@ in
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
host = {
|
||||
isServer = false;
|
||||
};
|
||||
in
|
||||
{
|
||||
_module.args.host = host;
|
||||
_module.args.hostType = "desktop";
|
||||
|
||||
imports = [
|
||||
nixosModules.desktopBase
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user