untested hm module
This commit is contained in:
parent
ae824fcb47
commit
e24383e81f
2 changed files with 48 additions and 15 deletions
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
a rust application to scrobble your currently playing song on last.fm with mpris
|
a rust application to scrobble your currently playing song on last.fm with mpris
|
||||||
|
|
||||||
upd 2024-08-27: i'm adding a home-manager module, eventually!
|
|
||||||
|
|
||||||
## limitations
|
## limitations
|
||||||
|
|
||||||
unfortunately, because of how most mpris players work, the [Track_Id](https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Simple-Type:Track_Id) (unique identifier for every song in the tracklist) object is very rarely supported, or, if supported, implemented incorrectly (looking at you, [Cider](https://cider.sh/)) meaning it is impossible to tell if the track has been played twice in a row. this means you cannot have succssive scrobbles of the same song, sorry! besides this, i'd say the program is feature complete.
|
unfortunately, because of how most mpris players work, the [Track_Id](https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html#Simple-Type:Track_Id) (unique identifier for every song in the tracklist) object is very rarely supported, or, if supported, implemented incorrectly (looking at you, [Cider](https://cider.sh/)) meaning it is impossible to tell if the track has been played twice in a row. this means you cannot have succssive scrobbles of the same song, sorry! besides this, i'd say the program is feature complete.
|
||||||
|
|
61
flake.nix
61
flake.nix
|
@ -15,14 +15,15 @@
|
||||||
overlays = [rust-overlay.overlays.default];
|
overlays = [rust-overlay.overlays.default];
|
||||||
};
|
};
|
||||||
package = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
|
package = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
|
||||||
rustPlatform = pkgs.makeRustPlatform {
|
|
||||||
cargo = pkgs.cargo;
|
|
||||||
rustc = pkgs.rustc;
|
|
||||||
};
|
|
||||||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./toolchain.toml;
|
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./toolchain.toml;
|
||||||
|
rustPlatform = pkgs.makeRustPlatform {
|
||||||
|
cargo = toolchain;
|
||||||
|
rustc = toolchain;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
packages = flake-utils.lib.flattenTree {
|
packages = flake-utils.lib.flattenTree rec {
|
||||||
|
default = lastfmpris;
|
||||||
lastfmpris = rustPlatform.buildRustPackage {
|
lastfmpris = rustPlatform.buildRustPackage {
|
||||||
pname = package.name;
|
pname = package.name;
|
||||||
inherit (package) version;
|
inherit (package) version;
|
||||||
|
@ -32,20 +33,20 @@
|
||||||
#cargoSha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
#cargoSha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
cargoSha256 = "sha256-KOMEvg3iGjmMEFxsrIqD4SaDw63ojiNNNqCfzRlbYLw=";
|
cargoSha256 = "sha256-KOMEvg3iGjmMEFxsrIqD4SaDw63ojiNNNqCfzRlbYLw=";
|
||||||
|
|
||||||
buildInputs = with pkgs; [ pkg-config ];
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ openssl dbus ];
|
buildInputs = with pkgs; [ openssl dbus ];
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultPackage = packages.lastfmpris;
|
meta.mainProgram = package.name;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [ pkg-config ];
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ openssl dbus ];
|
buildInputs = with pkgs; [ openssl dbus ];
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
toolchain
|
toolchain
|
||||||
|
@ -54,5 +55,39 @@
|
||||||
|
|
||||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||||
};
|
};
|
||||||
});
|
}) // {
|
||||||
|
homeManagerModules = rec {
|
||||||
|
default = lastfmpris;
|
||||||
|
lastfmpris = { config, lib, pkgs, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.services.lastfmpris;
|
||||||
|
in {
|
||||||
|
options.services.lastfmpris = {
|
||||||
|
enable = mkEnableOption "Enables the lastfmpris mpris scrobbling daemon";
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.user.services.lastfmpris = {
|
||||||
|
Unit = {
|
||||||
|
Description = "a rust application to scrobble your currently playing song on last.fm with mpris";
|
||||||
|
Requires = ["graphical-session.target"];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${lib.getExe cfg.package}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = [
|
||||||
|
cfg.package
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue