Compare commits
4 Commits
5bed1336c0
...
5cfd4d01c8
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cfd4d01c8 | |||
| 4bb3f44a37 | |||
| 2572022349 | |||
| 4008fde198 |
@@ -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;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{ config, ... }:
|
||||
let
|
||||
homeModules = config.flake.modules.homeManager;
|
||||
in
|
||||
{
|
||||
flake.modules.homeManager.userBase = {
|
||||
imports = with homeModules; [
|
||||
terminal
|
||||
shell
|
||||
neovim
|
||||
sshClient
|
||||
sopsAdmin
|
||||
git
|
||||
devTools
|
||||
podman
|
||||
gemini
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -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
|
||||
@@ -73,8 +68,6 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
services.hardware.openrgb.enable = true;
|
||||
|
||||
boot.loader.systemd-boot.extraInstallCommands = ''
|
||||
ENTRIES="${config.boot.loader.efi.efiSysMountPoint}/loader/entries"
|
||||
PROFILES="/nix/var/nix/profiles"
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
+20
-27
@@ -4,8 +4,8 @@ let
|
||||
|
||||
realName = "Jelle Spreeuwenberg";
|
||||
|
||||
accounts = {
|
||||
kiri = {
|
||||
name = "kiri";
|
||||
homeDirectory = "/home/kiri";
|
||||
gitEmail = "mail@jelles.net";
|
||||
vaultEmail = "mail@jelles.net";
|
||||
@@ -13,61 +13,55 @@ let
|
||||
};
|
||||
|
||||
ergon = {
|
||||
name = "ergon";
|
||||
homeDirectory = "/home/ergon";
|
||||
gitEmail = "jelle.spreeuwenberg@yookr.org";
|
||||
vaultEmail = "jelle.spreeuwenberg@yookr.org";
|
||||
extraHomeImports = with homeModules; [ nix ];
|
||||
};
|
||||
};
|
||||
|
||||
mkUser =
|
||||
{ accountName }:
|
||||
account:
|
||||
{
|
||||
config,
|
||||
hostType ? "desktop",
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
account = accounts.${accountName};
|
||||
username = account.name;
|
||||
isServer = hostType == "server";
|
||||
in
|
||||
{
|
||||
sops.secrets."hashed-password-${accountName}".neededForUsers = true;
|
||||
sops.secrets = lib.optionalAttrs (!isServer) {
|
||||
"hashed-password-${username}".neededForUsers = true;
|
||||
};
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
users.users.${accountName} = {
|
||||
name = accountName;
|
||||
users.users.${username} = {
|
||||
name = username;
|
||||
home = account.homeDirectory;
|
||||
hashedPasswordFile = config.sops.secrets."hashed-password-${accountName}".path;
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
];
|
||||
}
|
||||
// lib.optionalAttrs (!isServer) {
|
||||
hashedPasswordFile = config.sops.secrets."hashed-password-${username}".path;
|
||||
};
|
||||
|
||||
home-manager.users.${accountName} = {
|
||||
home-manager.users.${username} = {
|
||||
home = {
|
||||
username = accountName;
|
||||
inherit username;
|
||||
homeDirectory = account.homeDirectory;
|
||||
stateVersion = "24.05";
|
||||
};
|
||||
|
||||
imports =
|
||||
with homeModules;
|
||||
[
|
||||
terminal
|
||||
shell
|
||||
neovim
|
||||
sshClient
|
||||
sopsAdmin
|
||||
git
|
||||
devTools
|
||||
podman
|
||||
gemini
|
||||
]
|
||||
++ account.extraHomeImports;
|
||||
imports = [ homeModules.userBase ] ++ account.extraHomeImports;
|
||||
|
||||
programs.git.settings.user = {
|
||||
name = realName;
|
||||
@@ -79,7 +73,6 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.kiri = mkUser { accountName = "kiri"; };
|
||||
|
||||
flake.modules.nixos.ergon = mkUser { accountName = "ergon"; };
|
||||
flake.modules.nixos.kiri = mkUser kiri;
|
||||
flake.modules.nixos.ergon = mkUser ergon;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user