From 4ee2a9a01856d534e7c52ef305995f83306f83bf Mon Sep 17 00:00:00 2001 From: alfarel Date: Wed, 7 Jan 2026 01:28:45 +0000 Subject: [PATCH] keyd: cleanup Remove use of rec and python3.pkgs. Add mainProgram, versionCheckHook. --- pkgs/by-name/ke/keyd/package.nix | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/by-name/ke/keyd/package.nix b/pkgs/by-name/ke/keyd/package.nix index 406f3d2fe3c5..3faaee367268 100644 --- a/pkgs/by-name/ke/keyd/package.nix +++ b/pkgs/by-name/ke/keyd/package.nix @@ -4,10 +4,10 @@ fetchFromGitHub, systemd, runtimeShell, - python3, + python3Packages, nixosTests, + versionCheckHook, }: - let version = "2.6.0"; @@ -18,28 +18,26 @@ let hash = "sha256-l7yjGpicX1ly4UwF7gcOTaaHPRnxVUMwZkH70NDLL5M="; }; - pypkgs = python3.pkgs; - - appMap = pypkgs.buildPythonApplication rec { + appMap = python3Packages.buildPythonApplication (finalAttrs: { pname = "keyd-application-mapper"; inherit version src; pyproject = false; postPatch = '' - substituteInPlace scripts/${pname} \ + substituteInPlace scripts/${finalAttrs.pname} \ --replace-fail /bin/sh ${runtimeShell} ''; - propagatedBuildInputs = with pypkgs; [ xlib ]; + propagatedBuildInputs = with python3Packages; [ xlib ]; dontBuild = true; installPhase = '' - install -Dm555 -t $out/bin scripts/${pname} + install -Dm555 -t $out/bin scripts/${finalAttrs.pname} ''; meta.mainProgram = "keyd-application-mapper"; - }; + }); in stdenv.mkDerivation { @@ -58,10 +56,10 @@ stdenv.mkDerivation { buildInputs = [ systemd ]; - enableParallelBuilding = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; - # post-2.4.2 may need this to unbreak the test - # makeFlags = [ "SOCKET_PATH/run/keyd/keyd.socket" ]; + enableParallelBuilding = true; postInstall = '' ln -sf ${lib.getExe appMap} $out/bin/${appMap.pname} @@ -74,6 +72,7 @@ stdenv.mkDerivation { description = "Key remapping daemon for Linux"; homepage = "https://github.com/rvaiya/keyd"; license = lib.licenses.mit; + mainProgram = "keyd"; maintainers = with lib.maintainers; [ alfarel ]; platforms = lib.platforms.linux; };