From c91c8e703e6df481ee1294f9541bb770c992e02a Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 4 Aug 2024 13:52:41 -0400 Subject: [PATCH] fix(pkgs): improve versioning --- packages/default.nix | 2 -- packages/gpu-screen-recorder/default.nix | 4 +-- packages/libratbag/default.nix | 20 +++++++----- packages/pam-fprint-grosshack/default.nix | 18 +++++------ packages/piper/default.nix | 29 +++++++++++------- packages/proton-ge-latest/default.nix | 37 +++++++++++++---------- 6 files changed, 62 insertions(+), 48 deletions(-) diff --git a/packages/default.nix b/packages/default.nix index 67f9d24f..68bff5dc 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -12,7 +12,6 @@ libratbag = pkgs.callPackage ./libratbag { inherit (inputs) libratbag-src; - inherit mkVersion; }; pam-fprint-grosshack = pkgs.callPackage ./pam-fprint-grosshack { @@ -21,7 +20,6 @@ piper = pkgs.callPackage ./piper { inherit (inputs) piper-src; - inherit mkVersion; }; pokemon-colorscripts = pkgs.callPackage ./pokemon-colorscripts { diff --git a/packages/gpu-screen-recorder/default.nix b/packages/gpu-screen-recorder/default.nix index 035adc2e..9fbae47d 100644 --- a/packages/gpu-screen-recorder/default.nix +++ b/packages/gpu-screen-recorder/default.nix @@ -1,9 +1,9 @@ { + lib, + gpu-screen-recorder-src, addOpenGLRunpath, dbus, ffmpeg, - gpu-screen-recorder-src, - lib, libdrm, libglvnd, libpulseaudio, diff --git a/packages/libratbag/default.nix b/packages/libratbag/default.nix index c0b09b61..5f55aee5 100644 --- a/packages/libratbag/default.nix +++ b/packages/libratbag/default.nix @@ -1,11 +1,15 @@ { - libratbag, + lib, libratbag-src, - mkVersion, + libratbag, ... -}: -libratbag.overrideAttrs { - pname = "libratbag"; - version = mkVersion libratbag-src; - src = libratbag-src; -} +}: let + inherit (lib) elemAt match readFile splitString; + + releaseVer = elemAt (match "^([^']*).*" (elemAt (splitString "version : '" (readFile "${libratbag-src}/meson.build")) 1)) 0; +in + libratbag.overrideAttrs { + pname = "libratbag"; + version = "${releaseVer}+${libratbag-src.shortRev}"; + src = libratbag-src; + } diff --git a/packages/pam-fprint-grosshack/default.nix b/packages/pam-fprint-grosshack/default.nix index e37e07bd..a9a3d4a0 100644 --- a/packages/pam-fprint-grosshack/default.nix +++ b/packages/pam-fprint-grosshack/default.nix @@ -1,16 +1,16 @@ { - stdenv, - meson, - ninja, - pkg-config, + pam-fprint-grosshack-src, + dbus, glib, libfprint, - polkit, - dbus, - systemd, - pam, libpam-wrapper, - pam-fprint-grosshack-src, + meson, + ninja, + pam, + pkg-config, + polkit, + stdenv, + systemd, ... }: let inherit (builtins) elemAt head readFile split; diff --git a/packages/piper/default.nix b/packages/piper/default.nix index aa0119ce..baed948f 100644 --- a/packages/piper/default.nix +++ b/packages/piper/default.nix @@ -1,15 +1,22 @@ { - mkVersion, - piper, + lib, piper-src, + piper, ... -}: -piper.overrideAttrs { - pname = "piper"; - version = mkVersion piper-src; - src = piper-src; +}: let + inherit (lib) elemAt match readFile splitString; - mesonFlags = [ - "-Druntime-dependency-checks=false" - ]; -} + releaseVer = elemAt (match "^([^']*).*" (elemAt (splitString "version: '" (readFile "${piper-src}/meson.build")) 1)) 0; +in + piper.overrideAttrs rec { + pname = "piper"; + version = "${releaseVer}+${piper-src.shortRev}"; + + name = "${pname}-${version}"; + + src = piper-src; + + mesonFlags = [ + "-Druntime-dependency-checks=false" + ]; + } diff --git a/packages/proton-ge-latest/default.nix b/packages/proton-ge-latest/default.nix index 191c9509..2bfdaef1 100644 --- a/packages/proton-ge-latest/default.nix +++ b/packages/proton-ge-latest/default.nix @@ -1,25 +1,30 @@ { + lib, proton-ge-bin, rsync, ... -}: -proton-ge-bin.overrideAttrs { - buildInputs = [rsync]; +}: let + inherit (lib) elemAt match replaceStrings; +in + proton-ge-bin.overrideAttrs (o: { + version = replaceStrings ["-"] ["."] (elemAt (match "^[^0-9]*(.*)" o.version) 0); - buildCommand = - # bash - '' - runHook preBuild + buildInputs = [rsync]; - echo "Proton should not be installed into environments. Please use programs.steam.extraCompatPackages instead." > $out + buildCommand = + # bash + '' + runHook preBuild - cat $src/compatibilitytool.vdf > ./compatibilitytool.vdf - sed -i 's/"GE-Proton[^"]*"/"GE-Proton-Latest"/g' ./compatibilitytool.vdf + echo "Proton should not be installed into environments. Please use programs.steam.extraCompatPackages instead." > $out - mkdir $steamcompattool - cp -a ./compatibilitytool.vdf $steamcompattool/ - rsync -ar --exclude='compatibilitytool.vdf' $src/* $steamcompattool/ + cat $src/compatibilitytool.vdf > ./compatibilitytool.vdf + sed -i 's/"GE-Proton[^"]*"/"GE-Proton-Latest"/g' ./compatibilitytool.vdf - runHook postBuild - ''; -} + mkdir $steamcompattool + cp -a ./compatibilitytool.vdf $steamcompattool/ + rsync -ar --exclude='compatibilitytool.vdf' $src/* $steamcompattool/ + + runHook postBuild + ''; + })