too much shit idek anymore

This commit is contained in:
blahai 2025-01-26 00:36:34 +02:00
parent 14843ef945
commit bc82345beb
No known key found for this signature in database
63 changed files with 1759 additions and 346 deletions

View file

@ -0,0 +1,8 @@
{
imports = [
./pingu.nix
./options.nix
./root.nix
./mkuser.nix
];
}

View file

@ -0,0 +1,45 @@
{
lib,
config,
...
}: let
inherit (lib.modules) mkDefault;
inherit (lib.attrsets) genAttrs;
inherit (builtins) filter hasAttr;
ifTheyExist = config: groups: filter (group: hasAttr group config.users.groups) groups;
in {
users.users = genAttrs config.olympus.system.users (
name: {
home = "/home/" + name;
shell = config.olympus.programs.${config.olympus.programs.defaults.shell}.package;
uid = mkDefault 1000;
isNormalUser = true;
initialPassword = mkDefault "changeme";
# only add groups that exist
extraGroups =
[
"wheel"
"nix"
]
++ ifTheyExist config [
"network"
"networkmanager"
"systemd-journal"
"audio"
"pipewire"
"video"
"input"
"plugdev"
"tss"
"power"
"mysql"
"docker"
"git"
"libvirtd"
"cloudflared"
];
}
);
}

View file

@ -0,0 +1,25 @@
{
lib,
config,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) enum listOf str;
in {
options.olympus.system = {
mainUser = mkOption {
type = enum config.olympus.system.users;
description = "The username of the main user for your system";
default = builtins.elemAt config.olympus.system.users 0;
};
users = mkOption {
type = listOf str;
default = ["pingu"];
description = ''
A list of users that you wish to declare as your non-system users. The first username
in the list will be treated as your main user unless {option}`olympus.system.mainUser` is set.
'';
};
};
}

View file

@ -0,0 +1,14 @@
{
lib,
config,
...
}: let
inherit (builtins) elem;
inherit (lib.modules) mkIf;
in {
config = mkIf (elem "pingu" config.olympus.system.users) {
users.users.pingu.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPbmiNqoyeKXk/VopFm2cFfEnV4cKCFBhbhyYB69Fuu"
];
};
}

View file

@ -0,0 +1,13 @@
{
lib,
pkgs,
...
}: {
users.users.root = lib.modules.mkIf pkgs.stdenv.hostPlatform.isLinux {
initialPassword = "changeme";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILPbmiNqoyeKXk/VopFm2cFfEnV4cKCFBhbhyYB69Fuu"
];
};
}