Move lastfm-status nix module to the upstream repo

This commit is contained in:
batteredbunny 2024-04-03 11:58:14 +03:00
parent 1efecd81b7
commit e830980cdd
2 changed files with 0 additions and 79 deletions

View file

@ -108,21 +108,4 @@ services.roblox-account-value-api = {
robux_per_euro = 60;
};
};
```
## Lastfm status
[Simple api for showing currently scrobbling song on website](https://github.com/BatteredBunny/lastfm-status)
```nix
inputs = {
lastfm-status.url = "github:BatteredBunny/lastfm-status";
};
```
```nix
lastfm-status = {
enable = true;
package = inputs.lastfm-status.packages.${builtins.currentSystem}.default;
port = 8080;
cacheLength = "1m";
enableRatelimiting = true;
};
```

View file

@ -1,62 +0,0 @@
{
config,
lib,
...
}: let
cfg = config.services.lastfm-status;
in {
options.services.lastfm-status = {
enable = lib.mkEnableOption "lastfm-status";
package = lib.mkOption {
description = "package to use";
};
cacheLength = lib.mkOption {
type = lib.types.str;
default = "1m";
description = "how long to cache an entry for, accepts a golang time duration";
};
enableRatelimiting = lib.mkOption {
type = lib.types.bool;
default = true;
description = "if to enable ratelimiting on the api";
};
port = lib.mkOption {
type = lib.types.int;
description = "port to run http api on";
};
};
config = lib.mkIf cfg.enable {
systemd.services.lastfm-status = {
enable = true;
serviceConfig = {
DynamicUser = true;
ProtectSystem = "full";
ProtectHome = "yes";
DeviceAllow = [""];
LockPersonality = true;
MemoryDenyWriteExecute = true;
PrivateDevices = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
PrivateUsers = true;
ExecStart = "${lib.getExe cfg.package} --port=${toString cfg.port} --cache-length=${cfg.cacheLength} --ratelimit=${toString cfg.enableRatelimiting}";
Restart = "always";
};
wantedBy = ["default.target"];
};
};
}