about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/dwt1-shell-color-scripts/default.nix
blob: 39a9187b3babd40fc0fd3e48c4875d75ced6e905 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ lib
, stdenvNoCC
, fetchFromGitLab
, installShellFiles
}:

stdenvNoCC.mkDerivation {
  pname = "dwt1-shell-color-scripts";
  version = "unstable-2023-03-27";

  src = fetchFromGitLab {
    owner = "dwt1";
    repo = "shell-color-scripts";
    rev = "576735cf656ece1bfd314e617b91c0e9d486d262";
    hash = "sha256-1iDcUv6uVq5LzFgZo36RRKqAzKoYKZW/MnlbneayvCY=";
  };

  nativeBuildInputs = [ installShellFiles ];

  postPatch = ''
    patchShebangs ./colorscript.sh
    patchShebangs ./colorscripts
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/share/shell-color-scripts
    install -Dm755 colorscript.sh $out/bin/colorscript
    cp -r colorscripts $out/share/shell-color-scripts/colorscripts

    installManPage colorscript.1
    installShellCompletion --fish completions/colorscript.fish
    installShellCompletion --zsh completions/_colorscript

    runHook postInstall
  '';

  postFixup = ''
    substituteInPlace $out/bin/colorscript \
      --replace "/opt/shell-color-scripts/colorscripts" \
                "$out/share/shell-color-scripts/colorscripts"
  '';

  meta = {
    homepage = "https://gitlab.com/dwt1/shell-color-scripts";
    description = "A collection of shell color scripts collected by dt (Derek Taylor)";
    license = with lib.licenses; [ mit ];
    maintainers = with lib.maintainers; [ ];
    platforms = lib.platforms.all;
  };
}