From 2ad566ec275bcda6a24d05d75303aa063a4abd4d Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sun, 22 Sep 2024 14:54:06 -0600 Subject: [PATCH] stash wip --- hosts/miniserver/temp-nginx.nix | 5 +--- hosts/server/configuration.nix | 18 ++++++++----- overlay.nix | 1 + pkgs/stash.nix | 47 +++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 pkgs/stash.nix diff --git a/hosts/miniserver/temp-nginx.nix b/hosts/miniserver/temp-nginx.nix index 6e1f9fc..bacd077 100644 --- a/hosts/miniserver/temp-nginx.nix +++ b/hosts/miniserver/temp-nginx.nix @@ -1,7 +1,4 @@ -{ - config, - ... -}: +{ config, ... }: let proxy = locations: { inherit locations; diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index 7661059..02eeab3 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { imports = [ ./hardware-configuration.nix @@ -51,6 +51,7 @@ 6767 # bazarr 5000 # kavita 3399 # sabnzbd + 9999 # stash ]; in { @@ -88,12 +89,15 @@ }; users = { groups.nixremote.gid = 555; - users.nixremote = { - isNormalUser = true; - createHome = true; - group = "nixremote"; - home = "/var/nixremote/"; - openssh.authorizedKeys.keys = [ (builtins.readFile ../../secrets/ssh/ed25519_nixworkstation.pub) ]; + users = { + jawz.packages = with pkgs; [ stash ]; + nixremote = { + isNormalUser = true; + createHome = true; + group = "nixremote"; + home = "/var/nixremote/"; + openssh.authorizedKeys.keys = [ (builtins.readFile ../../secrets/ssh/ed25519_nixworkstation.pub) ]; + }; }; }; services = { diff --git a/overlay.nix b/overlay.nix index 17c64d1..28e09f9 100644 --- a/overlay.nix +++ b/overlay.nix @@ -39,6 +39,7 @@ _self: super: { inherit (pkgsU) ns-usbloader; inherit (pkgsU) collector; inherit (pkgsU) homepage-dashboard; + inherit (pkgsU) stash; inherit (pkgsM) gallery-dl; inherit (pkgsM) yt-dlp; handbrake = super.handbrake.override { useGtk = true; }; diff --git a/pkgs/stash.nix b/pkgs/stash.nix new file mode 100644 index 0000000..f587c95 --- /dev/null +++ b/pkgs/stash.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + cfg = config.services.stash; +in +{ + options = { + services.stash = { + enable = lib.mkEnableOption "Stash"; + + package = lib.mkPackageOption pkgs "stash" { }; + + # port = lib.mkOption { + # type = lib.types.port; + # default = 8080; + # description = "The port of the Stash web application"; + # }; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.services.stash = { + description = "Stash"; + wantedBy = [ "multi-user.target" ]; + # environment = { + # STASH_DIR = "/var/lib/stash"; + # } // lib.optionalAttrs (cfg.databaseUrl != null) { + # STASH_DATABASE_URL = cfg.databaseUrl; + # }; + + serviceConfig = { + ExecStart = "${cfg.package}/bin/stash server --address '${cfg.address}' --port '${toString cfg.port}' --webroot '${cfg.webRoot}'"; + + EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile; + + RootDirectory = "/var/lib/stash"; + }; + }; + }; + + meta.maintainers = with lib.maintainers; [ CaptainJawZ ]; +}