refactor: unify user config

This commit is contained in:
Patrick 2024-10-30 19:41:00 +01:00
parent 00092b2fac
commit 4cc594f131
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
57 changed files with 88 additions and 102 deletions

View file

@ -4,8 +4,7 @@ This file contains a small overview over the contents and structure of this repo
- `basic/` the basic system configuration, this should be applied for all systems - `basic/` the basic system configuration, this should be applied for all systems
- `system.nix` a far descendant of the original `configuration.nix` - `system.nix` a far descendant of the original `configuration.nix`
any global configuration should be done here first and later moved to their own file if necessary any global configuration should be done here first and later moved to their own file if necessary
- `support/` configuration for supporting specific hardware - `support/` configuration for supporting specific hardware or use cases on a system level
- `optional/` optionally includable configuration
- `services/` configuration for independent services - `services/` configuration for independent services
- `hosts/` contain nixos configuration for hosts - `hosts/` contain nixos configuration for hosts
- `<hostname>/` configuration for hosts - `<hostname>/` configuration for hosts
@ -17,9 +16,8 @@ This file contains a small overview over the contents and structure of this repo
- `secrets.nix.age` local secrets usable while evaluating - `secrets.nix.age` local secrets usable while evaluating
- `host.pub` host public key, needed for rekeying agenix secrets - `host.pub` host public key, needed for rekeying agenix secrets
- `keys/` public keys needed for evaluating the system - `keys/` public keys needed for evaluating the system
- `lib/` extra library functions
- `modules/` extra nixos modules - `modules/` extra nixos modules
- `modules-hm/` extra home-manager modules - `modules-hm/` extra home-manager or home management modules
- `nix/` additional nix functions - `nix/` additional nix functions
- `devshell.nix` Development shell - `devshell.nix` Development shell
- `extra-builtins.nix` Extra builtin plugin file to enable repository secrets - `extra-builtins.nix` Extra builtin plugin file to enable repository secrets
@ -29,10 +27,8 @@ This file contains a small overview over the contents and structure of this repo
- currently containing all yubikeys and a rage backup key - currently containing all yubikeys and a rage backup key
- `secrets.nix.age` global secrets available at deploy - `secrets.nix.age` global secrets available at deploy
- `users/` home manager user configuration - `users/` home manager user configuration
- `common/` shared home-manager modules - `patrick` personal configuration for myself
- `programs/` configuration for miscellaneous programs
- `wayland/` configuration for wayland windowmanagers and basic utilities - `wayland/` configuration for wayland windowmanagers and basic utilities
- `xorg/` configuration for xorg windowmanagers and basic utilities - `xorg/` configuration for xorg windowmanagers and basic utilities
- `programs/` configuration for miscellaneous programs - `root` minimal configuration for root
- `default.nix` minimal setup for all users
- `<username>/` configuration for users
- `impermanence.nix` users persistence configuration

View file

@ -1,40 +0,0 @@
{ lib, pkgs, ... }:
let
inherit (lib) concatStringsSep escapeShellArg mapAttrsToList;
env = {
MOZ_WEBRENDER = 1;
# For a better scrolling implementation and touch support.
# Be sure to also disable "Use smooth scrolling" in about:preferences
MOZ_USE_XINPUT2 = 1;
# Required for hardware video decoding.
# See https://github.com/elFarto/nvidia-vaapi-driver?tab=readme-ov-file#firefox
MOZ_DISABLE_RDD_SANDBOX = 1;
LIBVA_DRIVER_NAME = "nvidia";
NVD_BACKEND = "direct";
};
envStr = concatStringsSep " " (mapAttrsToList (n: v: "${n}=${escapeShellArg v}") env);
in
{
hm.programs.firefox = {
enable = true;
package = pkgs.firefox.overrideAttrs (old: {
buildCommand =
old.buildCommand
+ ''
substituteInPlace $out/bin/firefox \
--replace "exec -a" ${escapeShellArg envStr}" exec -a"
'';
});
};
hm.home.persistence."/state".directories = [
".cache/mozilla"
".mozilla"
];
hm.xdg.mimeApps.enable = true;
hm.xdg.mimeApps.defaultApplications = {
"text/html" = [ "firefox.desktop" ];
"text/xml" = [ "firefox.desktop" ];
"x-scheme-handler/http" = [ "firefox.desktop" ];
"x-scheme-handler/https" = [ "firefox.desktop" ];
};
}

View file

