grace/dots
dotfiles/nix configs
git clone https://git.gae.moe/grace/dots
c1be8e3
main
1{ lib , pkgs , ...} : 2 3let 4host = import ../hosts.nix ; 5tailnet = import ../tailnet.nix ; 6configuration = pkgs . writeText "copyparty.conf" '' 7[global] 8i: 0.0.0.0 9p: 8080 10rproxy: 1 11xff-src: ${ tailnet . knuth } 12idp-h-usr: Remote-User 13auth-ord: idp,pw 14idp-login: https://auth.gae.moe 15hist: /mnt/data/copyparty/history 16e2dsa 17no-reload 18no-robots 19chmod-f: 660 20chmod-d: 2770 21 22[/] 23/mnt/data/share 24accs: 25rwmd: ${ host . user } 26flags: 27scan: 300 28'' ; 29in 30{ 31imports = [ ./share.nix ]; 32 33users . users . copyparty = { 34isSystemUser = true ; 35group = "share" ; 36home = "/mnt/data/copyparty" ; 37}; 38 39systemd . tmpfiles . rules = [ 40"d /mnt/data/copyparty 0700 copyparty share -" 41]; 42 43networking . firewall . allowedTCPPorts = [ 8080 ]; 44environment . etc . "copyparty/config.conf" . source = configuration ; 45environment . systemPackages = [ pkgs . copyparty ]; 46 47systemd . services . copyparty = { 48description = "Copyparty file server" ; 49wantedBy = [ "multi-user.target" ]; 50after = [ "network.target" ]; 51unitConfig . RequiresMountsFor = [ "/mnt/data" ]; 52environment = { 53PYTHONUNBUFFERED = "1" ; 54XDG_CONFIG_HOME = "/mnt/data/copyparty" ; 55}; 56serviceConfig = { 57User = "copyparty" ; 58Group = "share" ; 59WorkingDirectory = "/mnt/data/copyparty" ; 60ExecStart = " ${ lib . getExe pkgs . copyparty } -c ${ configuration } -c %d/accounts.conf" ; 61LoadCredential = [ "accounts.conf:/etc/secrets/copyparty.conf" ]; 62Restart = "on-failure" ; 63RestartSec = 5 ; 64UMask = "0007" ; 65NoNewPrivileges = true ; 66PrivateTmp = true ; 67ProtectHome = true ; 68ProtectSystem = "strict" ; 69ReadWritePaths = [ 70"/mnt/data/share" 71"/mnt/data/copyparty" 72]; 73}; 74}; 75}