untested home-manager module
This commit is contained in:
parent
aa0f2201e4
commit
5cecfc66a9
2 changed files with 68 additions and 18 deletions
50
README.md
50
README.md
|
@ -6,6 +6,8 @@ a rust application to scrobble your currently playing song on last.fm with mpris
|
|||
|
||||
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.
|
||||
|
||||
also you can't configure the program through nix yet because i'm lazy, i'll do that sometime!!
|
||||
|
||||
## configuration
|
||||
|
||||
either run the program once and navigate to `.config/lastmpris/config.ini` or create the file and copy it from the `config.example.ini` file provided in this directory. once you do that, configure your authentication methods. the api keys are available [here](https://www.last.fm/login?next=/api/account/create)
|
||||
|
@ -14,26 +16,42 @@ you also have the option to define your mpris bus name, which will instead wait
|
|||
|
||||
## how to install
|
||||
|
||||
*if you're on a setup that uses nix, you can just use `nix build` or the provided devshell to build the application.*
|
||||
you have two methods of installation
|
||||
|
||||
first, clone repository:
|
||||
1. install with cargo + your package manager of choice
|
||||
|
||||
```sh
|
||||
git clone https://git.reidlab.pink/reidlab/lastfmpris && cd lastfmpris
|
||||
```
|
||||
1. obtain dependencies (this will vary on your package manager)
|
||||
```sh
|
||||
sudo apk add install pkgconf openssl dbus
|
||||
```
|
||||
2. run/build
|
||||
```sh
|
||||
cargo build --release
|
||||
```
|
||||
2. install using nix
|
||||
|
||||
second, obtain dependencies (this will vary on your package manager, here, alpine is used)
|
||||
simply run it with nix:
|
||||
|
||||
```sh
|
||||
sudo apk add install pkgconf openssl dbus
|
||||
```
|
||||
```sh
|
||||
nix run git+https://git.reidlab.pink/reidlab/lastfmpris
|
||||
```
|
||||
|
||||
finally, run/build
|
||||
or put it into your flake as such:
|
||||
|
||||
```sh
|
||||
cargo run
|
||||
```
|
||||
```nix
|
||||
# add this into your flake inputs:
|
||||
lastfmpris.url = "git+https://git.reidlab.pink/reidlab/lastfmpris";
|
||||
# add this to your `homeConfiguration`:
|
||||
imports = [
|
||||
inputs.lastfmpris.nixosModules.lastfmpris
|
||||
];
|
||||
```
|
||||
|
||||
```sh
|
||||
cargo build --release
|
||||
```
|
||||
and then just add this to use it as a home-manager option:
|
||||
|
||||
```nix
|
||||
# add this to your home-manager configuration:
|
||||
services.lastfmpris = {
|
||||
enable = true;
|
||||
};
|
||||
```
|
34
flake.nix
34
flake.nix
|
@ -54,5 +54,37 @@
|
|||
|
||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||
};
|
||||
});
|
||||
}) // {
|
||||
homeManagerModules = {
|
||||
lastfmpris = { config, lib, pkgs, system, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.lastfmpris;
|
||||
in {
|
||||
options.services.lastfmpris = {
|
||||
enable = mkEnableOption "enables the lastmpris scrobbler";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = self.defaultPackage.${pkgs.system};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
systemd.user.services.lastfmpris = {
|
||||
Unit = {
|
||||
Description = "Lastfmpris scrobbling daemon";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "Simple";
|
||||
ExecStart = "${lib.getExe cfg.package}";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue