Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.11-beta 77 lines 1.5 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, systemd 5, runtimeShell 6, python3 7, nixosTests 8}: 9 10let 11 version = "2.4.2"; 12 13 src = fetchFromGitHub { 14 owner = "rvaiya"; 15 repo = "keyd"; 16 rev = "v" + version; 17 hash = "sha256-QWr+xog16MmybhQlEWbskYa/dypb9Ld54MOdobTbyMo="; 18 }; 19 20 pypkgs = python3.pkgs; 21 22 appMap = pypkgs.buildPythonApplication rec { 23 pname = "keyd-application-mapper"; 24 inherit version src; 25 format = "other"; 26 27 postPatch = '' 28 substituteInPlace scripts/${pname} \ 29 --replace /bin/sh ${runtimeShell} 30 ''; 31 32 propagatedBuildInputs = with pypkgs; [ xlib ]; 33 34 dontBuild = true; 35 36 installPhase = '' 37 install -Dm555 -t $out/bin scripts/${pname} 38 ''; 39 40 meta.mainProgram = pname; 41 }; 42 43in 44stdenv.mkDerivation { 45 pname = "keyd"; 46 inherit version src; 47 48 postPatch = '' 49 substituteInPlace Makefile \ 50 --replace DESTDIR= DESTDIR=${placeholder "out"} \ 51 --replace /usr "" 52 53 substituteInPlace keyd.service \ 54 --replace /usr/bin $out/bin 55 ''; 56 57 buildInputs = [ systemd ]; 58 59 enableParallelBuilding = true; 60 61 # post-2.4.2 may need this to unbreak the test 62 # makeFlags = [ "SOCKET_PATH/run/keyd/keyd.socket" ]; 63 64 postInstall = '' 65 ln -sf ${lib.getExe appMap} $out/bin/${appMap.pname} 66 rm -rf $out/etc 67 ''; 68 69 passthru.tests.keyd = nixosTests.keyd; 70 71 meta = with lib; { 72 description = "A key remapping daemon for linux."; 73 license = licenses.mit; 74 maintainers = with maintainers; [ peterhoeg ]; 75 platforms = platforms.linux; 76 }; 77}