Merge pull request #1 from jsw08/seafile

seafile
This commit is contained in:
Jurn Wubben 2025-03-30 22:17:45 +02:00 committed by GitHub
commit 7fdab26712
4 changed files with 59 additions and 1 deletions

17
flake.lock generated
View file

@ -537,6 +537,22 @@
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" "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": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1737003892, "lastModified": 1737003892,
@ -702,6 +718,7 @@
"hm": "hm", "hm": "hm",
"nixcord": "nixcord", "nixcord": "nixcord",
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable",
"nvf": "nvf", "nvf": "nvf",
"somcli": "somcli", "somcli": "somcli",
"stylix": "stylix" "stylix": "stylix"

View file

@ -29,6 +29,7 @@
inputs = { inputs = {
# Nixpkgs and other core shit # Nixpkgs and other core shit
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small"; # build error unrelated to config. 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"; flake-parts.url = "github:hercules-ci/flake-parts";
hm = { hm = {

View file

@ -1,4 +1,4 @@
{lib, ...}: { {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. options.niksos.server = lib.mkEnableOption "server servcies (such as caddy)."; #TODO: per service option.
} }

40
system/server/seafile.nix Normal file
View file

@ -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
}
'';
};
}