commit 57b999272c84b17e88b5e4b67c5a4c5a4bcbef4d
parent 6a22a2e907ca5dc78ae7c5f2a5c95f660134ce9b
Author: mtmn <miro@haravara.org>
Date: Sat, 11 Apr 2026 12:16:49 +0200
feat: add scorpus
Diffstat:
5 files changed, 138 insertions(+), 0 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -138,6 +138,24 @@
"type": "github"
}
},
+ "flake-utils_2": {
+ "inputs": {
+ "systems": "systems_4"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -216,6 +234,22 @@
"type": "github"
}
},
+ "nixpkgs_2": {
+ "locked": {
+ "lastModified": 1775793324,
+ "narHash": "sha256-omax7atcZbol+6HJ2RLpP+ZCFcPa5bZ65Hn71RufeWQ=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "9d29d5f667d7467f98efc31881e824fa586c927e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"ragenix": {
"inputs": {
"agenix": "agenix",
@@ -248,6 +282,7 @@
"nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs",
"ragenix": "ragenix",
+ "scorpus": "scorpus",
"tools": "tools"
}
},
@@ -272,6 +307,25 @@
"type": "github"
}
},
+ "scorpus": {
+ "inputs": {
+ "flake-utils": "flake-utils_2",
+ "nixpkgs": "nixpkgs_2"
+ },
+ "locked": {
+ "lastModified": 1775892323,
+ "narHash": "sha256-jRrS7XiE0bD4koEJzT1qpLQ62TFgYqh0lHxOgjRmigE=",
+ "ref": "refs/heads/master",
+ "rev": "84917dd8e71259c54cb9e7482dafa29edcfe267e",
+ "revCount": 18,
+ "type": "git",
+ "url": "ssh://git@codeberg.org/mtmn/scorpus.git"
+ },
+ "original": {
+ "type": "git",
+ "url": "ssh://git@codeberg.org/mtmn/scorpus.git"
+ }
+ },
"systems": {
"locked": {
"lastModified": 1681028828,
@@ -317,6 +371,21 @@
"type": "github"
}
},
+ "systems_4": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
"tools": {
"flake": false,
"locked": {
diff --git a/flake.nix b/flake.nix
@@ -31,6 +31,8 @@
url = "git+ssh://git@codeberg.org/mtmn/tools.git";
flake = false;
};
+
+ scorpus.url = "git+ssh://git@codeberg.org/mtmn/scorpus.git";
};
outputs = {
@@ -168,6 +170,7 @@
static = import ./modules/services/static.nix;
miniflux = import ./modules/services/miniflux.nix;
listenbrainz-mpd = import ./modules/services/listenbrainz-mpd.nix;
+ scorpus = import ./modules/services/scorpus.nix;
};
deploy = {
diff --git a/hosts/nixaran/configuration.nix b/hosts/nixaran/configuration.nix
Binary files differ.
diff --git a/hosts/void/default.nix b/hosts/void/default.nix
@@ -109,6 +109,7 @@
nix-diff
attic-client
deploy-rs
+ nix-output-monitor
];
net = with pkgs; [
diff --git a/modules/services/scorpus.nix b/modules/services/scorpus.nix
@@ -0,0 +1,65 @@
+{
+ config,
+ lib,
+ pkgs,
+ inputs,
+ ...
+}: let
+ cfg = config.services.haravara.scorpus;
+in {
+ options.services.haravara.scorpus = {
+ enable = lib.mkEnableOption "Scorpus - ListenBrainz frontend";
+
+ port = lib.mkOption {
+ type = lib.types.port;
+ default = 8321;
+ };
+
+ domain = lib.mkOption {
+ type = lib.types.str;
+ };
+
+ dataDir = lib.mkOption {
+ type = lib.types.str;
+ default = "/var/lib/scorpus";
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+ age.secrets.scorpus = {
+ file = ../../secrets/scorpus.age;
+ owner = "scorpus";
+ };
+
+ systemd.services.scorpus = {
+ description = "Scorpus - ListenBrainz frontend";
+ wantedBy = ["multi-user.target"];
+ after = ["network.target"];
+
+ environment = {
+ PORT = toString cfg.port;
+ DATABASE_FILE = "${cfg.dataDir}/scorpus.db";
+ };
+
+ serviceConfig = {
+ ExecStart = "${inputs.scorpus.packages.${pkgs.system}.default}/bin/scorpus-server";
+ EnvironmentFile = config.age.secrets.scorpus.path;
+ Restart = "always";
+ User = "scorpus";
+ Group = "scorpus";
+ StateDirectory = "scorpus";
+ WorkingDirectory = cfg.dataDir;
+ };
+ };
+
+ users.users.scorpus = {
+ isSystemUser = true;
+ group = "scorpus";
+ };
+ users.groups.scorpus = {};
+
+ services.caddy.virtualHosts."${cfg.domain}".extraConfig = ''
+ reverse_proxy 127.0.0.1:${toString cfg.port}
+ '';
+ };
+}