-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
package.nix
71 lines (60 loc) · 2.26 KB
/
package.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# TODO: move this to nixpkgs
# This file aims to be a replacement for the nixpkgs derivation.
{ lib
, pkg-config
, rustPlatform
, fetchFromGitHub
, stdenv
, apple-sdk
, installShellFiles
, installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, buildNoDefaultFeatures ? false
, buildFeatures ? [ ]
}:
let
version = "0.0.10";
hash = "sha256-Y9SuxqI8wvoF0+X6CLNDlSFCwlSU8R73NYF/LjACP18=";
cargoHash = "sha256-1WJIIsTzbChWqvdBSR/OpLC1iR8FgLmypJFQEtpalbw=";
in
rustPlatform.buildRustPackage rec {
inherit cargoHash version;
inherit buildNoDefaultFeatures buildFeatures;
pname = "comodoro";
src = fetchFromGitHub {
inherit hash;
owner = "pimalaya";
repo = "comodoro";
rev = "v${version}";
};
nativeBuildInputs = [ pkg-config ]
++ lib.optional (installManPages || installShellCompletions) installShellFiles;
buildInputs = lib.optional stdenv.hostPlatform.isDarwin apple-sdk;
doCheck = false;
auditable = false;
# unit tests only
cargoTestFlags = [ "--lib" ];
postInstall = ''
mkdir -p $out/share/{completions,man}
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
"$out"/bin/comodoro man "$out"/share/man
'' + lib.optionalString installManPages ''
installManPage "$out"/share/man/*
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
"$out"/bin/comodoro completion bash > "$out"/share/completions/comodoro.bash
"$out"/bin/comodoro completion elvish > "$out"/share/completions/comodoro.elvish
"$out"/bin/comodoro completion fish > "$out"/share/completions/comodoro.fish
"$out"/bin/comodoro completion powershell > "$out"/share/completions/comodoro.powershell
"$out"/bin/comodoro completion zsh > "$out"/share/completions/comodoro.zsh
'' + lib.optionalString installShellCompletions ''
installShellCompletion "$out"/share/completions/comodoro.{bash,fish,zsh}
'';
meta = rec {
description = "CLI to manage emails";
mainProgram = "comodoro";
homepage = "https://github.com/pimalaya/comodoro";
changelog = "${homepage}/blob/v${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ soywod ];
};
}