From 0749c860858681384eb3da2df0a9b2e7d5fad959 Mon Sep 17 00:00:00 2001 From: Szymon P Date: Tue, 24 Mar 2026 10:40:31 +0100 Subject: [PATCH] refactor --- flake.nix | 88 +++++++++++++---------------- modules/bars/ashell.nix | 3 +- modules/bars/waybar.nix | 3 +- modules/cli/fish.nix | 4 +- modules/gui/browsers.nix | 4 +- modules/gui/kitty.nix | 4 +- modules/gui/mako.nix | 6 +- modules/gui/mangohud.nix | 4 +- modules/gui/obsidian-catppuccin.nix | 2 +- modules/gui/obsidian.nix | 3 +- modules/gui/satty.nix | 3 +- modules/hypr/hypridle.nix | 4 +- modules/hypr/hyprland.nix | 20 ++++--- modules/hypr/hyprlauncher.nix | 4 +- modules/hypr/hyprlock.nix | 4 +- modules/hypr/hyprsunset.nix | 4 +- 16 files changed, 75 insertions(+), 85 deletions(-) diff --git a/flake.nix b/flake.nix index 4e33658..812f217 100644 --- a/flake.nix +++ b/flake.nix @@ -39,98 +39,88 @@ }@inputs: let - baseUserConfig = { + defaultUserConfig = { username = "szymon"; - # for git email = "szymon_jozef@proton.me"; fullName = "Szymon P"; - # your public ssh key signingKey = "~/.ssh/github.pub"; - mainMonitor = "DP-1"; # only for some applications: you still need to set hyprland monitors yourself! - statusBar = "ashell"; # available: ashell|waybar + mainMonitor = "DP-1"; + statusBar = "ashell"; # available: ashell | waybar pathConfig = { wallpaper = "Obrazy/tapety/catppuccin"; screenshot = "Obrazy/zrzuty/"; obsidian = "Dokumenty/obsidian"; }; + + isNixOS = true; + hostName = "default"; }; system = "x86_64-linux"; - general_import = import nixpkgs { + pkgs = import nixpkgs { inherit system; config.allowUnfree = true; }; - general_module_import = [ - ./home.nix - catppuccin.homeModules.catppuccin - nixvim.homeModules.nixvim - inputs.hyprcursor-phinger.homeManagerModules.hyprcursor-phinger - ( - { pkgs, ... }: - { - home.packages = [ - zut-calendar.packages.${pkgs.system}.default - zutui.packages.${pkgs.system}.default - ]; - } - ) - ]; - - mkHomeConfig = - { - isNixOS, - overrides ? { }, - hostName, - }: + mkHome = + customConfig: + let + userConfig = defaultUserConfig // customConfig; + in home-manager.lib.homeManagerConfiguration { - pkgs = general_import; + inherit pkgs; extraSpecialArgs = { - inherit inputs isNixOS hostName; - userConfig = baseUserConfig // overrides; + inherit inputs userConfig; }; - modules = general_module_import; + modules = [ + ./home.nix + catppuccin.homeModules.catppuccin + nixvim.homeModules.nixvim + inputs.hyprcursor-phinger.homeManagerModules.hyprcursor-phinger + ( + { pkgs, ... }: + { + home.packages = [ + zut-calendar.packages.${pkgs.system}.default + zutui.packages.${pkgs.system}.default + ]; + } + ) + ] + ++ (customConfig.extraModules or [ ]); }; in { homeConfigurations = { - "arch" = mkHomeConfig { + # You can overwrite default configuration here + + "arch" = mkHome { isNixOS = false; hostName = "arch"; }; - "nixos" = mkHomeConfig { + "nixos" = mkHome { isNixOS = true; hostName = "nixos"; }; - "${baseUserConfig.username}@pitagoras" = mkHomeConfig { - isNixOS = true; - overrides = { - mainMonitor = "eDP-1"; - }; + "${defaultUserConfig.username}@pitagoras" = mkHome { hostName = "pitagoras"; + mainMonitor = "eDP-1"; }; - "${baseUserConfig.username}@pilecki" = mkHomeConfig { - isNixOS = true; - overrides = { - mainMonitor = "LVDS-1"; - }; + "${defaultUserConfig.username}@pilecki" = mkHome { hostName = "pilecki"; + mainMonitor = "LVDS-1"; }; - "${baseUserConfig.username}@paderewski" = mkHomeConfig { - isNixOS = true; - overrides = { - mainMonitor = "DP-1"; - }; + "${defaultUserConfig.username}@paderewski" = mkHome { hostName = "paderewski"; }; }; diff --git a/modules/bars/ashell.nix b/modules/bars/ashell.nix index d6e1815..acc5874 100644 --- a/modules/bars/ashell.nix +++ b/modules/bars/ashell.nix @@ -1,6 +1,5 @@ { lib, - isNixOS, userConfig, pkgs, ... @@ -9,7 +8,7 @@ { programs.ashell = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; settings = { outputs = { Targets = [ userConfig.mainMonitor ]; diff --git a/modules/bars/waybar.nix b/modules/bars/waybar.nix index a5ed65f..4f43f85 100644 --- a/modules/bars/waybar.nix +++ b/modules/bars/waybar.nix @@ -1,6 +1,5 @@ { pkgs, - isNixOS, userConfig, ... }: @@ -9,7 +8,7 @@ programs.waybar = { enable = true; package = - if isNixOS then pkgs.waybar else (pkgs.writeShellScriptBin "waybar" "exec /usr/bin/waybar \"$@\""); + if userConfig.isNixOS then pkgs.waybar else (pkgs.writeShellScriptBin "waybar" "exec /usr/bin/waybar \"$@\""); settings = { mainBar = { layer = "top"; diff --git a/modules/cli/fish.nix b/modules/cli/fish.nix index b13b25d..908bb66 100644 --- a/modules/cli/fish.nix +++ b/modules/cli/fish.nix @@ -1,4 +1,4 @@ -{ isNixOS, hostName, ... }: +{ userConfig, hostName, ... }: { programs.fish = { @@ -78,7 +78,7 @@ update = { body = - if isNixOS then + if userConfig.isNixOS then # fish '' echo "=== System packages update ===" diff --git a/modules/gui/browsers.nix b/modules/gui/browsers.nix index a81d79f..ba4d12b 100644 --- a/modules/gui/browsers.nix +++ b/modules/gui/browsers.nix @@ -1,8 +1,8 @@ -{ isNixOS, lib, ... }: +{ userConfig, lib, ... }: { programs.chromium = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; }; } diff --git a/modules/gui/kitty.nix b/modules/gui/kitty.nix index a579f42..d59bc50 100644 --- a/modules/gui/kitty.nix +++ b/modules/gui/kitty.nix @@ -1,9 +1,9 @@ -{ lib, isNixOS, ... }: +{ lib, userConfig, ... }: { programs.kitty = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; settings = { confirm_os_window_close = 0; dynamic_background_opacity = true; diff --git a/modules/gui/mako.nix b/modules/gui/mako.nix index 01d3d49..674f77d 100644 --- a/modules/gui/mako.nix +++ b/modules/gui/mako.nix @@ -1,4 +1,4 @@ -{ isNixOS, pkgs, ... }: +{ userConfig, pkgs, ... }: { services.mako = { @@ -21,7 +21,7 @@ progress-color = "over #313244"; output = "DP-1"; on-notify = - if isNixOS then + if userConfig.isNixOS then "exec ${pkgs.pulseaudio}/bin/paplay ${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/dialog-information.oga" else "exec paplay /usr/share/sounds/freedesktop/stereo/dialog-information.oga"; @@ -36,7 +36,7 @@ [urgency=critical] on-notify=${ - if isNixOS then + if userConfig.isNixOS then "exec ${pkgs.pulseaudio}/bin/paplay ${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/dialog-information.oga" else "exec paplay /usr/share/sounds/freedesktop/stereo/dialog-information.oga" diff --git a/modules/gui/mangohud.nix b/modules/gui/mangohud.nix index 82597ac..e4286ac 100644 --- a/modules/gui/mangohud.nix +++ b/modules/gui/mangohud.nix @@ -1,7 +1,7 @@ { config, pkgs, - isNixOS, + userConfig, ... }: @@ -10,7 +10,7 @@ programs.mangohud = { enable = true; - package = if isNixOS then pkgs.mangohud else (pkgs.runCommand "dummy-mangohud" { } "mkdir $out"); + package = if userConfig.isNixOS then pkgs.mangohud else (pkgs.runCommand "dummy-mangohud" { } "mkdir $out"); }; xdg.configFile."MangoHud/MangoHud.conf".text = '' diff --git a/modules/gui/obsidian-catppuccin.nix b/modules/gui/obsidian-catppuccin.nix index 9376607..a537d14 100644 --- a/modules/gui/obsidian-catppuccin.nix +++ b/modules/gui/obsidian-catppuccin.nix @@ -11,7 +11,7 @@ stdenv.mkDerivation { owner = "catppuccin"; repo = "obsidian"; rev = "main"; - hash = "sha256-IGkP0z8gJj1dbNclpMebZXZvaRby1F8zGNEDPtitfqo="; + hash = "sha256-uB0a2nSZkHHf65xBYXyNh50vaAiqdEpKQVf3eXnCVlE="; }; installPhase = '' diff --git a/modules/gui/obsidian.nix b/modules/gui/obsidian.nix index 6c343ab..46ffebd 100644 --- a/modules/gui/obsidian.nix +++ b/modules/gui/obsidian.nix @@ -1,5 +1,4 @@ { - isNixOS, lib, pkgs, userConfig, @@ -9,7 +8,7 @@ { programs.obsidian = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; defaultSettings = { app = { diff --git a/modules/gui/satty.nix b/modules/gui/satty.nix index c177d5e..21bfff3 100644 --- a/modules/gui/satty.nix +++ b/modules/gui/satty.nix @@ -1,6 +1,5 @@ { lib, - isNixOS, userConfig, ... }: @@ -8,7 +7,7 @@ { programs.satty = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; settings = { general = { fullscreen = true; diff --git a/modules/hypr/hypridle.nix b/modules/hypr/hypridle.nix index 0987667..f743b2c 100644 --- a/modules/hypr/hypridle.nix +++ b/modules/hypr/hypridle.nix @@ -1,9 +1,9 @@ -{ isNixOS, lib, ... }: +{ userConfig, lib, ... }: { services.hypridle = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; settings = { general = { diff --git a/modules/hypr/hyprland.nix b/modules/hypr/hyprland.nix index 6243d6b..35a5044 100644 --- a/modules/hypr/hyprland.nix +++ b/modules/hypr/hyprland.nix @@ -1,5 +1,4 @@ { - isNixOS, lib, userConfig, pkgs, @@ -7,7 +6,7 @@ ... }: let - exe = pkg: bin: if isNixOS then "${pkg}/bin/${bin}" else "/usr/bin/${bin}"; + exe = pkg: bin: if userConfig.isNixOS then "${pkg}/bin/${bin}" else "/usr/bin/${bin}"; jq = exe pkgs.jq "jq"; grim = exe pkgs.grim "grim"; @@ -15,7 +14,7 @@ let wl_copy = exe pkgs.wl-clipboard "wl-copy"; notify_send = exe pkgs.libnotify "notify-send"; xdg-desktop-portal-hyprland = - if isNixOS then + if userConfig.isNixOS then "${pkgs.xdg-desktop-portal-hyprland}/libexec/xdg-desktop-portal-hyprland" else "/usr/lib/xdg-desktop-portal-hyprland"; @@ -26,9 +25,9 @@ in wayland.windowManager.hyprland = { enable = true; package = - if isNixOS then inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland else null; + if userConfig.isNixOS then inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland else null; portalPackage = lib.mkIf ( - isNixOS + userConfig.isNixOS ) inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; xwayland.enable = true; @@ -36,9 +35,9 @@ in "$mainMod" = "SUPER"; "$terminal" = "uwsm app -- kitty"; "$menu" = "hyprlauncher"; - "$music_player" = if isNixOS then "spotify" else "flatpak run com.spotify.Client"; + "$music_player" = if userConfig.isNixOS then "spotify" else "flatpak run com.spotify.Client"; "$notes" = "obsidian"; - "$browser" = if isNixOS then "zen-beta" else "zen-browser"; # beta on nixos + "$browser" = if userConfig.isNixOS then "zen-beta" else "zen-browser"; # beta on nixos "$openrgb_color" = "09ce30"; env = [ @@ -60,7 +59,7 @@ in }; animations = { - enabled = true; + enabled = false; bezier = [ "easeOutQuint,0.23,1,0.32,1" "easeInOutCubic,0.65,0.05,0.36,1" @@ -142,6 +141,11 @@ in }; }; + device = { + name = "msft0001:01-06cb:7f28-touchpad"; + sensitivity = 0; + }; + cursor = { no_hardware_cursors = true; inactive_timeout = 5; diff --git a/modules/hypr/hyprlauncher.nix b/modules/hypr/hyprlauncher.nix index 3bf5e2f..24d4490 100644 --- a/modules/hypr/hyprlauncher.nix +++ b/modules/hypr/hyprlauncher.nix @@ -1,9 +1,9 @@ -{ isNixOS, lib, ... }: +{ userConfig, lib, ... }: { services.hyprlauncher = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; settings = { cache.enabled = true; diff --git a/modules/hypr/hyprlock.nix b/modules/hypr/hyprlock.nix index 26abc51..b729da2 100644 --- a/modules/hypr/hyprlock.nix +++ b/modules/hypr/hyprlock.nix @@ -1,9 +1,9 @@ -{ isNixOS, lib, ... }: +{ userConfig, lib, ... }: { programs.hyprlock = { enable = true; - package = lib.mkIf (!isNixOS) null; + package = lib.mkIf (!userConfig.isNixOS) null; settings = { "$font" = "Monospace"; diff --git a/modules/hypr/hyprsunset.nix b/modules/hypr/hyprsunset.nix index 0e6cc6a..60e12a4 100644 --- a/modules/hypr/hyprsunset.nix +++ b/modules/hypr/hyprsunset.nix @@ -1,5 +1,5 @@ { - isNixOS, + userConfig, pkgs, ... }: @@ -8,7 +8,7 @@ services.hyprsunset = { enable = true; package = - if isNixOS then + if userConfig.isNixOS then pkgs.hyprsunset else (pkgs.writeShellScriptBin "hyprsunset" "exec /usr/bin/hyprsunset \"$@\"");