diff --git a/flake.lock b/flake.lock index 6dce111..522148b 100644 --- a/flake.lock +++ b/flake.lock @@ -537,6 +537,22 @@ "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1743161759, + "narHash": "sha256-AJJy0SKtqLld9JPYi/yvI2P6qCNpcjExHuniZbRSklk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "873f4b2202bdac3845fa5ae294cfa2748ef0667e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11-small", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1737003892, @@ -702,6 +718,7 @@ "hm": "hm", "nixcord": "nixcord", "nixpkgs": "nixpkgs_4", + "nixpkgs-stable": "nixpkgs-stable", "nvf": "nvf", "somcli": "somcli", "stylix": "stylix" diff --git a/flake.nix b/flake.nix index 17d7ec3..5ab046c 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,7 @@ inputs = { # Nixpkgs and other core shit nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small"; # build error unrelated to config. + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11-small"; # build error unrelated to config. flake-parts.url = "github:hercules-ci/flake-parts"; hm = { diff --git a/system/server/default.nix b/system/server/default.nix index 17303ee..225bf10 100644 --- a/system/server/default.nix +++ b/system/server/default.nix @@ -1,4 +1,4 @@ {lib, ...}: { - imports = [./caddy.nix ./transfer-sh.nix]; + imports = [./caddy.nix ./transfer-sh.nix ./seafile.nix]; options.niksos.server = lib.mkEnableOption "server servcies (such as caddy)."; #TODO: per service option. } diff --git a/system/server/seafile.nix b/system/server/seafile.nix new file mode 100644 index 0000000..6c35106 --- /dev/null +++ b/system/server/seafile.nix @@ -0,0 +1,40 @@ +{config, inputs, pkgs, ...}:{ + services.seafile = { + enable = config.niksos.server; + seahubPackage = inputs.nixpkgs-stable.legacyPackages.${pkgs.system}.seahub; + + adminEmail = "jurnwubben@gmail.com"; + initialAdminPassword = "ChangeMeTheFuckNow!"; + + gc.enable = true; + + ccnetSettings.General.SERVICE_URL = "https://files.jsw.tf"; + seahubExtraConf = '' +ALLOWED_HOSTS = ['.files.jsw.tf'] +CSRF_COOKIE_SECURE = True +CSRF_COOKIE_SAMESITE = 'Strict' +CSRF_TRUSTED_ORIGINS = ['https://files.jsw.tf', 'https://www.files.jsw.tf'] + ''; + seafileSettings = { + quota.default = 30; + history.keep_days = 40; + library_trash.expire_days = 14; + fileserver = { + host = "unix:/run/seafile/server.sock"; + web_token_expire_time = 14400; # 4 hours + }; + }; + }; + + services.caddy.virtualHosts."files.jsw.tf" = { + # serverAliases = ["www.share.jsw.tf"]; + extraConfig = '' + handle_path /seafhttp/* { + reverse_proxy * unix//run/seafile/server.sock + } + handle_path /* { + reverse_proxy * unix//run/seahub/gunicorn.sock + } + ''; + }; +}