forked from apeyroux/tresorit.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.nix
37 lines (36 loc) · 1.03 KB
/
release.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
with import <nixpkgs> {};
let
installUsage = "You must first run install-tresorit-impure before using this command.";
pure = import ./default.nix {};
run-tresorit-install-script = writeShellScriptBin "install-tresorit-impure" ''
mkdir -p $HOME/.local/tresorit
cp -rf ${pure}/bin/* $HOME/.local/tresorit/
'';
run-tresorit-script = writeShellScriptBin "tresorit-impure" ''
BIN=$HOME/.local/tresorit/tresorit
if [ -f $BIN ]; then
$BIN "$@"
else
echo ${installUsage}
fi
'';
run-tresorit-cli-script = writeShellScriptBin "tresorit-cli-impure" ''
BIN=$HOME/.local/tresorit/tresorit-cli
if [ -f $BIN ]; then
$BIN "$@"
else
echo ${installUsage}
fi
'';
in {
impure = stdenv.mkDerivation {
name = "tresorit-impure-${pure.version}";
src = ./.;
installPhase = ''
mkdir -p $out/bin
install ${run-tresorit-install-script}/bin/* $out/bin
install ${run-tresorit-script}/bin/* $out/bin
install ${run-tresorit-cli-script}/bin/* $out/bin
'';
};
}