moved ester and eve over to home manager

This commit is contained in:
Leyla Becker 2024-10-04 01:01:41 +02:00
parent dec1ef1d96
commit 04871258ee
15 changed files with 233 additions and 119 deletions

View file

@ -43,8 +43,8 @@ to update passwords run: `nix shell nixpkgs#sops -c sops secrets/user-passwords.
- join config for systemd.tmpfiles.rules and service directory bindings
- monitor configuration in `~/.config/monitors.xml` should be sym linked to `/run/gdm/.config/monitors.xml` (https://www.reddit.com/r/NixOS/comments/u09cz9/home_manager_create_my_own_symlinks_automatically/)
- move applications in server environment into their own flakes
- Eve and Ester home-manager
- get rid of disko config and import it in hardware-configuration.nix
- why does users.users.<name>.home conflict with home-manager.users.<name>.home.homeDirectory
## New Features
- offline access for nfs mounts (overlay with rsync might be a good option here? https://www.spinics.net/lists/linux-unionfs/msg07105.html note about nfs4 and overlay fs)
- Flake templates

View file

@ -42,18 +42,21 @@
uid = 1000;
description = "Leyla";
group = "leyla";
home = "/home/leyla";
};
ester = {
uid = 1001;
description = "Ester";
group = "ester";
home = "/home/ester";
};
eve = {
uid = 1002;
description = "Eve";
group = "eve";
home = "/home/eve";
};
jellyfin = {

View file

@ -15,7 +15,7 @@
];
home-manager.users.leyla.config = {
isThinUser = true;
isTerminalUser = true;
};
boot.loader.grub = {

View file

@ -14,13 +14,16 @@
../../enviroments/client
];
home-manager.users.leyla.config = {
isFullUser = true;
};
users = {
ester.isFullUser = true;
eve.isFullUser = true;
home-manager.users = {
leyla.config = {
isDesktopUser = true;
};
ester.config = {
isDesktopUser = true;
};
eve.config = {
isDesktopUser = true;
};
};
# enabled virtualisation for docker

View file

@ -14,14 +14,17 @@
../../enviroments/client
];
home-manager.users.leyla.config = {
isFullUser = true;
hasGPU = true;
};
users = {
ester.isFullUser = true;
eve.isFullUser = true;
home-manager.users = {
leyla.config = {
isDesktopUser = true;
hasGPU = true;
};
ester.config = {
isDesktopUser = true;
};
eve.config = {
isDesktopUser = true;
};
};
systemd.tmpfiles.rules = [

View file

@ -3,6 +3,5 @@
users.mutableUsers = false;
home-manager.extraSpecialArgs = {inherit inputs;};
home-manager.users = import ./home.nix;
}

View file

@ -5,16 +5,12 @@
inputs,
...
}: let
cfg = config.users.ester;
cfg = config.home-manager.users.ester;
in {
options.users.ester = {
isFullUser = lib.mkEnableOption "ester";
};
config = {
nixpkgs.config.allowUnfree = true;
sops.secrets = lib.mkIf cfg.isFullUser {
sops.secrets = lib.mkIf cfg.isDesktopUser {
"passwords/ester" = {
neededForUsers = true;
sopsFile = "${inputs.secrets}/user-passwords.yaml";
@ -22,18 +18,12 @@ in {
};
users.users.ester = (
if cfg.isFullUser
if cfg.isDesktopUser
then {
isNormalUser = true;
extraGroups = ["networkmanager"];
hashedPasswordFile = config.sops.secrets."passwords/ester".path;
packages = with pkgs; [
firefox
bitwarden
discord
];
}
else {
isSystemUser = true;

73
users/ester/home.nix Normal file
View file

@ -0,0 +1,73 @@
{
pkgs,
lib,
config,
...
}: {
options = {
isDesktopUser = lib.mkEnableOption "install applications intended for desktop use";
};
config = {
home = {
username = "ester";
homeDirectory = "/home/ester";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
stateVersion = "23.11"; # Please read the comment before changing.
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. If you don't want to manage your shell through Home
# Manager then you have to manually source 'hm-session-vars.sh' located at
# either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/ester/etc/profile.d/hm-session-vars.sh
#
sessionVariables = {
# EDITOR = "emacs";
};
packages = lib.mkIf config.isDesktopUser (
with pkgs; [
firefox
bitwarden
discord
]
);
};
programs = {
# Let Home Manager install and manage itself.
home-manager.enable = true;
};
};
}

View file

@ -5,16 +5,12 @@
inputs,
...
}: let
cfg = config.users.eve;
cfg = config.home-manager.users.eve;
in {
options.users.eve = {
isFullUser = lib.mkEnableOption "eve";
};
config = {
nixpkgs.config.allowUnfree = true;
sops.secrets = lib.mkIf cfg.isFullUser {
sops.secrets = lib.mkIf cfg.isDesktopUser {
"passwords/eve" = {
neededForUsers = true;
sopsFile = "${inputs.secrets}/user-passwords.yaml";
@ -22,20 +18,12 @@ in {
};
users.users.eve = (
if cfg.isFullUser
if cfg.isDesktopUser
then {
isNormalUser = true;
extraGroups = ["networkmanager"];
hashedPasswordFile = config.sops.secrets."passwords/eve".path;
packages = with pkgs; [
firefox
bitwarden
discord
makemkv
signal-desktop
];
}
else {
isSystemUser = true;

75
users/eve/home.nix Normal file
View file

@ -0,0 +1,75 @@
{
pkgs,
lib,
config,
...
}: {
options = {
isDesktopUser = lib.mkEnableOption "install applications intended for desktop use";
};
config = {
home = {
username = "eve";
homeDirectory = "/home/eve";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
stateVersion = "23.11"; # Please read the comment before changing.
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. If you don't want to manage your shell through Home
# Manager then you have to manually source 'hm-session-vars.sh' located at
# either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/leyla/etc/profile.d/hm-session-vars.sh
#
sessionVariables = {
# EDITOR = "emacs";
};
packages = lib.mkIf config.isDesktopUser (
with pkgs; [
firefox
bitwarden
discord
makemkv
signal-desktop
]
);
};
programs = {
# Let Home Manager install and manage itself.
home-manager.enable = true;
};
};
}

View file

@ -1,5 +1,5 @@
{
leyla = import ./leyla/home.nix;
# ester = import ./ester/home.nix;
# eve = import ./eve/home.nix;
ester = import ./ester/home.nix;
eve = import ./eve/home.nix;
}

View file

@ -9,7 +9,7 @@ in {
config = {
nixpkgs.config.allowUnfree = true;
sops.secrets = lib.mkIf (cfg.isFullUser || cfg.isThinUser) {
sops.secrets = lib.mkIf (cfg.isDesktopUser || cfg.isTerminalUser) {
"passwords/leyla" = {
neededForUsers = true;
sopsFile = "${inputs.secrets}/user-passwords.yaml";
@ -17,15 +17,13 @@ in {
};
users.users.leyla = (
if (cfg.isFullUser || cfg.isThinUser)
if (cfg.isDesktopUser || cfg.isTerminalUser)
then {
isNormalUser = true;
extraGroups = lib.mkMerge [
extraGroups = (
["networkmanager" "wheel"]
(
lib.mkUnless cfg.isThinUser ["adbusers"]
)
];
++ lib.lists.optional (!cfg.isTerminalUser) "adbusers"
);
hashedPasswordFile = config.sops.secrets."passwords/leyla".path;
@ -43,8 +41,8 @@ in {
services = {
ollama = {
enable = true;
acceleration = lib.mkIf cfg.hasGPU "cuda";
enable = cfg.hasGPU;
acceleration = "cuda";
};
# TODO: this should reference the home directory from the user config
@ -59,16 +57,16 @@ in {
};
programs = {
steam = lib.mkIf cfg.isFullUser {
steam = lib.mkIf cfg.isDesktopUser {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated ServerServer
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
};
noisetorch.enable = cfg.isFullUser;
noisetorch.enable = cfg.isDesktopUser;
adb.enable = cfg.isFullUser;
adb.enable = cfg.isDesktopUser;
};
};
}

View file

@ -9,8 +9,8 @@
];
options = {
isFullUser = lib.mkEnableOption "create usable leyla user";
isThinUser = lib.mkEnableOption "create usable user but witohut user applications";
isDesktopUser = lib.mkEnableOption "install applications intended for desktop use";
isTerminalUser = lib.mkEnableOption "install applications intended for terminal use";
hasGPU = lib.mkEnableOption "installs gpu intensive programs";
};
@ -30,27 +30,6 @@
# release notes.
stateVersion = "23.11"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
packages = [
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
file = {
@ -101,10 +80,10 @@
# add direnv to auto load flakes for development
direnv = {
enable = true;
enableBashIntegration = true; # see note on other shells below
enableBashIntegration = true;
nix-direnv.enable = true;
};
bash.enable = true; # see note on other shells below
bash.enable = true;
# firefox = {
# enable = true;

View file

@ -11,7 +11,7 @@
];
home = {
packages = lib.mkIf (config.isFullUser || config.isThinUser) (
packages = lib.mkIf (config.isDesktopUser || config.isTerminalUser) (
lib.mkMerge [
(
with pkgs; [
@ -22,7 +22,7 @@
]
)
(
lib.mkIf (!config.isThinUser) (
lib.mkIf (!config.isTerminalUser) (
with pkgs; [
#foss platforms
signal-desktop

View file

@ -12,7 +12,7 @@
};
programs = {
bash.shellAliases = lib.mkIf config.isFullUser {
bash.shellAliases = lib.mkIf config.isDesktopUser {
code = "codium";
};
@ -36,42 +36,45 @@
];
};
extensions = with extensions.open-vsx;
[
# vs code feel extensions
ms-vscode.atom-keybindings
akamud.vscode-theme-onedark
streetsidesoftware.code-spell-checker
streetsidesoftware.code-spell-checker-german
streetsidesoftware.code-spell-checker-italian
jeanp413.open-remote-ssh
extensions = (
with extensions.open-vsx;
[
# vs code feel extensions
ms-vscode.atom-keybindings
akamud.vscode-theme-onedark
streetsidesoftware.code-spell-checker
streetsidesoftware.code-spell-checker-german
streetsidesoftware.code-spell-checker-italian
jeanp413.open-remote-ssh
# nix extensions
pinage404.nix-extension-pack
jnoortheen.nix-ide
# nix extensions
pinage404.nix-extension-pack
jnoortheen.nix-ide
# html extensions
formulahendry.auto-rename-tag
ms-vscode.live-server
# html extensions
formulahendry.auto-rename-tag
ms-vscode.live-server
# js extensions
dsznajder.es7-react-js-snippets
dbaeumer.vscode-eslint
standard.vscode-standard
firsttris.vscode-jest-runner
stylelint.vscode-stylelint
tauri-apps.tauri-vscode
# js extensions
dsznajder.es7-react-js-snippets
dbaeumer.vscode-eslint
standard.vscode-standard
firsttris.vscode-jest-runner
stylelint.vscode-stylelint
tauri-apps.tauri-vscode
# misc extensions
bungcip.better-toml
# misc extensions
bungcip.better-toml
# the number at the start of the name here doesnt resolve nicely so we have to refernce it as a part of open-vsx directly instead of though with
open-vsx."10nates".ollama-autocoder
]
++ (with extensions.vscode-marketplace; [
# js extensions
karyfoundation.nearley
]);
open-vsx."10nates".ollama-autocoder
]
++ (
with extensions.vscode-marketplace; [
# js extensions
karyfoundation.nearley
]
)
);
};
};
}