15
LICENSE
Normal file
15
LICENSE
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
mpd-discord-presence: MPD Discord daemon
|
||||||
|
Copyright (C) 2025 Slendi
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
27
flake.nix
27
flake.nix
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
description = "Rust flake";
|
description = "MPD Discord daemon";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{
|
{
|
||||||
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
fenix,
|
fenix,
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
overlay =
|
overlay =
|
||||||
final: prev:
|
final: prev:
|
||||||
let
|
let
|
||||||
fenixPkgs = fenix.packages.${final.system};
|
fenixPkgs = fenix.packages.${final.stdenv.hostPlatform.system};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
rustToolchain =
|
rustToolchain =
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
overlays.default = overlay;
|
overlays.default = overlay;
|
||||||
|
homeManagerModules.mpd-discord-presence = import ./nix/mpd-discord-presence.nix;
|
||||||
}
|
}
|
||||||
// flake-utils.lib.eachDefaultSystem (
|
// flake-utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
@@ -65,6 +67,27 @@
|
|||||||
export RUST_SRC_PATH="${pkgs.rustToolchain}/lib/rustlib/src/rust/library"
|
export RUST_SRC_PATH="${pkgs.rustToolchain}/lib/rustlib/src/rust/library"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
packages = rec {
|
||||||
|
mpd-discord-presence = pkgs.rustPlatform.buildRustPackage {
|
||||||
|
pname = "mpd-discord-presence";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
enableParallelBuild = true;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "MPD Discord daemon";
|
||||||
|
homepage = "https://git.slendi.dev/Slendi/mpd-discord-presence";
|
||||||
|
license = pkgs.lib.licenses.gpl3;
|
||||||
|
mainProgrma = "mpd-discord-presence";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = mpd-discord-presence;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
45
nix/mpd-discord-presence.nix
Normal file
45
nix/mpd-discord-presence.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{ config, lib, pkgs, self, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.mpd-discord-presence;
|
||||||
|
defaultPkg =
|
||||||
|
self.packages.${pkgs.stdenv.hostPlatform.system}.mpd-discord-presence;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.mpd-discord-presence = {
|
||||||
|
enable = lib.mkEnableOption "mpd-discord-presence (systemd user service)";
|
||||||
|
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = defaultPkg;
|
||||||
|
description = "Package providing the mpd-discord-presence binary.";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraArgs = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [];
|
||||||
|
description = "Extra CLI args passed to mpd-discord-presence.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
systemd.user.services.mpd-discord-presence = {
|
||||||
|
Unit = {
|
||||||
|
Description = "MPD Discord Presence";
|
||||||
|
Wants = [ "mpd.service" ];
|
||||||
|
After = [ "mpd.service" "network-online.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${cfg.package}/bin/mpd-discord-presence ${lib.escapeShellArgs cfg.extraArgs}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = {
|
||||||
|
WantedBy = [ "default.target" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user