-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
63 lines (57 loc) · 1.92 KB
/
flake.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
{
description = "Java Discord bot system modules";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
};
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in rec {
nixosModules.default = {pkgs, config, lib, ...}:
{
options.services.putricide = {
path = lib.mkOption {
type = lib.types.str;
default = "/var/run/putricide";
};
enable = lib.mkOption {
type = lib.types.bool;
default = false;
};
args = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
};
};
config.systemd.services.putricide = {
enable = config.services.putricide.enable;
description = "Java Discord bot systemd service";
serviceConfig = {
ExecStart = "${packages.${system}.default}/bin/putricide-wrapped --config ${config.services.putricide.path} --source ${packages.${system}.source}/share/putricide ${lib.concatStrings (lib.strings.intersperse "" config.services.putricide.args)}";
};
wantedBy = ["default.target"];
after = ["network-online.target"];
wants = ["network-online.target"];
};
};
packages.${system} = {
source = pkgs.maven.buildMavenPackage rec {
pname = "ppbot";
name = "putricide";
version = "3.38a";
mvnParameters = "-f ${pname}";
mvnHash = "sha256-cuJvC/yYEC9ok2991y0VjGhycNBnaDOPv1SxZj6lrjA=";
src = ./.;
installPhase = ''
mkdir -p $out/{lib,share}/putricide
cp ${pname}-${version}.jar $out/lib/putricide/putricide.jar
cp -r $src/* $out/share/putricide
'';
};
default = pkgs.writeScriptBin "putricide-wrapped" ''
#!${pkgs.bash}/bin/bash
${pkgs.jdk21}/bin/java -jar ${packages.${system}.source}/lib/putricide/putricide.jar $@
'';
};
};
}