diff --git a/pkgs/tools/system/auto-cpufreq/default.nix b/pkgs/tools/system/auto-cpufreq/default.nix index 139cc295b87e..427fe12267ec 100644 --- a/pkgs/tools/system/auto-cpufreq/default.nix +++ b/pkgs/tools/system/auto-cpufreq/default.nix @@ -1,4 +1,4 @@ -{ lib, python3Packages, fetchFromGitHub }: +{ lib, python3Packages, fetchFromGitHub, substituteAll }: python3Packages.buildPythonPackage rec { pname = "auto-cpufreq"; @@ -16,8 +16,16 @@ python3Packages.buildPythonPackage rec { doCheck = false; pythonImportsCheck = [ "auto_cpufreq" ]; - # patch to prevent script copying and to disable install - patches = [ ./prevent-install-and-copy.patch ]; + patches = [ + # hardcodes version output + (substituteAll { + src = ./fix-version-output.patch; + inherit version; + }) + + # patch to prevent script copying and to disable install + ./prevent-install-and-copy.patch + ]; postInstall = '' # copy script manually diff --git a/pkgs/tools/system/auto-cpufreq/fix-version-output.patch b/pkgs/tools/system/auto-cpufreq/fix-version-output.patch new file mode 100644 index 000000000000..69293a4c3dc2 --- /dev/null +++ b/pkgs/tools/system/auto-cpufreq/fix-version-output.patch @@ -0,0 +1,37 @@ +--- a/auto_cpufreq/core.py ++++ b/auto_cpufreq/core.py +@@ -68,32 +68,8 @@ dist_name = distro.id() + + # display running version of auto-cpufreq + def app_version(): +- +- print("auto-cpufreq version:") +- +- # snap package +- if os.getenv("PKG_MARKER") == "SNAP": +- print(getoutput("echo Snap: $SNAP_VERSION")) +- # aur package +- elif dist_name in ["arch", "manjaro", "garuda"]: +- aur_pkg_check = call("pacman -Qs auto-cpufreq > /dev/null", shell=True) +- if aur_pkg_check == 1: +- print( +- "Git commit:", +- check_output(["git", "describe", "--always"]).strip().decode(), +- ) +- else: +- print(getoutput("pacman -Qi auto-cpufreq | grep Version")) +- else: +- # source code (auto-cpufreq-installer) +- try: +- print( +- "Git commit:", +- check_output(["git", "describe", "--always"]).strip().decode(), +- ) +- except Exception as e: +- print(repr(e)) +- pass ++ print("auto-cpufreq version: @version@") ++ print("Git commit: v@version@") + + + def app_res_use():