feat: reworked home-manager files

This commit is contained in:
Patrick Großmann 2023-06-02 21:18:30 +09:00
parent 91c0c8492b
commit fc740d4d32
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
37 changed files with 160 additions and 140 deletions

View file

@ -1,9 +1,4 @@
{
impermanence,
hyprland,
stateVersion,
...
}: {
imports = [
./inputrc.nix
./issue.nix
@ -13,25 +8,11 @@
./system.nix
./xdg.nix
./impermanence.nix
./home-manager.nix
../../../users/root
../../../nix/secrets.nix
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
verbose = true;
sharedModules = [
{
home.stateVersion = stateVersion;
}
impermanence.home-manager.impermanence
hyprland.homeManagerModules.default
];
};
# HM zsh needs this or else the startup order is fucked
# and env variables will be loaded incorrectly
programs.zsh.enable = true;
age.identityPaths = ["/state/etc/ssh/ssh_host_ed25519_key"];
}

View file

@ -0,0 +1,26 @@
{
impermanence,
hyprland,
stateVersion,
config,
...
}: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
verbose = true;
sharedModules = [
{
home.stateVersion = stateVersion;
}
impermanence.home-manager.impermanence
hyprland.homeManagerModules.default
];
extraSpecialArgs = {
nixosConfig = config;
};
};
# HM zsh needs this or else the startup order is fucked
# and env variables will be loaded incorrectly
programs.zsh.enable = true;
}

View file

@ -1,9 +1,9 @@
{
config,
lib,
pkgs,
...
}: {
age.identityPaths = ["/state/etc/ssh/ssh_host_ed25519_key"];
# to allow all users to access hm managed persistent folders
programs.fuse.userAllowOther = true;
environment.persistence."/state" = {
@ -14,13 +14,17 @@
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
];
directories = [
{
directory = "/var/lib/nixos";
user = "root";
group = "root";
mode = "0775";
}
];
directories =
[
{
directory = "/var/lib/nixos";
user = "root";
group = "root";
mode = "0775";
}
]
++ lib.lists.optionals config.hardware.acpilight.enable [
"/var/lib/systemd/backlight"
];
};
}

View file

@ -12,15 +12,6 @@
USB_EXCLUDE_PHONE = 1;
};
};
# enabel users in the video group to control backlight
udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video $sys$devpath/brightness", RUN+="${pkgs.coreutils}/bin/chmod g+w $sys$devpath/brightness"
'';
};
# enable systemd to save and restore backlight state
environment.persistence."/state" = {
directories = [
"/var/lib/systemd/backlight"
];
};
hardware.acpilight.enable = true;
}

View file

@ -1,15 +1,12 @@
{
imports = [
./shells/zsh
./programs/htop.nix
./nvim
./shells/alias.nix
./git.nix
./gpg
./util.nix
./shells/zsh
./programs/gpg
./impermanence.nix
];
nixpkgs.config = {
allowUnfree = true;
};

View file

@ -0,0 +1,26 @@
{pkgs, ...}: {
imports = [
./graphical/kitty.nix
./graphical/hyprland
./graphical/rofi.nix
./graphical/firefox.nix
];
home = {
packages = with pkgs; [
thunderbird
bitwarden
signal-desktop
chromium
xdragon
xournalpp
zathura
pinentry
feh
galaxy-buds-client
netflix
];
};
# notification are nice to have
services.dunst.enable = true;
}

View file

@ -0,0 +1,28 @@
{config, ...}: {
home = {
sessionVariables = {
# Firefox touch support
"MOZ_USE_XINPUT2" = 1;
# Firefox Hardware render
"MOZ_WEBRENDER" = 1;
};
};
programs.firefox = {
enable = true;
profiles.patrick = {
userChrome = ''
#TabsToolbar {
visibility: collapse;
}
#titlebar {
margin-bottom: !important;
}
#titlebar-buttonbox {
height: 32px !important;
}
'';
};
};
}

View file

