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 - 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/) - 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 - 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 - 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 ## 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) - 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 - Flake templates

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@ in {
config = { config = {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
sops.secrets = lib.mkIf (cfg.isFullUser || cfg.isThinUser) { sops.secrets = lib.mkIf (cfg.isDesktopUser || cfg.isTerminalUser) {
"passwords/leyla" = { "passwords/leyla" = {
neededForUsers = true; neededForUsers = true;
sopsFile = "${inputs.secrets}/user-passwords.yaml"; sopsFile = "${inputs.secrets}/user-passwords.yaml";
@ -17,15 +17,13 @@ in {
}; };
users.users.leyla = ( users.users.leyla = (
if (cfg.isFullUser || cfg.isThinUser) if (cfg.isDesktopUser || cfg.isTerminalUser)
then { then {
isNormalUser = true; isNormalUser = true;
extraGroups = lib.mkMerge [ extraGroups = (
["networkmanager" "wheel"] ["networkmanager" "wheel"]
( ++ lib.lists.optional (!cfg.isTerminalUser) "adbusers"
lib.mkUnless cfg.isThinUser ["adbusers"] );
)
];
hashedPasswordFile = config.sops.secrets."passwords/leyla".path; hashedPasswordFile = config.sops.secrets."passwords/leyla".path;
@ -43,8 +41,8 @@ in {
services = { services = {
ollama = { ollama = {
enable = true; enable = cfg.hasGPU;
acceleration = lib.mkIf cfg.hasGPU "cuda"; acceleration = "cuda";
}; };
# TODO: this should reference the home directory from the user config # TODO: this should reference the home directory from the user config
@ -59,16 +57,16 @@ in {
}; };
programs = { programs = {
steam = lib.mkIf cfg.isFullUser { steam = lib.mkIf cfg.isDesktopUser {
enable = true; enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated ServerServer 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 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 = { options = {
isFullUser = lib.mkEnableOption "create usable leyla user"; isDesktopUser = lib.mkEnableOption "install applications intended for desktop use";
isThinUser = lib.mkEnableOption "create usable user but witohut user applications"; isTerminalUser = lib.mkEnableOption "install applications intended for terminal use";
hasGPU = lib.mkEnableOption "installs gpu intensive programs"; hasGPU = lib.mkEnableOption "installs gpu intensive programs";
}; };
@ -30,27 +30,6 @@
# release notes. # release notes.
stateVersion = "23.11"; # Please read the comment before changing. 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 # Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'. # plain files is through 'home.file'.
file = { file = {
@ -101,10 +80,10 @@
# add direnv to auto load flakes for development # add direnv to auto load flakes for development
direnv = { direnv = {
enable = true; enable = true;
enableBashIntegration = true; # see note on other shells below enableBashIntegration = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
bash.enable = true; # see note on other shells below bash.enable = true;
# firefox = { # firefox = {
# enable = true; # enable = true;

View file

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

View file

@ -12,7 +12,7 @@
}; };
programs = { programs = {
bash.shellAliases = lib.mkIf config.isFullUser { bash.shellAliases = lib.mkIf config.isDesktopUser {
code = "codium"; code = "codium";
}; };
@ -36,42 +36,45 @@
]; ];
}; };
extensions = with extensions.open-vsx; extensions = (
[ with extensions.open-vsx;
# vs code feel extensions [
ms-vscode.atom-keybindings # vs code feel extensions
akamud.vscode-theme-onedark ms-vscode.atom-keybindings
streetsidesoftware.code-spell-checker akamud.vscode-theme-onedark
streetsidesoftware.code-spell-checker-german streetsidesoftware.code-spell-checker
streetsidesoftware.code-spell-checker-italian streetsidesoftware.code-spell-checker-german
jeanp413.open-remote-ssh streetsidesoftware.code-spell-checker-italian
jeanp413.open-remote-ssh
# nix extensions # nix extensions
pinage404.nix-extension-pack pinage404.nix-extension-pack
jnoortheen.nix-ide jnoortheen.nix-ide
# html extensions # html extensions
formulahendry.auto-rename-tag formulahendry.auto-rename-tag
ms-vscode.live-server ms-vscode.live-server
# js extensions # js extensions
dsznajder.es7-react-js-snippets dsznajder.es7-react-js-snippets
dbaeumer.vscode-eslint dbaeumer.vscode-eslint
standard.vscode-standard standard.vscode-standard
firsttris.vscode-jest-runner firsttris.vscode-jest-runner
stylelint.vscode-stylelint stylelint.vscode-stylelint
tauri-apps.tauri-vscode tauri-apps.tauri-vscode
# misc extensions # misc extensions
bungcip.better-toml 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
open-vsx."10nates".ollama-autocoder ]
] ++ (
++ (with extensions.vscode-marketplace; [ with extensions.vscode-marketplace; [
# js extensions # js extensions
karyfoundation.nearley karyfoundation.nearley
]); ]
)
);
}; };
}; };
} }