From 8157d3ef2de888c898050fa6284684559c136d82 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Thu, 2 Jan 2025 12:10:56 -0500 Subject: [PATCH] refactor(ags): clean up girName handling --- flake.lock | Bin 57252 -> 57252 bytes lib/pkgs/default.nix | 34 ++++++++++++++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index ab35108d69a2f026433fe6bb504d6c0c83ac8c65..792122f4afb4b62aac03f08a62d91e2af83ee0bd 100644 GIT binary patch delta 126 zcmV-^0D=FczXPPd1F%&G1UNA^Hj{A$A1hgHS8Qc$GHzyTT180EGXfzXPPd1F%&G1~)Y~GC4Do@o*h0ZDL|_H*Gj;W<*9fVn;DjI95h)Z%lVK za7cQ2Y;!|LY(*<^Gc{8-Y*uHJAte@*T?i_X{RbvwHe)kmIb$(5Ib~vDFk?A2Gd5u{ dVr5}rWnwTjGBsf~Gi5h5GLztuO|xAHN7wd*DDVIP diff --git a/lib/pkgs/default.nix b/lib/pkgs/default.nix index d991c3fa..39fb3c82 100644 --- a/lib/pkgs/default.nix +++ b/lib/pkgs/default.nix @@ -3,8 +3,8 @@ self, }: let inherit (builtins) readFile fromJSON; - inherit (self.lib) capitalise mkVersion; - inherit (pkgs.lib) concatMapStrings elemAt length map optionalString splitString toLower; + inherit (self.lib) mkVersion; + inherit (pkgs.lib) elemAt hasAttr length map optionalString toLower; in { buildPlugin = pname: src: pkgs.vimUtils.buildVimPlugin { @@ -33,25 +33,23 @@ in { pname, delete ? [], }: let + girNameTable = { + gtk4 = "Gtk-4.0"; + gtk-session-lock = "GtkSessionLock-0.1"; + libadwaita = "Adw-1"; + }; + withGirNames = - map (package: { + map (package: let + in { inherit package; girName = - if package.pname == "astal-wireplumber" - then "AstalWp-0.1" - else if package.pname == "astal" - then "AstalIO-0.1" - else if package.pname == "astal3" - then "Astal-3.0" - else if package.pname == "astal4" - then "Astal-4.0" - else if package.pname == "astal-powerprofiles" - then "AstalPowerProfiles-0.1" - else if package.pname == "gtk4" - then "Gtk-4.0" - else if package.pname == "libadwaita" - then "Adw-1" - else (concatMapStrings capitalise (splitString "-" package.pname)) + "-0.1"; + package.girName + or ( + if hasAttr package.pname girNameTable + then girNameTable.${package.pname} + else throw "girName of ${package.name} couldn't be found" + ); }) packages; in {