mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
home-manager/services/gonic: init
Even though it's pointless in practice since it needs firewall for security-oriented systems but still... could be useful for desktop systems where security is permissive.
This commit is contained in:
parent
3c56efb777
commit
2a2526f196
@ -9,6 +9,7 @@
|
||||
./services/bleachbit.nix
|
||||
./services/distant.nix
|
||||
./services/gallery-dl.nix
|
||||
./services/gonic.nix
|
||||
./services/matcha.nix
|
||||
./services/plover.nix
|
||||
./services/yt-dlp.nix
|
||||
|
54
modules/home-manager/services/gonic.nix
Normal file
54
modules/home-manager/services/gonic.nix
Normal file
@ -0,0 +1,54 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.gonic;
|
||||
|
||||
settingsFormat = pkgs.formats.keyValue {
|
||||
mkKeyValue = lib.generators.mkKeyValueDefault { } " ";
|
||||
listsAsDuplicateKeys = true;
|
||||
};
|
||||
settingsFile = settingsFormat.generate "gonic-settings-config" cfg.settings;
|
||||
in
|
||||
{
|
||||
options.services.gonic = {
|
||||
enable = lib.mkEnableOption "Gonic, a Subsonic-compatible music server";
|
||||
|
||||
package = lib.mkPackageOption pkgs "gonic" { };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration to be included to the service.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
music-path = [ config.xdg.userDirs.music ];
|
||||
podcast-path = [ "''${config.xdg.userDirs.music}/Podcasts" ];
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.gonic" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
systemd.user.services.gonic = {
|
||||
Unit = {
|
||||
Description = "Gonic media server";
|
||||
Documentation = [ "https://github.com/sentriz/gonic/wiki" ];
|
||||
After = [ "network.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${lib.getExe' cfg.package "gonic"} -config-path ${settingsFile}";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
}
|
@ -60,6 +60,7 @@ import nmt {
|
||||
./services/archivebox
|
||||
./services/bleachbit
|
||||
./services/gallery-dl
|
||||
./services/gonic
|
||||
./services/matcha
|
||||
./services/plover
|
||||
./services/yt-dlp
|
||||
|
19
tests/modules/home-manager/services/gonic/basic.nix
Normal file
19
tests/modules/home-manager/services/gonic/basic.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.gonic = {
|
||||
enable = true;
|
||||
package = pkgs.gonic;
|
||||
|
||||
settings = {
|
||||
music-path = [ config.xdg.userDirs.music ];
|
||||
podcast-path = [ "${config.xdg.userDirs.music}/Podcasts" ];
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.gonic = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/systemd/user/gonic.service
|
||||
'';
|
||||
}
|
3
tests/modules/home-manager/services/gonic/default.nix
Normal file
3
tests/modules/home-manager/services/gonic/default.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
gonic-basic = ./basic.nix;
|
||||
}
|
Loading…
Reference in New Issue
Block a user