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 = [ imports = [
./inputrc.nix ./inputrc.nix
./issue.nix ./issue.nix
@ -13,25 +8,11 @@
./system.nix ./system.nix
./xdg.nix ./xdg.nix
./impermanence.nix ./impermanence.nix
./home-manager.nix
../../../users/root ../../../users/root
../../../nix/secrets.nix ../../../nix/secrets.nix
]; ];
age.identityPaths = ["/state/etc/ssh/ssh_host_ed25519_key"];
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;
} }

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

View file

@ -12,15 +12,6 @@
USB_EXCLUDE_PHONE = 1; 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 = [ imports = [
./shells/zsh
./programs/htop.nix
./nvim
./shells/alias.nix ./shells/alias.nix
./git.nix ./shells/zsh
./gpg
./util.nix ./programs/gpg
./impermanence.nix ./impermanence.nix
]; ];
nixpkgs.config = { nixpkgs.config = {
allowUnfree = true; 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"; MOD = "SUPER";
TAGS = map toString (lib.lists.range 41 49); TAGS = map toString (lib.lists.range 41 49);
in { in {
imports = [./waybar.nix]; imports = [../waybar];
# This does not work currently no idea why # This does not work currently no idea why
programs.waybar.settings.main."wlr/workspaces".persistent_workspaces = builtins.listToAttrs (map (x: { programs.waybar.settings.main."wlr/workspaces".persistent_workspaces = builtins.listToAttrs (map (x: {
name = x; name = x;

View file

@ -1,33 +1,51 @@
{ {
config, config,
lib, lib,
pkgs, nixosConfig,
... ...
}: }: {
with lib.lists; { home.persistence."/state/home/${config.home.username}" = with lib.lists; {
home.persistence."/state/home/${config.home.username}" = {
allowOther = true; allowOther = true;
files = [ files = [
".ssh/known_hosts" ".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 [ optionals config.programs.atuin.enable [
".local/share/atuin" ".local/share/atuin"
] ]
++ optionals config.programs.firefox.enable [ ++ optionals config.programs.direnv.enable [
".mozilla" ".local/share/direnv"
] ]
++ optionals config.programs.neovim.enable [ ++ optionals config.programs.neovim.enable [
".local/share/nvim" ".local/share/nvim"
".local/state/nvim" ".local/state/nvim"
".cache/nvim" ".cache/nvim"
] ]
++ optionals config.programs.direnv.enable [ ++ optionals config.programs.firefox.enable [
".local/share/direnv" ".mozilla"
# root should never use interactive programs
] ]
++ optionals (builtins.elem pkgs.nextcloud-client config.home.packages) [ ++ optionals (config.home.username != "root") (
"./Nextcloud" optionals nixosConfig.services.pipewire.enable [
".config/Nextcloud" # 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, config,
... ...
}: { }: {
# TODO: only import this if the current host is a nixos host # enable nixos wide hyprland config
imports = [ imports = [
../../hosts/common/graphical/hyprland.nix ../../hosts/common/graphical/hyprland.nix
]; ];
@ -23,10 +23,13 @@
# xournalpp needs this or else it will crash # xournalpp needs this or else it will crash
gnome3.adwaita-icon-theme gnome3.adwaita-icon-theme
]; ];
home-manager.users.patrick = { home-manager.users.patrick = {
imports = [ imports = [
./patrick.nix ./patrick.nix
../common ../common
../common/interactive.nix
../common/graphical.nix
]; ];
}; };
} }

View file

@ -4,83 +4,21 @@
... ...
}: { }: {
imports = [ imports = [
../common/programs/kitty.nix
../common/graphical/hyprland.nix
../common/programs/rofi.nix
../common/devshell.nix
./ssh.nix ./ssh.nix
]; ];
home = { home = {
packages = with pkgs; [ packages = [
thunderbird pkgs.nextcloud-client
discord
bitwarden
nextcloud-client
signal-desktop
chromium
xdragon
xournalpp
zathura
pinentry
feh
acpilight
galaxy-buds-client
netflix
]; ];
sessionVariables = { persistence."/state/home/${config.home.username}" = {
# Firefox touch support directories = [
"MOZ_USE_XINPUT2" = 1;
# Firefox Hardware render
"MOZ_WEBRENDER" = 1;
};
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" "repos"
"Downloads" "Downloads"
# persist sound config "./Nextcloud"
".local/state/wireplumber" ".config/Nextcloud"
]
++ makeSymLinks [
".local/share/Steam"
".steam"
".local/share//Daedalic Entertainment GmbH/The Pillars of the Earth/"
]; ];
}; };
}; };
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; hashedPassword = config.secrets.secrets.global.users.root.passwordHash;
}; };
# the user needs to exists home-manager.users.root.imports = [
home-manager.users.root.imports = [../common]; ../common
];
} }