nixos/share/users.nix

165 lines
3.9 KiB
Nix
Raw Normal View History

2024-06-27 20:37:20 +02:00
{ config, pkgs, ... }:
2024-07-02 19:54:05 +02:00
let
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/master.tar.gz";
in
2024-06-27 20:37:20 +02:00
{
2024-07-02 19:54:05 +02:00
# get home manager working
imports = [
# home manager for per user config
"${home-manager}/nixos"
];
2024-07-02 19:55:04 +02:00
# define the users we have on our systems
2024-06-27 20:37:20 +02:00
users = {
# all users and passwords are defined here
mutableUsers = false;
# default shell is ZSH
defaultUserShell = pkgs.zsh;
2024-06-27 20:37:20 +02:00
#
# administrator
#
users.root = {
# init password
2024-10-03 00:50:52 +02:00
hashedPassword = builtins.readFile "/data/nixos/secret/password.secret";
2024-06-27 20:37:20 +02:00
# use fixed auth keys
2024-10-03 00:50:52 +02:00
openssh.authorizedKeys.keys = pkgs.lib.splitString "\n" (builtins.readFile "/data/nixos/secret/authorized_keys.secret");
2024-06-27 20:37:20 +02:00
};
#
# my main user
#
users.cullmann = {
2024-10-05 17:03:22 +02:00
# home on persistent volume
home = "/data/home/cullmann";
2024-06-27 20:37:20 +02:00
# hard code UID for stability over machines
uid = 1000;
# normal user
isNormalUser = true;
# it's me :P
description = "Christoph Cullmann";
# allow VirtualBox and sudo for my main user
extraGroups = [ "vboxusers" "wheel" ];
# init password
hashedPassword = config.users.users.root.hashedPassword;
# use fixed auth keys
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
};
2024-10-05 17:03:22 +02:00
#
# sandbox for lutris and steam games and Co.
2024-10-05 17:03:22 +02:00
#
users.sandbox-games = {
# home on persistent volume
home = "/data/home/sandbox-games";
# hard code UID for stability over machines
# out of range of normal login users
uid = 32000;
# normal user
isNormalUser = true;
# sandbox user
description = "Sandbox Games";
2024-10-08 18:49:40 +02:00
# use fixed auth keys
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
2024-10-05 17:03:22 +02:00
};
#
# sandbox for kde development
#
users.sandbox-kde = {
# home on persistent volume
home = "/data/home/sandbox-kde";
# hard code UID for stability over machines
# out of range of normal login users
uid = 32001;
# normal user
isNormalUser = true;
# sandbox user
description = "Sandbox KDE";
2024-10-08 18:49:40 +02:00
# use fixed auth keys
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
2024-10-05 17:03:22 +02:00
};
2024-06-27 20:37:20 +02:00
};
2024-07-02 19:54:05 +02:00
# home manager settings
home-manager = {
# let home manager install stuff to /etc/profiles
useUserPackages = true;
# use global pkgs
useGlobalPkgs = true;
2024-10-05 17:03:22 +02:00
# root just with shared home manager settings
users.root = {
# shared config
imports = [ ./home.nix ];
};
# main user with extra settings
users.cullmann = {
# shared config
imports = [ ./home.nix ];
# enable keychain
2024-10-05 17:03:22 +02:00
programs.keychain = {
enable = true;
enableZshIntegration = true;
keys = [ "/data/home/cullmann/.ssh/id_ed25519" ];
};
};
# games user with extra settings
users.sandbox-games = {
# shared config
imports = [ ./home.nix ];
# install gaming stuff
home.packages = with pkgs; [
lutris
steam
2024-10-05 18:37:39 +02:00
wineWowPackages.stable
winetricks
];
2024-10-05 17:03:22 +02:00
};
# kde user with extra settings
users.sandbox-kde = {
# shared config
imports = [ ./home.nix ];
2024-10-06 17:25:34 +02:00
# create kde build setup
home.file = {
"projects/kde/.envrc" = {
text = "use nix";
};
"projects/kde/cleanup.sh" = {
text = (builtins.readFile "/data/nixos/projects/kde/cleanup.sh");
executable = true;
};
"projects/kde/kdesrc-buildrc" = {
text = (builtins.readFile "/data/nixos/projects/kde/kdesrc-buildrc");
};
"projects/kde/shell.nix" = {
text = (builtins.readFile "/data/nixos/projects/kde/shell.nix");
};
};
2024-10-05 17:03:22 +02:00
};
2024-07-02 19:54:05 +02:00
};
2024-06-27 20:37:20 +02:00
}