add dufs module to thinkpad
This commit is contained in:
parent
dd47a6a18d
commit
d234b775e2
3 changed files with 43 additions and 1 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
../../../modules/hyprland/system.nix
|
../../../modules/hyprland/system.nix
|
||||||
../../../modules/wireguard.nix
|
../../../modules/wireguard.nix
|
||||||
../../../modules/login-display.nix
|
../../../modules/login-display.nix
|
||||||
|
../../../modules/dufs.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Bootloader - standard UEFI setup
|
# Bootloader - standard UEFI setup
|
||||||
|
|
@ -253,4 +254,10 @@
|
||||||
showDiskUsage = true;
|
showDiskUsage = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.dufs = {
|
||||||
|
sharedPath = "/home/yanlin/NSFW";
|
||||||
|
user = "yanlin";
|
||||||
|
group = "users";
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,18 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# NSFW WebDAV (dufs on thinkpad)
|
||||||
|
nsfw = {
|
||||||
|
rule = "Host(`nsfw.yanlincs.com`)";
|
||||||
|
service = "nsfw";
|
||||||
|
tls = {
|
||||||
|
certResolver = "cloudflare";
|
||||||
|
domains = [{
|
||||||
|
main = "*.yanlincs.com";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
|
@ -115,6 +127,15 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# NSFW backend (dufs on thinkpad via WireGuard)
|
||||||
|
nsfw = {
|
||||||
|
loadBalancer = {
|
||||||
|
servers = [{
|
||||||
|
url = "http://10.2.2.30:5099";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,18 @@ in
|
||||||
default = 5099;
|
default = 5099;
|
||||||
description = "Port to listen on";
|
description = "Port to listen on";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "root";
|
||||||
|
description = "User account under which dufs runs";
|
||||||
|
};
|
||||||
|
|
||||||
|
group = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "root";
|
||||||
|
description = "Group under which dufs runs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (cfg.sharedPath != null) {
|
config = lib.mkIf (cfg.sharedPath != null) {
|
||||||
|
|
@ -35,7 +47,9 @@ in
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "root"; # Run as root to access any system path
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
|
UMask = "0022";
|
||||||
ExecStart = ''/bin/sh -c "${pkgs.dufs}/bin/dufs ${cfg.sharedPath} --port ${toString cfg.port} --bind 0.0.0.0 --allow-all --auth $(cat ${authFile})@/:rw"'';
|
ExecStart = ''/bin/sh -c "${pkgs.dufs}/bin/dufs ${cfg.sharedPath} --port ${toString cfg.port} --bind 0.0.0.0 --allow-all --auth $(cat ${authFile})@/:rw"'';
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "10s";
|
RestartSec = "10s";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue