1{
2 lib,
3 stdenvNoCC,
4 fetchFromGitLab,
5 installShellFiles,
6}:
7
8stdenvNoCC.mkDerivation {
9 pname = "dwt1-shell-color-scripts";
10 version = "unstable-2023-03-27";
11
12 src = fetchFromGitLab {
13 owner = "dwt1";
14 repo = "shell-color-scripts";
15 rev = "576735cf656ece1bfd314e617b91c0e9d486d262";
16 hash = "sha256-1iDcUv6uVq5LzFgZo36RRKqAzKoYKZW/MnlbneayvCY=";
17 };
18
19 nativeBuildInputs = [ installShellFiles ];
20
21 postPatch = ''
22 patchShebangs ./colorscript.sh
23 patchShebangs ./colorscripts
24 '';
25
26 installPhase = ''
27 runHook preInstall
28
29 mkdir -p $out/bin $out/share/shell-color-scripts
30 install -Dm755 colorscript.sh $out/bin/colorscript
31 cp -r colorscripts $out/share/shell-color-scripts/colorscripts
32
33 installManPage colorscript.1
34 installShellCompletion --fish completions/colorscript.fish
35 installShellCompletion --zsh completions/_colorscript
36
37 runHook postInstall
38 '';
39
40 postFixup = ''
41 substituteInPlace \
42 $out/bin/colorscript \
43 $out/share/fish/vendor_completions.d/colorscript.fish \
44 $out/share/zsh/site-functions/_colorscript \
45 --replace-fail "/opt/shell-color-scripts/colorscripts" \
46 "$out/share/shell-color-scripts/colorscripts"
47 '';
48
49 meta = {
50 homepage = "https://gitlab.com/dwt1/shell-color-scripts";
51 description = "Collection of shell color scripts collected by dt (Derek Taylor)";
52 license = with lib.licenses; [ mit ];
53 maintainers = [ ];
54 platforms = lib.platforms.all;
55 mainProgram = "colorscript";
56 };
57}