@ -6,7 +6,7 @@
MOD = "SUPER";
TAGS = map toString (lib.lists.range 41 49);
in {
imports = [./waybar.nix];
imports = [../waybar];
# This does not work currently no idea why
programs.waybar.settings.main."wlr/workspaces".persistent_workspaces = builtins.listToAttrs (map (x: {
name = x;

View file

@ -1,33 +1,51 @@
{
config,
lib,
pkgs,
nixosConfig,
...
}:
with lib.lists; {
home.persistence."/state/home/${config.home.username}" = {
}: {
home.persistence."/state/home/${config.home.username}" = with lib.lists; {
allowOther = true;
files = [
".ssh/known_hosts"
];
directories =
directories = let
# some programs( such as steam do not work with bindmounts
# additionally symlinks are a lot faster than bindmounts
# ~ 2x faster in my tests
makeSymLinks = x:
builtins.map (x: {
directory = x;
method = "symlink";
})
x;
in
optionals config.programs.atuin.enable [
".local/share/atuin"
]
++ optionals config.programs.firefox.enable [
".mozilla"
++ optionals config.programs.direnv.enable [
".local/share/direnv"
]
++ optionals config.programs.neovim.enable [
".local/share/nvim"
".local/state/nvim"
".cache/nvim"
]
++ optionals config.programs.direnv.enable [
".local/share/direnv"
++ optionals config.programs.firefox.enable [
".mozilla"
# root should never use interactive programs
]
++ optionals (builtins.elem pkgs.nextcloud-client config.home.packages) [
"./Nextcloud"
".config/Nextcloud"
];
++ optionals (config.home.username != "root") (
optionals nixosConfig.services.pipewire.enable [
# persist sound config
".local/state/wireplumber"
]
++ optionals nixosConfig.programs.steam.enable
(makeSymLinks [
".local/share/Steam"
".steam"
".local/share//Daedalic Entertainment GmbH/The Pillars of the Earth/"
])
);
};
}

View file

@ -0,0 +1,12 @@
{pkgs, ...}: {
imports = [
./programs/direnv.nix
./programs/htop.nix
./programs/nvim
./programs/git.nix
];
home.packages = with pkgs; [
bat
];
}

View file

@ -1,5 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
bat
];
}

View file

@ -3,7 +3,7 @@
config,
...
}: {
# TODO: only import this if the current host is a nixos host
# enable nixos wide hyprland config
imports = [
../../hosts/common/graphical/hyprland.nix
];
@ -23,10 +23,13 @@
# xournalpp needs this or else it will crash
gnome3.adwaita-icon-theme
];
home-manager.users.patrick = {
imports = [
./patrick.nix
../common
../common/interactive.nix
../common/graphical.nix
];
};
}

View file

@ -4,83 +4,21 @@
...
}: {
imports = [
../common/programs/kitty.nix
../common/graphical/hyprland.nix
../common/programs/rofi.nix
../common/devshell.nix
./ssh.nix
];
home = {
packages = with pkgs; [
thunderbird
discord
bitwarden
nextcloud-client
signal-desktop
chromium
xdragon
xournalpp
zathura
pinentry
feh
acpilight
galaxy-buds-client
netflix
packages = [
pkgs.nextcloud-client
];
sessionVariables = {
# Firefox touch support
"MOZ_USE_XINPUT2" = 1;
# Firefox Hardware render
"MOZ_WEBRENDER" = 1;
};
persistence."/state/home/${config.home.username}" = {
directories = [
"repos"
"Downloads"
persistence."/state/home/${config.home.username}" = let
# some programs( such as steam do not work with bindmounts
# additionally symlinks are a lot faster than bindmounts
# ~ 2x faster in my tests
makeSymLinks = x:
builtins.map (x: {
directory = x;
method = "symlink";
})
x;
in {
directories =
[
"repos"
"Downloads"
# persist sound config
".local/state/wireplumber"
]
++ makeSymLinks [
".local/share/Steam"
".steam"
".local/share//Daedalic Entertainment GmbH/The Pillars of the Earth/"
];
"./Nextcloud"
".config/Nextcloud"
];
};
};
programs.firefox = {
enable = true;
profiles.patrick = {
userChrome = ''
#TabsToolbar {
visibility: collapse;
}
#titlebar {
margin-bottom: !important;
}
#titlebar-buttonbox {
height: 32px !important;
}
'';
};
};
# notification are nice to have
services.dunst.enable = true;
}

View file

@ -11,6 +11,7 @@
];
hashedPassword = config.secrets.secrets.global.users.root.passwordHash;
};
# the user needs to exists
home-manager.users.root.imports = [../common];
home-manager.users.root.imports = [
../common
];
}