diff --git a/STRUCTURE.md b/STRUCTURE.md index c786868..8f0af21 100644 --- a/STRUCTURE.md +++ b/STRUCTURE.md @@ -4,7 +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 - - `hardware/` configuration for specific hardware + - `support/` configuration for supporting specific hardware - `optional/` optionally includable configuration - `services/` configuration for independent services - `hosts/` contain nixos configuration for hosts @@ -30,9 +30,9 @@ This file contains a small overview over the contents and structure of this repo - `secrets.nix.age` global secrets available at deploy - `users/` home manager user configuration - `common/` shared home-manager modules - - `graphical/` configuration for graphical programs + - `wayland/` configuration for wayland windowmanagers and basic utilities + - `xorg/` configuration for xorg windowmanagers and basic utilities - `programs/` configuration for miscellaneous programs - - `shells/` configuration for shells - `default.nix` minimal setup for all users - `/` configuration for users - `impermanence.nix` users persistence configuration diff --git a/config/basic/default.nix b/config/basic/default.nix index b68000f..4116fcd 100644 --- a/config/basic/default.nix +++ b/config/basic/default.nix @@ -34,6 +34,7 @@ inputs.nixos-extra-modules.nixosModules.default inputs.nixos-nftables-firewall.nixosModules.default inputs.nixvim.nixosModules.nixvim + inputs.stylix.nixosModules.stylix ]; age.identityPaths = [ "/state/etc/ssh/ssh_host_ed25519_key" ]; boot.mode = lib.mkDefault "efi"; diff --git a/config/basic/home-manager.nix b/config/basic/home-manager.nix index 3df616d..0b05988 100644 --- a/config/basic/home-manager.nix +++ b/config/basic/home-manager.nix @@ -1,7 +1,6 @@ { stateVersion, inputs, - pkgs, nodes, minimal, ... @@ -9,6 +8,7 @@ { imports = [ ../../modules-hm/impermanence.nix + ../../modules-hm/hm-all.nix ]; home-manager = { useGlobalPkgs = true; @@ -16,10 +16,12 @@ verbose = true; extraSpecialArgs = { inherit nodes minimal; - spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; }; sharedModules = [ - { home.stateVersion = stateVersion; } + { + home.stateVersion = stateVersion; + systemd.user.startServices = "sd-switch"; + } inputs.nix-index-database.hmModules.nix-index inputs.nixos-extra-modules.homeManagerModules.default inputs.nixvim.homeManagerModules.nixvim diff --git a/config/basic/nix.nix b/config/basic/nix.nix index f86ac9f..76bf159 100644 --- a/config/basic/nix.nix +++ b/config/basic/nix.nix @@ -59,4 +59,7 @@ }; programs.nix-ld.enable = true; system.stateVersion = stateVersion; + hm-all.nixpkgs.config = { + allowUnfree = true; + }; } diff --git a/config/optional/graphical.nix b/config/optional/graphical.nix deleted file mode 100644 index 3c54ff4..0000000 --- a/config/optional/graphical.nix +++ /dev/null @@ -1,224 +0,0 @@ -{ - config, - inputs, - pkgs, - lib, - ... -}: -let - inherit (lib) mkOption types; -in -{ - options.hidpi = mkOption { - default = false; - type = types.bool; - description = "Enable HighDPI configuration for this host and all installed users"; - }; - - # stylix acceses stylix options on import meaning you can only import this module when you're actually setting stylix options - imports = [ inputs.stylix.nixosModules.stylix ]; - - config = { - environment.systemPackages = with pkgs; [ xdg-utils ]; - xdg.portal = { - xdgOpenUsePortal = true; - enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - ]; - config = { - common.default = [ - "gtk" - "hyprland" - ]; - sway.default = [ "wlr" ]; - }; - }; - # needed for gnome pinentry - services.dbus.packages = [ pkgs.gcr ]; - fonts = { - enableGhostscriptFonts = false; - fontDir.enable = false; - fontconfig = { - localConf = '' - - - - - monospace - - emoji - - - - sans-serif - - emoji - - - - serif - - emoji - - - - ''; - }; - packages = with pkgs; [ - (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) - ibm-plex - dejavu_fonts - unifont - freefont_ttf - gyre-fonts # TrueType substitutes for standard PostScript fonts - liberation_ttf - noto-fonts - noto-fonts-cjk-sans - noto-fonts-cjk-serif - noto-fonts-emoji - noto-fonts-extra - ]; - }; - stylix.fonts = { - serif = { - package = pkgs.dejavu_fonts; - name = "IBM Plex Serif"; - }; - - sansSerif = { - package = pkgs.dejavu_fonts; - name = "IBM Plex Sans"; - }; - - monospace = { - # No need for patched nerd fonts, kitty can pick up on them automatically, - # and ideally every program should do that: https://sw.kovidgoyal.net/kitty/faq/#kitty-is-not-able-to-use-my-favorite-font - package = pkgs.jetbrains-mono; - name = "JetBrains Mono"; - }; - - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - stylix = { - enable = true; - autoEnable = false; - polarity = "dark"; - image = config.lib.stylix.pixel "base00"; - base16Scheme = "${pkgs.base16-schemes}/share/themes/vice.yaml"; - # Has to be green - override.base0B = "#00CC99"; - #base16Scheme = { - # base00 = "#101419"; - # base01 = "#171B20"; - # base02 = "#21262e"; - # base03 = "#242931"; - # base04 = "#485263"; - # base05 = "#b6beca"; - # base06 = "#dee1e6"; - # base07 = "#e3e6eb"; - # base08 = "#e05f65"; - # base09 = "#f9a872"; - # base0A = "#f1cf8a"; - # base0B = "#78dba9"; - # base0C = "#74bee9"; - # base0D = "#70a5eb"; - # base0E = "#c68aee"; - # base0F = "#9378de"; - #}; - ## based on decaycs-dark, bright variant - #base16Scheme = { - # base00 = "#101419"; - # base01 = "#171B20"; - # base02 = "#21262e"; - # base03 = "#242931"; - # base04 = "#485263"; - # base05 = "#b6beca"; - # base06 = "#dee1e6"; - # base07 = "#e3e6eb"; - # base08 = "#e5646a"; - # base09 = "#f7b77c"; - # base0A = "#f6d48f"; - # base0B = "#94F7C5"; - # base0C = "#79c3ee"; - # base0D = "#75aaf0"; - # base0E = "#cb8ff3"; - # base0F = "#9d85e1"; - #}; - }; - - home-manager.sharedModules = [ - ( - { - pkgs, - config, - nixosConfig, - ... - }: - { - stylix = { - cursor = { - package = pkgs.openzone-cursors; - name = "OpenZone_White_Slim"; - size = if nixosConfig.hidpi then 48 else 18; - }; - inherit (nixosConfig.stylix) polarity; - targets = { - gtk.enable = true; - bat.enable = true; - dunst.enable = true; - zathura.enable = true; - xresources.enable = true; - }; - }; - - xresources.properties = { - "Xft.hinting" = true; - "Xft.antialias" = true; - "Xft.autohint" = false; - "Xft.lcdfilter" = "lcddefault"; - "Xft.hintstyle" = "hintfull"; - "Xft.rgba" = "rgb"; - }; - - gtk = - let - gtk34extraConfig = { - gtk-application-prefer-dark-theme = 1; - gtk-cursor-theme-size = 18; - gtk-enable-animations = true; - gtk-xft-antialias = 1; - gtk-xft-dpi = 96; # XXX: delete for wayland? - gtk-xft-hinting = 1; - gtk-xft-hintstyle = "hintfull"; - gtk-xft-rgba = "rgb"; - }; - in - { - enable = true; - iconTheme = { - name = "Vimix-Doder"; - package = pkgs.vimix-icon-theme; - }; - - gtk2.extraConfig = "gtk-application-prefer-dark-theme = true"; - gtk3.extraConfig = gtk34extraConfig; - gtk4.extraConfig = gtk34extraConfig; - }; - - home.sessionVariables.GTK_THEME = config.gtk.theme.name; - - qt = { - enable = true; - platformTheme.name = "adwaita"; - style.name = "Adwaita-Dark"; - }; - } - ) - ]; - }; -} diff --git a/config/optional/steam.nix b/config/optional/steam.nix deleted file mode 100644 index 23a455b..0000000 --- a/config/optional/steam.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - lib, - minimal, - pkgs, - ... -}: -lib.optionalAttrs (!minimal) { - programs.gpu-screen-recorder.enable = true; - programs.steam = { - enable = true; - package = pkgs.steam.override { - extraPkgs = - pkgs: with pkgs; [ - # vampir überlebende braucht diese pkgs - libgdiplus - cups - ]; - }; - }; -} diff --git a/config/optional/vr.nix b/config/optional/vr.nix deleted file mode 100644 index fb53ae1..0000000 --- a/config/optional/vr.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - # can't play VR until https://github.com/hyprwm/Hyprland/pull/8116 is merged - services.monado = { - enable = true; - defaultRuntime = true; - }; - systemd.user.services.monado.environment = { - STEAMVR_LH_ENABLE = "1"; - XRT_COMPOSITOR_COMPUTE = "1"; - }; -} diff --git a/config/hardware/bluetooth.nix b/config/support/bluetooth.nix similarity index 100% rename from config/hardware/bluetooth.nix rename to config/support/bluetooth.nix diff --git a/config/optional/initrd-ssh.nix b/config/support/initrd-ssh.nix similarity index 100% rename from config/optional/initrd-ssh.nix rename to config/support/initrd-ssh.nix diff --git a/config/hardware/laptop.nix b/config/support/laptop.nix similarity index 100% rename from config/hardware/laptop.nix rename to config/support/laptop.nix diff --git a/config/hardware/nintendo.nix b/config/support/nintendo.nix similarity index 100% rename from config/hardware/nintendo.nix rename to config/support/nintendo.nix diff --git a/config/hardware/nvidia.nix b/config/support/nvidia.nix similarity index 100% rename from config/hardware/nvidia.nix rename to config/support/nvidia.nix diff --git a/config/hardware/physical.nix b/config/support/physical.nix similarity index 100% rename from config/hardware/physical.nix rename to config/support/physical.nix diff --git a/config/hardware/pipewire.nix b/config/support/pipewire.nix similarity index 100% rename from config/hardware/pipewire.nix rename to config/support/pipewire.nix diff --git a/config/hardware/prime-offload.nix b/config/support/prime-offload.nix similarity index 100% rename from config/hardware/prime-offload.nix rename to config/support/prime-offload.nix diff --git a/config/optional/printing.nix b/config/support/printing.nix similarity index 100% rename from config/optional/printing.nix rename to config/support/printing.nix diff --git a/config/optional/secureboot.nix b/config/support/secureboot.nix similarity index 100% rename from config/optional/secureboot.nix rename to config/support/secureboot.nix diff --git a/config/support/vr.nix b/config/support/vr.nix new file mode 100644 index 0000000..df6a5c1 --- /dev/null +++ b/config/support/vr.nix @@ -0,0 +1,46 @@ +{ pkgs, ... }: +{ + # can't play VR until https://github.com/hyprwm/Hyprland/pull/8116 is merged + services.monado = { + enable = true; + defaultRuntime = true; + }; + systemd.user.services.monado.environment = { + STEAMVR_LH_ENABLE = "1"; + XRT_COMPOSITOR_COMPUTE = "1"; + }; + hm = + { config, ... }: + { + home.packages = [ pkgs.wlx-overlay-s ]; + xdg.configFile."openxr/1/active_runtime.json".text = '' + { + "file_format_version": "1.0.0", + "runtime": { + "name": "Monado", + "library_path": "${pkgs.monado}/lib/libopenxr_monado.so" + } + } + ''; + + xdg.configFile."openvr/openvrpaths.vrpath".text = '' + { + "config" : + [ + "${config.xdg.dataHome}/Steam/config" + ], + "external_drivers" : null, + "jsonid" : "vrpathreg", + "log" : + [ + "${config.xdg.dataHome}/Steam/logs" + ], + "runtime" : + [ + "${pkgs.opencomposite}/lib/opencomposite" + ], + "version" : 1 + } + ''; + }; +} diff --git a/config/hardware/yubikey.nix b/config/support/yubikey.nix similarity index 100% rename from config/hardware/yubikey.nix rename to config/support/yubikey.nix diff --git a/config/optional/zfs.nix b/config/support/zfs.nix similarity index 100% rename from config/optional/zfs.nix rename to config/support/zfs.nix diff --git a/hosts/desktopnix/default.nix b/hosts/desktopnix/default.nix index f0728c2..5a85e7c 100644 --- a/hosts/desktopnix/default.nix +++ b/hosts/desktopnix/default.nix @@ -13,22 +13,16 @@ ../../config/basic - ../../config/hardware/bluetooth.nix - ../../config/hardware/nintendo.nix - ../../config/hardware/nvidia.nix - ../../config/hardware/physical.nix - ../../config/hardware/pipewire.nix - ../../config/hardware/yubikey.nix - - ../../config/optional/dev.nix - ../../config/optional/graphical.nix - ../../config/optional/printing.nix - ../../config/optional/secureboot.nix - ../../config/optional/steam.nix - ../../config/optional/xserver.nix - ../../config/optional/wayland.nix - ../../config/optional/vr.nix - ../../config/optional/zfs.nix + ../../config/support/bluetooth.nix + ../../config/support/nintendo.nix + ../../config/support/nvidia.nix + ../../config/support/physical.nix + ../../config/support/pipewire.nix + ../../config/support/printing.nix + ../../config/support/secureboot.nix + ../../config/support/vr.nix + ../../config/support/yubikey.nix + ../../config/support/zfs.nix ./net.nix ./fs.nix diff --git a/hosts/elisabeth/default.nix b/hosts/elisabeth/default.nix index 2e7e17e..1e41cf9 100644 --- a/hosts/elisabeth/default.nix +++ b/hosts/elisabeth/default.nix @@ -13,11 +13,10 @@ ../../config/basic - ../../config/optional/initrd-ssh.nix - ../../config/optional/secureboot.nix - ../../config/optional/zfs.nix - - ../../config/hardware/physical.nix + ../../config/support/initrd-ssh.nix + ../../config/support/physical.nix + ../../config/support/secureboot.nix + ../../config/support/zfs.nix ./net.nix ./fs.nix diff --git a/hosts/maddy/default.nix b/hosts/maddy/default.nix index a345ced..01e0014 100644 --- a/hosts/maddy/default.nix +++ b/hosts/maddy/default.nix @@ -1,9 +1,9 @@ { imports = [ ../../config/basic - ../../config/optional/initrd-ssh.nix + ../../config/support/initrd-ssh.nix ../../config/services/maddy.nix - ../../config/optional/zfs.nix + ../../config/support/zfs.nix ./net.nix ./fs.nix diff --git a/hosts/patricknix/default.nix b/hosts/patricknix/default.nix index 0aea02d..35a494f 100644 --- a/hosts/patricknix/default.nix +++ b/hosts/patricknix/default.nix @@ -10,33 +10,27 @@ ../../config/basic - ../../config/hardware/bluetooth.nix - ../../config/hardware/laptop.nix - ../../config/hardware/nvidia.nix - ../../config/hardware/physical.nix - ../../config/hardware/pipewire.nix - ../../config/hardware/prime-offload.nix - ../../config/hardware/yubikey.nix - - ../../config/optional/dev.nix - ../../config/optional/graphical.nix - ../../config/optional/printing.nix - ../../config/optional/secureboot.nix - ../../config/optional/steam.nix - ../../config/optional/wayland.nix - ../../config/optional/zfs.nix + ../../config/support/bluetooth.nix + ../../config/support/laptop.nix + ../../config/support/nvidia.nix + ../../config/support/physical.nix + ../../config/support/pipewire.nix + ../../config/support/prime-offload.nix + ../../config/support/printing.nix + ../../config/support/secureboot.nix + ../../config/support/yubikey.nix + ../../config/support/zfs.nix ./net.nix ./fs.nix - ../../users/patrick + #../../users/patrick ]; stylix.fonts.sizes = { terminal = 9; applications = 9; desktop = 8; }; - hidpi = true; services = { xserver.xkb = { layout = "de"; diff --git a/hosts/testienix/default.nix b/hosts/testienix/default.nix index 1d330dd..53fbdfe 100644 --- a/hosts/testienix/default.nix +++ b/hosts/testienix/default.nix @@ -10,10 +10,10 @@ inputs.nixos-hardware.nixosModules.common-pc-ssd ../../config/basic - ../../config/optional/initrd-ssh.nix - ../../config/hardware/physical.nix - ../../config/optional/zfs.nix + ../../config/support/initrd-ssh.nix + ../../config/support/physical.nix + ../../config/support/zfs.nix ./net.nix ./fs.nix diff --git a/modules-hm/hm-all.nix b/modules-hm/hm-all.nix new file mode 100644 index 0000000..cde9144 --- /dev/null +++ b/modules-hm/hm-all.nix @@ -0,0 +1,40 @@ +{ config, lib, ... }: +let + inherit (lib) + mkOption + mkOptionType + types + mkIf + ; +in +{ + options = { + primaryUser = mkOption { + description = "Home-manager primary Username"; + type = types.nullOr types.str; + default = null; + }; + hm = mkOption { + description = "Home-manager options for the main user"; + type = mkOptionType { + name = "Home-manager options for the main user"; + merge = _loc: defs: (map (x: x.value) defs); + }; + }; + hm-all = mkOption { + description = "Home-manager options for the primary User and root."; + type = mkOptionType { + name = "Home-manager options for the all users"; + merge = _loc: defs: (map (x: x.value) defs); + }; + }; + }; + config.home-manager.users = mkIf (config.primaryUser != null) { + ${config.primaryUser} = { + imports = config.hm ++ config.hm-all; + }; + root = { + imports = config.hm-all; + }; + }; +} diff --git a/modules/secrets.nix b/modules/secrets.nix index 93db425..3971052 100644 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -65,24 +65,4 @@ in ''; }; }; - config.home-manager.sharedModules = [ - ( - { config, ... }: - { - options = { - userSecretsFile = mkOption { - default = ../users/${config._module.args.name}/secrets.nix.age; - type = types.path; - description = "The global secrets attribute that should be exposed to the user"; - }; - userSecrets = mkOption { - readOnly = true; - default = importEncrypted config.userSecretsFile inputs; - type = types.unspecified; - description = "User secrets"; - }; - }; - } - ) - ]; } diff --git a/pkgs/actual.nix b/pkgs/actual.nix deleted file mode 100644 index 56a8191..0000000 --- a/pkgs/actual.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - makeWrapper, - cacert, - gitMinimal, - nodejs, - yarn, -}: -stdenv.mkDerivation rec { - pname = "actual-server"; - version = "24.10.1"; - - src = fetchFromGitHub { - owner = "actualbudget"; - repo = "actual-server"; - rev = "v${version}"; - hash = "sha256-VJAD+lNamwuYmiPJLXkum6piGi5zLOHBp8cUeZagb4s="; - }; - # we cannot use fetchYarnDeps because that doesn't support yarn 2/berry lockfiles - offlineCache = stdenv.mkDerivation { - name = "actual-server-${version}-offline-cache"; - inherit src; - - nativeBuildInputs = [ - cacert # needed for git - gitMinimal # needed to download git dependencies - yarn - ]; - - buildPhase = '' - export HOME=$(mktemp -d) - yarn config set enableTelemetry 0 - yarn config set cacheFolder $out - yarn config set --json supportedArchitectures.os '[ "linux" ]' - yarn config set --json supportedArchitectures.cpu '[ "x64" ]' - yarn - ''; - - installPhase = '' - mkdir -p $out - cp -r ./node_modules $out/node_modules - ''; - dontFixup = true; - - outputHashMode = "recursive"; - outputHash = "sha256-siq3JnM0FFmXj5iX48E1A8X0lbdHM9NNCjOcg0Pwg5I="; - }; - - nativeBuildInputs = [ - makeWrapper - yarn - ]; - - installPhase = '' - runHook preInstall - mkdir -p $out - cp -r ${offlineCache}/node_modules/ $out/ - cp -r ./ $out - - mkdir -p $out/bin - makeWrapper ${lib.getExe nodejs} "$out/bin/actual-server" \ - --add-flags "$out/app.js" --set NODE_PATH "$out/node_modules" \ - - runHook postInstall - ''; - - meta = with lib; { - description = "A super fast privacy-focused app for managing your finances"; - homepage = "https://actualbudget.com/"; - license = licenses.mit; - mainProgram = "actual-server"; - maintainers = with maintainers; [ patrickdag ]; - platforms = [ "x86_64-linux" ]; - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index 7771d76..7c3fb61 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,7 +3,6 @@ _inputs: [ (_final: prev: { zsh-histdb-skim = prev.callPackage ./zsh-histdb-skim.nix { }; zsh-histdb = prev.callPackage ./zsh-histdb.nix { }; - actual = prev.callPackage ./actual.nix { }; pr-tracker = prev.callPackage ./pr-tracker.nix { }; deploy = prev.callPackage ./deploy.nix { }; signal-to-blog = prev.callPackage ./signal-to-blog.nix { }; diff --git a/pkgs/ollama-webui.nix b/pkgs/ollama-webui.nix deleted file mode 100644 index 1e188c9..0000000 --- a/pkgs/ollama-webui.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - lib, - buildNpmPackage, - nodePackages, - fetchFromGitHub, - runtimeShell, -}: -# We just package the JS frontend part, not the Python reverse-proxy backend. -# NixOS can provide any another reverse proxy such as nginx. -buildNpmPackage rec { - pname = "ollama-webui"; - # ollama-webui doesn't tag versions yet. - version = "0.0.0-unstable-2023-12-22"; - - src = fetchFromGitHub { - owner = "ollama-webui"; - repo = "ollama-webui"; - rev = "77c1a77fccb04337ff95440030cd051fd16c2cd8"; - hash = "sha256-u7h2tpHgtQwYXornslY3CZjKjigqBK2mHmaiK1EoEgk="; - }; - # dependencies are downloaded into a separate node_modules Nix package - npmDepsHash = "sha256-SI2dPn1SwbGwl8093VBtcDsA2eHSxr3UUC+ta68w2t8="; - - # We have to bake in the default URL it will use for ollama webserver here, - # but it can be overriden in the UI later. - PUBLIC_API_BASE_URL = "http://localhost:11434/api"; - - # The path '/ollama/api' will be redirected to the specified backend URL - OLLAMA_API_BASE_URL = PUBLIC_API_BASE_URL; - # "npm run build" creates a static page in the "build" folder. - installPhase = '' - mkdir -p $out/lib - cp -R ./build/. $out/lib - - mkdir -p $out/bin - cat <>$out/bin/${pname} - #!${runtimeShell} - ${nodePackages.http-server}/bin/http-server $out/lib "\$@" - EOF - chmod +x $out/bin/${pname} - ''; - - meta = with lib; { - description = "ChatGPT-Style Web Interface for Ollama"; - longDescription = '' - Tools like Ollama make open-source large langue models (LLM) accessible and almost - trivial to download and run them locally on a consumer computer. - However, Ollama only runs in a terminal and doesn't store any chat history. - Ollama-WebUI is a web frontend on top of Ollama that looks and behaves similar to ChatGPT's web frontend. - You can have separate chats with different LLMs that are saved in your browser, - automatic Markdown and Latex rendering, upload files etc. - This package contains two parts: - - `/lib` The WebUI as a compiled, static html folder to bundle in your web server - - `/bin/${pname}` A runnable webserver the serves the WebUI for convenience. - ''; - homepage = "https://github.com/ollama-webui/ollama-webui"; - license = licenses.mit; - mainProgram = pname; - maintainers = with maintainers; [ malteneuss ]; - platforms = platforms.all; - }; -} diff --git a/secrets/secrets.nix.age b/secrets/secrets.nix.age index 77e2003..92a3407 100644 Binary files a/secrets/secrets.nix.age and b/secrets/secrets.nix.age differ diff --git a/users/common/graphical/Xorg/default.nix b/users/common/Xorg/default.nix similarity index 100% rename from users/common/graphical/Xorg/default.nix rename to users/common/Xorg/default.nix diff --git a/users/common/graphical/Xorg/herbst-keys.nix b/users/common/Xorg/herbst-keys.nix similarity index 100% rename from users/common/graphical/Xorg/herbst-keys.nix rename to users/common/Xorg/herbst-keys.nix diff --git a/users/common/graphical/Xorg/herbstluft.nix b/users/common/Xorg/herbstluft.nix similarity index 100% rename from users/common/graphical/Xorg/herbstluft.nix rename to users/common/Xorg/herbstluft.nix diff --git a/users/common/graphical/Xorg/i3.nix b/users/common/Xorg/i3.nix similarity index 100% rename from users/common/graphical/Xorg/i3.nix rename to users/common/Xorg/i3.nix diff --git a/users/common/graphical/Xorg/polybar.nix b/users/common/Xorg/polybar.nix similarity index 100% rename from users/common/graphical/Xorg/polybar.nix rename to users/common/Xorg/polybar.nix diff --git a/users/common/graphical/Xorg/rofi.nix b/users/common/Xorg/rofi.nix similarity index 67% rename from users/common/graphical/Xorg/rofi.nix rename to users/common/Xorg/rofi.nix index c960f53..abdd4fc 100644 --- a/users/common/graphical/Xorg/rofi.nix +++ b/users/common/Xorg/rofi.nix @@ -7,4 +7,7 @@ dpi = 1; }; }; + hm.home.persistence."/state".files = [ + ".cache/rofi3.druncache" + ]; } diff --git a/users/common/Xorg/sway3.nix b/users/common/Xorg/sway3.nix new file mode 100644 index 0000000..1d646b0 --- /dev/null +++ b/users/common/Xorg/sway3.nix @@ -0,0 +1,246 @@ +{ + config, + lib, + pkgs, + ... +}: +# shared sway/i3 config +let + nixConfig = config; +in +{ + hm = + { config, ... }: + let + modifier = "Mod4"; + down = "r"; + left = "n"; + right = "s"; + up = "l"; + terminal = "kitty"; + cfg = { + inherit modifier terminal; + focus = { + followMouse = false; + mouseWarping = false; + }; + #bindkeysToCode = true; + window.titlebar = false; + floating.titlebar = false; + workspaceLayout = "stacking"; + bars = map (x: x // config.lib.stylix.i3.bar) [ + { + mode = "dock"; + workspaceButtons = true; + workspaceNumbers = false; + statusCommand = "${config.programs.i3status-rust.package}/bin/i3status-rs config-main.toml"; + trayOutput = "primary"; + } + ]; + floating.criteria = [ { class = "Pavucontrol"; } ]; + + assigns = { + "2:d" = [ { class = "^firefox$"; } ]; + "2:2" = [ { class = "^spotify$"; } ]; + "3:u" = [ { class = "^thunderbird$"; } ]; + "4:a" = [ + { class = "^bottles$"; } + { class = "^steam$"; } + { class = "^prismlauncher$"; } + ]; + "1:F1" = [ { class = "^discord$"; } ]; + "2:F2" = [ + { class = "^Signal$"; } + { class = "^TelegramDesktop$"; } + ]; + }; + + workspaceOutputAssign = + let + output = + out: + lib.lists.imap1 ( + i: x: { + workspace = "${toString i}:${x}"; + output = out; + } + ); + in + { + "desktopnix" = + output "HDMI-0" [ + "1" + "2" + "3" + "4" + "5" + "6" + "7" + "8" + "9" + ] + ++ output "DP-4" [ + "j" + "d" + "u" + "a" + "x" + "p" + ] + ++ output "DVI-D-0" [ + "F1" + "F2" + "F3" + "F4" + ]; + "patricknix" = + output "eDP-1" [ + "1" + "2" + "3" + "4" + "5" + "6" + "7" + "8" + "9" + ] + ++ output "DP-1" [ + "j" + "d" + "u" + "a" + "x" + "p" + ]; + "gojo" = output "eDP-1" [ + "1" + "2" + "3" + "4" + "5" + "6" + ]; + } + .${nixConfig.node.name} or [ ]; + + keybindings = + (lib.attrsets.mergeAttrsList ( + map ( + x: + ( + let + key = lib.elemAt (lib.strings.splitString ":" x.workspace) 1; + in + { + "${modifier}+${key}" = "workspace ${x.workspace}"; + "${modifier}+Shift+${key}" = "move container to workspace ${x.workspace}"; + } + ) + ) cfg.workspaceOutputAssign + )) + // { + "${modifier}+t" = "exec ${terminal}"; + "${modifier}+b" = "exec firefox"; + "${modifier}+m" = "exec thunderbird"; + "${modifier}+q" = "kill"; + "${modifier}+c" = "exec ${lib.getExe pkgs.scripts.clone-term}"; + "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl next"; + "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl previous"; + "XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t"; + "XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 5"; + "XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5"; + + "${modifier}+${left}" = "focus left"; + "${modifier}+${down}" = "focus down"; + "${modifier}+${up}" = "focus up"; + "${modifier}+${right}" = "focus right"; + + "${modifier}+Left" = "focus left"; + "${modifier}+Down" = "focus down"; + "${modifier}+Up" = "focus up"; + "${modifier}+Right" = "focus right"; + + "${modifier}+Shift+${left}" = "move left"; + "${modifier}+Shift+${down}" = "move down"; + "${modifier}+Shift+${up}" = "move up"; + "${modifier}+Shift+${right}" = "move right"; + + "${modifier}+Shift+Left" = "move left"; + "${modifier}+Shift+Down" = "move down"; + "${modifier}+Shift+Up" = "move up"; + "${modifier}+Shift+Right" = "move right"; + + "${modifier}+v" = "splith"; + "${modifier}+udiaeresis" = "splitv"; + "${modifier}+Return" = "fullscreen toggle"; + + "${modifier}+odiaeresis" = "layout stacking"; + "${modifier}+y" = "layout tabbed"; + "${modifier}+z" = "layout toggle split"; + + "${modifier}+f" = "floating toggle"; + "${modifier}+space" = "focus mode_toggle"; + + "${modifier}+comma" = "workspace prev_on_output"; + "${modifier}+period" = "workspace next_on_output"; + }; + }; + in + { + wayland.windowManager.sway.config = cfg; + xsession.windowManager.i3.config = cfg; + + programs.i3status-rust = { + enable = true; + bars.main = { + blocks = + [ + { block = "net"; } + { + block = "cpu"; + format = " $icon $utilization "; + } + { + block = "nvidia_gpu"; + format = " $icon $utilization $memory $temperature "; + } + ] + ++ { + "patricknix" = [ { block = "battery"; } ]; + } + .${nixConfig.node.name} or [ ] + ++ [ + { + block = "sound"; + click = [ + { + button = "left"; + action = "toggle_mute"; + } + ]; + } + { + block = "backlight"; + missing_format = ""; + } + { + block = "time"; + format = "$icon $timestamp.datetime(f:'%a %d.%m.%y %H:%M:%S') "; + interval = 1; + } + ]; + theme = "native"; + # currently nixpgs-wayland breaks this + # icons = "material-nf"; + settings = { + icons.icons = "material-nf"; + icons.overrides = { + cpu = " "; + }; + }; + }; + }; + }; +} diff --git a/users/common/graphical/Xorg/xinitrc b/users/common/Xorg/xinitrc similarity index 100% rename from users/common/graphical/Xorg/xinitrc rename to users/common/Xorg/xinitrc diff --git a/config/optional/xserver.nix b/users/common/Xorg/xserver.nix similarity index 100% rename from config/optional/xserver.nix rename to users/common/Xorg/xserver.nix diff --git a/users/common/shells/alias.nix b/users/common/alias.nix similarity index 95% rename from users/common/shells/alias.nix rename to users/common/alias.nix index b8df91f..5c25aca 100644 --- a/users/common/shells/alias.nix +++ b/users/common/alias.nix @@ -1,5 +1,5 @@ { - home.shellAliases = { + hm-all.home.shellAliases = { # Aliases l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto"; ll = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto"; diff --git a/users/common/default.nix b/users/common/default.nix deleted file mode 100644 index 7e23a2e..0000000 --- a/users/common/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ minimal, lib, ... }: -{ - imports = [ - ./shells/alias.nix - ./shells/zsh - - ./programs/gpg.nix - ] ++ lib.optional (!minimal) ./programs/htop.nix; - - programs.bat.enable = true; - nixpkgs.config = { - allowUnfree = true; - }; -} diff --git a/config/optional/dev.nix b/users/common/dev.nix similarity index 100% rename from config/optional/dev.nix rename to users/common/dev.nix diff --git a/users/common/graphical/default.nix b/users/common/graphical/default.nix deleted file mode 100644 index f5e2be7..0000000 --- a/users/common/graphical/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, config, ... }: -{ - home = { - packages = with pkgs; [ - zathura - feh - mpv - pinentry-gnome3 # for yubikey pinentry - ]; - }; - - # notification are nice to have - services.dunst = { - enable = true; - settings.global = { - monitor = 1; - frame_width = 0; - highlight = config.lib.stylix.colors.withHashtag.base0C; - progress_bar_frame_width = 0; - progress_bar_corner_radius = 0; - }; - }; -} diff --git a/users/common/graphical/sway3.nix b/users/common/graphical/sway3.nix deleted file mode 100644 index d3cfd10..0000000 --- a/users/common/graphical/sway3.nix +++ /dev/null @@ -1,240 +0,0 @@ -{ - config, - nixosConfig, - lib, - pkgs, - ... -}: -# shared sway/i3 config -let - modifier = "Mod4"; - down = "r"; - left = "n"; - right = "s"; - up = "l"; - terminal = "kitty"; - cfg = { - inherit modifier terminal; - focus = { - followMouse = false; - mouseWarping = false; - }; - #bindkeysToCode = true; - window.titlebar = false; - floating.titlebar = false; - workspaceLayout = "stacking"; - bars = map (x: x // config.lib.stylix.i3.bar) [ - { - mode = "dock"; - workspaceButtons = true; - workspaceNumbers = false; - statusCommand = "${config.programs.i3status-rust.package}/bin/i3status-rs config-main.toml"; - trayOutput = "primary"; - } - ]; - floating.criteria = [ { class = "Pavucontrol"; } ]; - - assigns = { - "2:d" = [ { class = "^firefox$"; } ]; - "2:2" = [ { class = "^spotify$"; } ]; - "3:u" = [ { class = "^thunderbird$"; } ]; - "4:a" = [ - { class = "^bottles$"; } - { class = "^steam$"; } - { class = "^prismlauncher$"; } - ]; - "1:F1" = [ { class = "^discord$"; } ]; - "2:F2" = [ - { class = "^Signal$"; } - { class = "^TelegramDesktop$"; } - ]; - }; - - workspaceOutputAssign = - let - output = - out: - lib.lists.imap1 ( - i: x: { - workspace = "${toString i}:${x}"; - output = out; - } - ); - in - { - "desktopnix" = - output "HDMI-0" [ - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" - ] - ++ output "DP-4" [ - "j" - "d" - "u" - "a" - "x" - "p" - ] - ++ output "DVI-D-0" [ - "F1" - "F2" - "F3" - "F4" - ]; - "patricknix" = - output "eDP-1" [ - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" - ] - ++ output "DP-1" [ - "j" - "d" - "u" - "a" - "x" - "p" - ]; - "gojo" = output "eDP-1" [ - "1" - "2" - "3" - "4" - "5" - "6" - ]; - } - .${nixosConfig.node.name} or [ ]; - - keybindings = - (lib.attrsets.mergeAttrsList ( - map ( - x: - ( - let - key = lib.elemAt (lib.strings.splitString ":" x.workspace) 1; - in - { - "${modifier}+${key}" = "workspace ${x.workspace}"; - "${modifier}+Shift+${key}" = "move container to workspace ${x.workspace}"; - } - ) - ) cfg.workspaceOutputAssign - )) - // { - "${modifier}+t" = "exec ${terminal}"; - "${modifier}+b" = "exec firefox"; - "${modifier}+m" = "exec thunderbird"; - "${modifier}+q" = "kill"; - "${modifier}+c" = "exec ${lib.getExe pkgs.scripts.clone-term}"; - "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl next"; - "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl previous"; - "XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t"; - "XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 5"; - "XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5"; - - "${modifier}+${left}" = "focus left"; - "${modifier}+${down}" = "focus down"; - "${modifier}+${up}" = "focus up"; - "${modifier}+${right}" = "focus right"; - - "${modifier}+Left" = "focus left"; - "${modifier}+Down" = "focus down"; - "${modifier}+Up" = "focus up"; - "${modifier}+Right" = "focus right"; - - "${modifier}+Shift+${left}" = "move left"; - "${modifier}+Shift+${down}" = "move down"; - "${modifier}+Shift+${up}" = "move up"; - "${modifier}+Shift+${right}" = "move right"; - - "${modifier}+Shift+Left" = "move left"; - "${modifier}+Shift+Down" = "move down"; - "${modifier}+Shift+Up" = "move up"; - "${modifier}+Shift+Right" = "move right"; - - "${modifier}+v" = "splith"; - "${modifier}+udiaeresis" = "splitv"; - "${modifier}+Return" = "fullscreen toggle"; - - "${modifier}+odiaeresis" = "layout stacking"; - "${modifier}+y" = "layout tabbed"; - "${modifier}+z" = "layout toggle split"; - - "${modifier}+f" = "floating toggle"; - "${modifier}+space" = "focus mode_toggle"; - - "${modifier}+comma" = "workspace prev_on_output"; - "${modifier}+period" = "workspace next_on_output"; - }; - }; -in -{ - wayland.windowManager.sway.config = cfg; - xsession.windowManager.i3.config = cfg; - - programs.i3status-rust = { - enable = true; - bars.main = { - blocks = - [ - { block = "net"; } - { - block = "cpu"; - format = " $icon $utilization "; - } - { - block = "nvidia_gpu"; - format = " $icon $utilization $memory $temperature "; - } - ] - ++ { - "patricknix" = [ { block = "battery"; } ]; - } - .${nixosConfig.node.name} or [ ] - ++ [ - { - block = "sound"; - click = [ - { - button = "left"; - action = "toggle_mute"; - } - ]; - } - { - block = "backlight"; - missing_format = ""; - } - { - block = "time"; - format = "$icon $timestamp.datetime(f:'%a %d.%m.%y %H:%M:%S') "; - interval = 1; - } - ]; - theme = "native"; - # currently nixpgs-wayland breaks this - # icons = "material-nf"; - settings = { - icons.icons = "material-nf"; - icons.overrides = { - cpu = " "; - }; - }; - }; - }; -} diff --git a/users/common/graphical/wayland/default.nix b/users/common/graphical/wayland/default.nix deleted file mode 100644 index 5918afc..0000000 --- a/users/common/graphical/wayland/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, ... }: -{ - imports = [ - ../. - ./fuzzel.nix - ./sway.nix - ./hyprland.nix - ./waybar - ./swaync - ./swww.nix - ]; - home.packages = with pkgs; [ - wdisplays - wl-clipboard - ]; -} diff --git a/users/common/graphical/wayland/fuzzel.nix b/users/common/graphical/wayland/fuzzel.nix deleted file mode 100644 index ba2a294..0000000 --- a/users/common/graphical/wayland/fuzzel.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - stylix.targets.fuzzel.enable = true; - programs.fuzzel = { - enable = true; - settings = { - main = { - launch-prefix = "uwsm app --"; - }; - }; - }; -} diff --git a/users/common/graphical/wayland/hyprland.nix b/users/common/graphical/wayland/hyprland.nix deleted file mode 100644 index 0458edf..0000000 --- a/users/common/graphical/wayland/hyprland.nix +++ /dev/null @@ -1,306 +0,0 @@ -{ - pkgs, - lib, - nixosConfig, - ... -}: -let - inherit (lib) - mkMerge - optionals - elem - mkIf - flip - concatMap - ; - #from https://github.com/hyprwm/Hyprland/issues/3835 - float_script = pkgs.writeShellScript "hyprland-bitwarden-float" '' - handle() { - case $1 in - windowtitle*) - # Extract the window ID from the line - window_id=''${1#*>>} - - # Fetch the list of windows and parse it using jq to find the window by its decimal ID - window_info=$(hyprctl clients -j | ${pkgs.jq}/bin/jq --arg id "0x$window_id" '.[] | select(.address == ($id))') - - # Extract the title from the window info - window_title=$(echo "$window_info" | ${pkgs.jq}/bin/jq '.title') - - # Check if the title matches the characteristics of the Bitwarden popup window - if [[ "$window_title" == '"Extension: (Bitwarden Password Manager) - Bitwarden — Mozilla Firefox"' ]]; then - - # echo $window_id, $window_title - # hyprctl dispatch togglefloating address:0x$window_id - # hyprctl dispatch resizewindowpixel exact 20% 40%,address:0x$window_id - # hyprctl dispatch movewindowpixel exact 40% 30%,address:0x$window_id - - hyprctl dispatch togglefloating address:0x$window_id - hyprctl dispatch resizewindowpixel exact "512 768",address:0x$window_id - hyprctl dispatch movewindowpixel exact "$HYPRLAND_FLOAT_LOCATION",address:0x$window_id - fi - ;; - esac - } - - # Listen to the Hyprland socket for events and process each line with the handle function - ${pkgs.socat}/bin/socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done - ''; -in -{ - # UWSM starts a SH to read env variables - # this ensures all home.sessionVars are exported - programs.bash.enable = true; - wayland.windowManager.hyprland = { - enable = true; - settings = mkMerge [ - { - input = { - kb_layout = "de"; - kb_variant = "nodeadkeys"; - follow_mouse = 2; - numlock_by_default = true; - repeat_rate = 60; - repeat_delay = 235; - # Only change focus on mouse click - float_switch_override_focus = 0; - accel_profile = "flat"; - - touchpad = { - natural_scroll = true; - disable_while_typing = true; - scroll_factor = 0.7; - }; - }; - device = { - name = "xp-pen-g430s-pen"; - active_area_size = "48 27"; - }; - gestures = { - workspace_swipe = true; - }; - - general = { - gaps_in = 0; - gaps_out = 0; - allow_tearing = true; - }; - #render = { - # explicit_sync = 0; - # direct_scanout = false; - #}; - binds = { - focus_preferred_method = 1; - workspace_center_on = 1; - }; - bind = - let - monitor_binds = { - "1" = "j"; - "2" = "d"; - "3" = "u"; - "4" = "a"; - "5" = "x"; - "6" = "F1"; - "7" = "F2"; - "8" = "F3"; - "9" = "F4"; - }; - in - [ - "SUPER,q,killactive," - "SUPER,return,fullscreen," - "SUPER + SHIFT,return,fullscreenstate,2,0," - "SUPER,f,togglefloating" - "SUPER,g,togglegroup" - "SUPER,tab,cyclenext," - "ALT,tab,cyclenext," - "SUPER+CTRL,r,submap,resize" - - "SUPER,left,movefocus,l" - "SUPER,right,movefocus,r" - "SUPER,up,movefocus,u" - "SUPER,down,movefocus,d" - - "SUPER,n,movefocus,l" - "SUPER,s,movefocus,r" - "SUPER,l,movefocus,u" - "SUPER,r,movefocus,d" - - "SUPER,h,changegroupactive,b" - "SUPER,m,changegroupactive,f" - - "SUPER + SHIFT,left,movewindoworgroup,l" - "SUPER + SHIFT,right,movewindoworgroup,r" - "SUPER + SHIFT,up,movewindoworgroup,u" - "SUPER + SHIFT,down,movewindoworgroup,d" - - "SUPER + SHIFT,n,movewindoworgroup,l" - "SUPER + SHIFT,s,movewindoworgroup,r" - "SUPER + SHIFT,l,movewindoworgroup,u" - "SUPER + SHIFT,r,movewindoworgroup,d" - - "SUPER,comma,workspace,-1" - "SUPER,period,workspace,+1" - "SUPER + SHIFT,comma,movetoworkspace,-1" - "SUPER + SHIFT,period,movetoworkspace,+1" - - "SUPER,b,exec,uwsm app -- firefox" - "SUPER,t,exec,uwsm app -- kitty" - ",Menu,exec,fuzzel" - "SUPER,c,exec,${lib.getExe pkgs.scripts.clone-term}" - - "CTRL,F7,pass,class:^(discord)$" - "CTRL,F8,pass,class:^(discord)$" - "CTRL,F7,pass,class:^(TeamSpeak 3)$" - "CTRL,F8,pass,class:^(TeamSpeak 3)$" - "CTRL,F9,exec,systemctl --user start swww-update-wallpaper" - - "SUPER + SHIFT,q,exec,uwsm stop" - ] - ++ flip concatMap (map toString (lib.lists.range 1 9)) (x: [ - "SUPER,${monitor_binds."${x}"},workspace,${x}" - "SUPER + SHIFT,${monitor_binds."${x}"},movetoworkspacesilent,${x}" - ]); - - cursor.no_warps = true; - debug.disable_logs = false; - env = - [ - "NIXOS_OZONE_WL,1" - "MOZ_ENABLE_WAYLAND,1" - "_JAVA_AWT_WM_NONREPARENTING,1" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "QT_QPA_PLATFORM,wayland;xcb" - "GDK_BACKEND,wayland" - "WLR_DRM_NO_ATOMIC,1" # retest on newest nvidia driver - "XDG_SESSION_TYPE,wayland" - "TERMINAL,uwsm app -- kitty" - ] - ++ optionals (elem "nvidia" nixosConfig.services.xserver.videoDrivers) [ - # See https://wiki.hyprland.org/Nvidia/ - "LIBVA_DRIVER_NAME,nvidia" - "GBM_BACKEND,nvidia-drm" - ]; - bindm = [ - # mouse movements - "SUPER, mouse:272, movewindow" - "SUPER, mouse:273, resizewindow" - "SUPER ALT, mouse:272, resizewindow" - ]; - animations = { - enabled = true; - animation = [ - "windows, 1, 4, default, slide" - "windowsOut, 1, 4, default, slide" - "windowsMove, 1, 4, default" - "border, 1, 2, default" - "fade, 1, 4, default" - "fadeDim, 1, 4, default" - "workspaces, 1, 4, default" - ]; - }; - decoration.rounding = 4; - exec-once = [ - "${pkgs.swaynotificationcenter}/bin/swaync" - ]; - misc = { - vrr = 1; - disable_hyprland_logo = true; - mouse_move_focuses_monitor = false; - }; - xwayland.force_zero_scaling = true; - windowrulev2 = [ - # fix these once nvidia gets their shit together - #"immediate, class:^(cs2)$" - # apex legends - "immediate, class:^(steam_app_1172470)$" - #??? - "immediate, class:^(steam_app_238960)$" - #baldur - #"immediate, class:^(steam_app_1086940)$" - "float, class:^(steam)$, title:^(Friends List)" - "float, class:^(steam)$, title:(Chat)" - - "float, class:^(streamlink-twitch-gui)$" - - "workspace 2,class:^(firefox)$" - "workspace 3,class:^(thunderbird)$" - "workspace 4,class:^(bottles)$" - "workspace 4,class:^(steam)$, title:^(Steam)" - "workspace 4,class:^(prismlauncher)$" - "workspace 6,class:^(discord)$" - "workspace 6,class:^(WebCord)$" - "workspace 6,class:^(TeamSpeak 3)$" - "workspace 7,class:^(signal)$" - "workspace 7,class:^(TelegramDesktop)$" - ]; - } - (mkIf (nixosConfig.node.name == "desktopnix") { - input.tablet = { - output = "DP-3"; - }; - monitor = [ - "DVI-D-1,preferred,0x0,1" - "HDMI-A-1,preferred,0x1080,1" - "DP-3,2560x1440@144.00Hz,1920x540,1" - # Thank you NVIDIA for this generous, free-of-charge, extra monitor that - # doesn't exist and crashes yoru session sometimes when moving a window to it. - "Unknown-1, disable" - ]; - workspace = [ - "1, monitor:DP-3, default:true" - "2, monitor:DP-3" - "3, monitor:DP-3" - "4, monitor:DP-3" - "5, monitor:DP-3" - "6, monitor:DVI-D-1, default:true" - "7, monitor:DVI-D-1" - "8, monitor:HDMI-A-1, default: true" - "9, monitor:HDMI-A-1" - ]; - env = [ "HYPRLAND_FLOAT_LOCATION,3800 680" ]; - }) - (mkIf (nixosConfig.node.name == "patricknix") { - monitor = [ - "eDP-1,preferred,0x0,2" - # Thank you NVIDIA for this generous, free-of-charge, extra monitor that - # doesn't exist and crashes yoru session sometimes when moving a window to it. - "Unknown-1, disable" - ]; - workspace = [ - "1, monitor:eDP-1, default:true" - "2, monitor:eDP-1" - "3, monitor:eDP-1" - "4, monitor:eDP-1" - "5, monitor:eDP-1" - "6, monitor:eDP-1" - "7, monitor:eDP-1" - "8, monitor:eDP-1" - "9, monitor:eDP-1" - ]; - env = [ "HYPRLAND_FLOAT_LOCATION,1400 200" ]; - }) - ]; - extraConfig = '' - submap=resize - binde=,right,resizeactive,80 0 - binde=,left,resizeactive,-80 0 - binde=,up,resizeactive,0 -80 - binde=,down,resizeactive,0 80 - binde=SHIFT,right,resizeactive,10 0 - binde=SHIFT,left,resizeactive,-10 0 - binde=SHIFT,up,resizeactive,0 -10 - binde=SHIFT,down,resizeactive,0 10 - bind=,return,submap,reset - bind=,escape,submap,reset - submap=reset - - exec-once = ${pkgs.xorg.xprop}/bin/xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 - exec-once = ${float_script} - env = XCURSOR_SIZE,48 - exec-once = uwsm finalize - - ''; - }; -} diff --git a/users/common/graphical/wayland/sway.nix b/users/common/graphical/wayland/sway.nix deleted file mode 100644 index 5f8cce2..0000000 --- a/users/common/graphical/wayland/sway.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ config, nixosConfig, ... }: -{ - # import shared i3 config - imports = [ ../sway3.nix ]; - stylix.targets.sway.enable = true; - wayland.windowManager.sway = { - enable = true; - config = - { - menu = "fuzzel"; - startup = [ - # for games to work input 1 has to be qwerts - # but i would like to have bone as my layout - { - command = "swaymsg input \"*\" xkb_switch_layout 1"; - always = true; - } - { command = "uwsm finalize"; } - ]; - input = { - "*" = { - xkb_layout = "de,de,de"; - # games are stupid so the main ui has to be de() without bone - xkb_variant = ",bone,neo"; - xkb_options = "grp:win_space_toggle"; - repeat_delay = "235"; - repeat_rate = "60"; - accel_profile = "flat"; - pointer_accel = "0.3"; - tap = "enabled"; - }; - "type:touchpad" = { - pointer_accel = "0.5"; - natural_scroll = "enabled"; - }; - "type:touch" = { - map_to_output = "eDP-1"; - }; - "type:tablet_tool" = { - map_to_output = "eDP-1"; - }; - }; - keybindings = - let - cfg = config.wayland.windowManager.sway.config; - in - { - "Menu" = "exec ${cfg.menu}"; - }; - } - // { - desktopnix = { - output = { - DVI-D-1 = { - mode = "1920x1080@60Hz"; - pos = "0,0"; - }; - HDMI-A-1 = { - mode = "1920x1080@60Hz"; - pos = "0,1080"; - }; - DP-3 = { - mode = "2560x1440@143.998Hz"; - pos = "1920,720"; - adaptive_sync = "on"; - }; - }; - }; - patricknix = { - output = { - "Acer Technologies XB271HU #ASP7ytE/6A7d" = { - mode = "2560x1440@59.951Hz"; - pos = "0,0"; - }; - "AU Optronics 0x30EB Unknown" = { - mode = "3840x2160@60.002Hz"; - pos = "2560,0"; - scale = "2"; - }; - }; - }; - } - .${nixosConfig.node.name} or { }; - extraConfig = - let - cfg = config.wayland.windowManager.sway.config; - in - '' - bindgesture swipe:3:left workpace next - bindgesture swipe:3:right workpace prev - bindgesture pinch:4:outward exec ${cfg.menu} - ''; - }; - # Cursor invisible - home.sessionVariables = { - WLR_NO_HARDWARE_CURSORS = 1; - NIXOS_OZONE_WL = 1; - # opengl backend flickers, also vulkan is love. - #WLR_RENDERER = "vulkan"; - }; -} diff --git a/users/common/impermanence.nix b/users/common/impermanence.nix deleted file mode 100644 index 614b906..0000000 --- a/users/common/impermanence.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - nixosConfig, - ... -}: -{ - home.persistence."/state" = { - files = - with lib.lists; - [ - ".ssh/known_hosts" - ".cache/fuzzel" - ] - ++ optionals config.programs.rofi.enable [ ".cache/rofi3.druncache" ]; - directories = - with lib.lists; - [ ".config/dconf" ] - ++ optionals config.programs.direnv.enable [ ".local/share/direnv" ] - ++ optionals config.programs.nushell.enable [ ".config/nushell" ] - ++ optionals nixosConfig.services.pipewire.enable [ - # persist sound config - ".local/state/wireplumber" - ]; - }; -} diff --git a/users/common/programs/bottles.nix b/users/common/programs/bottles.nix index 72c2f35..4b0edee 100644 --- a/users/common/programs/bottles.nix +++ b/users/common/programs/bottles.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - home.packages = with pkgs; [ + hm.home.packages = with pkgs; [ bottles winetricks wineWowPackages.fonts @@ -8,4 +8,9 @@ ]; # To enable dark mode use the command: # dconf write /com/usebottles/bottles/dark-theme true + hm.home.persistence."/state".directories = [ + # bottles state games + ".local/share/bottles" + + ]; } diff --git a/users/common/programs/direnv.nix b/users/common/programs/direnv.nix index 2b51c9d..d447526 100644 --- a/users/common/programs/direnv.nix +++ b/users/common/programs/direnv.nix @@ -1,6 +1,9 @@ { - programs.direnv = { + hm.programs.direnv = { enable = true; nix-direnv.enable = true; }; + hm.home.persistence."/state".directories = [ + ".local/share/direnv" + ]; } diff --git a/users/common/programs/firefox.nix b/users/common/programs/firefox.nix index 3d3cb1b..eaffde2 100644 --- a/users/common/programs/firefox.nix +++ b/users/common/programs/firefox.nix @@ -15,7 +15,7 @@ let envStr = concatStringsSep " " (mapAttrsToList (n: v: "${n}=${escapeShellArg v}") env); in { - programs.firefox = { + hm.programs.firefox = { enable = true; package = pkgs.firefox.overrideAttrs (old: { buildCommand = @@ -26,12 +26,12 @@ in ''; }); }; - home.persistence."/state".directories = [ + hm.home.persistence."/state".directories = [ ".cache/mozilla" ".mozilla" ]; - xdg.mimeApps.enable = true; - xdg.mimeApps.defaultApplications = { + hm.xdg.mimeApps.enable = true; + hm.xdg.mimeApps.defaultApplications = { "text/html" = [ "firefox.desktop" ]; "text/xml" = [ "firefox.desktop" ]; "x-scheme-handler/http" = [ "firefox.desktop" ]; diff --git a/users/common/programs/gdb.nix b/users/common/programs/gdb.nix index 899485e..984731f 100644 --- a/users/common/programs/gdb.nix +++ b/users/common/programs/gdb.nix @@ -13,21 +13,23 @@ let ); in { - home.packages = [ pwndbgWithDebuginfod ]; - home.enableDebugInfo = true; - xdg.configFile.gdbinit = { - target = "gdb/gdbinit"; - text = '' - set debuginfod enabled on - set auto-load safe-path / + hm = { + home.packages = [ pwndbgWithDebuginfod ]; + home.enableDebugInfo = true; + xdg.configFile.gdbinit = { + target = "gdb/gdbinit"; + text = '' + set debuginfod enabled on + set auto-load safe-path / - set history save on - set history filename ~/.local/share/gdb/history + set history save on + set history filename ~/.local/share/gdb/history - set disassembly-flavor intel - set print pretty on - ''; + set disassembly-flavor intel + set print pretty on + ''; + }; + + home.persistence."/state".directories = [ ".local/share/gdb" ]; }; - - home.persistence."/state".directories = [ ".local/share/gdb" ]; } diff --git a/users/common/programs/git.nix b/users/common/programs/git.nix index 759f85c..2a12dd0 100644 --- a/users/common/programs/git.nix +++ b/users/common/programs/git.nix @@ -26,42 +26,44 @@ let ); in { - programs.gitui.enable = true; - programs.git = { - enable = true; - difftastic.enable = true; - lfs.enable = true; - aliases = { - cs = "commit -v -S"; - s = "status"; - a = "add"; - p = "push"; - rebase = "rebase --gpg-sign"; - fixup = ''!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ''${@:2} && EDITOR=true git rebase -i --gpg-sign --autostash --autosquash $TARGET^; }; f''; - f = "!${gf}"; - crm = ''!git commit -v -S --edit --file "$(git rev-parse --git-dir)"/COMMIT_EDITMSG''; - }; - extraConfig = { - core.pager = "${pkgs.delta}/bin/delta"; - delta = { - hyperlinks = true; - keep-plus-minus-markers = true; - line-numbers = true; - navigate = true; - side-by-side = true; - syntax-theme = "TwoDark"; - tabs = 4; + hm = { + programs.gitui.enable = true; + programs.git = { + enable = true; + difftastic.enable = true; + lfs.enable = true; + aliases = { + cs = "commit -v -S"; + s = "status"; + a = "add"; + p = "push"; + rebase = "rebase --gpg-sign"; + fixup = ''!f() { TARGET=$(git rev-parse "$1"); git commit --fixup=$TARGET ''${@:2} && EDITOR=true git rebase -i --gpg-sign --autostash --autosquash $TARGET^; }; f''; + f = "!${gf}"; + crm = ''!git commit -v -S --edit --file "$(git rev-parse --git-dir)"/COMMIT_EDITMSG''; + }; + extraConfig = { + core.pager = "${pkgs.delta}/bin/delta"; + delta = { + hyperlinks = true; + keep-plus-minus-markers = true; + line-numbers = true; + navigate = true; + side-by-side = true; + syntax-theme = "TwoDark"; + tabs = 4; + }; + mergetool.prompt = true; + merge.conflictstyle = "diff3"; + init.defaultBranch = "main"; + pull.ff = "only"; + pull.rebase = true; + push.autoSetupRemote = true; + }; + signing = { + key = null; + signByDefault = true; }; - mergetool.prompt = true; - merge.conflictstyle = "diff3"; - init.defaultBranch = "main"; - pull.ff = "only"; - pull.rebase = true; - push.autoSetupRemote = true; - }; - signing = { - key = null; - signByDefault = true; }; }; } diff --git a/users/common/programs/gpg.nix b/users/common/programs/gpg.nix index 62fc697..900abdd 100644 --- a/users/common/programs/gpg.nix +++ b/users/common/programs/gpg.nix @@ -1,12 +1,12 @@ { pkgs, ... }: { - services.gpg-agent = { + hm.services.gpg-agent = { enable = true; enableSshSupport = true; pinentryPackage = pkgs.pinentry-gnome3; }; - programs.gpg = { + hm.programs.gpg = { enable = true; scdaemonSettings.disable-ccid = true; settings = { diff --git a/users/common/programs/gpu-screen-recorder.nix b/users/common/programs/gpu-screen-recorder.nix index 3413e30..6015dab 100644 --- a/users/common/programs/gpu-screen-recorder.nix +++ b/users/common/programs/gpu-screen-recorder.nix @@ -1,7 +1,7 @@ { lib, pkgs, - nixosConfig, + config, ... }: let @@ -88,11 +88,12 @@ let }; in { - lib.gpu-screen-recorder = { + programs.gpu-screen-recorder.enable = true; + hm.lib.gpu-screen-recorder = { inherit save-replay; }; - systemd.user.services.gpu-screen-recorder = { + hm.systemd.user.services.gpu-screen-recorder = { #Install.WantedBy = ["graphical-session.target"]; Unit = { Description = "GPU Screen Recorder Service"; @@ -113,8 +114,8 @@ in "GSR_COLOR_RANGE=full" "GSR_FPSPPS=no" ] - ++ lib.optionals (nixosConfig.node.name == "kroma") [ - "GSR_WINDOW=DP-2" # Primary monitor + ++ lib.optionals (config.node.name == "desktopnix") [ + "GSR_WINDOW=DP-3" # Primary monitor ]; ExecStart = lib.getExe start-service; diff --git a/users/common/programs/htop.nix b/users/common/programs/htop.nix index 9bab773..5ded83f 100644 --- a/users/common/programs/htop.nix +++ b/users/common/programs/htop.nix @@ -1,6 +1,6 @@ { config, ... }: { - programs.htop = { + hm-all.programs.htop = { enable = true; settings = { diff --git a/users/common/programs/kitty.nix b/users/common/programs/kitty.nix index da096d9..86d95e4 100644 --- a/users/common/programs/kitty.nix +++ b/users/common/programs/kitty.nix @@ -1,7 +1,7 @@ { pkgs, lib, ... }: { - stylix.targets.kitty.enable = true; - programs.kitty = { + hm.stylix.targets.kitty.enable = true; + hm.programs.kitty = { enable = true; package = pkgs.kitty.overrideAttrs (_finalAttrs: _prevAttrs: { doCheck = false; }); settings = { diff --git a/users/common/programs/minecraft.nix b/users/common/programs/minecraft.nix index 1029fd6..5012823 100644 --- a/users/common/programs/minecraft.nix +++ b/users/common/programs/minecraft.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { - home.persistence."/persist".directories = [ ".local/share/PrismLauncher" ]; - home.packages = [ pkgs.prismlauncher ]; + hm.home.persistence."/persist".directories = [ ".local/share/PrismLauncher" ]; + hm.home.packages = [ pkgs.prismlauncher ]; } diff --git a/users/common/shells/nu/config.nu b/users/common/programs/nu/config.nu similarity index 100% rename from users/common/shells/nu/config.nu rename to users/common/programs/nu/config.nu diff --git a/users/common/shells/nu/default.nix b/users/common/programs/nu/default.nix similarity index 81% rename from users/common/shells/nu/default.nix rename to users/common/programs/nu/default.nix index d1c35f9..64606aa 100644 --- a/users/common/shells/nu/default.nix +++ b/users/common/programs/nu/default.nix @@ -8,4 +8,7 @@ configFile.source = ./config.nu; envFile.source = ./env.nu; }; + home.persistence."/state" = { + directories = [ ".config/nushell" ]; + }; } diff --git a/users/common/shells/nu/env.nu b/users/common/programs/nu/env.nu similarity index 100% rename from users/common/shells/nu/env.nu rename to users/common/programs/nu/env.nu diff --git a/users/common/programs/nvim/default.nix b/users/common/programs/nvim/default.nix index 5ff4b49..b17cae8 100644 --- a/users/common/programs/nvim/default.nix +++ b/users/common/programs/nvim/default.nix @@ -1,58 +1,60 @@ { pkgs, ... }: { imports = [ - ./nixvim/keybinds.nix - ./nixvim/options.nix - ./nixvim/plugins.nix + ./keybinds.nix + ./options.nix + ./plugins.nix ]; - programs.nixvim = { - enable = true; - luaLoader.enable = true; - files."ftplugin/nix.lua".extraConfigLua = '' - vim.opt_local.expandtab = true - vim.opt_local.tabstop = 2 - vim.opt_local.shiftwidth = 2 - vim.opt_local.softtabstop = 2 - ''; - globals.mapleader = " "; - extraPlugins = with pkgs.vimPlugins; [ - vim-better-whitespace - dressing-nvim - nvim-window-picker - nabla-nvim - vim-gnupg - onedark-nvim - ]; - extraConfigLuaPre = '' - require("onedark").load() - ''; - extraConfigLuaPost = - # lua - '' - vim.notify = require("notify") - require("window-picker").setup { - hint = "floating-big-letter", - filter_rules = { - bo = { - filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" }, - buftype = { "terminal", "quickfix", "prompt" }, - }, - }, - floating_big_letter = { - font = "ansi-shadow", - }, - selection_chars = "EITCAUDJÄÜVF", - show_prompt = false, - } + hm = { + programs.nixvim = { + enable = true; + luaLoader.enable = true; + files."ftplugin/nix.lua".extraConfigLua = '' + vim.opt_local.expandtab = true + vim.opt_local.tabstop = 2 + vim.opt_local.shiftwidth = 2 + vim.opt_local.softtabstop = 2 ''; + globals.mapleader = " "; + extraPlugins = with pkgs.vimPlugins; [ + vim-better-whitespace + dressing-nvim + nvim-window-picker + nabla-nvim + vim-gnupg + onedark-nvim + ]; + extraConfigLuaPre = '' + require("onedark").load() + ''; + extraConfigLuaPost = + # lua + '' + vim.notify = require("notify") + require("window-picker").setup { + hint = "floating-big-letter", + filter_rules = { + bo = { + filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" }, + buftype = { "terminal", "quickfix", "prompt" }, + }, + }, + floating_big_letter = { + font = "ansi-shadow", + }, + selection_chars = "EITCAUDJÄÜVF", + show_prompt = false, + } + ''; + }; + home.sessionVariables.EDITOR = "nvim"; + home.shellAliases.vim = "nvim"; + home.shellAliases.vi = "nvim"; + home.shellAliases.vimdiff = "nvim -d"; + home.persistence."/state".directories = [ + ".local/share/nvim" + ".local/state/nvim" + ".cache/nvim" + ]; }; - home.sessionVariables.EDITOR = "nvim"; - home.shellAliases.vim = "nvim"; - home.shellAliases.vi = "nvim"; - home.shellAliases.vimdiff = "nvim -d"; - home.persistence."/state".directories = [ - ".local/share/nvim" - ".local/state/nvim" - ".cache/nvim" - ]; } diff --git a/users/common/programs/nvim/nixvim/keybinds.nix b/users/common/programs/nvim/keybinds.nix similarity index 98% rename from users/common/programs/nvim/nixvim/keybinds.nix rename to users/common/programs/nvim/keybinds.nix index 589d04c..cc0f93b 100644 --- a/users/common/programs/nvim/nixvim/keybinds.nix +++ b/users/common/programs/nvim/keybinds.nix @@ -5,7 +5,7 @@ let }; in { - programs.nixvim.keymaps = [ + hm.programs.nixvim.keymaps = [ { key = ""; action = ""; diff --git a/users/common/programs/nvim/nixvim/options.nix b/users/common/programs/nvim/options.nix similarity index 98% rename from users/common/programs/nvim/nixvim/options.nix rename to users/common/programs/nvim/options.nix index 4f82df0..23f00ed 100644 --- a/users/common/programs/nvim/nixvim/options.nix +++ b/users/common/programs/nvim/options.nix @@ -1,5 +1,5 @@ { - programs.nixvim.opts = { + hm.programs.nixvim.opts = { # Set maximum undo levels undolevels = 1000000; # Persistent Undo diff --git a/users/common/programs/nvim/nixvim/plugins.nix b/users/common/programs/nvim/plugins.nix similarity index 98% rename from users/common/programs/nvim/nixvim/plugins.nix rename to users/common/programs/nvim/plugins.nix index 0cae44c..46862a6 100644 --- a/users/common/programs/nvim/nixvim/plugins.nix +++ b/users/common/programs/nvim/plugins.nix @@ -5,7 +5,7 @@ ./plugins/alpha.nix ./plugins/neo-tree.nix ]; - programs.nixvim.plugins = { + hm.programs.nixvim.plugins = { web-devicons.enable = true; which-key.enable = true; lualine = { diff --git a/users/common/programs/nvim/nixvim/plugins/alpha.nix b/users/common/programs/nvim/plugins/alpha.nix similarity index 98% rename from users/common/programs/nvim/nixvim/plugins/alpha.nix rename to users/common/programs/nvim/plugins/alpha.nix index aff2877..9edf9a2 100644 --- a/users/common/programs/nvim/nixvim/plugins/alpha.nix +++ b/users/common/programs/nvim/plugins/alpha.nix @@ -1,5 +1,5 @@ { - programs.nixvim.plugins.alpha = { + hm.programs.nixvim.plugins.alpha = { enable = true; layout = let diff --git a/users/common/programs/nvim/nixvim/plugins/cmp.nix b/users/common/programs/nvim/plugins/cmp.nix similarity index 99% rename from users/common/programs/nvim/nixvim/plugins/cmp.nix rename to users/common/programs/nvim/plugins/cmp.nix index d9b651f..965f6e9 100644 --- a/users/common/programs/nvim/nixvim/plugins/cmp.nix +++ b/users/common/programs/nvim/plugins/cmp.nix @@ -1,5 +1,5 @@ { - programs.nixvim.plugins = { + hm.programs.nixvim.plugins = { luasnip = { enable = true; settings = { diff --git a/users/common/programs/nvim/nixvim/plugins/lsp.nix b/users/common/programs/nvim/plugins/lsp.nix similarity index 97% rename from users/common/programs/nvim/nixvim/plugins/lsp.nix rename to users/common/programs/nvim/plugins/lsp.nix index cfc4db2..e151d36 100644 --- a/users/common/programs/nvim/nixvim/plugins/lsp.nix +++ b/users/common/programs/nvim/plugins/lsp.nix @@ -1,6 +1,6 @@ { lib, pkgs, ... }: { - programs.nixvim.plugins = { + hm.programs.nixvim.plugins = { none-ls = { enable = true; sources = { diff --git a/users/common/programs/nvim/nixvim/plugins/neo-tree.nix b/users/common/programs/nvim/plugins/neo-tree.nix similarity index 97% rename from users/common/programs/nvim/nixvim/plugins/neo-tree.nix rename to users/common/programs/nvim/plugins/neo-tree.nix index 86e6a95..58960b1 100644 --- a/users/common/programs/nvim/nixvim/plugins/neo-tree.nix +++ b/users/common/programs/nvim/plugins/neo-tree.nix @@ -1,5 +1,5 @@ { - programs.nixvim.plugins.neo-tree = { + hm.programs.nixvim.plugins.neo-tree = { enable = true; sortCaseInsensitive = true; usePopupsForInput = false; diff --git a/users/common/programs/obs.nix b/users/common/programs/obs.nix index 1a2b8b4..922d116 100644 --- a/users/common/programs/obs.nix +++ b/users/common/programs/obs.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - programs.obs-studio = { + hm.programs.obs-studio = { enable = true; plugins = with pkgs.obs-studio-plugins; [ #obs-backgroundremoval @@ -9,4 +9,7 @@ obs-nvfbc ]; }; + hm.home.persistence."/state".directories = [ + ".config/obs-studio" + ]; } diff --git a/users/common/shells/pager.nix b/users/common/programs/pager.nix similarity index 96% rename from users/common/shells/pager.nix rename to users/common/programs/pager.nix index 59a61d9..2c9db11 100644 --- a/users/common/shells/pager.nix +++ b/users/common/programs/pager.nix @@ -66,5 +66,5 @@ let ); in { - home.sessionVariables.MANPAGER = "${exe} '+Man!'"; + hm.home.sessionVariables.MANPAGER = "${exe} '+Man!'"; } diff --git a/users/common/programs/poe.nix b/users/common/programs/poe.nix index a4a1522..5645699 100644 --- a/users/common/programs/poe.nix +++ b/users/common/programs/poe.nix @@ -1,10 +1,10 @@ { pkgs, ... }: { - home.persistence."/state".directories = [ ".config/awakened-poe-trade" ]; + hm.home.persistence."/state".directories = [ ".config/awakened-poe-trade" ]; - home.persistence."/persist".directories = [ ".local/share/pobfrontend" ]; + hm.home.persistence."/persist".directories = [ ".local/share/pobfrontend" ]; - home.packages = [ + hm.home.packages = [ #pkgs.awakened-poe-trade pkgs.path-of-building ]; diff --git a/users/common/programs/spicetify.nix b/users/common/programs/spicetify.nix index 8f0ac00..cdc4f13 100644 --- a/users/common/programs/spicetify.nix +++ b/users/common/programs/spicetify.nix @@ -1,6 +1,9 @@ -{ spicePkgs, ... }: +{ inputs, pkgs, ... }: +let + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; +in { - programs.spicetify = { + hm.programs.spicetify = { enable = true; theme = spicePkgs.themes.retroBlur; colorScheme = "Purple"; diff --git a/users/common/programs/steam.nix b/users/common/programs/steam.nix new file mode 100644 index 0000000..7407dae --- /dev/null +++ b/users/common/programs/steam.nix @@ -0,0 +1,35 @@ +{ + pkgs, + lib, + config, + ... +}: +{ + programs.steam = { + enable = true; + package = pkgs.steam.override { + extraPkgs = + pkgs: with pkgs; [ + # vampir überlebende braucht diese pkgs + libgdiplus + cups + ]; + }; + }; + hm.home.persistence = { + "/state".directories = [ + # Folders for steam + ".local/share/Steam" + ".steam" + # Ken follets pillars of earth + ".local/share//Daedalic Entertainment GmbH/" + # Nvidia shader cache + ".cache/nvidia" + # Vulkan shader cache + ".local/share/vulkan" + ]; + "/panzer/state".directories = lib.lists.optionals (config.disko.devices.zpool ? "panzer") [ + ".local/share/SteamPanzer" + ]; + }; +} diff --git a/users/common/programs/thunderbird.nix b/users/common/programs/thunderbird.nix index 21b6a81..2e5677c 100644 --- a/users/common/programs/thunderbird.nix +++ b/users/common/programs/thunderbird.nix @@ -1,81 +1,83 @@ { config, lib, ... }: { - accounts.email.accounts = lib.flip lib.mapAttrs' config.userSecrets.accounts.email ( - _: v: - lib.nameValuePair v.address ( - lib.recursiveUpdate v { - thunderbird.enable = true; - thunderbird.profiles = [ "personal" ]; - } - ) - ); - programs.thunderbird = { - enable = true; + hm = { + accounts.email.accounts = lib.flip lib.mapAttrs' config.secrets.secrets.global.user.accounts.email ( + _: v: + lib.nameValuePair v.address ( + lib.recursiveUpdate v { + thunderbird.enable = true; + thunderbird.profiles = [ "personal" ]; + } + ) + ); + programs.thunderbird = { + enable = true; - profiles.personal = { - isDefault = true; - withExternalGnupg = true; + profiles.personal = { + isDefault = true; + withExternalGnupg = true; + + settings = { + "mail.identity.default.archive_enabled" = true; + "mail.identity.default.archive_keep_folder_structure" = true; + "mail.identity.default.compose_html" = false; + "mail.identity.default.protectSubject" = true; + "mail.identity.default.reply_on_top" = 1; + "mail.identity.default.sig_on_reply" = false; + + "gfx.webrender.all" = true; + "gfx.webrender.enabled" = true; + + "browser.display.use_system_colors" = true; + "browser.theme.dark-toolbar-theme" = true; + }; + }; settings = { - "mail.identity.default.archive_enabled" = true; - "mail.identity.default.archive_keep_folder_structure" = true; - "mail.identity.default.compose_html" = false; - "mail.identity.default.protectSubject" = true; - "mail.identity.default.reply_on_top" = 1; - "mail.identity.default.sig_on_reply" = false; + # Some general settings. + "mail.server.default.allow_utf8_accept" = true; + "mail.server.default.max_articles" = 1000; + "mail.server.default.check_all_folders_for_new" = true; + "mail.show_headers" = 1; - "gfx.webrender.all" = true; - "gfx.webrender.enabled" = true; + # Show some metadata. + "mailnews.headers.showMessageId" = true; + "mailnews.headers.showOrganization" = true; + "mailnews.headers.showReferences" = true; + "mailnews.headers.showUserAgent" = true; - "browser.display.use_system_colors" = true; - "browser.theme.dark-toolbar-theme" = true; + # Sort mails and news in descending order. + "mailnews.default_sort_order" = 2; + "mailnews.default_news_sort_order" = 2; + # Sort mails and news by date. + "mailnews.default_sort_type" = 18; + "mailnews.default_news_sort_type" = 18; + + # Sort them by the newest reply in thread. + "mailnews.sort_threads_by_root" = true; + # Show time. + "mail.ui.display.dateformat.default" = 1; + # Sanitize it to UTC to prevent leaking local time. + "mail.sanitize_date_header" = true; + + # Email composing QoL. + "mail.identity.default.auto_quote" = true; + "mail.identity.default.attachPgpKey" = true; + + "app.update.auto" = false; + "privacy.donottrackheader.enabled" = true; }; }; - settings = { - # Some general settings. - "mail.server.default.allow_utf8_accept" = true; - "mail.server.default.max_articles" = 1000; - "mail.server.default.check_all_folders_for_new" = true; - "mail.show_headers" = 1; - - # Show some metadata. - "mailnews.headers.showMessageId" = true; - "mailnews.headers.showOrganization" = true; - "mailnews.headers.showReferences" = true; - "mailnews.headers.showUserAgent" = true; - - # Sort mails and news in descending order. - "mailnews.default_sort_order" = 2; - "mailnews.default_news_sort_order" = 2; - # Sort mails and news by date. - "mailnews.default_sort_type" = 18; - "mailnews.default_news_sort_type" = 18; - - # Sort them by the newest reply in thread. - "mailnews.sort_threads_by_root" = true; - # Show time. - "mail.ui.display.dateformat.default" = 1; - # Sanitize it to UTC to prevent leaking local time. - "mail.sanitize_date_header" = true; - - # Email composing QoL. - "mail.identity.default.auto_quote" = true; - "mail.identity.default.attachPgpKey" = true; - - "app.update.auto" = false; - "privacy.donottrackheader.enabled" = true; + home.persistence."/state".directories = [ + ".cache/thunderbird" + ".thunderbird" + ]; + xdg.mimeApps.enable = true; + xdg.mimeApps.defaultApplications = { + "x-scheme-handler/mailto" = [ "thunderbird.desktop" ]; + "x-scheme-handler/mid" = [ "thunderbird.desktop" ]; + "message/rfc822" = [ "thunderbird.desktop" ]; }; }; - - home.persistence."/state".directories = [ - ".cache/thunderbird" - ".thunderbird" - ]; - xdg.mimeApps.enable = true; - xdg.mimeApps.defaultApplications = { - "x-scheme-handler/mailto" = [ "thunderbird.desktop" ]; - "x-scheme-handler/mid" = [ "thunderbird.desktop" ]; - "message/rfc822" = [ "thunderbird.desktop" ]; - }; } diff --git a/users/common/programs/zsh/default.nix b/users/common/programs/zsh/default.nix new file mode 100644 index 0000000..771329b --- /dev/null +++ b/users/common/programs/zsh/default.nix @@ -0,0 +1,68 @@ +{ pkgs, ... }: +{ + imports = [ ./starfish.nix ]; + # save history in xdg data home + hm-all = + { config, ... }: + { + home.sessionVariables.HISTDB_FILE = "${config.xdg.dataHome}/zsh/history.db"; + + # has to be enabled to support zsh reverse search + programs.fzf.enable = true; + + programs.carapace = { + enable = false; + # this would source all completers sadly some are worse than the builtin completers + enableZshIntegration = false; + }; + + programs.zoxide.enable = true; + + programs.nix-index.enable = true; + programs.nix-index.enableZshIntegration = false; + programs.nix-index-database.comma.enable = true; + + programs.zsh = { + enable = true; + dotDir = ".config/zsh"; + history = { + extended = true; + path = "${config.xdg.dataHome}/zsh/zsh_history"; + save = 1000000; + share = false; + }; + initExtra = builtins.readFile ./zshrc; + # This needs to be loaded befor zsh-fast-syntax-highlighting + # is sourced as that overwrites all widgets to redraw with highlighting + initExtraFirst = '' + if autoload history-search-end; then + zle -N history-beginning-search-backward-end history-search-end + zle -N history-beginning-search-forward-end history-search-end + fi + + ''; + plugins = [ + { + name = "fzf-tab"; + src = "${pkgs.zsh-fzf-tab}/share/fzf-tab"; + } + { + name = "fast-syntax-highlighting"; + src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions"; + } + { + name = "zsh-histdb"; + src = pkgs.zsh-histdb; + } + { + name = "zsh-histdb-skim"; + src = pkgs.zsh-histdb-skim; + } + ]; + }; + home.persistence."/state".directories = [ + ".local/share/zsh" + ".local/share/zoxide" + ]; + }; +} diff --git a/users/common/shells/starfish.nix b/users/common/programs/zsh/starfish.nix similarity index 98% rename from users/common/shells/starfish.nix rename to users/common/programs/zsh/starfish.nix index a5610cf..a60935b 100644 --- a/users/common/shells/starfish.nix +++ b/users/common/programs/zsh/starfish.nix @@ -1,6 +1,6 @@ { lib, ... }: { - programs.starship = { + hm-all.programs.starship = { enable = true; settings = { add_newline = false; diff --git a/users/common/shells/zsh/zshrc b/users/common/programs/zsh/zshrc similarity index 100% rename from users/common/shells/zsh/zshrc rename to users/common/programs/zsh/zshrc diff --git a/users/common/shells/zsh/default.nix b/users/common/shells/zsh/default.nix deleted file mode 100644 index 613c7ac..0000000 --- a/users/common/shells/zsh/default.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ pkgs, config, ... }: -{ - imports = [ ../starfish.nix ]; - - # save history in xdg data home - home.sessionVariables.HISTDB_FILE = "${config.xdg.dataHome}/zsh/history.db"; - - # has to be enabled to support zsh reverse search - programs.fzf.enable = true; - - programs.carapace = { - enable = false; - # this would source all completers sadly some are worse than the builtin completers - enableZshIntegration = false; - }; - - programs.zoxide.enable = true; - - programs.nix-index.enable = true; - programs.nix-index.enableZshIntegration = false; - programs.nix-index-database.comma.enable = true; - - programs.zsh = { - enable = true; - dotDir = ".config/zsh"; - history = { - extended = true; - path = "${config.xdg.dataHome}/zsh/zsh_history"; - save = 1000000; - share = false; - }; - initExtra = builtins.readFile ./zshrc; - # This needs to be loaded befor zsh-fast-syntax-highlighting - # is sourced as that overwrites all widgets to redraw with highlighting - initExtraFirst = '' - if autoload history-search-end; then - zle -N history-beginning-search-backward-end history-search-end - zle -N history-beginning-search-forward-end history-search-end - fi - - ''; - plugins = [ - { - name = "fzf-tab"; - src = "${pkgs.zsh-fzf-tab}/share/fzf-tab"; - } - { - name = "fast-syntax-highlighting"; - src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions"; - } - { - name = "zsh-histdb"; - src = pkgs.zsh-histdb; - } - { - name = "zsh-histdb-skim"; - src = pkgs.zsh-histdb-skim; - } - ]; - }; - home.persistence."/state".directories = [ - ".local/share/zsh" - ".local/share/zoxide" - ]; -} diff --git a/config/optional/wayland.nix b/users/common/wayland/default.nix similarity index 72% rename from config/optional/wayland.nix rename to users/common/wayland/default.nix index 918a9d6..c2aef2c 100644 --- a/config/optional/wayland.nix +++ b/users/common/wayland/default.nix @@ -1,19 +1,13 @@ { lib, - minimal, pkgs, ... }: -lib.optionalAttrs (!minimal) { +{ services.dbus = { enable = true; implementation = "broker"; }; - environment.systemPackages = with pkgs; [ - wdisplays - wl-clipboard - wev - ]; xdg.portal = { enable = true; xdgOpenUsePortal = true; @@ -42,4 +36,23 @@ lib.optionalAttrs (!minimal) { }; }; }; + imports = [ + ./fuzzel.nix + ./sway.nix + ./hyprland.nix + ./waybar + ./swaync + ./swww.nix + ]; + hm.home.packages = with pkgs; [ + wdisplays + wl-clipboard + wev + ]; + # Autostart hyprland if on tty1 (once, don't restart after logout) + hm.programs.zsh.initExtra = lib.mkOrder 9999 '' + if uwsm check may-start ; then + exec systemd-cat -t uwsm_start uwsm start -S -F Hyprland + fi + ''; } diff --git a/users/common/wayland/fuzzel.nix b/users/common/wayland/fuzzel.nix new file mode 100644 index 0000000..974f576 --- /dev/null +++ b/users/common/wayland/fuzzel.nix @@ -0,0 +1,14 @@ +{ + hm.stylix.targets.fuzzel.enable = true; + hm.programs.fuzzel = { + enable = true; + settings = { + main = { + launch-prefix = "uwsm app --"; + }; + }; + }; + hm.home.persistence."/state".files = [ + ".cache/fuzzel" + ]; +} diff --git a/users/common/wayland/hyprland.nix b/users/common/wayland/hyprland.nix new file mode 100644 index 0000000..3d0f82c --- /dev/null +++ b/users/common/wayland/hyprland.nix @@ -0,0 +1,308 @@ +{ + pkgs, + lib, + config, + ... +}: +let + inherit (lib) + mkMerge + optionals + elem + mkIf + flip + concatMap + ; + #from https://github.com/hyprwm/Hyprland/issues/3835 + float_script = pkgs.writeShellScript "hyprland-bitwarden-float" '' + handle() { + case $1 in + windowtitle*) + # Extract the window ID from the line + window_id=''${1#*>>} + + # Fetch the list of windows and parse it using jq to find the window by its decimal ID + window_info=$(hyprctl clients -j | ${pkgs.jq}/bin/jq --arg id "0x$window_id" '.[] | select(.address == ($id))') + + # Extract the title from the window info + window_title=$(echo "$window_info" | ${pkgs.jq}/bin/jq '.title') + + # Check if the title matches the characteristics of the Bitwarden popup window + if [[ "$window_title" == '"Extension: (Bitwarden Password Manager) - Bitwarden — Mozilla Firefox"' ]]; then + + # echo $window_id, $window_title + # hyprctl dispatch togglefloating address:0x$window_id + # hyprctl dispatch resizewindowpixel exact 20% 40%,address:0x$window_id + # hyprctl dispatch movewindowpixel exact 40% 30%,address:0x$window_id + + hyprctl dispatch togglefloating address:0x$window_id + hyprctl dispatch resizewindowpixel exact "512 768",address:0x$window_id + hyprctl dispatch movewindowpixel exact "$HYPRLAND_FLOAT_LOCATION",address:0x$window_id + fi + ;; + esac + } + + # Listen to the Hyprland socket for events and process each line with the handle function + ${pkgs.socat}/bin/socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done + ''; +in +{ + hm = { + # UWSM starts a SH to read env variables + # this ensures all home.sessionVars are exported + programs.bash.enable = true; + wayland.windowManager.hyprland = { + enable = true; + settings = mkMerge [ + { + input = { + kb_layout = "de"; + kb_variant = "nodeadkeys"; + follow_mouse = 2; + numlock_by_default = true; + repeat_rate = 60; + repeat_delay = 235; + # Only change focus on mouse click + float_switch_override_focus = 0; + accel_profile = "flat"; + + touchpad = { + natural_scroll = true; + disable_while_typing = true; + scroll_factor = 0.7; + }; + }; + device = { + name = "xp-pen-g430s-pen"; + active_area_size = "48 27"; + }; + gestures = { + workspace_swipe = true; + }; + + general = { + gaps_in = 0; + gaps_out = 0; + allow_tearing = true; + }; + #render = { + # explicit_sync = 0; + # direct_scanout = false; + #}; + binds = { + focus_preferred_method = 1; + workspace_center_on = 1; + }; + bind = + let + monitor_binds = { + "1" = "j"; + "2" = "d"; + "3" = "u"; + "4" = "a"; + "5" = "x"; + "6" = "F1"; + "7" = "F2"; + "8" = "F3"; + "9" = "F4"; + }; + in + [ + "SUPER,q,killactive," + "SUPER,return,fullscreen," + "SUPER + SHIFT,return,fullscreenstate,2,0," + "SUPER,f,togglefloating" + "SUPER,g,togglegroup" + "SUPER,tab,cyclenext," + "ALT,tab,cyclenext," + "SUPER+CTRL,r,submap,resize" + + "SUPER,left,movefocus,l" + "SUPER,right,movefocus,r" + "SUPER,up,movefocus,u" + "SUPER,down,movefocus,d" + + "SUPER,n,movefocus,l" + "SUPER,s,movefocus,r" + "SUPER,l,movefocus,u" + "SUPER,r,movefocus,d" + + "SUPER,h,changegroupactive,b" + "SUPER,m,changegroupactive,f" + + "SUPER + SHIFT,left,movewindoworgroup,l" + "SUPER + SHIFT,right,movewindoworgroup,r" + "SUPER + SHIFT,up,movewindoworgroup,u" + "SUPER + SHIFT,down,movewindoworgroup,d" + + "SUPER + SHIFT,n,movewindoworgroup,l" + "SUPER + SHIFT,s,movewindoworgroup,r" + "SUPER + SHIFT,l,movewindoworgroup,u" + "SUPER + SHIFT,r,movewindoworgroup,d" + + "SUPER,comma,workspace,-1" + "SUPER,period,workspace,+1" + "SUPER + SHIFT,comma,movetoworkspace,-1" + "SUPER + SHIFT,period,movetoworkspace,+1" + + "SUPER,b,exec,uwsm app -- firefox" + "SUPER,t,exec,uwsm app -- kitty" + ",Menu,exec,fuzzel" + "SUPER,c,exec,${lib.getExe pkgs.scripts.clone-term}" + + "CTRL,F7,pass,class:^(discord)$" + "CTRL,F8,pass,class:^(discord)$" + "CTRL,F7,pass,class:^(TeamSpeak 3)$" + "CTRL,F8,pass,class:^(TeamSpeak 3)$" + "CTRL,F9,exec,systemctl --user start swww-update-wallpaper" + + "SUPER + SHIFT,q,exec,uwsm stop" + ] + ++ flip concatMap (map toString (lib.lists.range 1 9)) (x: [ + "SUPER,${monitor_binds."${x}"},workspace,${x}" + "SUPER + SHIFT,${monitor_binds."${x}"},movetoworkspacesilent,${x}" + ]); + + cursor.no_warps = true; + debug.disable_logs = false; + env = + [ + "NIXOS_OZONE_WL,1" + "MOZ_ENABLE_WAYLAND,1" + "_JAVA_AWT_WM_NONREPARENTING,1" + "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" + "QT_QPA_PLATFORM,wayland;xcb" + "GDK_BACKEND,wayland" + "WLR_DRM_NO_ATOMIC,1" # retest on newest nvidia driver + "XDG_SESSION_TYPE,wayland" + "TERMINAL,uwsm app -- kitty" + ] + ++ optionals (elem "nvidia" config.services.xserver.videoDrivers) [ + # See https://wiki.hyprland.org/Nvidia/ + "LIBVA_DRIVER_NAME,nvidia" + "GBM_BACKEND,nvidia-drm" + ]; + bindm = [ + # mouse movements + "SUPER, mouse:272, movewindow" + "SUPER, mouse:273, resizewindow" + "SUPER ALT, mouse:272, resizewindow" + ]; + animations = { + enabled = true; + animation = [ + "windows, 1, 4, default, slide" + "windowsOut, 1, 4, default, slide" + "windowsMove, 1, 4, default" + "border, 1, 2, default" + "fade, 1, 4, default" + "fadeDim, 1, 4, default" + "workspaces, 1, 4, default" + ]; + }; + decoration.rounding = 4; + exec-once = [ + "${pkgs.swaynotificationcenter}/bin/swaync" + ]; + misc = { + vrr = 1; + disable_hyprland_logo = true; + mouse_move_focuses_monitor = false; + }; + xwayland.force_zero_scaling = true; + windowrulev2 = [ + # fix these once nvidia gets their shit together + #"immediate, class:^(cs2)$" + # apex legends + "immediate, class:^(steam_app_1172470)$" + #??? + "immediate, class:^(steam_app_238960)$" + #baldur + #"immediate, class:^(steam_app_1086940)$" + "float, class:^(steam)$, title:^(Friends List)" + "float, class:^(steam)$, title:(Chat)" + + "float, class:^(streamlink-twitch-gui)$" + + "workspace 2,class:^(firefox)$" + "workspace 3,class:^(thunderbird)$" + "workspace 4,class:^(bottles)$" + "workspace 4,class:^(steam)$, title:^(Steam)" + "workspace 4,class:^(prismlauncher)$" + "workspace 6,class:^(discord)$" + "workspace 6,class:^(WebCord)$" + "workspace 6,class:^(TeamSpeak 3)$" + "workspace 7,class:^(signal)$" + "workspace 7,class:^(TelegramDesktop)$" + ]; + } + (mkIf (config.node.name == "desktopnix") { + input.tablet = { + output = "DP-3"; + }; + monitor = [ + "DVI-D-1,preferred,0x0,1" + "HDMI-A-1,preferred,0x1080,1" + "DP-3,2560x1440@144.00Hz,1920x540,1" + # Thank you NVIDIA for this generous, free-of-charge, extra monitor that + # doesn't exist and crashes yoru session sometimes when moving a window to it. + "Unknown-1, disable" + ]; + workspace = [ + "1, monitor:DP-3, default:true" + "2, monitor:DP-3" + "3, monitor:DP-3" + "4, monitor:DP-3" + "5, monitor:DP-3" + "6, monitor:DVI-D-1, default:true" + "7, monitor:DVI-D-1" + "8, monitor:HDMI-A-1, default: true" + "9, monitor:HDMI-A-1" + ]; + env = [ "HYPRLAND_FLOAT_LOCATION,3800 680" ]; + }) + (mkIf (config.node.name == "patricknix") { + monitor = [ + "eDP-1,preferred,0x0,2" + # Thank you NVIDIA for this generous, free-of-charge, extra monitor that + # doesn't exist and crashes yoru session sometimes when moving a window to it. + "Unknown-1, disable" + ]; + workspace = [ + "1, monitor:eDP-1, default:true" + "2, monitor:eDP-1" + "3, monitor:eDP-1" + "4, monitor:eDP-1" + "5, monitor:eDP-1" + "6, monitor:eDP-1" + "7, monitor:eDP-1" + "8, monitor:eDP-1" + "9, monitor:eDP-1" + ]; + env = [ "HYPRLAND_FLOAT_LOCATION,1400 200" ]; + }) + ]; + extraConfig = '' + submap=resize + binde=,right,resizeactive,80 0 + binde=,left,resizeactive,-80 0 + binde=,up,resizeactive,0 -80 + binde=,down,resizeactive,0 80 + binde=SHIFT,right,resizeactive,10 0 + binde=SHIFT,left,resizeactive,-10 0 + binde=SHIFT,up,resizeactive,0 -10 + binde=SHIFT,down,resizeactive,0 10 + bind=,return,submap,reset + bind=,escape,submap,reset + submap=reset + + exec-once = ${pkgs.xorg.xprop}/bin/xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 + exec-once = ${float_script} + env = XCURSOR_SIZE,48 + exec-once = uwsm finalize + + ''; + }; + }; +} diff --git a/users/common/wayland/sway.nix b/users/common/wayland/sway.nix new file mode 100644 index 0000000..bc0595a --- /dev/null +++ b/users/common/wayland/sway.nix @@ -0,0 +1,108 @@ +{ config, ... }: +let + nixConfig = config; +in +{ + # import shared i3 config + imports = [ ../Xorg/sway3.nix ]; + hm = + { config, ... }: + { + stylix.targets.sway.enable = true; + wayland.windowManager.sway = { + enable = true; + config = + { + menu = "fuzzel"; + startup = [ + # for games to work input 1 has to be qwerts + # but i would like to have bone as my layout + { + command = "swaymsg input \"*\" xkb_switch_layout 1"; + always = true; + } + { command = "uwsm finalize"; } + ]; + input = { + "*" = { + xkb_layout = "de,de,de"; + # games are stupid so the main ui has to be de() without bone + xkb_variant = ",bone,neo"; + xkb_options = "grp:win_space_toggle"; + repeat_delay = "235"; + repeat_rate = "60"; + accel_profile = "flat"; + pointer_accel = "0.3"; + tap = "enabled"; + }; + "type:touchpad" = { + pointer_accel = "0.5"; + natural_scroll = "enabled"; + }; + "type:touch" = { + map_to_output = "eDP-1"; + }; + "type:tablet_tool" = { + map_to_output = "eDP-1"; + }; + }; + keybindings = + let + cfg = config.wayland.windowManager.sway.config; + in + { + "Menu" = "exec ${cfg.menu}"; + }; + } + // { + desktopnix = { + output = { + DVI-D-1 = { + mode = "1920x1080@60Hz"; + pos = "0,0"; + }; + HDMI-A-1 = { + mode = "1920x1080@60Hz"; + pos = "0,1080"; + }; + DP-3 = { + mode = "2560x1440@143.998Hz"; + pos = "1920,720"; + adaptive_sync = "on"; + }; + }; + }; + patricknix = { + output = { + "Acer Technologies XB271HU #ASP7ytE/6A7d" = { + mode = "2560x1440@59.951Hz"; + pos = "0,0"; + }; + "AU Optronics 0x30EB Unknown" = { + mode = "3840x2160@60.002Hz"; + pos = "2560,0"; + scale = "2"; + }; + }; + }; + } + .${nixConfig.node.name} or { }; + extraConfig = + let + cfg = config.wayland.windowManager.sway.config; + in + '' + bindgesture swipe:3:left workpace next + bindgesture swipe:3:right workpace prev + bindgesture pinch:4:outward exec ${cfg.menu} + ''; + }; + # Cursor invisible + home.sessionVariables = { + WLR_NO_HARDWARE_CURSORS = 1; + NIXOS_OZONE_WL = 1; + # opengl backend flickers, also vulkan is love. + #WLR_RENDERER = "vulkan"; + }; + }; +} diff --git a/users/common/graphical/wayland/swaync/default.nix b/users/common/wayland/swaync/default.nix similarity index 92% rename from users/common/graphical/wayland/swaync/default.nix rename to users/common/wayland/swaync/default.nix index 7fea219..e9a8e0c 100644 --- a/users/common/graphical/wayland/swaync/default.nix +++ b/users/common/wayland/swaync/default.nix @@ -1,6 +1,6 @@ { config, lib, ... }: { - services.swaync = { + hm.services.swaync = { enable = true; settings = { positionX = "right"; @@ -83,7 +83,4 @@ ) + (builtins.readFile ./swaync.css); }; - - # Started via hyprland to ensure it restarts properly with hyprland - systemd.user.services.swaync.Install.WantedBy = lib.mkForce [ ]; } diff --git a/users/common/graphical/wayland/swaync/swaync.css b/users/common/wayland/swaync/swaync.css similarity index 100% rename from users/common/graphical/wayland/swaync/swaync.css rename to users/common/wayland/swaync/swaync.css diff --git a/users/common/graphical/wayland/swww.nix b/users/common/wayland/swww.nix similarity index 98% rename from users/common/graphical/wayland/swww.nix rename to users/common/wayland/swww.nix index e5cd761..897eca2 100644 --- a/users/common/graphical/wayland/swww.nix +++ b/users/common/wayland/swww.nix @@ -17,7 +17,7 @@ let }; in { - systemd.user = { + hm.systemd.user = { services = { swww = { Install.WantedBy = [ "graphical-session.target" ]; diff --git a/users/common/graphical/wayland/waybar/default.nix b/users/common/wayland/waybar/default.nix similarity index 97% rename from users/common/graphical/wayland/waybar/default.nix rename to users/common/wayland/waybar/default.nix index e4813ac..82d3fa9 100644 --- a/users/common/graphical/wayland/waybar/default.nix +++ b/users/common/wayland/waybar/default.nix @@ -1,15 +1,15 @@ { pkgs, lib, - nixosConfig, + config, ... }: { - systemd.user.services."waybar" = { + hm.systemd.user.services."waybar" = { Unit.After = [ "graphical-session.target" ]; Service.Slice = [ "app-graphical.slice" ]; }; - programs.waybar = { + hm.programs.waybar = { enable = true; systemd.enable = true; style = @@ -32,7 +32,7 @@ } ''; } - .${nixosConfig.node.name} or "" + .${config.node.name} or "" ) + builtins.readFile ./waybar.css; settings.main = { @@ -68,7 +68,7 @@ "tray" ]; } - .${nixosConfig.node.name} or [ ]; + .${config.node.name} or [ ]; battery = { interval = 1; diff --git a/users/common/graphical/wayland/waybar/waybar.css b/users/common/wayland/waybar/waybar.css similarity index 100% rename from users/common/graphical/wayland/waybar/waybar.css rename to users/common/wayland/waybar/waybar.css diff --git a/users/patrick/default.nix b/users/patrick/default.nix index 73d976f..e73391f 100644 --- a/users/patrick/default.nix +++ b/users/patrick/default.nix @@ -6,6 +6,7 @@ ... }: lib.optionalAttrs (!minimal) { + primaryUser = "patrick"; users.users.patrick = { shell = pkgs.zsh; isNormalUser = true; @@ -40,12 +41,6 @@ lib.optionalAttrs (!minimal) { # xournalpp needs this or else it will crash adwaita-icon-theme ]; - age.secrets = { - smb-creds = { - owner = "patrick"; - rekeyFile = ../../secrets/smb.cred.age; - }; - }; programs.dconf.enable = true; age.secrets."my-gpg-yubikey-keygrip.tar" = { @@ -54,43 +49,38 @@ lib.optionalAttrs (!minimal) { mode = "640"; }; - home-manager.users.patrick = { - imports = - [ - ./patrick.nix - ./ssh.nix - ./firefox.nix - ./gpg - ./impermanence.nix - ./minion.nix - ./vr.nix + imports = [ - ../common - ../common/impermanence.nix + ./firefox.nix + ./gpg + ./impermanence.nix + ./minion.nix + ./patrick.nix + ./smb.nix + ./ssh.nix + ./theme.nix - ../common/programs/bottles.nix - ../common/programs/direnv.nix - ../common/programs/firefox.nix - ../common/programs/gdb.nix - ../common/programs/git.nix - ../common/programs/kitty.nix - ../common/programs/minecraft.nix - ../common/programs/nvim - ../common/programs/poe.nix - ../common/programs/spicetify.nix - ../common/programs/thunderbird.nix - ../common/programs/gpu-screen-recorder.nix - ../common/shells/pager.nix - ] - ++ { - "desktopnix" = [ - ../common/graphical/Xorg - ../common/programs/obs.nix - ../common/graphical/wayland - ./smb.nix - ]; - "patricknix" = [ ../common/graphical/wayland ]; - } - .${config.node.name} or [ ]; - }; + ../common/alias.nix + ../common/dev.nix + ../common/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 + + ]; } diff --git a/users/patrick/firefox.nix b/users/patrick/firefox.nix index d17f04a..a3d9978 100644 --- a/users/patrick/firefox.nix +++ b/users/patrick/firefox.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - programs.firefox = + hm.programs.firefox = let betterfox = pkgs.fetchFromGitHub { owner = "yokoffing"; diff --git a/users/patrick/gpg/default.nix b/users/patrick/gpg/default.nix index 8d673c5..3a78e53 100644 --- a/users/patrick/gpg/default.nix +++ b/users/patrick/gpg/default.nix @@ -1,5 +1,11 @@ { - programs.gpg.publicKeys = [ + config, + lib, + pkgs, + ... +}: +{ + hm.programs.gpg.publicKeys = [ { source = ./pubkey.gpg; trust = 5; @@ -9,4 +15,14 @@ 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/" + ''; } diff --git a/users/patrick/impermanence.nix b/users/patrick/impermanence.nix index 9a92389..d6363da 100644 --- a/users/patrick/impermanence.nix +++ b/users/patrick/impermanence.nix @@ -1,11 +1,13 @@ -{ nixosConfig, lib, ... }: +{ config, lib, ... }: { - home.persistence = { + hm.home.persistence = { "/state" = { + files = [ + ".ssh/known_hosts" + ]; directories = [ "repos" "Downloads" - "Zotero" ".config/ts3client" @@ -13,6 +15,8 @@ ".config/xournalpp" ".cache/xournalpp" + ".local/state/wireplumber" + ".config/OrcaSlicer" ".config/streamcontroller" @@ -28,13 +32,12 @@ ".local/share/osu" - ".config/obs-studio" - ".local/share/monado" # For nextcloud client install "Nextcloud" ".config/Nextcloud" + ".config/dconf" # for electron signal app state ".config/Signal" @@ -45,27 +48,13 @@ ".cache/mpv" - # Folders for steam - ".local/share/Steam" - ".steam" - # Ken follets pillars of earth - ".local/share//Daedalic Entertainment GmbH/" - # Nvidia shader cache - ".cache/nvidia" - # Vulkan shader cache - ".local/share/vulkan" - - # bottles state games - ".local/share/bottles" - ".config/spotify" ".cache/spotify" ".local/share/cargo" ".local/share/wallpapers" ]; }; - "/panzer/state".directories = lib.lists.optionals (nixosConfig.disko.devices.zpool ? "panzer") [ - ".local/share/SteamPanzer" + "/panzer/state".directories = lib.lists.optionals (config.disko.devices.zpool ? "panzer") [ "videos" ]; }; diff --git a/users/patrick/minion.nix b/users/patrick/minion.nix index c817de8..ada1478 100644 --- a/users/patrick/minion.nix +++ b/users/patrick/minion.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ config, pkgs, ... }: let # addon-path is base64 encode path cfgFile = pkgs.writeText "mimion.xml" '' @@ -26,12 +26,14 @@ let ''; in { - home.packages = [ pkgs.minion ]; + hm.home.packages = [ pkgs.minion ]; # yet another program that uses the config file as a live state file # Why? - home.activation.installMinionConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run mkdir -p .minion - run cp -f ${cfgFile} .minion/minion.xml - run chmod 640 .minion/minion.xml - ''; + hm.home.activation.installMinionConfig = + config.home-manager.users.root.lib.dag.entryAfter [ "writeBoundary" ] + '' + run mkdir -p .minion + run cp -f ${cfgFile} .minion/minion.xml + run chmod 640 .minion/minion.xml + ''; } diff --git a/users/patrick/patrick.nix b/users/patrick/patrick.nix index 4fd984c..f18825b 100644 --- a/users/patrick/patrick.nix +++ b/users/patrick/patrick.nix @@ -1,70 +1,57 @@ { pkgs, - lib, - nixosConfig, ... }: { - home = { + hm.home = { packages = with pkgs; [ - nextcloud-client - discord - webcord - netflix - xournalpp - galaxy-buds-client - thunderbird - signal-desktop - telegram-desktop + chatterino2 chromium - osu-lazer-bin - teamspeak_client - zotero - timer - orca-slicer - hexyl + cmatrix + cowsay + discord + feh + figlet + galaxy-buds-client gh + hexyl + hyperfine + mpv + netflix + nextcloud-client nixpkgs-review - - via - + orca-slicer + osu-lazer-bin + pinentry-gnome3 # for yubikey pinentry + signal-desktop streamlink streamlink-twitch-gui-bin - chatterino2 - + teamspeak_client + telegram-desktop + timer + via + webcord + xournalpp yt-dlp - - hyperfine - - figlet - cowsay - cmatrix + zathura + zotero ]; }; - xdg.configFile."streamlink/config".text = '' - player=mpv - ''; - xdg.configFile."mpv/mpv.conf".text = '' - vo=gpu-next - hwdec=auto-safe - volume=50 - ''; - xdg.configFile."mpv/input.conf".text = '' - UP add volume 2 - DOWN add volume -2 - ''; - # Make sure the keygrips exist, otherwise we'd need to run `gpg --card-status` - # before being able to use the yubikey. - home.activation.installKeygrips = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run mkdir -p "$HOME/.gnupg/private-keys-v1.d" - run ${lib.getExe pkgs.gnutar} xvf ${ - lib.escapeShellArg nixosConfig.age.secrets."my-gpg-yubikey-keygrip.tar".path - } -C "$HOME/.gnupg/private-keys-v1.d/" - ''; - # Autostart hyprland if on tty1 (once, don't restart after logout) - programs.zsh.initExtra = lib.mkOrder 9999 '' - if uwsm check may-start ; then - exec systemd-cat -t uwsm_start uwsm start -S -F Hyprland - fi - ''; + hm.programs.bat.enable = true; + # needed for gnome pinentry + services.dbus.packages = [ pkgs.gcr ]; + hm = { + xdg.configFile."streamlink/config".text = '' + player=mpv + ''; + xdg.configFile."mpv/mpv.conf".text = '' + vo=gpu-next + hwdec=auto-safe + volume=50 + ''; + xdg.configFile."mpv/input.conf".text = '' + UP add volume 2 + DOWN add volume -2 + ''; + }; } diff --git a/users/patrick/secrets.nix.age b/users/patrick/secrets.nix.age deleted file mode 100644 index c848923..0000000 Binary files a/users/patrick/secrets.nix.age and /dev/null differ diff --git a/users/patrick/smb.nix b/users/patrick/smb.nix index 4ba362d..4dfed5a 100644 --- a/users/patrick/smb.nix +++ b/users/patrick/smb.nix @@ -1,9 +1,9 @@ -{ nixosConfig, nodes, ... }: +{ config, nodes, ... }: { - home.smb = + hm.home.smb = let address = nodes.elisabeth-samba.config.wireguard.samba-patrick.ipv4; - credentials = nixosConfig.age.secrets.smb-creds.path; + credentials = config.age.secrets.smb-creds.path; in [ { @@ -37,4 +37,10 @@ automatic = true; } ]; + age.secrets = { + smb-creds = { + owner = "patrick"; + rekeyFile = ../../secrets/smb.cred.age; + }; + }; } diff --git a/users/patrick/ssh.nix b/users/patrick/ssh.nix index 0ef1821..4c6fe13 100644 --- a/users/patrick/ssh.nix +++ b/users/patrick/ssh.nix @@ -1,13 +1,15 @@ { config, ... }: { # yubikey public key parts - home.file.".ssh/1.pub".text = '' - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDZixkix0KfKuq7Q19whS5FQQg51/AJGB5BiNF/7h/LM cardno:15 489 049 - ''; - home.file.".ssh/2.pub".text = '' - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHxD4GOrwrBTG4/qQhm5hoSB2CP7W9g1LPWP11oLGOjQ cardno:23 010 997 - ''; - programs.ssh = { + hm.home.file = { + ".ssh/1.pub".text = '' + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDZixkix0KfKuq7Q19whS5FQQg51/AJGB5BiNF/7h/LM cardno:15 489 049 + ''; + ".ssh/2.pub".text = '' + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHxD4GOrwrBTG4/qQhm5hoSB2CP7W9g1LPWP11oLGOjQ cardno:23 010 997 + ''; + }; + hm.programs.ssh = { enable = true; controlMaster = "auto"; controlPersist = "5s"; @@ -35,7 +37,7 @@ }; "maddy" = { - hostname = config.userSecrets.hetzner_ip; + hostname = config.secrets.secrets.global.user.hetzner_ip; user = "root"; }; diff --git a/users/patrick/theme.nix b/users/patrick/theme.nix new file mode 100644 index 0000000..de16ed4 --- /dev/null +++ b/users/patrick/theme.nix @@ -0,0 +1,199 @@ +{ + config, + pkgs, + ... +}: +{ + + environment.systemPackages = with pkgs; [ xdg-utils ]; + xdg.portal = { + xdgOpenUsePortal = true; + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + config = { + common.default = [ + "gtk" + "hyprland" + ]; + sway.default = [ "wlr" ]; + }; + }; + fonts = { + enableGhostscriptFonts = false; + fontDir.enable = false; + fontconfig = { + localConf = '' + + + + + monospace + + emoji + + + + sans-serif + + emoji + + + + serif + + emoji + + + + ''; + }; + packages = with pkgs; [ + (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) + ibm-plex + dejavu_fonts + unifont + freefont_ttf + gyre-fonts # TrueType substitutes for standard PostScript fonts + liberation_ttf + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + noto-fonts-emoji + noto-fonts-extra + ]; + }; + stylix.fonts = { + serif = { + package = pkgs.dejavu_fonts; + name = "IBM Plex Serif"; + }; + + sansSerif = { + package = pkgs.dejavu_fonts; + name = "IBM Plex Sans"; + }; + + monospace = { + # No need for patched nerd fonts, kitty can pick up on them automatically, + # and ideally every program should do that: https://sw.kovidgoyal.net/kitty/faq/#kitty-is-not-able-to-use-my-favorite-font + package = pkgs.jetbrains-mono; + name = "JetBrains Mono"; + }; + + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + }; + stylix = { + enable = true; + autoEnable = false; + polarity = "dark"; + image = config.lib.stylix.pixel "base00"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/vice.yaml"; + # Has to be green + override.base0B = "#00CC99"; + #base16Scheme = { + # base00 = "#101419"; + # base01 = "#171B20"; + # base02 = "#21262e"; + # base03 = "#242931"; + # base04 = "#485263"; + # base05 = "#b6beca"; + # base06 = "#dee1e6"; + # base07 = "#e3e6eb"; + # base08 = "#e05f65"; + # base09 = "#f9a872"; + # base0A = "#f1cf8a"; + # base0B = "#78dba9"; + # base0C = "#74bee9"; + # base0D = "#70a5eb"; + # base0E = "#c68aee"; + # base0F = "#9378de"; + #}; + ## based on decaycs-dark, bright variant + #base16Scheme = { + # base00 = "#101419"; + # base01 = "#171B20"; + # base02 = "#21262e"; + # base03 = "#242931"; + # base04 = "#485263"; + # base05 = "#b6beca"; + # base06 = "#dee1e6"; + # base07 = "#e3e6eb"; + # base08 = "#e5646a"; + # base09 = "#f7b77c"; + # base0A = "#f6d48f"; + # base0B = "#94F7C5"; + # base0C = "#79c3ee"; + # base0D = "#75aaf0"; + # base0E = "#cb8ff3"; + # base0F = "#9d85e1"; + #}; + }; + + hm = + { config, ... }: + { + stylix = { + cursor = { + package = pkgs.openzone-cursors; + name = "OpenZone_White_Slim"; + size = 18; + }; + inherit (config.stylix) polarity; + targets = { + gtk.enable = true; + bat.enable = true; + dunst.enable = true; + zathura.enable = true; + xresources.enable = true; + }; + }; + + xresources.properties = { + "Xft.hinting" = true; + "Xft.antialias" = true; + "Xft.autohint" = false; + "Xft.lcdfilter" = "lcddefault"; + "Xft.hintstyle" = "hintfull"; + "Xft.rgba" = "rgb"; + }; + + gtk = + let + gtk34extraConfig = { + gtk-application-prefer-dark-theme = 1; + gtk-cursor-theme-size = 18; + gtk-enable-animations = true; + gtk-xft-antialias = 1; + gtk-xft-dpi = 96; # XXX: delete for wayland? + gtk-xft-hinting = 1; + gtk-xft-hintstyle = "hintfull"; + gtk-xft-rgba = "rgb"; + }; + in + { + enable = true; + iconTheme = { + name = "Vimix-Doder"; + package = pkgs.vimix-icon-theme; + }; + + gtk2.extraConfig = "gtk-application-prefer-dark-theme = true"; + gtk3.extraConfig = gtk34extraConfig; + gtk4.extraConfig = gtk34extraConfig; + }; + + home.sessionVariables.GTK_THEME = config.gtk.theme.name; + + qt = { + enable = true; + platformTheme.name = "adwaita"; + style.name = "Adwaita-Dark"; + }; + }; +} diff --git a/users/patrick/vr.nix b/users/patrick/vr.nix deleted file mode 100644 index 33981fd..0000000 --- a/users/patrick/vr.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, pkgs, ... }: -{ - home.packages = [ pkgs.wlx-overlay-s ]; - xdg.configFile."openxr/1/active_runtime.json".text = '' - { - "file_format_version": "1.0.0", - "runtime": { - "name": "Monado", - "library_path": "${pkgs.monado}/lib/libopenxr_monado.so" - } - } - ''; - - xdg.configFile."openvr/openvrpaths.vrpath".text = '' - { - "config" : - [ - "${config.xdg.dataHome}/Steam/config" - ], - "external_drivers" : null, - "jsonid" : "vrpathreg", - "log" : - [ - "${config.xdg.dataHome}/Steam/logs" - ], - "runtime" : - [ - "${pkgs.opencomposite}/lib/opencomposite" - ], - "version" : 1 - } - ''; -} diff --git a/users/root/default.nix b/users/root/default.nix index 79a7213..1312826 100644 --- a/users/root/default.nix +++ b/users/root/default.nix @@ -1,8 +1,6 @@ { pkgs, config, - lib, - minimal, ... }: { @@ -17,5 +15,4 @@ ]; hashedPassword = config.secrets.secrets.global.users.root.passwordHash; }; - home-manager.users.root.imports = lib.lists.optionals (!minimal) [ ../common ]; }