@ -51,36 +51,34 @@ lib.optionalAttrs (!minimal) {
imports = [ imports = [
./firefox.nix ./alias.nix
./gpg ./dev.nix
./impermanence.nix ./impermanence.nix
./minion.nix
./patrick.nix ./patrick.nix
./smb.nix ./smb.nix
./ssh.nix ./ssh.nix
./theme.nix ./theme.nix
../common/alias.nix ./wayland
../common/dev.nix
../common/wayland
../common/programs/bottles.nix ./programs/bottles.nix
../common/programs/direnv.nix ./programs/direnv.nix
../common/programs/firefox.nix ./programs/firefox.nix
../common/programs/gdb.nix ./programs/gdb.nix
../common/programs/git.nix ./programs/git.nix
../common/programs/gpg.nix ./programs/gpg
../common/programs/gpu-screen-recorder.nix ./programs/gpu-screen-recorder.nix
../common/programs/kitty.nix ./programs/kitty.nix
../common/programs/minecraft.nix ./programs/minecraft.nix
../common/programs/nvim ./programs/minion.nix
../common/programs/obs.nix ./programs/nvim
../common/programs/pager.nix ./programs/obs.nix
../common/programs/poe.nix ./programs/pager.nix
../common/programs/spicetify.nix ./programs/poe.nix
../common/programs/steam.nix ./programs/spicetify.nix
../common/programs/thunderbird.nix ./programs/steam.nix
../common/programs/zsh ./programs/thunderbird.nix
./programs/zsh
]; ];
} }

View file

@ -1,28 +0,0 @@
{
config,
lib,
pkgs,
...
}:
{
hm.programs.gpg.publicKeys = [
{
source = ./pubkey.gpg;
trust = 5;
}
{
source = ./newpubkey.gpg;
trust = 5;
}
];
# Make sure the keygrips exist, otherwise we'd need to run `gpg --card-status`
# before being able to use the yubikey.
hm.home.activation.installKeygrips =
config.home-manager.users.root.lib.dag.entryAfter [ "writeBoundary" ]
''
run mkdir -p "$HOME/.gnupg/private-keys-v1.d"
run ${lib.getExe pkgs.gnutar} xvf ${
lib.escapeShellArg config.age.secrets."my-gpg-yubikey-keygrip.tar".path
} -C "$HOME/.gnupg/private-keys-v1.d/"
'';
}

View file

@ -1,5 +1,31 @@
{ pkgs, ... }: { lib, pkgs, ... }:
let
inherit (lib) concatStringsSep escapeShellArg mapAttrsToList;
env = {
MOZ_WEBRENDER = 1;
# For a better scrolling implementation and touch support.
# Be sure to also disable "Use smooth scrolling" in about:preferences
MOZ_USE_XINPUT2 = 1;
# Required for hardware video decoding.
# See https://github.com/elFarto/nvidia-vaapi-driver?tab=readme-ov-file#firefox
MOZ_DISABLE_RDD_SANDBOX = 1;
LIBVA_DRIVER_NAME = "nvidia";
NVD_BACKEND = "direct";
};
envStr = concatStringsSep " " (mapAttrsToList (n: v: "${n}=${escapeShellArg v}") env);
in
{ {
hm.home.persistence."/state".directories = [
".cache/mozilla"
".mozilla"
];
hm.xdg.mimeApps.enable = true;
hm.xdg.mimeApps.defaultApplications = {
"text/html" = [ "firefox.desktop" ];
"text/xml" = [ "firefox.desktop" ];
"x-scheme-handler/http" = [ "firefox.desktop" ];
"x-scheme-handler/https" = [ "firefox.desktop" ];
};
hm.programs.firefox = hm.programs.firefox =
let let
betterfox = pkgs.fetchFromGitHub { betterfox = pkgs.fetchFromGitHub {
@ -10,6 +36,15 @@
}; };
in in
{ {
enable = true;
package = pkgs.firefox.overrideAttrs (old: {
buildCommand =
old.buildCommand
+ ''
substituteInPlace $out/bin/firefox \
--replace "exec -a" ${escapeShellArg envStr}" exec -a"
'';
});
profiles.patrick = { profiles.patrick = {
userChrome = '' userChrome = ''
#TabsToolbar { #TabsToolbar {

View file

@ -1,5 +1,30 @@
{ pkgs, ... }:
{ {
config,
lib,
pkgs,
...
}:
{
hm.programs.gpg.publicKeys = [
{
source = ./pubkey.gpg;
trust = 5;
}
{
source = ./newpubkey.gpg;
trust = 5;
}
];
# Make sure the keygrips exist, otherwise we'd need to run `gpg --card-status`
# before being able to use the yubikey.
hm.home.activation.installKeygrips =
config.home-manager.users.root.lib.dag.entryAfter [ "writeBoundary" ]
''
run mkdir -p "$HOME/.gnupg/private-keys-v1.d"
run ${lib.getExe pkgs.gnutar} xvf ${
lib.escapeShellArg config.age.secrets."my-gpg-yubikey-keygrip.tar".path
} -C "$HOME/.gnupg/private-keys-v1.d/"
'';
hm.services.gpg-agent = { hm.services.gpg-agent = {
enable = true; enable = true;
enableSshSupport = true; enableSshSupport = true;