nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 fetchFromGitHub,
5 installShellFiles,
6 patsh,
7 coreutils,
8}:
9
10stdenvNoCC.mkDerivation rec {
11 pname = "script-directory";
12 version = "1.1.0";
13
14 src = fetchFromGitHub {
15 owner = "ianthehenry";
16 repo = "sd";
17 rev = "v${version}";
18 hash = "sha256-X5RWCJQUqDnG2umcCk5KS6HQinTJVapBHp6szEmbc4U=";
19 };
20
21 nativeBuildInputs = [
22 installShellFiles
23 patsh
24 ];
25
26 # needed for cross
27 buildInputs = [ coreutils ];
28
29 installPhase = ''
30 runHook preInstall
31
32 patsh -f sd -s ${builtins.storeDir} --path "$HOST_PATH"
33 install -Dt "$out/bin" sd
34 installShellCompletion --zsh _sd
35
36 runHook postInstall
37 '';
38
39 meta = {
40 description = "Cozy nest for your scripts";
41 homepage = "https://github.com/ianthehenry/sd";
42 changelog = "https://github.com/ianthehenry/sd/tree/${src.rev}#changelog";
43 license = lib.licenses.mit;
44 maintainers = [ ];
45 mainProgram = "sd";
46 };
47}