mirror of
https://github.com/blahai/nyx.git
synced 2025-06-09 11:33:01 -04:00
too much shit idek anymore
This commit is contained in:
parent
14843ef945
commit
bc82345beb
63 changed files with 1759 additions and 346 deletions
8
modules/base/users/default.nix
Normal file
8
modules/base/users/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
imports = [
|
||||
./pingu.nix
|
||||
./options.nix
|
||||
./root.nix
|
||||
./mkuser.nix
|
||||
];
|
||||
}
|
45
modules/base/users/mkuser.nix
Normal file
45
modules/base/users/mkuser.nix
Normal 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"
|
||||
];
|
||||
}
|
||||
);
|
||||
}
|
25
modules/base/users/options.nix
Normal file
25
modules/base/users/options.nix
Normal 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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
14
modules/base/users/pingu.nix
Normal file
14
modules/base/users/pingu.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
}
|
13
modules/base/users/root.nix
Normal file
13
modules/base/users/root.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue