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
- `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
- `support/` configuration for supporting specific hardware
- `optional/` optionally includable configuration
- `support/` configuration for supporting specific hardware or use cases on a system level
- `services/` configuration for independent services
- `hosts/` contain nixos 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
- `host.pub` host public key, needed for rekeying agenix secrets
- `keys/` public keys needed for evaluating the system
- `lib/` extra library functions
- `modules/` extra nixos modules
- `modules-hm/` extra home-manager modules
- `modules-hm/` extra home-manager or home management modules
- `nix/` additional nix functions
- `devshell.nix` Development shell
- `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
- `secrets.nix.age` global secrets available at deploy
- `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
- `xorg/` configuration for xorg windowmanagers and basic utilities
- `programs/` configuration for miscellaneous programs
- `default.nix` minimal setup for all users
- `<username>/` configuration for users
- `impermanence.nix` users persistence configuration
- `root` minimal configuration for root

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 = [
./firefox.nix
./gpg
./alias.nix
./dev.nix
./impermanence.nix
./minion.nix
./patrick.nix
./smb.nix
./ssh.nix
./theme.nix
../common/alias.nix
../common/dev.nix
../common/wayland
./wayland
../common/programs/bottles.nix
../common/programs/direnv.nix
../common/programs/firefox.nix
../common/programs/gdb.nix
../common/programs/git.nix
../common/programs/gpg.nix
../common/programs/gpu-screen-recorder.nix
../common/programs/kitty.nix
../common/programs/minecraft.nix
../common/programs/nvim
../common/programs/obs.nix
../common/programs/pager.nix
../common/programs/poe.nix
../common/programs/spicetify.nix
../common/programs/steam.nix
../common/programs/thunderbird.nix
../common/programs/zsh
./programs/bottles.nix
./programs/direnv.nix
./programs/firefox.nix
./programs/gdb.nix
./programs/git.nix
./programs/gpg
./programs/gpu-screen-recorder.nix
./programs/kitty.nix
./programs/minecraft.nix
./programs/minion.nix
./programs/nvim
./programs/obs.nix
./programs/pager.nix
./programs/poe.nix
./programs/spicetify.nix
./programs/steam.nix
./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 =
let
betterfox = pkgs.fetchFromGitHub {
@ -10,6 +36,15 @@
};
in
{
enable = true;
package = pkgs.firefox.overrideAttrs (old: {
buildCommand =
old.buildCommand
+ ''
substituteInPlace $out/bin/firefox \
--replace "exec -a" ${escapeShellArg envStr}" exec -a"
'';
});
profiles.patrick = {
userChrome = ''
#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 = {
enable = true;
enableSshSupport = true;