]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flakes/mypackages/pkgs/bash-libs/default.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / flakes / mypackages / pkgs / bash-libs / default.nix
diff --git a/flakes/mypackages/pkgs/bash-libs/default.nix b/flakes/mypackages/pkgs/bash-libs/default.nix
new file mode 100644 (file)
index 0000000..991c9d2
--- /dev/null
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchFromGitHub, makeWrapper, shellcheck, bashInteractive, coreutils, gnugrep, gawk, file, aspell, util-linux, gnused }:
+stdenv.mkDerivation {
+  pname = "bash-libs";
+  version = "master";
+  src = fetchFromGitHub {
+    owner = "foopgp";
+    repo = "bash-libs";
+    rev = "4bf7fe3a488f55beecc74b76e0daf24244bd824f";
+    sha256 = "sha256-8AHUXPd1dQpo1Ce9MT4++eFhJT3X8SYtgaIKbPFUYjM=";
+  };
+
+  buildInputs = [ shellcheck makeWrapper bashInteractive ];
+  phases = [ "checkPhase" "installPhase" ];
+  checkPhase = ''
+    shellcheck bin/*
+  '';
+  installPhase = 
+  let binPath = lib.makeBinPath [
+    coreutils file aspell util-linux gnused gnugrep gawk
+  ];
+  in ''
+    mkdir -p $out/bin $out/nix-support $out/share/doc/bash-libs $out/share/bash-libs/include
+
+    for i in $src/bin/*; do
+      name=$(basename $i)
+      cp "$i" $out/share/bash-libs/include
+      patchShebangs $out/share/bash-libs/include/$name
+      makeWrapper $out/share/bash-libs/include/$name $out/bin/$name --set PATH ${binPath}
+    done
+    echo "${binPath}" > $out/nix-support/propagated-build-inputs
+    cp $src/man/* $out/share/doc/bash-libs
+  '';
+}