add copyparty
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
url = "github:NotAShelf/nvf";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
copyparty.url = "github:9001/copyparty";
|
||||
};
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, ... }@inputs:
|
||||
let
|
||||
|
||||
@@ -27,6 +27,7 @@ in
|
||||
nvidia.enable = true;
|
||||
};
|
||||
holocron = {
|
||||
copyparty.enable = true;
|
||||
zfs.enable = true;
|
||||
smb.enable = true;
|
||||
nfs.enable = true;
|
||||
@@ -124,6 +125,7 @@ in
|
||||
7704 # srv - hass
|
||||
7705 # srv - zigbee2mqtt
|
||||
7901 # srv - uptime kuma
|
||||
7902 # srv - copyparty
|
||||
25777 # srv - minecraft
|
||||
25565 # ^ ^ ^
|
||||
25566 # | | |
|
||||
|
||||
122
modules/holocron/copyparty/default.nix
Normal file
122
modules/holocron/copyparty/default.nix
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
service = "copyparty";
|
||||
cfg = config.holocron.${service};
|
||||
sec = config.sops.secrets;
|
||||
homelab = config.modules.homelab;
|
||||
in {
|
||||
options.holocron.${service} = {
|
||||
enable = lib.mkEnableOption "enables ${service}";
|
||||
|
||||
# set port options
|
||||
port = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 7902;
|
||||
description = "set port for ${service} (default: ${toString cfg.port}";
|
||||
};
|
||||
url = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${service}.${homelab.base_domain}";
|
||||
description = "set domain for ${service}";
|
||||
};
|
||||
data_dir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/var/lib/${service}";
|
||||
description = "set data directory for ${service}";
|
||||
};
|
||||
ids = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = cfg.port;
|
||||
description = "set uid and pid of ${service} user (matches port by default)";
|
||||
};
|
||||
backup = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "enable backups for ${service}";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
imports = [inputs.copyparty.nixosModules.default];
|
||||
|
||||
# declare ${service} group
|
||||
users.groups.${service} = {
|
||||
gid = lib.mkForce cfg.ids;
|
||||
};
|
||||
|
||||
# declare ${service} user
|
||||
users.users.${service} = {
|
||||
description = "${service} server user";
|
||||
uid = lib.mkForce cfg.ids;
|
||||
isSystemUser = true;
|
||||
home = cfg.data_dir;
|
||||
createHome = true;
|
||||
group = service;
|
||||
extraGroups = [];
|
||||
};
|
||||
|
||||
# enable the ${service} service
|
||||
services.${service} = {
|
||||
enable = true;
|
||||
settings = {
|
||||
};
|
||||
accounts = {
|
||||
};
|
||||
groups = {
|
||||
};
|
||||
volumes = {
|
||||
};
|
||||
flags = {
|
||||
};
|
||||
};
|
||||
|
||||
# # override umask to make permissions work out
|
||||
# systemd.services.${service}.serviceConfig = {
|
||||
# UMask = lib.mkForce "0007";
|
||||
# # User = service;
|
||||
# # Group = service;
|
||||
# };
|
||||
|
||||
# open firewall
|
||||
networking.firewall.allowedTCPPorts = [cfg.port];
|
||||
|
||||
# add to caddy for reverse proxy
|
||||
services.caddy.virtualHosts."${cfg.url}" = {
|
||||
serverAliases = ["${service}.${homelab.public_domain}"];
|
||||
extraConfig = ''
|
||||
tls /etc/ssl/blakedheld.xyz.crt /etc/ssl/blakedheld.xyz.key
|
||||
reverse_proxy 127.0.0.1:${toString cfg.port}
|
||||
'';
|
||||
};
|
||||
|
||||
# add to glance (local service)
|
||||
modules.services.glance.links.system = [
|
||||
{
|
||||
title = service;
|
||||
url = "https://${cfg.url}";
|
||||
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||
icon = "di:${service}";
|
||||
}
|
||||
];
|
||||
#
|
||||
# sops.secrets = {
|
||||
# "${service}_" = {
|
||||
# owner = ;
|
||||
# group = ;
|
||||
# };
|
||||
# };
|
||||
|
||||
# add to backups
|
||||
modules.system.backups.baks = {
|
||||
${service} = {
|
||||
paths = [cfg.data_dir];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -9,5 +9,6 @@
|
||||
./nfs
|
||||
./smb
|
||||
./zfs
|
||||
./copyparty
|
||||
];
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ in
|
||||
};
|
||||
repo = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/holocron/borg";
|
||||
default = "/holocron/archives/devices/snowbelle";
|
||||
description = "borg repository path";
|
||||
};
|
||||
passwd_file = lib.mkOption {
|
||||
|
||||
Reference in New Issue
Block a user