-
Notifications
You must be signed in to change notification settings - Fork 10
/
default.nix
69 lines (57 loc) · 1.59 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{ stdenv, lib, makeWrapper
, fetchFromGitHub, gitignoreSource
, ruby, bundler, bundix, bundlerEnv, defaultGemConfig
, rustPlatform, cargo, rustc, fetchgit
, libsodium, libopus, imagemagick }:
let
env = bundlerEnv {
name = "qbot-bundler-env";
gemdir = ./.;
inherit ruby;
gemConfig = defaultGemConfig // {
tantiny = attrs: {
cargoDeps = rustPlatform.fetchCargoTarball {
src = fetchgit {
inherit (attrs.source)
url rev sha256 fetchSubmodules;
};
sha256 = "JlPkdrU2fq+0v/2QJnqtSEv3bqiJbdAvzK3NrrMdY8A=";
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook cargo rustc
];
postUnpack = ''
mv .cargo tantiny*
'';
};
};
};
in stdenv.mkDerivation rec {
name = "qbot";
src = gitignoreSource ./.;
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ env.wrappedRuby imagemagick ];
propagatedBuildInputs = [ libopus libsodium ];
passthru = {
fontconfigFile = "${src}/share/fc-config.xml";
binPath = lib.makeBinPath buildInputs;
libPath = lib.makeLibraryPath propagatedBuildInputs;
};
installPhase = let
inherit (passthru) binPath libPath fontconfigFile;
in ''
mkdir -p $out/{bin,share}
cp -r . $out/share/qbot
makeWrapper $out/share/qbot/qbot $out/bin/qbot \
--set FONTCONFIG_FILE '${fontconfigFile}' \
--prefix PATH : '${binPath}' \
--prefix LD_LIBRARY_PATH : '${libPath}'
'';
meta = with lib; {
description = "General purpose Discord bot";
homepage = "https://github.com/arch-community/qbot";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ anna328p ];
mainProgram = "qbot";
};
}