-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdefault.nix
48 lines (43 loc) · 1.53 KB
/
default.nix
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
{ pkgs ? import <nixpkgs> {}
, lib ? import <nixpkgs/lib>
, ...
}:
with pkgs;
let
deps = import ./dependencies.nix { inherit pkgs; };
in
stdenvNoCC.mkDerivation rec {
name = "drinklist-cli";
meta = {
homepage = https://github.com/FIUS/drinklist-cli;
description = "A CLI for the FIUS drinklsit";
license = lib.licenses.gpl3;
};
src = ./.;
dontBuild = true;
nativeBuildInputs = deps.nativeBuildInputs;
buildInputs = deps.buildInputs;
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/opt
for file in ./src/*
do
cp -r $file $out/opt/
done
cp LICENSE $out/opt/LICENSE
cp COPYING $out/opt/COPYING
makeWrapper $out/opt/drink.py $out/bin/drinklist
makeWrapper $out/opt/drink.py $out/bin/drink --add-flags drink
# Link bash completion
mkdir -p $out/etc/bash_completion.d
ln -s $out/opt/bash_completions.sh $out/etc/bash_completion.d/drinklist.bash-completion
mkdir -p $out/share/bash-completion/completions
ln -s $out/opt/bash_completions.sh $out/share/bash-completion/completions/drinklist
ln -s $out/opt/bash_completions.sh $out/share/bash-completion/completions/drinklist.bash-completion
# Link zsh completion
mkdir -p $out/share/zsh/site-functions
ln -s $out/opt/zsh_completion_drinklist.zsh $out/share/zsh/site-functions/_drinklist
ln -s $out/opt/zsh_completion_drink.zsh $out/share/zsh/site-functions/_drink
ln -s $out/opt/zsh_completion_helpers.zsh $out/share/zsh/site-functions/_drinklist_completion_helpers
'';
}