Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 84 additions & 56 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,69 +1,97 @@
{ stdenv, lib, makeWrapper
, fetchFromGitHub, gitignoreSource
, ruby, bundler, bundix, bundlerEnv, defaultGemConfig
, rustPlatform, cargo, rustc, fetchgit
, libsodium, libopus, imagemagick }:
{
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;
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;
};
gemConfig = defaultGemConfig // {
tantiny = attrs: {
cargoDeps = rustPlatform.fetchCargoTarball {
src = fetchgit {
inherit (attrs.source)
url
rev
sha256
fetchSubmodules
;
};

sha256 = "JlPkdrU2fq+0v/2QJnqtSEv3bqiJbdAvzK3NrrMdY8A=";
};
sha256 = "JlPkdrU2fq+0v/2QJnqtSEv3bqiJbdAvzK3NrrMdY8A=";
};

nativeBuildInputs = [
rustPlatform.cargoSetupHook cargo rustc
];
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
];

postUnpack = ''
mv .cargo tantiny*
'';
};
};
};
postUnpack = ''
mv .cargo tantiny*
'';
};
};
};

in stdenv.mkDerivation rec {
name = "qbot";
in
stdenv.mkDerivation rec {
name = "qbot";

src = gitignoreSource ./.;
src = gitignoreSource ./.;

nativeBuildInputs = [ makeWrapper ];
buildInputs = [ env.wrappedRuby imagemagick ];
propagatedBuildInputs = [ libopus libsodium ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
env.wrappedRuby
imagemagick
];
propagatedBuildInputs = [
libopus
libsodium
];

passthru = {
fontconfigFile = "${src}/share/fc-config.xml";
binPath = lib.makeBinPath buildInputs;
libPath = lib.makeLibraryPath propagatedBuildInputs;
};
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
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}'
'';

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";
};
meta = with lib; {
description = "General purpose Discord bot";
homepage = "https://github.com/arch-community/qbot";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ anna328p ];
mainProgram = "qbot";
};
}
Loading