From 58ff418feca3b032b4c1744329887c57ee9b9036 Mon Sep 17 00:00:00 2001 From: figsoda Date: Sun, 27 Nov 2022 10:20:00 -0500 Subject: [PATCH 1/2] patsh: init at 0.1.3 --- pkgs/development/tools/misc/patsh/default.nix | 37 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 39 insertions(+) create mode 100644 pkgs/development/tools/misc/patsh/default.nix diff --git a/pkgs/development/tools/misc/patsh/default.nix b/pkgs/development/tools/misc/patsh/default.nix new file mode 100644 index 000000000000..9d79fc8ba53e --- /dev/null +++ b/pkgs/development/tools/misc/patsh/default.nix @@ -0,0 +1,37 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, stdenv +, runCommand +, tree-sitter +}: + +rustPlatform.buildRustPackage rec { + pname = "patsh"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "nix-community"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-KmQVZwZC7KHlzNnL2IKQ76wHUDNUZKz/aFaY4ujvBo4="; + }; + + cargoSha256 = "sha256-vozQKBxAVELdqTnqBpgHX0Wyk18EZAtpiRsKjwz8xKE="; + + # tests fail on darwin due to rpath issues + doCheck = !stdenv.isDarwin; + + TREE_SITTER_BASH = runCommand "tree-sitter-bash" { } '' + mkdir $out + ln -s ${tree-sitter.builtGrammars.tree-sitter-bash}/parser $out/libtree-sitter-bash.a + ''; + + meta = with lib; { + description = "A command-line tool for patching shell scripts inspired by resholve"; + homepage = "https://github.com/nix-community/patsh"; + changelog = "https://github.com/nix-community/patsh/blob/v${version}/CHANGELOG.md"; + license = licenses.mpl20; + maintainers = with maintainers; [ figsoda ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6adc4451777e..a8e1ffb772dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17550,6 +17550,8 @@ with pkgs; patchelfUnstable = lowPrio (callPackage ../development/tools/misc/patchelf/unstable.nix { }); + patsh = callPackage ../development/tools/misc/patsh { }; + pax-rs = callPackage ../development/tools/pax-rs { }; perfect-hash = callPackage ../development/tools/misc/perfect-hash { }; From 3e3f5eba2cd987822478b8e5db57fb759a85043e Mon Sep 17 00:00:00 2001 From: figsoda Date: Sun, 27 Nov 2022 12:12:38 -0500 Subject: [PATCH 2/2] sx: use patsh instead of resholve --- pkgs/tools/X11/sx/default.nix | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/pkgs/tools/X11/sx/default.nix b/pkgs/tools/X11/sx/default.nix index faddc7486809..f48e59c753eb 100644 --- a/pkgs/tools/X11/sx/default.nix +++ b/pkgs/tools/X11/sx/default.nix @@ -1,12 +1,11 @@ { lib -, bash -, coreutils +, stdenvNoCC , fetchFromGitHub -, resholve +, patsh , xorg }: -resholve.mkDerivation rec { +stdenvNoCC.mkDerivation rec { pname = "sx"; version = "2.1.7"; @@ -19,20 +18,16 @@ resholve.mkDerivation rec { makeFlags = [ "PREFIX=$(out)" ]; - solutions = { - sx = { - scripts = [ "bin/sx" ]; - interpreter = "${bash}/bin/sh"; - inputs = [ - coreutils - xorg.xauth - xorg.xorgserver - ]; - execer = [ - "cannot:${xorg.xorgserver}/bin/Xorg" - ]; - }; - }; + nativeBuildInputs = [ patsh ]; + + buildInputs = [ + xorg.xauth + xorg.xorgserver + ]; + + postInstall = '' + patsh -f $out/bin/sx -s ${builtins.storeDir} + ''; meta = with lib; { description = "Simple alternative to both xinit and startx for starting a Xorg server";