From 5dce5bc67ecce450a313688c98691defb17b7a4d Mon Sep 17 00:00:00 2001 From: benvonh Date: Thu, 2 Jan 2025 07:33:01 +1000 Subject: [PATCH 1/4] nix: Possibly remove systemd unit from HM module --- nix/module.nix | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/nix/module.nix b/nix/module.nix index ca84fa2..8e2c825 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -334,7 +334,8 @@ in bar.workspaces.workspaces = mkIntOption 5; dummy = mkBoolOption true; hyprpanel.restartAgs = mkBoolOption true; - hyprpanel.restartCommand = mkStrOption "${pkgs.procps}/bin/pkill -u $USER -USR1 hyprpanel; ${package}/bin/hyprpanel"; + # hyprpanel.restartCommand = mkStrOption "${pkgs.procps}/bin/pkill -u $USER -USR1 hyprpanel; ${package}/bin/hyprpanel"; + hyprpanel.restartCommand = mkStrOption "${package}/bin/hyprpanel q; ${package}/bin/hyprpanel"; menus.clock.time.hideSeconds = mkBoolOption false; menus.clock.time.military = mkBoolOption false; menus.clock.weather.enabled = mkBoolOption true; @@ -581,7 +582,6 @@ in text = '' cd echo '------------- HyprPanel -------------' - echo echo 'Please ignore the layout diff for now' echo '-------------------------------------' colordiff ${config.xdg.configFile.hyprpanel.target} \ @@ -615,7 +615,8 @@ in xdg.configFile.hyprpanel = { target = "hyprpanel/config.json"; text = finalConfig; - onChange = "${pkgs.procps}/bin/pkill -u $USER -USR1 hyprpanel || true"; + # onChange = "${pkgs.procps}/bin/pkill -u $USER -USR1 hyprpanel || true"; + onChange = "${package}/bin/hyprpanel r"; }; xdg.configFile.hyprpanel-swap = { @@ -623,23 +624,23 @@ in text = finalConfig; }; - systemd.user.services = mkIf cfg.systemd.enable { - hyprpanel = { - Unit = { - Description = "A Bar/Panel for Hyprland with extensive customizability."; - Documentation = "https://hyprpanel.com"; - PartOf = [ "graphical-session.target" ]; - After = [ "graphical-session-pre.target" ]; - }; - Service = { - ExecStart = "${package}/bin/hyprpanel"; - ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR1 $MAINPID"; - Restart = "on-failure"; - KillMode = "mixed"; - }; - Install = { WantedBy = [ "graphical-session.target" ]; }; - }; - }; + # systemd.user.services = mkIf cfg.systemd.enable { + # hyprpanel = { + # Unit = { + # Description = "A Bar/Panel for Hyprland with extensive customizability."; + # Documentation = "https://hyprpanel.com"; + # PartOf = [ "graphical-session.target" ]; + # After = [ "graphical-session-pre.target" ]; + # }; + # Service = { + # ExecStart = "${package}/bin/hyprpanel"; + # ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR1 $MAINPID"; + # Restart = "on-failure"; + # KillMode = "mixed"; + # }; + # Install = { WantedBy = [ "graphical-session.target" ]; }; + # }; + # }; wayland.windowManager.hyprland.settings.exec-once = mkIf cfg.hyprland.enable [ "${package}/bin/hyprpanel" ]; }; From e19518ad60599569e4859ecf3d3eaa83b772268e Mon Sep 17 00:00:00 2001 From: benvonh Date: Thu, 2 Jan 2025 23:19:56 +1000 Subject: [PATCH 2/4] nix: Deprecated systemd.enable option --- nix/module.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nix/module.nix b/nix/module.nix index 8e440de..12ca363 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -97,7 +97,7 @@ in ''; description = '' An arbitrary set to override the final config with. - Useful for overriding colors in your selected theme. + Useful for overriding colors in your chosen theme. ''; }; @@ -623,6 +623,7 @@ in text = finalConfig; }; + # NOTE: Deprecated # systemd.user.services = mkIf cfg.systemd.enable { # hyprpanel = { # Unit = { @@ -640,6 +641,7 @@ in # Install = { WantedBy = [ "graphical-session.target" ]; }; # }; # }; + warnings = if cfg.systemd.enable then [ "The `systemd.enable` option is now obsolete." ] else []; wayland.windowManager.hyprland.settings.exec-once = mkIf cfg.hyprland.enable [ "${package}/bin/hyprpanel" ]; }; From 30ba8e7c75198783fc9af3b84e6d95482538ce4a Mon Sep 17 00:00:00 2001 From: benvonh Date: Fri, 3 Jan 2025 01:24:59 +1000 Subject: [PATCH 3/4] nix: Use lib.optionals for overlays in HM module --- nix/module.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/nix/module.nix b/nix/module.nix index 12ca363..d2909d4 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -10,14 +10,15 @@ let package = if pkgs ? hyprpanel then pkgs.hyprpanel else abort '' - ****************************************** - * HyprPanel * - ****************************************** - * You didn't add the overlay! * - * * - * Either set 'overlay.enable = true' or * - * manually add it to 'nixpkgs.overlays'. * - ****************************************** + ******************************************************************************** + * HyprPanel * + *------------------------------------------------------------------------------* + * You didn't add the overlay! * + * * + * Either set 'overlay.enable = true' or manually add it to 'nixpkgs.overlays'. * + * If you use the 'nixosModule' for Home Manager and have 'useGlobalPkgs' set, * + * you will need to add the overlay yourself. * + ******************************************************************************** ''; # Shorthand lambda for self-documenting options under settings @@ -590,7 +591,8 @@ in in mkIf cfg.enable { - nixpkgs.overlays = if cfg.overlay.enable then [ self.overlay ] else null; + # nixpkgs.overlays = if cfg.overlay.enable then [ self.overlay ] else null; + nixpkgs.overlays = lib.optionals cfg.overlay.enable [ self.overlay ]; home.packages = [ package From 63f6f94535713e53d12e092c5162b936ccac0f92 Mon Sep 17 00:00:00 2001 From: Ben <75413535+benvonh@users.noreply.github.com> Date: Fri, 10 Jan 2025 22:07:20 +1000 Subject: [PATCH 4/4] nix: Add config.enable option to HM module --- nix/module.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nix/module.nix b/nix/module.nix index d2909d4..e0a2438 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -76,6 +76,7 @@ in { options.programs.hyprpanel = { enable = mkEnableOption "HyprPanel"; + config.enable = mkBoolOption true; # Generate config overlay.enable = mkEnableOption "script overlay"; systemd.enable = mkEnableOption "systemd integration"; hyprland.enable = mkEnableOption "Hyprland integration"; @@ -613,14 +614,14 @@ in ''; }; - xdg.configFile.hyprpanel = { + xdg.configFile.hyprpanel = mkIf cfg.config.enable { target = "hyprpanel/config.json"; text = finalConfig; # onChange = "${pkgs.procps}/bin/pkill -u $USER -USR1 hyprpanel || true"; onChange = "${package}/bin/hyprpanel r"; }; - xdg.configFile.hyprpanel-swap = { + xdg.configFile.hyprpanel-swap = mkIf cfg.config.enable { target = "hyprpanel/config.hm.json"; text = finalConfig; };