diff options
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/helix-directory.nix | 57 | ||||
-rw-r--r-- | pkgs/default.nix | 2 |
3 files changed, 59 insertions, 1 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 2ae236d..68174a4 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -6,6 +6,7 @@ ./programs/dwm.nix ./services/catbus-bridge-snapcast.nix ./services/dlnatoad.nix + ./services/helix-directory.nix ./services/helix-player.nix ./services/mosquitto.nix ./services/snapclient.nix diff --git a/nixos/modules/services/helix-directory.nix b/nixos/modules/services/helix-directory.nix new file mode 100644 index 0000000..4601dea --- /dev/null +++ b/nixos/modules/services/helix-directory.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: +with lib; + +let + cfg = config.eth.services.helix-directory; + +in { + + options.eth.services.helix-directory = { + + enable = mkEnableOption "Whether to enable helix-directory"; + + friendlyName = mkOption { + type = types.str; + default = "Helix (${config.networking.hostName})"; + description = "Human-readable name to broadcast"; + example = "My Media Server"; + }; + + directory = mkOption { + type = types.str; + default = ""; + description = "Directory to serve"; + example = "/mnt/md0/media"; + }; + }; + + + config = mkIf cfg.enable { + assertions = [ + { + assertion = cfg.directory != ""; + message = "must set config.eth.services.helix-directory.directory"; + } + ]; + + systemd.services.helix-directory = { + enable = true; + description = "Helix UPnP ContentDirectory server"; + wants = [ "network.target" ]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + DynamicUser = true; + + ExecStart = "${pkgs.eth.helix}/bin/helix-directory -friendly-name ${escapeShellArg cfg.friendlyName} -path ${escapeShellArg cfg.directory}"; + + NoNewPrivileges = true; + ProtectHome = true; + ProtectKernelTunables = true; + ProtectControlGroups = true; + ProtectKernelModules = true; + }; + }; + }; + +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 52fcd14..48d3117 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,7 +8,7 @@ pkgs: super: { catbus-snapcast = pkgs.callPackage ( builtins.fetchGit { url = "https://github.com/ethulhu/catbus-snapcast"; } ) {}; catbus-web-ui = pkgs.callPackage ( builtins.fetchGit { url = "https://github.com/ethulhu/catbus-web-ui"; } ) {}; - helix = pkgs.callPackage ( builtins.fetchGit { url = "https://github.com/ethulhu/helix"; rev = "6162800302ac41bcacded9916260827bbf5ac99e"; } ) {}; + helix = pkgs.callPackage ( builtins.fetchGit { url = "https://github.com/ethulhu/helix"; rev = "dd13cd32ec89503bc1244d4f307452faba1ca7ba"; } ) {}; dlnatoad = pkgs.callPackage ./dlnatoad {}; |