From d97d07e98e218dc6a046b6ea51f280774af242dd Mon Sep 17 00:00:00 2001 From: reo101 Date: Sun, 4 May 2025 13:30:24 +0300 Subject: [PATCH] chore(nix): reformat `package.nix` with `alejandra` --- nix/package.nix | 112 +++++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/nix/package.nix b/nix/package.nix index 18ba622..60abdfc 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -30,7 +30,7 @@ builderName ? "nix", builder ? {}, }: let - hasFeature = f: features == [ ] || builtins.elem f features; + hasFeature = f: features == [] || builtins.elem f features; basePkg = rec { inherit version; @@ -43,34 +43,37 @@ }; nativeBuildInputs = [ - pkg-config - wrapGAppsHook - gobject-introspection - installShellFiles + pkg-config + wrapGAppsHook + gobject-introspection + installShellFiles ]; - buildInputs = [ - gtk3 - gdk-pixbuf - glib - gtk-layer-shell - glib-networking - shared-mime-info - adwaita-icon-theme - hicolor-icon-theme - gsettings-desktop-schemas - libxkbcommon ] - ++ lib.optionals (hasFeature "http") [ openssl ] - ++ lib.optionals (hasFeature "tray") [ libdbusmenu-gtk3 ] - ++ lib.optionals (hasFeature "volume")[ libpulseaudio ] - ++ lib.optionals (hasFeature "cairo") [ luajit ] - ++ lib.optionals (hasFeature "keyboard") [ libinput libevdev ]; + buildInputs = + [ + gtk3 + gdk-pixbuf + glib + gtk-layer-shell + glib-networking + shared-mime-info + adwaita-icon-theme + hicolor-icon-theme + gsettings-desktop-schemas + libxkbcommon + ] + ++ lib.optionals (hasFeature "http") [openssl] + ++ lib.optionals (hasFeature "tray") [libdbusmenu-gtk3] + ++ lib.optionals (hasFeature "volume") [libpulseaudio] + ++ lib.optionals (hasFeature "cairo") [luajit] + ++ lib.optionals (hasFeature "keyboard") [libinput libevdev]; - propagatedBuildInputs = [ gtk3 ]; + propagatedBuildInputs = [gtk3]; lgi = luajitPackages.lgi; - gappsWrapperArgs = '' + gappsWrapperArgs = + '' # Thumbnailers --prefix XDG_DATA_DIRS : "${gdk-pixbuf}/share" --prefix XDG_DATA_DIRS : "${librsvg}/share" @@ -78,12 +81,12 @@ --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" # gtk-launch - --suffix PATH : "${lib.makeBinPath [ gtk3 ]}" - '' - + lib.optionalString (hasFeature "cairo") '' + --suffix PATH : "${lib.makeBinPath [gtk3]}" + '' + + lib.optionalString (hasFeature "cairo") '' --prefix LUA_PATH : "./?.lua;${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/?/init.lua;${luajit}/share/lua/5.1/\?.lua;${luajit}/share/lua/5.1/?/init.lua" --prefix LUA_CPATH : "./?.so;${lgi}/lib/lua/5.1/?.so;${luajit}/lib/lua/5.1/?.so;${luajit}/lib/lua/5.1/loadall.so" - ''; + ''; preFixup = '' gappsWrapperArgs+=( @@ -107,38 +110,41 @@ meta = with lib; { homepage = "https://github.com/JakeStanger/ironbar"; - description = - "Customisable gtk-layer-shell wlroots/sway bar written in rust."; + description = "Customisable gtk-layer-shell wlroots/sway bar written in rust."; license = licenses.mit; platforms = platforms.linux; mainProgram = "ironbar"; }; - }; flags = let - noDefault = if features == [ ] then "" else "--no-default-features"; + noDefault = + if features == [] + then "" + else "--no-default-features"; - featuresStr = if features == [ ] then - "" - else - ''-F "${builtins.concatStringsSep "," features}"''; + featuresStr = + if features == [] + then "" + else ''-F "${builtins.concatStringsSep "," features}"''; + in [noDefault featuresStr]; +in + if builderName == "naersk" + then builder.buildPackage (basePkg // {cargoBuildOptions = old: old ++ flags;}) + else if builderName == "crane" + then + builder.buildPackage (basePkg + // { + cargoExtraArgs = builtins.concatStringsSep " " flags; + doCheck = false; + }) + else + rustPlatform.buildRustPackage (basePkg + // { + buildNoDefaultFeatures = features != []; - in [ noDefault featuresStr ]; -in if builderName == "naersk" then - builder.buildPackage (basePkg // { cargoBuildOptions = old: old ++ flags; }) -else if builderName == "crane" then - builder.buildPackage (basePkg // { - cargoExtraArgs = builtins.concatStringsSep " " flags; - doCheck = false; - }) -else - rustPlatform.buildRustPackage (basePkg // { - buildNoDefaultFeatures = features != [ ]; - - buildFeatures = features; - cargoDeps = rustPlatform.importCargoLock { lockFile = ../Cargo.lock; }; - cargoLock.lockFile = ../Cargo.lock; - cargoLock.outputHashes."stray-0.1.3" = - "sha256-7mvsWZFmPWti9AiX67h6ZlWiVVRZRWIxq3pVaviOUtc="; - }) + buildFeatures = features; + cargoDeps = rustPlatform.importCargoLock {lockFile = ../Cargo.lock;}; + cargoLock.lockFile = ../Cargo.lock; + cargoLock.outputHashes."stray-0.1.3" = "sha256-7mvsWZFmPWti9AiX67h6ZlWiVVRZRWIxq3pVaviOUtc="; + })