playerctld: add module

This commit is contained in:
Sara Johnsson 2021-01-30 18:20:36 +01:00 committed by Robert Helgesson
parent 98d030f723
commit df7d81b0b3
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
8 changed files with 87 additions and 0 deletions

3
.github/CODEOWNERS vendored
View File

@ -209,6 +209,9 @@
/modules/services/plan9port.nix @ehmry
/modules/services/playerctld.nix @fendse
/tests/modules/playerctld @fendse
/modules/services/pulseeffects.nix @jonringer
/modules/services/random-background.nix @rycee

View File

@ -53,4 +53,10 @@
github = "thiagokokada";
githubId = 844343;
};
fendse = {
email = "46252070+Fendse@users.noreply.github.com";
github = "Fendse";
githubId = 46252070;
name = "Sara Johnsson";
};
}

View File

@ -1814,6 +1814,14 @@ in
A new module is available: 'services.plan9port'.
'';
}
{
time = "2021-01-31T11:23:30+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.playerctld'.
'';
}
];
};
}

View File

@ -175,6 +175,7 @@ let
(loadModule ./services/pbgopy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/picom.nix { })
(loadModule ./services/plan9port.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/playerctld.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/polybar.nix { })
(loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/random-background.nix { })

View File

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.playerctld;
in {
meta.maintainers = [ maintainers.fendse ];
options.services.playerctld = {
enable = mkEnableOption "playerctld daemon";
package = mkOption {
type = types.package;
default = pkgs.playerctl;
defaultText = literalExample "pkgs.playerctl";
description = "The playerctl package to use.";
};
};
config = mkIf cfg.enable {
systemd.user.services.playerctld = {
Unit.Description = "MPRIS media player daemon";
Install.WantedBy = [ "default.target" ];
Service = {
ExecStart = "${cfg.package}/bin/playerctld";
Type = "dbus";
BusName = "org.mpris.MediaPlayer2.playerctld";
};
};
};
}

View File

@ -102,6 +102,7 @@ import nmt {
./modules/services/lieer
./modules/services/redshift-gammastep
./modules/services/pbgopy
./modules/services/playerctld
./modules/services/polybar
./modules/services/sxhkd
./modules/services/window-managers/i3

View File

@ -0,0 +1,31 @@
{ config, pkgs, ... }:
{
config = {
services.playerctld.enable = true;
services.playerctld.package = pkgs.writeScriptBin "playerctld" "" // {
outPath = "@playerctld@";
};
nmt.script = ''
serviceFile=home-files/.config/systemd/user/playerctld.service
assertFileExists "$serviceFile"
assertFileContent "$serviceFile" "${
pkgs.writeText "playerctld-test" ''
[Install]
WantedBy=default.target
[Service]
BusName=org.mpris.MediaPlayer2.playerctld
ExecStart=@playerctld@/bin/playerctld
Type=dbus
[Unit]
Description=MPRIS media player daemon
''
}"
'';
};
}

View File

@ -0,0 +1 @@
{ playerctld-basic = ./basic.nix; }