Compare commits
29 commits
5563a1718f
...
38268c61ea
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 38268c61ea | ||
Bruno BELANYI | 7b9a04ba86 | ||
Bruno BELANYI | 906299a1ef | ||
Bruno BELANYI | f41f974e5f | ||
Bruno BELANYI | 380991d5a7 | ||
Bruno BELANYI | 6091c0ccd6 | ||
Bruno BELANYI | 9fca6c2011 | ||
Bruno BELANYI | 53a0a1f613 | ||
Bruno BELANYI | d1521a4a85 | ||
Bruno BELANYI | a8f3a5b6cc | ||
Bruno BELANYI | 576f18e083 | ||
Bruno BELANYI | e5e9769f5c | ||
Bruno BELANYI | 740432cd90 | ||
Bruno BELANYI | 738c50c05e | ||
Bruno BELANYI | 2f0d9cf70d | ||
Bruno BELANYI | 2c51cb52c6 | ||
Bruno BELANYI | 74b1c5a83d | ||
Bruno BELANYI | 463aa0a80c | ||
Bruno BELANYI | 1d8c10ecf5 | ||
Bruno BELANYI | c108c04ff8 | ||
Bruno BELANYI | da9d84da3d | ||
Bruno BELANYI | 270c3a560d | ||
Bruno BELANYI | 136de66291 | ||
Bruno BELANYI | 04439f1d95 | ||
Bruno BELANYI | 0744d8ea86 | ||
Bruno BELANYI | a877570e4d | ||
Bruno BELANYI | aedd0798e8 | ||
Bruno BELANYI | 5a0197922e | ||
Bruno BELANYI | 26495fc8b2 |
30
flake.lock
30
flake.lock
|
@ -94,11 +94,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731533236,
|
"lastModified": 1726560853,
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -136,11 +136,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732482255,
|
"lastModified": 1730837930,
|
||||||
"narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=",
|
"narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "a9953635d7f34e7358d5189751110f87e3ac17da",
|
"rev": "2f607e07f3ac7e53541120536708e824acccfaa8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -168,11 +168,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732521221,
|
"lastModified": 1730785428,
|
||||||
"narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=",
|
"narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d",
|
"rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -184,11 +184,11 @@
|
||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732704680,
|
"lastModified": 1730885145,
|
||||||
"narHash": "sha256-x3NlO2qzuobU9BrynzydX7X9oskJpysv7BI7DJ5cVSE=",
|
"narHash": "sha256-UPrBEY0No1O3ULb67xYjRh2r3u7MnZovfo1oYSPCIxI=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "31a30f0862fd8b5f88a6597382bb09197356b19e",
|
"rev": "c0d8828600ef47d475e6ec33513bf9af6eb6b991",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -210,11 +210,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732021966,
|
"lastModified": 1730814269,
|
||||||
"narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=",
|
"narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "pre-commit-hooks.nix",
|
"repo": "pre-commit-hooks.nix",
|
||||||
"rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
|
"rev": "d70155fdc00df4628446352fc58adc640cd705c2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
age-encryption.org/v1
|
age-encryption.org/v1
|
||||||
-> ssh-ed25519 cKojmg Ec0xt1uJTva8MxUdoTVX5m3uWaIiRlodf345FEM7Uzs
|
-> ssh-ed25519 cKojmg bQFr9oAnbo1rI/MpUV8wQz/Xj7iZY4ZU+Swf0nSIQFw
|
||||||
aJIneWFJPB5HVeoUGp57agXih9YeZ6xMEbyQ+zJtWQY
|
zama2XJ0gdvUlD2GHMhmZqHSxHe+dKSfXnHoWDcSw7Y
|
||||||
-> ssh-ed25519 jPowng B5XotRgv7s/FUegGhceBj7EoukewNUOIFl4TFRQf1EQ
|
-> ssh-ed25519 jPowng gitUwSKTNKWLSxnwa185O7x/u0ul93g8wPESdZaKRk8
|
||||||
PgGCBd/Pqwp7ayqi7okHBGF1SfFpwT4KlHJ/np6p2uQ
|
uvBIfAUkZp5sg6rfeEGvL5ZDV8m2uSEotW02kjPN3Hw
|
||||||
--- AeLgwGz6k3OABb53cXNaCU/sgI4FlU1s6p8PhAaFOlg
|
--- SZxe5f/CUZBvPQa2Sz/UBY3L68rMkIGGRuZPk7YE+Vg
|
||||||
1ÌÉCÔ¹ð¤ŽULfI1¸Hm»Ûòb}m”” ÁÅ¡ìg•ß0¦¢–¤`X<16>G>\>¹8rŽz+Š›Y ™¼`—Ê¢.JBUÏ!z¸Z50ú*õ¡ÙŸ¤×ÖÇ®I<C2AE>ôÔ]¹‹ÏåI
|
¾r ú&…¥‹{~v?¨}=Ä
|
||||||
ĵ<18>¿–oÒÛ°…g„®„ÒêÁ³Â¿Ÿt’©nƒºãcz[»{
|
}+
¿SQ’M[²]Œ±kMÒAàtŒÃmMë/£µLsü|Þ…m©CÀñiYC}ƒŽ‡çxŽ€
|
||||||
jçå&ÁõõNæ°Nÿo{õš½‚
-eP¾=L‰™
6¦.SP:»e¶–
|
|
|
@ -95,9 +95,6 @@ in
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
passwordFile = secrets."nextcloud/password".path;
|
passwordFile = secrets."nextcloud/password".path;
|
||||||
collabora = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
nix-cache = {
|
nix-cache = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -152,6 +149,11 @@ in
|
||||||
};
|
};
|
||||||
# Because I still need to play sysadmin
|
# Because I still need to play sysadmin
|
||||||
ssh-server.enable = true;
|
ssh-server.enable = true;
|
||||||
|
# Recipe manager
|
||||||
|
tandoor-recipes = {
|
||||||
|
enable = true;
|
||||||
|
secretKeyFile = secrets."tandoor-recipes/secret-key".path;
|
||||||
|
};
|
||||||
# Torrent client and webui
|
# Torrent client and webui
|
||||||
transmission = {
|
transmission = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -53,5 +53,4 @@ layout_uv() {
|
||||||
PATH_add "$VIRTUAL_ENV/bin"
|
PATH_add "$VIRTUAL_ENV/bin"
|
||||||
watch_file pyproject.toml
|
watch_file pyproject.toml
|
||||||
watch_file uv.lock
|
watch_file uv.lock
|
||||||
watch_file .python-version
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ in
|
||||||
clock24 = true; # I'm one of those heathens
|
clock24 = true; # I'm one of those heathens
|
||||||
escapeTime = 0; # Let vim do its thing instead
|
escapeTime = 0; # Let vim do its thing instead
|
||||||
historyLimit = 100000; # Bigger buffer
|
historyLimit = 100000; # Bigger buffer
|
||||||
mouse = false; # I dislike mouse support
|
|
||||||
terminal = "tmux-256color"; # I want accurate termcap info
|
terminal = "tmux-256color"; # I want accurate termcap info
|
||||||
|
|
||||||
plugins = with pkgs.tmuxPlugins; [
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
|
@ -81,13 +80,6 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
# Refresh configuration
|
|
||||||
bind-key -N "Source tmux.conf" R source-file ${config.xdg.configHome}/tmux/tmux.conf \; display-message "Sourced tmux.conf!"
|
|
||||||
|
|
||||||
# Accept sloppy Ctrl key when switching windows, on top of default mapping
|
|
||||||
bind-key -N "Select the previous window" C-p previous-window
|
|
||||||
bind-key -N "Select the next window" C-n next -window
|
|
||||||
|
|
||||||
# Better vim mode
|
# Better vim mode
|
||||||
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
||||||
${
|
${
|
||||||
|
|
|
@ -30,10 +30,11 @@ in
|
||||||
};
|
};
|
||||||
# A tidy home is a tidy mind
|
# A tidy home is a tidy mind
|
||||||
dataFile = {
|
dataFile = {
|
||||||
"tig/.keep".text = ""; # `tig` uses `XDG_DATA_HOME` specifically...
|
"bash/.keep".text = "";
|
||||||
|
"gdb/.keep".text = "";
|
||||||
|
"tig/.keep".text = "";
|
||||||
};
|
};
|
||||||
stateFile = {
|
stateFile = {
|
||||||
"bash/.keep".text = "";
|
|
||||||
"python/.keep".text = "";
|
"python/.keep".text = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,7 +65,9 @@ in
|
||||||
aria-rpc = {
|
aria-rpc = {
|
||||||
port = cfg.rpcPort;
|
port = cfg.rpcPort;
|
||||||
# Proxy websockets for RPC
|
# Proxy websockets for RPC
|
||||||
websocketsLocations = [ "/" ];
|
extraConfig = {
|
||||||
|
locations."/".proxyWebsockets = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,9 @@ in
|
||||||
audiobookshelf = {
|
audiobookshelf = {
|
||||||
inherit (cfg) port;
|
inherit (cfg) port;
|
||||||
# Proxy websockets for RPC
|
# Proxy websockets for RPC
|
||||||
websocketsLocations = [ "/" ];
|
extraConfig = {
|
||||||
|
locations."/".proxyWebsockets = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,5 @@ in
|
||||||
extraGroups = [ "docker" ]; # Give access to the daemon
|
extraGroups = [ "docker" ]; # Give access to the daemon
|
||||||
};
|
};
|
||||||
users.groups.drone-runner-docker = { };
|
users.groups.drone-runner-docker = { };
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,5 @@ in
|
||||||
group = "drone-runner-exec";
|
group = "drone-runner-exec";
|
||||||
};
|
};
|
||||||
users.groups.drone-runner-exec = { };
|
users.groups.drone-runner-exec = { };
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,5 @@ in
|
||||||
inherit (cfg) port;
|
inherit (cfg) port;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,5 @@ in
|
||||||
bantime = "10m";
|
bantime = "10m";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,8 +148,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
my.system.persist.directories = [
|
my.system.persist.directories = [
|
||||||
config.services.forgejo.lfs.contentDir
|
config.services.gitea.lfs.contentDir
|
||||||
config.services.forgejo.repositoryRoot
|
config.services.gitea.repositoryRoot
|
||||||
];
|
];
|
||||||
|
|
||||||
services.fail2ban.jails = {
|
services.fail2ban.jails = {
|
||||||
|
|
|
@ -27,13 +27,17 @@ in
|
||||||
my.services.nginx.virtualHosts = {
|
my.services.nginx.virtualHosts = {
|
||||||
jellyfin = {
|
jellyfin = {
|
||||||
port = 8096;
|
port = 8096;
|
||||||
websocketsLocations = [ "/socket" ];
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
# Too bad for the repetition...
|
||||||
|
locations."/socket" = {
|
||||||
|
proxyPass = "http://127.0.0.1:8096/";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,8 +36,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
|
|
||||||
services.fail2ban.jails = {
|
services.fail2ban.jails = {
|
||||||
komga = ''
|
komga = ''
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
# Document editor with Nextcloud
|
|
||||||
{ config, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.my.services.nextcloud.collabora;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.my.services.nextcloud.collabora = with lib; {
|
|
||||||
enable = mkEnableOption "Collabora integration";
|
|
||||||
|
|
||||||
port = mkOption {
|
|
||||||
type = types.port;
|
|
||||||
default = 9980;
|
|
||||||
example = 8080;
|
|
||||||
description = "Internal port for API";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
services.collabora-online = {
|
|
||||||
enable = true;
|
|
||||||
inherit (cfg) port;
|
|
||||||
|
|
||||||
aliasGroups = [
|
|
||||||
{
|
|
||||||
host = "https://collabora.${config.networking.domain}";
|
|
||||||
# Allow using from nextcloud
|
|
||||||
aliases = [ "https://${config.services.nextcloud.hostName}" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
# Rely on reverse proxy for SSL
|
|
||||||
ssl = {
|
|
||||||
enable = false;
|
|
||||||
termination = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
my.services.nginx.virtualHosts = {
|
|
||||||
collabora = {
|
|
||||||
inherit (cfg) port;
|
|
||||||
websocketsLocations = [
|
|
||||||
"~ ^/cool/(.*)/ws$"
|
|
||||||
"^~ /cool/adminws"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -4,10 +4,6 @@ let
|
||||||
cfg = config.my.services.nextcloud;
|
cfg = config.my.services.nextcloud;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
|
||||||
./collabora.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
options.my.services.nextcloud = with lib; {
|
options.my.services.nextcloud = with lib; {
|
||||||
enable = mkEnableOption "Nextcloud";
|
enable = mkEnableOption "Nextcloud";
|
||||||
maxSize = mkOption {
|
maxSize = mkOption {
|
||||||
|
|
|
@ -17,16 +17,6 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
websocketsLocations = mkOption {
|
|
||||||
type = with types; listOf str;
|
|
||||||
default = [ ];
|
|
||||||
example = [ "/socket" ];
|
|
||||||
description = ''
|
|
||||||
Which locations on this virtual host should be configured for
|
|
||||||
websockets.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
port = mkOption {
|
port = mkOption {
|
||||||
type = with types; nullOr port;
|
type = with types; nullOr port;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -70,13 +60,10 @@ let
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.attrs; # FIXME: forward type of virtualHosts
|
type = types.attrs; # FIXME: forward type of virtualHosts
|
||||||
example = {
|
example = {
|
||||||
extraConfig = ''
|
locations."/socket" = {
|
||||||
add_header X-Clacks-Overhead "GNU Terry Pratchett";
|
proxyPass = "http://127.0.0.1:8096/";
|
||||||
'';
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
locations."/".extraConfig = ''
|
|
||||||
client_max_body_size 1G;
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -99,7 +86,7 @@ in
|
||||||
type = types.str;
|
type = types.str;
|
||||||
example = "/var/lib/acme/creds.env";
|
example = "/var/lib/acme/creds.env";
|
||||||
description = ''
|
description = ''
|
||||||
OVH API key file as an 'EnvironmentFile' (see `systemd.exec(5)`)
|
Gandi API key file as an 'EnvironmentFile' (see `systemd.exec(5)`)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -121,7 +108,12 @@ in
|
||||||
};
|
};
|
||||||
jellyfin = {
|
jellyfin = {
|
||||||
port = 8096;
|
port = 8096;
|
||||||
websocketsLocations = [ "/socket" ];
|
extraConfig = {
|
||||||
|
locations."/socket" = {
|
||||||
|
proxyPass = "http://127.0.0.1:8096/";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -203,19 +195,6 @@ in
|
||||||
} configured.
|
} configured.
|
||||||
'';
|
'';
|
||||||
}))
|
}))
|
||||||
++ (lib.flip lib.mapAttrsToList cfg.virtualHosts (_: { subdomain, ... } @ args:
|
|
||||||
let
|
|
||||||
proxyPass = [ "port" "socket" ];
|
|
||||||
proxyPassUsed = lib.any (v: args.${v} != null) proxyPass;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
assertion = args.websocketsLocations != [ ] -> proxyPassUsed;
|
|
||||||
message = ''
|
|
||||||
Subdomain '${subdomain}' can only use 'websocketsLocations' with one of ${
|
|
||||||
lib.concatStringsSep ", " (builtins.map (v: "'${v}'") proxyPass)
|
|
||||||
}.
|
|
||||||
'';
|
|
||||||
}))
|
|
||||||
++ (
|
++ (
|
||||||
let
|
let
|
||||||
ports = lib.my.mapFilter
|
ports = lib.my.mapFilter
|
||||||
|
@ -262,14 +241,6 @@ in
|
||||||
virtualHosts =
|
virtualHosts =
|
||||||
let
|
let
|
||||||
domain = config.networking.domain;
|
domain = config.networking.domain;
|
||||||
mkProxyPass = { websocketsLocations, ... }: proxyPass:
|
|
||||||
let
|
|
||||||
websockets = lib.genAttrs websocketsLocations (_: {
|
|
||||||
inherit proxyPass;
|
|
||||||
proxyWebsockets = true;
|
|
||||||
});
|
|
||||||
in
|
|
||||||
{ "/" = { inherit proxyPass; }; } // websockets;
|
|
||||||
mkVHost = ({ subdomain, ... } @ args: lib.nameValuePair
|
mkVHost = ({ subdomain, ... } @ args: lib.nameValuePair
|
||||||
"${subdomain}.${domain}"
|
"${subdomain}.${domain}"
|
||||||
(lib.my.recursiveMerge [
|
(lib.my.recursiveMerge [
|
||||||
|
@ -280,7 +251,8 @@ in
|
||||||
}
|
}
|
||||||
# Proxy to port
|
# Proxy to port
|
||||||
(lib.optionalAttrs (args.port != null) {
|
(lib.optionalAttrs (args.port != null) {
|
||||||
locations = mkProxyPass args "http://127.0.0.1:${toString args.port}";
|
locations."/".proxyPass =
|
||||||
|
"http://127.0.0.1:${toString args.port}";
|
||||||
})
|
})
|
||||||
# Serve filesystem content
|
# Serve filesystem content
|
||||||
(lib.optionalAttrs (args.root != null) {
|
(lib.optionalAttrs (args.root != null) {
|
||||||
|
@ -288,7 +260,8 @@ in
|
||||||
})
|
})
|
||||||
# Serve to UNIX socket
|
# Serve to UNIX socket
|
||||||
(lib.optionalAttrs (args.socket != null) {
|
(lib.optionalAttrs (args.socket != null) {
|
||||||
locations = mkProxyPass args "http://unix:${args.socket}";
|
locations."/".proxyPass =
|
||||||
|
"http://unix:${args.socket}";
|
||||||
})
|
})
|
||||||
# Redirect to a different domain
|
# Redirect to a different domain
|
||||||
(lib.optionalAttrs (args.redirect != null) {
|
(lib.optionalAttrs (args.redirect != null) {
|
||||||
|
@ -308,7 +281,6 @@ in
|
||||||
|
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
extraConfig =
|
extraConfig =
|
||||||
# FIXME: check that X-User is dropped otherwise
|
|
||||||
(args.extraConfig.locations."/".extraConfig or "") + ''
|
(args.extraConfig.locations."/".extraConfig or "") + ''
|
||||||
# Use SSO
|
# Use SSO
|
||||||
auth_request /sso-auth;
|
auth_request /sso-auth;
|
||||||
|
@ -442,8 +414,7 @@ in
|
||||||
{
|
{
|
||||||
"${domain}" = {
|
"${domain}" = {
|
||||||
extraDomainNames = [ "*.${domain}" ];
|
extraDomainNames = [ "*.${domain}" ];
|
||||||
dnsProvider = "ovh";
|
dnsProvider = "gandiv5";
|
||||||
dnsPropagationCheck = false; # OVH is slow
|
|
||||||
inherit (cfg.acme) credentialsFile;
|
inherit (cfg.acme) credentialsFile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.my.services.paperless;
|
cfg = config.my.services.paperless;
|
||||||
in
|
in
|
||||||
|
@ -80,34 +80,50 @@ in
|
||||||
# Misc
|
# Misc
|
||||||
PAPERLESS_TIME_ZONE = config.time.timeZone;
|
PAPERLESS_TIME_ZONE = config.time.timeZone;
|
||||||
PAPERLESS_ADMIN_USER = cfg.username;
|
PAPERLESS_ADMIN_USER = cfg.username;
|
||||||
|
|
||||||
|
# Fix classifier hangs
|
||||||
|
LD_LIBRARY_PATH = "${lib.getLib pkgs.mkl}/lib";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Admin password
|
# Admin password
|
||||||
passwordFile = cfg.passwordFile;
|
passwordFile = cfg.passwordFile;
|
||||||
|
|
||||||
# Secret key
|
|
||||||
environmentFile = cfg.secretKeyFile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services = {
|
systemd.services = {
|
||||||
paperless-scheduler = {
|
paperless-scheduler = {
|
||||||
requires = [ "postgresql.service" ];
|
requires = [ "postgresql.service" ];
|
||||||
after = [ "postgresql.service" ];
|
after = [ "postgresql.service" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = cfg.secretKeyFile;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
paperless-consumer = {
|
paperless-consumer = {
|
||||||
requires = [ "postgresql.service" ];
|
requires = [ "postgresql.service" ];
|
||||||
after = [ "postgresql.service" ];
|
after = [ "postgresql.service" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = cfg.secretKeyFile;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
paperless-web = {
|
paperless-web = {
|
||||||
requires = [ "postgresql.service" ];
|
requires = [ "postgresql.service" ];
|
||||||
after = [ "postgresql.service" ];
|
after = [ "postgresql.service" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = cfg.secretKeyFile;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
paperless-task-queue = {
|
paperless-task-queue = {
|
||||||
requires = [ "postgresql.service" ];
|
requires = [ "postgresql.service" ];
|
||||||
after = [ "postgresql.service" ];
|
after = [ "postgresql.service" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = cfg.secretKeyFile;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,7 +152,11 @@ in
|
||||||
sso = {
|
sso = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
websocketsLocations = [ "/" ];
|
|
||||||
|
# Enable websockets on root
|
||||||
|
extraConfig = {
|
||||||
|
locations."/".proxyWebsockets = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
|
|
||||||
services.fail2ban.jails = {
|
services.fail2ban.jails = {
|
||||||
stirling-pdf = ''
|
stirling-pdf = ''
|
||||||
enabled = true
|
enabled = true
|
||||||
|
|
|
@ -56,20 +56,6 @@ in
|
||||||
# FIXME: backup
|
# FIXME: backup
|
||||||
# FIXME: persistence
|
# FIXME: persistence
|
||||||
|
|
||||||
services.fail2ban.jails = {
|
# FIXME: fail2ban
|
||||||
pyload = ''
|
|
||||||
enabled = true
|
|
||||||
filter = pyload
|
|
||||||
port = http,https
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.etc = {
|
|
||||||
"fail2ban/filter.d/pyload.conf".text = ''
|
|
||||||
[Definition]
|
|
||||||
failregex = ^.*Login failed for user '<F-USER>.*</F-USER>' \[CLIENT: <HOST>\]$
|
|
||||||
journalmatch = _SYSTEMD_UNIT=pyload.service
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,12 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# Persist SSH keys
|
# Persist SSH keys
|
||||||
my.system.persist.files =
|
my.system.persist.files = [
|
||||||
let
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
pubAndPrivKey = key: [ key.path "${key.path}.pub" ];
|
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||||
in
|
"/etc/ssh/ssh_host_rsa_key"
|
||||||
lib.concatMap pubAndPrivKey systemConfig.services.openssh.hostKeys;
|
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||||
|
];
|
||||||
|
|
||||||
# Opens the relevant UDP ports.
|
# Opens the relevant UDP ports.
|
||||||
programs.mosh.enable = true;
|
programs.mosh.enable = true;
|
||||||
|
|
|
@ -38,7 +38,5 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,5 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: persistence?
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Common packages
|
# Common packages
|
||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.my.system.packages;
|
cfg = config.my.system.packages;
|
||||||
in
|
in
|
||||||
|
@ -13,6 +13,10 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
wget
|
||||||
|
];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
vim = {
|
vim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -47,17 +47,16 @@ in
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.persistence."${cfg.mountPoint}" = {
|
environment.persistence."${cfg.mountPoint}" = {
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id" # Machine-specific ID
|
"/etc/machine-id"
|
||||||
"/etc/adjtime" # Clock drift factor and offsets
|
|
||||||
]
|
]
|
||||||
++ cfg.files
|
++ cfg.files
|
||||||
;
|
;
|
||||||
|
|
||||||
directories = [
|
directories = [
|
||||||
"/etc/nixos" # In case it's storage directory of our configuration
|
"/etc/nixos"
|
||||||
"/var/log" # Logs
|
"/var/log"
|
||||||
"/var/lib/nixos" # UID/GID maps
|
"/var/lib/nixos"
|
||||||
"/var/lib/systemd/coredump" # Coredumps
|
"/var/lib/systemd/coredump"
|
||||||
]
|
]
|
||||||
++ cfg.directories
|
++ cfg.directories
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in a new issue