Merge pull request #185866 from tars0x9752/refactor/blesh

This commit is contained in:
Sandro 2022-12-08 14:50:50 +01:00 committed by GitHub
commit 3d0fbbd0f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 25 deletions

View file

@ -9,7 +9,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.bash.interactiveShellInit = mkBefore '' programs.bash.interactiveShellInit = mkBefore ''
source ${pkgs.blesh}/share/ble.sh source ${pkgs.blesh}/share/blesh/ble.sh
''; '';
}; };
meta.maintainers = with maintainers; [ laalsaas ]; meta.maintainers = with maintainers; [ laalsaas ];

View file

@ -1,51 +1,54 @@
{ lib { lib
, stdenvNoCC , stdenvNoCC
, fetchFromGitHub , fetchzip
, git , runtimeShell
, bashInteractive , bashInteractive
, glibcLocales , glibcLocales
, runtimeShell
}: }:
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {
name = "blesh"; name = "blesh";
version = "unstable-2022-07-24"; version = "unstable-2022-07-29";
src = fetchFromGitHub { src = fetchzip {
owner = "akinomyoga"; url = "https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly-20220729+a22e145.tar.xz";
repo = "ble.sh"; sha256 = "088jv02y40pjcfzgrbx8n6aksznfh6zl0j5siwfw3pmwn3i16njw";
rev = "0b95d5d900b79a63e7f0834da5aa7276b8332a44";
hash = "sha256-s/RQKcAFcCUB3Xd/4uOsIgigOE0lCCeVC9K3dfnP/EQ=";
fetchSubmodules = true;
leaveDotGit = true;
}; };
nativeBuildInputs = [ git ]; dontBuild = true;
doCheck = true; doCheck = true;
checkInputs = [ bashInteractive glibcLocales ]; checkInputs = [ bashInteractive glibcLocales ];
preCheck = "export LC_ALL=en_US.UTF-8"; preCheck = "export LC_ALL=en_US.UTF-8";
installFlags = [ "INSDIR=$(out)/share" ]; installPhase = ''
runHook preInstall
mkdir -p "$out/share/blesh/lib"
cat <<EOF >"$out/share/blesh/lib/_package.sh"
_ble_base_package_type=nix
function ble/base/package:nix/update {
echo "Ble.sh is installed by Nix. You can update it there." >&2
return 1
}
EOF
cp -rv $src/* $out/share/blesh
runHook postInstall
'';
postInstall = '' postInstall = ''
mkdir -p "$out/bin" mkdir -p "$out/bin"
cat <<EOF >"$out/bin/blesh-share" cat <<EOF >"$out/bin/blesh-share"
#!${runtimeShell} #!${runtimeShell}
# Run this script to find the ble.sh shared folder # Run this script to find the ble.sh shared folder
# where all the shell scripts are living. # where all the shell scripts are living.
echo "$out/share/ble.sh" echo "$out/share/blesh"
EOF EOF
chmod +x "$out/bin/blesh-share" chmod +x "$out/bin/blesh-share"
mkdir -p "$out/share/lib"
cat <<EOF >"$out/share/lib/_package.sh"
_ble_base_package_type=nix
function ble/base/package:nix/update {
echo "Ble.sh is installed by Nix. You can update it there." >/dev/stderr
return 1
}
EOF
''; '';
meta = with lib; { meta = with lib; {