mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 22:29:06 +01:00
Rename modules directory system to nixos
This commit is contained in:
parent
653a6f310b
commit
1c1b9221fc
48 changed files with 1 additions and 1 deletions
53
modules/nixos/web-services/filebrowser.nix
Normal file
53
modules/nixos/web-services/filebrowser.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
config,
|
||||
self,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.web-services.filebrowser;
|
||||
|
||||
dataDir = "/var/lib/filebrowser";
|
||||
in
|
||||
{
|
||||
options.custom.web-services.filebrowser = {
|
||||
enable = lib.mkEnableOption "";
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "";
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 44093;
|
||||
};
|
||||
doBackups = lib.mkEnableOption "";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = lib.singleton {
|
||||
assertion = self.lib.isPrivateDomain cfg.domain;
|
||||
message = self.lib.mkUnprotectedMessage "Filebrowser";
|
||||
};
|
||||
|
||||
services.filebrowser = {
|
||||
enable = true;
|
||||
settings = {
|
||||
inherit (cfg) port;
|
||||
noauth = true;
|
||||
};
|
||||
};
|
||||
|
||||
custom = {
|
||||
services = {
|
||||
caddy.virtualHosts.${cfg.domain}.port = cfg.port;
|
||||
|
||||
restic.backups.filebrowser = lib.mkIf cfg.doBackups {
|
||||
conflictingService = "filebrowser.service";
|
||||
paths = [ dataDir ];
|
||||
};
|
||||
};
|
||||
|
||||
persistence.directories = [ dataDir ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue