Compare commits

...
Sign in to create a new pull request.

85 commits
grocy ... main

Author SHA1 Message Date
c356952829
Bump nixpkgs 2026-04-28 21:12:34 +02:00
6c9e6893b9
remove proxy_cookie_path nginx setting 2026-02-22 15:13:32 +01:00
Emelie Graven
6b002df0c8 fix: Attempt to fix immich again 2026-02-22 15:09:25 +01:00
74a073513b
Remove default gitea theme 2026-02-22 15:04:44 +01:00
932a0210a3
Add 1 git-crypt collaborator
New collaborators:

    8D0BB1659F9F9198F9D24406AFB2896A1FA1B827
        Charlie Graven <charlie@graven.se>
2026-02-22 14:52:38 +01:00
b2482bcd0e
Bump Nextcloud to 32 2026-02-22 14:48:03 +01:00
Emelie Graven
7d3a905a5b fix: Attempt to fix immich 2026-02-22 13:05:43 +01:00
Emelie Graven
0a05b244b9 Configure webfinger 2026-02-06 20:21:47 +01:00
Emelie Graven
3fa70d15e1 Add akkoma 2026-02-01 12:32:17 +01:00
a4968bffc1
Upgrade nixpkgs to 25.11 2026-01-12 20:37:27 +01:00
2e2e7c13a6
Add amanda@bitwarden ssh key 2026-01-09 18:35:40 +01:00
317f1bfb0d
Remove $ prefix from shell code fences 2026-01-09 18:34:33 +01:00
1844cb7ef3
Bump nixpkgs 2025-12-14 19:52:17 +01:00
ca16e3af50
Disable global headers to appease nginx linter 2025-12-14 19:52:00 +01:00
41f68392eb
Upgrade to 25.05 2025-08-15 19:11:04 +02:00
68359e345d
Bump nixpkgs 2025-05-28 19:14:12 +02:00
17b279a41b
Disable coturn 2025-05-28 19:14:04 +02:00
Emelie Graven
1ad4f3a598 update to new domain 2025-04-05 19:12:25 +02:00
4ebfb82746
Update nixpkgs 2025-04-05 16:46:52 +02:00
f444c9a9ea
Accommodate postgres renaming extraPlugins to extensions 2025-04-05 16:05:32 +02:00
25391e3261
Add Out of Your Element 2025-04-05 16:05:09 +02:00
b41fbbe6f8
Update ssh keys 2025-04-05 16:04:10 +02:00
0a01c859ab
Route amanda.graven.dev to wind 2025-03-29 15:05:09 +01:00
68bd97fe3a
Add immich 2025-03-23 21:51:47 +01:00
2210d8eecf
Bump nixpkgs 2025-03-23 18:10:23 +01:00
997aa93cdc
Bump nixpkgs 2025-02-08 09:44:57 +01:00
beb429d72d
Upgrade to nixos-24.11 2025-01-08 19:45:36 +01:00
43f898a7c5
Bump nixpkgs 2024-12-10 21:06:11 +01:00
3d8655d208
Bump nixpkgs 2024-11-06 17:44:33 +01:00
c7d5cf033b
Disable sliding sync proxy 2024-11-06 17:44:06 +01:00
da1928e8ca
Update nixpkgs, remove nitter 2024-10-19 18:03:34 +02:00
b1ff58b3d9
Upgrade nixpkgs to 24.05 2024-08-03 20:47:06 +02:00
aa404c2de6
Version update 2024-06-01 23:02:10 +02:00
b38af9cce3
Update nixpkgs 2024-05-15 22:01:00 +02:00
57b2d2f051
Update nixpkgs 2024-04-25 20:26:20 +02:00
8ffde247cf
Update nixpkgs 2024-04-01 18:23:02 +02:00
cfd54d3f7f
Version update 2024-03-10 21:57:17 +01:00
d3f12d97e9
Update 2024-03-03 13:03:12 +01:00
840bcd4cea
nixpkgs update 2024-01-06 09:32:52 +01:00
5b36b4089d
Replace gitea with forgejo 2023-12-13 20:27:13 +01:00
d3c8c253f2
Upgrade to nextcloud 27 2023-12-08 17:38:51 +01:00
fec23849d3
Upgrade wind to postgres 16 2023-12-08 14:58:35 +01:00
71c97ab7a5
Upgrade grondahl to postgres 16 2023-12-08 14:41:08 +01:00
2895a51862
Upgrade nixpkgs to 23.11 2023-12-08 14:05:12 +01:00
bdd876cdfd
Upgrade rudiger to postgres 15 2023-12-08 13:33:57 +01:00
ed2a33f3a6
Disable minimal profile 2023-11-29 15:09:10 +01:00
b43a55bb9f
Configure borg for grondahl 2023-10-26 17:12:27 +02:00
8d718be321 Update nixpkgs 2023-10-22 14:18:29 +02:00
dac10cfe1a Remove grocy 2023-10-22 14:17:15 +02:00
86fef3990e Finish configuring sliding sync 2023-10-16 07:56:23 +02:00
Emelie Graven
b2bd89105d
feat: Add sliding sync proxy 2023-10-13 13:32:53 +02:00
1c537e6c1b change from release to nixos branch 2023-10-09 21:13:28 +02:00
33ba5078e7 Run nix gc weekly 2023-10-03 17:03:44 +02:00
8c1c1e864b
Remaining backup jobs for wind 2023-06-21 17:35:12 +02:00
69f780a9f2
Configure borg backup for gitea 2023-06-18 12:21:21 +02:00
e21bba4363
Upgrade to 23.05 2023-06-17 12:22:58 +02:00
Emelie Graven
c0e5c26ae9
remove old gitea conf flag 2023-02-21 14:33:54 +01:00
Emelie Graven
32ac87ee41
Add ssh keys, disable gitea reg 2023-02-21 11:32:35 +01:00
34df05f81a
Add and enable tinytinyrss fever api derivation 2023-01-29 18:47:19 +01:00
7a784af41d
gitea: Replace deprecated options 2023-01-25 19:34:07 +01:00
03650c11c0
Nextcloud: Disable at rest encryption for better SSL 2023-01-22 19:33:55 +01:00
708014dbdc
Update sources.json 2023-01-22 16:33:20 +01:00
6b93088039
Tiny Tiny RSS: Disable registration 2023-01-22 16:28:47 +01:00
Emelie Graven
965c43679a
Update to nixos 22.11 2023-01-19 19:52:00 +01:00
Emelie Graven
25fb72c8ec
Add tailscale 2022-10-24 11:13:11 +02:00
Emelie Graven
b738c1451f
Add grocy service 2022-10-12 05:25:46 +02:00
Emelie Graven
487523ce55
Add resident ssh keys 2022-10-12 05:21:22 +02:00
Emelie Graven
1c508735c0
forgot to push last time oops 2022-09-17 13:42:25 +02:00
Emelie Graven
5557db3a54
Bump nixpkgs, add ssh key 2022-09-13 10:13:23 +02:00
Emelie Graven
4ee143230e
fix perms 2022-08-23 20:42:25 +02:00
Emelie Graven
071126e9c3
fuck 2022-08-23 20:31:09 +02:00
Emelie Graven
ca550f134f
Add 1 git-crypt collaborator
New collaborators:

	BE59D7CC Emelie Graven <e.graven@famedly.com>
2022-08-23 19:40:35 +02:00
Emelie Graven
c975d30f4f
Disable zfs snapshots 2022-08-23 18:36:50 +02:00
Emelie Graven
3d860de343
fix anarkafem.dev synapse 2022-08-23 18:34:47 +02:00
Emelie Graven
4ba7a0328a
Fix anarkafem.dev synapse db 2022-08-10 21:30:41 +02:00
Emelie Graven
8750d000bc
Bump to nixpkgs 22.05 2022-08-03 08:57:34 +02:00
Emelie Graven
41781e6a17
Up nixpkgs 2022-04-12 19:25:11 +02:00
Emelie Graven
27530f0de0
Remove wildcard cert 2022-04-12 17:36:08 +02:00
Emelie Graven
2fc3df27a4
Up nixpkgs, fix nitter syntax errors 2022-04-12 16:36:07 +02:00
Emelie Graven
e970325774
Merge branch 'nitter' 2022-04-12 16:10:44 +02:00
Emelie Graven
5669eb73f1
Merge branch 'main' of git.graven.dev:emelie/nix-deploy 2022-04-12 16:10:17 +02:00
Emelie Graven
eb43445854
Disable external access, delete nginx config 2022-04-12 16:07:17 +02:00
306652ff73
Set up nitter on wind 2022-04-12 15:38:07 +02:00
d173ab984f
Enable SSL for beanz.one 2022-02-27 17:39:59 +01:00
c710e06232
Add beanz.one to nginx and update sources 2022-02-27 17:30:31 +01:00
68 changed files with 795 additions and 431 deletions

4
.EditorConfig Normal file
View file

@ -0,0 +1,4 @@
root = true
[*.nix]
indent_style = "tab"

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "config/hosts/grondahl/services/ooye"]
path = config/hosts/grondahl/services/ooye
url = https://cgit.rory.gay/nix/OOYE-module.git

12
Makefile Normal file
View file

@ -0,0 +1,12 @@
all: result
.PHONY: update result deploy
result:
nix build -f deploy/default.nix
update:
cd config/sources && niv update
deploy:
./result

View file

@ -1 +1,27 @@
NixOS deployments using [nixus](https://github.com/Infinisil/nixus). NixOS deployments using [nixus](https://github.com/Infinisil/nixus).
TL;DR:
1. `make update`
2. `make result`
3. `make deploy`
First make sure you have `niv` so you can upgrade dependency versions in `sources.json`.
```sh
nix-shell -p niv
(cd config/sources && niv update)
```
Build with:
```sh
nix-build deploy/
```
Deploy by running the generated executable.
```sh
./result
```
## Switching nixpkgs branch
```sh
cd config/sources
niv modify nixpkgs -b nixos-xx.yy
```

View file

@ -0,0 +1,12 @@
{ ... }:
{
# Some docs fail to build, so we need to disable some of it
documentation = {
enable = true;
man.enable = true;
doc.enable = true;
dev.enable = false;
nixos.enable = false;
};
}

View file

@ -0,0 +1,12 @@
{ ... }:
# Configuration options for the nix package manager
{
nix.gc = {
# Run garbage collection automatically
automatic = true;
# Run it once a week
dates = "weekly";
options = "--delete-older-than 30d";
};
}

View file

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG4C5OgZpxoF42L5rPqwejs+Q1ViN9TM9o/fEbpnPFtA

View file

@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH+ZQk80BU/OdQfV990yrkFwvsLVbVZ2Itof/qwxjTn7

View file

@ -20,26 +20,26 @@
map $scheme $hsts_header { map $scheme $hsts_header {
https "max-age=31536000; includeSubdomains; preload"; https "max-age=31536000; includeSubdomains; preload";
} }
add_header Strict-Transport-Security $hsts_header; #add_header Strict-Transport-Security $hsts_header;
# Enable CSP for your services. # Enable CSP for your services.
#add_header Content-Security-Policy "script-src 'self'; object-src 'none'; base-uri 'none';" always; #add_header Content-Security-Policy "script-src 'self'; object-src 'none'; base-uri 'none';" always;
# Minimize information leaked to other domains # Minimize information leaked to other domains
add_header 'Referrer-Policy' 'same-origin'; #add_header 'Referrer-Policy' 'same-origin';
# Disable embedding as a frame # Disable embedding as a frame
add_header X-Frame-Options DENY; #add_header X-Frame-Options DENY;
# Prevent injection of code in other mime types (XSS Attacks) # Prevent injection of code in other mime types (XSS Attacks)
add_header X-Content-Type-Options nosniff; #add_header X-Content-Type-Options nosniff;
# Enable XSS protection of the browser. # Enable XSS protection of the browser.
# May be unnecessary when CSP is configured properly (see above) # May be unnecessary when CSP is configured properly (see above)
add_header X-XSS-Protection "1; mode=block"; #add_header X-XSS-Protection "1; mode=block";
# This might create errors # This might create errors
proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict"; #proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
''; '';
}; };
} }

View file

@ -2,19 +2,21 @@
{ {
services.openssh = { services.openssh = {
enable = true; enable = true;
permitRootLogin = "no";
passwordAuthentication = false;
challengeResponseAuthentication = false;
hostKeys = [ { path = config.secrets.files.ssh_host_ed25519_key.file; type = "ed25519"; } ]; hostKeys = [ { path = config.secrets.files.ssh_host_ed25519_key.file; type = "ed25519"; } ];
kexAlgorithms = [ "curve25519-sha256" "curve25519-sha256@libssh.org" ]; settings = {
macs = [ "hmac-sha2-512-etm@openssh.com" "hmac-sha2-512-etm@openssh.com" "umac-128-etm@openssh.com" ]; KexAlgorithms = [ "curve25519-sha256" "curve25519-sha256@libssh.org" ];
Macs = [ "hmac-sha2-512-etm@openssh.com" "hmac-sha2-512-etm@openssh.com" "umac-128-etm@openssh.com" ];
PermitRootLogin = "no";
KbdInteractiveAuthentication = false;
PasswordAuthentication = false;
}; };
};
programs.ssh.knownHosts = { programs.ssh.knownHosts = {
despondos = { backup = {
hostNames = [ "despondos.nao.sh" ]; hostNames = [ "backup.graven.dev" ];
publicKeyFile = ../data/pubkeys/despondos_host_ed25519_key.pub; publicKeyFile = ../data/pubkeys/backup_host_ed25519_key.pub;
}; };
}; };

View file

@ -0,0 +1,37 @@
{ config, pkgs, ... }:
{
environment.systemPackages = [ pkgs.tailscale ];
services.tailscale.enable = false;
# ...
# create a oneshot job to authenticate to Tailscale
systemd.services.tailscale-autoconnect = {
description = "Automatic connection to Tailscale";
# make sure tailscale is running before trying to connect to tailscale
after = [ "network-pre.target" "tailscale.service" ];
wants = [ "network-pre.target" "tailscale.service" ];
wantedBy = [ "multi-user.target" ];
# set this service as a oneshot job
serviceConfig.Type = "oneshot";
# have the job run this shell script
script = with pkgs; ''
# wait for tailscaled to settle
sleep 2
# check if we are already authenticated to tailscale
status="$(${tailscale}/bin/tailscale status -json | ${jq}/bin/jq -r .BackendState)"
if [ $status = "Running" ]; then # if so, then do nothing
exit 0
fi
# otherwise authenticate with tailscale
${tailscale}/bin/tailscale up -authkey CHANGEME
'';
};
}

View file

@ -5,8 +5,7 @@
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICO4LyBsW1YuUA6i3EL/IZhchSvk7reO4qgRmR/tdQPU emelie@flap" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAn9xV1GA/hMkCFoP7DWzYyGmbeiri823fHMRz0ZVoxq emelie-personal-bw"
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIGRtSxLRqPWmsn161ybDFcMYxrBKhay5a485tlM8hQEuAAAABHNzaDo= emelie@thinky-fed"
]; ];
}; };
@ -17,6 +16,10 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILwmREgBmckocQerEfO4XhB+dbKDsZopok37ePWHwCEj id_ed25519" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILwmREgBmckocQerEfO4XhB+dbKDsZopok37ePWHwCEj id_ed25519"
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAILrZWS1PBVRbdmPh8IJdIPHhK0+ZuSnQCR10a8Bl11VZAAAABHNzaDo= amanda@sharpy" "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAILrZWS1PBVRbdmPh8IJdIPHhK0+ZuSnQCR10a8Bl11VZAAAABHNzaDo= amanda@sharpy"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO6v5D/aJuIhuIVcnzFA7ocxPMI8JgHEnxSPuD+SaLHX amanda@sharpy" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO6v5D/aJuIhuIVcnzFA7ocxPMI8JgHEnxSPuD+SaLHX amanda@sharpy"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG+0x2uHcuXpFQdeXeUWeLGPefWo6Sd7yy2FJlyZy8V+ amanda@tappy"
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFKWhc20jOFF+pVVT/Mf1ACYOtppkYWkP7NkY0/fPvjPAAAAFHNzaDphMy1uazNhLXBlcnNvbmFs ssh:a3-nk3a-personal"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGMLbLay9KARrdb8QM4OLzmqWIN48rZMX6wCddBwYT/U amanda@gpg"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICGMWTQc7A3W/LI4AgFWy/Uw/+oMucmSziuJKxC2rleo amanda@bitwarden"
]; ];
}; };
}; };

View file

@ -5,23 +5,26 @@
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./data/secrets/secrets.nix ./data/secrets/secrets.nix
../../common/configuration/nix.nix
../../common/configuration/documentation.nix
../../common/services/ssh.nix ../../common/services/ssh.nix
../../common/services/tailscale.nix
../../common/users.nix ../../common/users.nix
./services/acme.nix ./services/acme.nix
./services/borg.nix
./services/coturn.nix ./services/coturn.nix
./services/nginx.nix ./services/nginx.nix
./services/restic.nix
./services/synapse.nix ./services/synapse.nix
./services/postgres.nix ./services/postgres.nix
./services/ooye.nix
#./services/mail.nix #./services/mail.nix
#./services/containers.nix #./services/containers.nix
#./services/redis.nix #./services/redis.nix
]; ];
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda"; boot.loader.grub.device = "/dev/vda";
boot.kernelPackages = pkgs.linuxPackages_5_10; boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
networking = { networking = {
hostName = "grondahl"; hostName = "grondahl";
useDHCP = false; useDHCP = false;
@ -49,9 +52,9 @@
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
nix = { nix.settings = {
autoOptimiseStore = true; auto-optimise-store = true;
trustedUsers = [ trusted-users = [
"root" "root"
"@wheel" "@wheel"
]; ];
@ -72,9 +75,15 @@
dig dig
]; ];
networking.firewall.allowedTCPPorts = [ 22 80 443 ]; networking.firewall = {
networking.firewall.allowedTCPPortRanges = [ { from = 3478; to = 3479; } { from = 5349; to = 5350; } ]; enable = true;
networking.firewall.allowedUDPPortRanges = [ { from = 3478; to = 3479; } { from = 5349; to = 5350; } { from = 49152; to = 49999; } ]; checkReversePath = "loose";
trustedInterfaces = [ "tailscale0" ];
allowedUDPPorts = [ config.services.tailscale.port ];
allowedTCPPorts = [ 22 80 443 ];
allowedTCPPortRanges = [ { from = 3478; to = 3479; } { from = 5349; to = 5350; } ];
allowedUDPPortRanges = [ { from = 3478; to = 3479; } { from = 5349; to = 5350; } { from = 49152; to = 49999; } ];
};
system.stateVersion = "21.05"; system.stateVersion = "21.05";

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -2,7 +2,7 @@
{ {
imports = imports =
[ (modulesPath + "/profiles/qemu-guest.nix") [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/minimal.nix") #(modulesPath + "/profiles/minimal.nix")
]; ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ]; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];

View file

@ -3,12 +3,7 @@
{ {
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
email = "admin+certs@anarkafem.dev"; defaults.email = "admin+certs@anarkafem.dev";
certs."anarkafem.dev" = {
extraDomainNames = [ "*.anarkafem.dev" ];
dnsProvider = "hurricane";
credentialsFile = config.secrets.files.acme_anarkafem_dev.file;
};
}; };
} }

View file

@ -0,0 +1,26 @@
{ config, ... }:
{
services.borgbackup.jobs = {
postgres = {
paths = "/var/lib/postgresql/backup";
repo = "ssh://borg@backup.graven.dev//mnt/slab/backup/grondahl/postgres";
encryption.mode = "repokey";
encryption.passCommand = "cat ${config.secrets.files.borg_pass_postgres.file}";
environment.BORG_RSH = "ssh -i ${config.secrets.files.ssh_key_postgres.file}";
compression = "auto,zstd";
startAt = "*-*-* 03:15:00";
user = "postgres";
};
synapse = {
paths = "/var/lib/matrix-synapse";
repo = "ssh://borg@backup.graven.dev//mnt/slab/backup/grondahl/synapse";
encryption.mode = "repokey";
encryption.passCommand = "cat ${config.secrets.files.borg_pass_synapse.file}";
environment.BORG_RSH = "ssh -i ${config.secrets.files.ssh_key_synapse.file}";
compression = "auto,zstd";
startAt = "*-*-* 03:45:00";
user = "matrix-synapse";
};
};
}

View file

@ -1,8 +1,13 @@
{ {
imports = [ ../../../common/services/nginx.nix ]; imports = [ ../../../common/services/nginx.nix ];
services.nginx.virtualHosts = { services.nginx.virtualHosts = {
"ooye.anarkafem.dev" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:6693/";
};
"anarkafem.dev" = { "anarkafem.dev" = {
useACMEHost = "anarkafem.dev"; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".root = "/var/www/anarkafem.dev/public"; locations."/".root = "/var/www/anarkafem.dev/public";
locations."/_matrix/".proxyPass = "http://127.0.0.1:8008"; locations."/_matrix/".proxyPass = "http://127.0.0.1:8008";
@ -21,14 +26,21 @@
}; };
}; };
"cal.anarkafem.dev" = { "cal.anarkafem.dev" = {
useACMEHost = "anarkafem.dev"; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:4000"; locations."/".proxyPass = "http://127.0.0.1:4000";
}; };
"auth.anarkafem.dev" = { "auth.anarkafem.dev" = {
useACMEHost = "anarkafem.dev"; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:9000"; locations."/".proxyPass = "http://127.0.0.1:9000";
}; };
"beanz.one" = {
forceSSL = true;
enableACME = true;
locations."/" = {
root = "/var/www/beanz.one/public";
};
};
}; };
} }

@ -0,0 +1 @@
Subproject commit 11cc65efa2909bdc7e3e978bf1f56f6d141bf82a

View file

@ -0,0 +1,16 @@
# Out of your Element prerequisites
{ config, ... }:
{
imports = [
./ooye/module.nix
];
services.matrix-ooye = {
enable = true;
homeserver = "http://localhost:8008";
namespace = "_discord_";
discordClientSecretPath = builtins.toString config.secrets.files.ooye_client_secret.file;
discordTokenPath = builtins.toString config.secrets.files.ooye_token.file;
bridgeOrigin = "https://ooye.anarkafem.dev";
enableSynapseIntegration = true;
};
}

View file

@ -2,8 +2,8 @@
{ {
services.postgresql = { services.postgresql = {
enable = true; enable = true;
package = pkgs.postgresql_13; package = pkgs.postgresql_16;
extraPlugins = with config.services.postgresql.package.pkgs; [ extensions = with config.services.postgresql.package.pkgs; [
postgis postgis
]; ];
ensureDatabases = [ ensureDatabases = [
@ -14,15 +14,15 @@
ensureUsers = [ ensureUsers = [
{ {
name = "matrix-synapse"; name = "matrix-synapse";
ensurePermissions."DATABASE \"matrix-synapse\"" = "ALL PRIVILEGES"; ensureDBOwnership = true;
} }
{ {
name = "mobilizon"; name = "mobilizon";
ensurePermissions."DATABASE mobilizon" = "ALL PRIVILEGES"; ensureDBOwnership = true;
} }
{ {
name = "authentik"; name = "authentik";
ensurePermissions."DATABASE authentik" = "ALL PRIVILEGES"; ensureDBOwnership = true;
} }
]; ];
initialScript = pkgs.writeText "synapse-init.sql" '' initialScript = pkgs.writeText "synapse-init.sql" ''

View file

@ -1,11 +1,13 @@
{ config, ... }: { config, ... }:
{ {
services.redis = { services.redis = {
vmOverCommit = true;
servers."" = {
enable = true; enable = true;
unixSocket = "/run/redis/redis.sock"; unixSocket = "/run/redis/redis.sock";
vmOverCommit = true;
unixSocketPerm = 770; unixSocketPerm = 770;
#requirePassfile = config.secrets.files.redis_pass.file; #requirePassfile = config.secrets.files.redis_pass.file;
}; };
};
} }

View file

@ -1,26 +0,0 @@
{ config, ... }:
{
services.restic.backups = {
"postgres" = {
paths = [ "/var/lib/postgresql/backup" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/grondahl/postgres";
initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "03:15"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "postgres";
};
"synapse" = {
paths = [ "/var/lib/matrix-synapse" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/grondahl/synapse";
initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "03:45"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "matrix-synapse";
};
};
}

View file

@ -3,15 +3,19 @@
{ {
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
withJemalloc = true;
settings = {
database = {
name = "psycopg2";
args.user = "matrix-synapse";
args.database = "matrix-synapse";
};
server_name = "anarkafem.dev"; server_name = "anarkafem.dev";
enable_registration = false; enable_registration = false;
registration_shared_secret = builtins.toString config.secrets.files.synapse_registration_shared_secret.file; registration_shared_secret = builtins.toString config.secrets.files.synapse_registration_shared_secret.file;
turn_shared_secret = builtins.toString config.secrets.files.turn_shared_secret.file; turn_shared_secret = builtins.toString config.secrets.files.turn_shared_secret.file;
max_upload_size = "100M"; max_upload_size = "100M";
database_type = "psycopg2";
database_args = {
password = builtins.toString config.secrets.files.synapse_db_password.file;
};
turn_uris = [ turn_uris = [
"turn:turn.anarkafem.dev:3478?transport=udp" "turn:turn.anarkafem.dev:3478?transport=udp"
"turn:turn.anarkafem.dev:3478?transport=tcp" "turn:turn.anarkafem.dev:3478?transport=tcp"
@ -23,7 +27,6 @@
"turns:turn.anarkafem.dev:5350?transport=tcp" "turns:turn.anarkafem.dev:5350?transport=tcp"
]; ];
report_stats = false; report_stats = false;
withJemalloc = true;
servers = { "anarkafem.dev" = {}; }; servers = { "anarkafem.dev" = {}; };
extraConfig = '' extraConfig = ''
default_room_version: "9" default_room_version: "9"
@ -57,7 +60,7 @@
listeners = [ listeners = [
{ {
port = 8008; port = 8008;
bind_address = "127.0.0.1"; bind_addresses = ["127.0.0.1"];
type = "http"; type = "http";
tls = false; tls = false;
x_forwarded = true; x_forwarded = true;
@ -70,5 +73,6 @@
} }
]; ];
}; };
};
} }

View file

@ -1,13 +1,16 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = imports = [
[
./hardware-configuration.nix ./hardware-configuration.nix
./data/secrets/secrets.nix ./data/secrets/secrets.nix
../../common/configuration/nix.nix
../../common/configuration/documentation.nix
../../common/services/ssh.nix ../../common/services/ssh.nix
../../common/services/tailscale.nix
../../common/users.nix ../../common/users.nix
./services/acme.nix ./services/acme.nix
./services/immich.nix
./services/nextcloud.nix ./services/nextcloud.nix
./services/nginx.nix ./services/nginx.nix
./services/postgres.nix ./services/postgres.nix
@ -16,11 +19,11 @@
]; ];
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.supportedFilesystems = ["zfs"]; boot.supportedFilesystems = ["zfs"];
services.zfs.autoSnapshot.enable = true; services.zfs.autoSnapshot.enable = false;
services.zfs.autoScrub.enable = true; services.zfs.autoScrub.enable = true;
time.timeZone = "Europe/Copenhagen"; time.timeZone = "Europe/Copenhagen";
@ -51,9 +54,9 @@
}; };
nix = { nix.settings = {
autoOptimiseStore = true; auto-optimise-store = true;
trustedUsers = [ trusted-users = [
"root" "root"
"@wheel" "@wheel"
]; ];
@ -65,6 +68,7 @@
htop htop
iotop iotop
dig dig
tailscale
]; ];
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
@ -76,7 +80,13 @@
users.groups.redis.members = [ "nextcloud" ]; users.groups.redis.members = [ "nextcloud" ];
users.groups.backup.members = [ "nextcloud" "postgres" ]; users.groups.backup.members = [ "nextcloud" "postgres" ];
networking.firewall.allowedTCPPorts = [ 22 80 443 ]; networking.firewall = {
allowedTCPPorts = [ 22 80 443 ];
allowedUDPPorts = [ config.services.tailscale.port ];
trustedInterfaces = [ "tailscale0" ];
enable = true;
checkReversePath = "loose";
};
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];
system.stateVersion = "21.05"; system.stateVersion = "21.05";

View file

@ -3,7 +3,7 @@
{ {
imports = imports =
[ (modulesPath + "/profiles/qemu-guest.nix") [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/minimal.nix") #(modulesPath + "/profiles/minimal.nix")
]; ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];

View file

@ -3,7 +3,7 @@
{ {
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
email = "admin+certs@graven.dev"; defaults.email = "admin+certs@graven.dev";
}; };
} }

View file

@ -0,0 +1,27 @@
{ config, ... }:
{
services.borgbackup.jobs = {
postgres = {
paths = "/var/lib/postgresql/backup";
repo = "ssh://borg@backup.graven.dev//mnt/slab/backup/rudiger/postgres";
encryption.mode = "repokey";
encryption.passCommand = "cat ${config.secrets.files.borg_pass_postgres.file}";
environment.BORG_RSH = "ssh -i ${config.secrets.files.ssh_key_postgres.file}";
compression = "auto,zstd";
startAt = "*-*-* 03:15:00";
user = "postgres";
};
synapse = {
paths = "/var/lib/nextcloud/data";
repo = "ssh://borg@backup.graven.dev//mnt/slab/backup/rudiger/nextcloud";
encryption.mode = "repokey";
encryption.passCommand = "cat ${config.secrets.files.borg_pass_synapse.file}";
environment.BORG_RSH = "ssh -i ${config.secrets.files.ssh_key_synapse.file}";
compression = "auto,zstd";
startAt = "*-*-* 03:45:00";
user = "nextcloud";
};
};
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
services.immich = {
enable = true;
port = 2283;
settings.server.externalDomain = "https://immich.graven.dev";
};
}

View file

@ -4,7 +4,7 @@
enable = true; enable = true;
hostName = "cloud.graven.dev"; hostName = "cloud.graven.dev";
https = true; https = true;
package = pkgs.nextcloud22; package = pkgs.nextcloud32;
autoUpdateApps.enable = true; autoUpdateApps.enable = true;
maxUploadSize = "10G"; maxUploadSize = "10G";
webfinger = true; webfinger = true;
@ -14,9 +14,12 @@
dbuser = "nextcloud"; dbuser = "nextcloud";
dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself dbhost = "/run/postgresql"; # nextcloud will add /.s.PGSQL.5432 by itself
dbname = "nextcloud"; dbname = "nextcloud";
defaultPhoneRegion = "DK";
adminpassFile = builtins.toString config.secrets.files.nc_admin_pass.file; adminpassFile = builtins.toString config.secrets.files.nc_admin_pass.file;
adminuser = "root"; adminuser = "root";
}; };
settings = {
default_phone_region = "DK";
};
phpOptions."opcache.interned_strings_buffer" = "23";
}; };
} }

View file

@ -1,8 +1,25 @@
{ ... }: { config, ... }:
{ {
imports = [ ../../../common/services/nginx.nix ]; imports = [ ../../../common/services/nginx.nix ];
services.nginx.virtualHosts."cloud.graven.dev" = { services.nginx.virtualHosts."cloud.graven.dev" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
}; };
services.nginx.virtualHosts."immich.graven.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://[::1]:${toString config.services.immich.port}";
proxyWebsockets = true;
recommendedProxySettings = true;
extraConfig = ''
client_max_body_size 50000M;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
send_timeout 600s;
proxy_max_temp_file_size 0;
proxy_buffering off;
'';
};
};
} }

View file

@ -1,14 +1,15 @@
{ ... }: { pkgs, ... }:
{ {
services.postgresql = { services.postgresql = {
enable = true; enable = true;
package = pkgs.postgresql_15;
ensureDatabases = [ ensureDatabases = [
"nextcloud" "nextcloud"
]; ];
ensureUsers = [ ensureUsers = [
{ {
name = "nextcloud"; name = "nextcloud";
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; ensureDBOwnership = true;
} }
]; ];
}; };

View file

@ -1,10 +1,12 @@
{ config, ... }: { config, ... }:
{ {
services.redis = { services.redis = {
vmOverCommit = true;
servers."" = {
enable = true; enable = true;
unixSocket = "/run/redis/redis.sock"; unixSocket = "/run/redis/redis.sock";
vmOverCommit = true;
unixSocketPerm = 770; unixSocketPerm = 770;
#requirePassfile = config.secrets.files.redis_pass.file; #requirePassfile = config.secrets.files.redis_pass.file;
}; };
};
} }

View file

@ -3,21 +3,21 @@
services.restic.backups = { services.restic.backups = {
"postgres" = { "postgres" = {
paths = [ "/var/lib/postgresql/backup" ]; paths = [ "/var/lib/postgresql/backup" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/rudiger/postgres"; repository = "sftp:restic@backup.graven.dev:/etheria/backup/rudiger/postgres";
initialize = true; initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "04:15"; }; timerConfig = { "OnCalendar" = "04:15"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ]; extraOptions = [ "sftp.command='ssh restic@backup.graven.dev -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file; passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "postgres"; user = "postgres";
}; };
"nextcloud" = { "nextcloud" = {
paths = [ "/var/lib/nextcloud/data" ]; paths = [ "/var/lib/nextcloud/data" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/rudiger/nextcloud"; repository = "sftp:restic@backup.graven.dev:/etheria/backup/rudiger/nextcloud";
initialize = true; initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "04:30"; }; timerConfig = { "OnCalendar" = "04:30"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ]; extraOptions = [ "sftp.command='ssh restic@backup.graven.dev -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file; passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "nextcloud"; user = "nextcloud";
}; };

View file

@ -1,11 +1,15 @@
{ config, pkgs, lib, ... }: { config, pkgs, ... }:
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../common/configuration/nix.nix
../../common/configuration/documentation.nix
../../common/services/ssh.nix ../../common/services/ssh.nix
../../common/services/tailscale.nix
../../common/users.nix ../../common/users.nix
./services/acme.nix ./services/acme.nix
./services/borg.nix
./services/coturn.nix ./services/coturn.nix
./services/nginx.nix ./services/nginx.nix
./services/postgres.nix ./services/postgres.nix
@ -15,15 +19,15 @@
./services/restic.nix ./services/restic.nix
./services/vaultwarden.nix ./services/vaultwarden.nix
./services/wireguard.nix ./services/wireguard.nix
./services/akkoma.nix
./data/secrets/secrets.nix ./data/secrets/secrets.nix
]; ];
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
boot.kernelPackages = pkgs.linuxPackages_5_10; boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.supportedFilesystems = ["zfs"]; boot.supportedFilesystems = ["zfs"];
services.zfs.autoSnapshot.enable = true; services.zfs.autoSnapshot.enable = false;
services.zfs.autoScrub.enable = true; services.zfs.autoScrub.enable = true;
networking.hostName = "wind"; networking.hostName = "wind";
@ -49,11 +53,12 @@
htop htop
iotop iotop
dig dig
tailscale
]; ];
nix = { nix.settings = {
autoOptimiseStore = true; auto-optimise-store = true;
trustedUsers = [ trusted-users = [
"root" "root"
"@wheel" "@wheel"
]; ];

Binary file not shown.

Binary file not shown.

View file

@ -6,7 +6,7 @@
{ {
imports = imports =
[ (modulesPath + "/profiles/qemu-guest.nix") [ (modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/minimal.nix") #(modulesPath + "/profiles/minimal.nix")
#(modulesPath + "/profiles/hardened.nix") #(modulesPath + "/profiles/hardened.nix")
]; ];

View file

@ -3,19 +3,7 @@
{ {
security.acme = { security.acme = {
acceptTerms = true; acceptTerms = true;
email = "admin+certs@graven.dev"; defaults.email = "admin+certs@graven.dev";
certs = {
"graven.dev" = {
extraDomainNames = [ "*.graven.dev" ];
dnsProvider = "hurricane";
credentialsFile = config.secrets.files.acme_graven_dev.file;
};
"graven.se" = {
extraDomainNames = [ "*.graven.se" ];
dnsProvider = "hurricane";
credentialsFile = config.secrets.files.acme_graven_se.file;
};
};
}; };
} }

View file

@ -0,0 +1,36 @@
{ config, pkgs, ... }:
{
services.akkoma = {
enable = true;
config = {
":pleroma" = {
":instance" = {
name = "graven.se";
description = "Graven Fedi";
email = "charlie@graven.se";
registration_open = false;
};
"Pleroma.Web.Endpoint" = {
url.host = "fedi.graven.se";
};
"Pleroma.Web.Webfinger" = {
domain = "graven.se";
};
"Pleroma.Upload".filters =
map (pkgs.formats.elixirConf { }).lib.mkRaw
[
"Pleroma.Upload.Filter.Exiftool"
"Pleroma.Upload.Filter.Dedupe"
"Pleroma.Upload.Filter.AnonymizeFilename"
];
};
};
nginx = {
enableACME = true;
forceSSL = true;
serverName = "fedi.graven.se";
};
};
}

View file

@ -0,0 +1,36 @@
{ config, ... }:
{
services.borgbackup.jobs = {
gitea = {
paths = "/var/lib/gitea";
repo = "ssh://borg@backup.graven.dev//mnt/slab/backup/wind/gitea";
encryption.mode = "repokey";
encryption.passCommand = "cat ${config.secrets.files.borg_pass_gitea.file}";
environment.BORG_RSH = "ssh -i ${config.secrets.files.ssh_key_gitea.file}";
compression = "auto,zstd";
startAt = "*-*-* 02:15:00";
user = "gitea";
};
postgres = {
paths = "/var/lib/postgresql/backup";
repo = "ssh://borg@backup.graven.dev//mnt/slab/backup/wind/postgres";
encryption.mode = "repokey";
encryption.passCommand = "cat ${config.secrets.files.borg_pass_postgres.file}";
environment.BORG_RSH = "ssh -i ${config.secrets.files.ssh_key_postgres.file}";
compression = "auto,zstd";
startAt = "*-*-* 03:15:00";
user = "postgres";
};
synapse = {
paths = "/var/lib/matrix-synapse";
repo = "ssh://borg@backup.graven.dev//mnt/slab/backup/wind/synapse";
encryption.mode = "repokey";
encryption.passCommand = "cat ${config.secrets.files.borg_pass_synapse.file}";
environment.BORG_RSH = "ssh -i ${config.secrets.files.ssh_key_synapse.file}";
compression = "auto,zstd";
startAt = "*-*-* 03:15:00";
user = "matrix-synapse";
};
};
}

View file

@ -1,7 +1,7 @@
{ config, ... }: { config, ... }:
{ {
services.coturn = { services.coturn = {
enable = true; enable = false;
lt-cred-mech = true; lt-cred-mech = true;
use-auth-secret = true; use-auth-secret = true;
static-auth-secret = builtins.toString config.secrets.files.turn_shared_secret.file; static-auth-secret = builtins.toString config.secrets.files.turn_shared_secret.file;

View file

@ -1,16 +1,32 @@
{ ... }: { ... }:
{ {
services.gitea = { services.forgejo = {
enable = true; enable = true;
domain = "git.graven.dev"; user = "gitea";
rootUrl = "https://git.graven.dev"; group = "gitea";
enableUnixSocket = true; stateDir = "/var/lib/gitea";
cookieSecure = true;
appName = "Graven Gitea";
settings = { "ui" = { "DEFAULT_THEME" = "arc-green"; }; };
database = { database = {
type = "postgres"; type = "postgres";
name = "gitea";
user = "gitea";
};
settings = {
DEFAULT.APP_NAME = "Graven Gitea";
service.DISABLE_REGISTRATION = true;
session.COOKIE_SECURE = true;
server.DOMAIN = "git.graven.dev";
server.ROOT_URL = "https://git.graven.dev";
server.PROTOCOL = "http+unix";
}; };
}; };
users.users.gitea = {
home = "/var/lib/gitea";
useDefaultShell = true;
group = "gitea";
isSystemUser = true;
};
users.groups.gitea = {};
} }

View file

@ -2,11 +2,13 @@
imports = [ ../../../common/services/nginx.nix ]; imports = [ ../../../common/services/nginx.nix ];
services.nginx.virtualHosts = { services.nginx.virtualHosts = {
"graven.dev" = { "graven.dev" = {
useACMEHost = "graven.dev"; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".root = "/var/www/graven.dev/public"; locations."/".root = "/var/www/graven.dev/public";
locations."/_matrix".proxyPass = "http://127.0.0.1:8008"; locations."~ ^(\\/_matrix|\\/_synapse\\/client)" = {
locations."/_synapse".proxyPass = "http://127.0.0.1:8008"; proxyPass = "http://127.0.0.1:8008";
priority = 1000;
};
locations."/.well-known/matrix/" = { locations."/.well-known/matrix/" = {
root = "/var/www/matrix/public"; root = "/var/www/matrix/public";
extraConfig = '' extraConfig = ''
@ -14,24 +16,34 @@
add_header Access-Control-Allow-Origin "*"; add_header Access-Control-Allow-Origin "*";
add_header Strict-Transport-Security $hsts_header; add_header Strict-Transport-Security $hsts_header;
add_header Referrer-Policy "same-origin"; add_header Referrer-Policy "same-origin";
add_header X-Frame-Options "DENY";
add_header X-Content-Type-Options "nosniff"; add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
''; '';
}; };
}; };
# Fedi webfinger
"graven.se" = {
enableACME = true;
forceSSL = true;
locations."/.well-known/host-meta".return = "301 https://fedi.graven.se$request_uri";
};
"amanda.graven.dev" = {
enableACME = true;
forceSSL = true;
locations."/".root = "/var/www/amanda.graven.dev/public";
};
"rss.graven.dev" = { "rss.graven.dev" = {
useACMEHost = "graven.dev"; enableACME = true;
forceSSL = true; forceSSL = true;
}; };
"git.graven.dev" = { "git.graven.dev" = {
useACMEHost = "graven.dev"; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".proxyPass = "http://unix:/run/gitea/gitea.sock:"; locations."/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:";
}; };
"vault.graven.dev" = { "vault.graven.dev" = {
forceSSL = true; forceSSL = true;
useACMEHost = "graven.dev"; enableACME = true;
locations."/" = { locations."/" = {
proxyPass = "http://localhost:8812"; proxyPass = "http://localhost:8812";
proxyWebsockets = true; proxyWebsockets = true;
@ -47,7 +59,7 @@
}; };
"openpgpkey.graven.dev" = { "openpgpkey.graven.dev" = {
forceSSL = true; forceSSL = true;
useACMEHost = "graven.dev"; enableACME = true;
locations."/" = { locations."/" = {
root = "/var/www/openpgpkey"; root = "/var/www/openpgpkey";
extraConfig = '' extraConfig = ''
@ -63,7 +75,7 @@
}; };
"openpgpkey.graven.se" = { "openpgpkey.graven.se" = {
forceSSL = true; forceSSL = true;
useACMEHost = "graven.se"; enableACME = true;
locations."/" = { locations."/" = {
root = "/var/www/openpgpkey"; root = "/var/www/openpgpkey";
extraConfig = '' extraConfig = ''
@ -79,7 +91,7 @@
}; };
"tor.graven.dev" = { "tor.graven.dev" = {
forceSSL = true; forceSSL = true;
useACMEHost = "graven.dev"; enableACME = true;
locations."/" = { locations."/" = {
root = "/var/www/tor"; root = "/var/www/tor";
extraConfig = '' extraConfig = ''

View file

@ -2,7 +2,7 @@
{ {
services.postgresql = { services.postgresql = {
enable = true; enable = true;
package = pkgs.postgresql_13; package = pkgs.postgresql_16;
initialScript = pkgs.writeText "synapse-init.sql" '' initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE ROLE synapse; CREATE ROLE synapse;
CREATE DATABASE synapse WITH OWNER synapse CREATE DATABASE synapse WITH OWNER synapse

View file

@ -5,41 +5,41 @@
services.restic.backups = { services.restic.backups = {
"gitea" = { "gitea" = {
paths = [ "/var/lib/gitea" ]; paths = [ "/var/lib/gitea" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/wind/gitea"; repository = "sftp:restic@backup.graven.dev:/etheria/backup/wind/gitea";
initialize = true; initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "02:15"; }; timerConfig = { "OnCalendar" = "02:15"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ]; extraOptions = [ "sftp.command='ssh restic@backup.graven.dev -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file; passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "gitea"; user = "gitea";
}; };
"postgres" = { "postgres" = {
paths = [ "/var/lib/postgresql/backup" ]; paths = [ "/var/lib/postgresql/backup" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/wind/postgres"; repository = "sftp:restic@backup.graven.dev:/etheria/backup/wind/postgres";
initialize = true; initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "03:00"; }; timerConfig = { "OnCalendar" = "03:00"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ]; extraOptions = [ "sftp.command='ssh restic@backup.graven.dev -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file; passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "postgres"; user = "postgres";
}; };
"synapse" = { "synapse" = {
paths = [ "/var/lib/matrix-synapse" ]; paths = [ "/var/lib/matrix-synapse" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/wind/synapse"; repository = "sftp:restic@backup.graven.dev:/etheria/backup/wind/synapse";
initialize = true; initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "03:30"; }; timerConfig = { "OnCalendar" = "03:30"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ]; extraOptions = [ "sftp.command='ssh restic@backup.graven.dev -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file; passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "matrix-synapse"; user = "matrix-synapse";
}; };
"vaultwarden" = { "vaultwarden" = {
paths = [ "/var/lib/bitwarden_rs" ]; paths = [ "/var/lib/bitwarden_rs" ];
repository = "sftp:restic@despondos.nao.sh:/etheria/backup/wind/vaultwarden"; repository = "sftp:restic@backup.graven.dev:/etheria/backup/wind/vaultwarden";
initialize = true; initialize = true;
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ];
timerConfig = { "OnCalendar" = "23:45"; }; timerConfig = { "OnCalendar" = "23:45"; };
extraOptions = [ "sftp.command='ssh restic@despondos.nao.sh -i ${config.secrets.files.ssh_key.file} -s sftp'" ]; extraOptions = [ "sftp.command='ssh restic@backup.graven.dev -i ${config.secrets.files.ssh_key.file} -s sftp'" ];
passwordFile = builtins.toString config.secrets.files.restic_pass.file; passwordFile = builtins.toString config.secrets.files.restic_pass.file;
user = "vaultwarden"; user = "vaultwarden";
}; };

View file

@ -3,14 +3,17 @@
{ {
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
withJemalloc = true;
extraConfigFiles = [ config.secrets.files.synapse_extra_config.file ];
settings = {
server_name = "graven.dev"; server_name = "graven.dev";
enable_registration = false; enable_registration = false;
registration_shared_secret = builtins.toString config.secrets.files.synapse_registration_shared_secret.file; registration_shared_secret = builtins.toString config.secrets.files.synapse_registration_shared_secret.file;
turn_shared_secret = builtins.toString config.secrets.files.turn_shared_secret.file; turn_shared_secret = builtins.toString config.secrets.files.turn_shared_secret.file;
max_upload_size = "100M"; max_upload_size = "100M";
database_type = "psycopg2"; database.name = "psycopg2";
database_user = "synapse"; database.args.user = "synapse";
database_name = "synapse"; database.args.database = "synapse";
turn_uris = [ turn_uris = [
"turn:turn.graven.dev:3478?transport=udp" "turn:turn.graven.dev:3478?transport=udp"
"turn:turn.graven.dev:3478?transport=tcp" "turn:turn.graven.dev:3478?transport=tcp"
@ -22,29 +25,6 @@
"turns:turn.graven.dev:5350?transport=tcp" "turns:turn.graven.dev:5350?transport=tcp"
]; ];
report_stats = true; report_stats = true;
withJemalloc = true;
extraConfig = ''
password_config:
enabled: false
oidc_providers:
- idp_id: authentik
idp_name: authentik
discover: true
issuer: "https://auth.graven.dev/application/o/synapse/"
client_id: "7a77036d3b360265895f2ab5a51264ba586c93d5"
client_secret: "a9f9146fd13338230481a71c824d122bfb5e8a2118f2cdaf882746ad6726aeecd50ef522338acec89d3f8ccb8014124e022a6af6769807ea4271931f219a3f55"
allow_existing_users: true
scopes:
- "openid"
- "profile"
- "email"
user_mapping_provider:
config:
localpart_template: "{{ user.name }}"
display_name_template: "{{ user.name|capitalize }}"
'';
logConfig = '' logConfig = ''
version: 1 version: 1
@ -72,7 +52,7 @@ disable_existing_loggers: false
listeners = [ listeners = [
{ {
port = 8008; port = 8008;
bind_address = "127.0.0.1"; bind_addresses = ["127.0.0.1"];
type = "http"; type = "http";
tls = false; tls = false;
x_forwarded = true; x_forwarded = true;
@ -85,5 +65,6 @@ disable_existing_loggers: false
} }
]; ];
}; };
};
} }

View file

@ -0,0 +1,37 @@
{ lib, stdenv, fetchFromGitHub, tt-rss, ... }:
stdenv.mkDerivation rec {
pname = "tt-rss-fever-api";
version = "2.3.0";
src = fetchFromGitHub {
owner = "DigitalDJ";
repo = "tinytinyrss-fever-plugin";
rev = "${version}";
sha256 = "fKHnF7pXMD04sWygoRnPH5hLUyWW4Dv/e4JWtfobX/g=";
};
installPhase = ''
mkdir -p $out/fever
cp -r fever_api.php index.php init.php $out/fever/
'';
meta = {
description = "Fever API for Tiny Tiny RSS";
longDescription = ''
This is a plugin for Tiny Tiny RSS (tt-rss).
It lets you use feed reader programs which interface with the Fever feed
reader API together with Tiny Tiny RSS
'';
license = lib.licenses.gpl3Only;
homepage = "https://github.com/DigitalDJ/tinytinyrss-fever-plugin";
maintainers = [ {
email = "amanda@graven.dev";
name = "Amanda Graven";
github = "agraven";
githubId = 23525639;
} ];
inherit (tt-rss.meta) platforms;
};
}

View file

@ -1,10 +1,13 @@
{ config, ... }: { config, pkgs, ... }:
{ {
services.tt-rss = { services.tt-rss = {
enable = true; enable = true;
registration.enable = true; registration.enable = false;
virtualHost = "rss.graven.dev"; virtualHost = "rss.graven.dev";
selfUrlPath = "https://rss.graven.dev"; selfUrlPath = "https://rss.graven.dev";
pluginPackages = [
(pkgs.callPackage ./ttrss-plugins/fever.nix {})
];
}; };
} }

View file

@ -3,7 +3,7 @@
services.vaultwarden = { services.vaultwarden = {
enable = true; enable = true;
environmentFile = config.secrets.files.vaultwarden_env.file; environmentFile = config.secrets.files.vaultwarden_env.file;
backupDir = "/var/lib/bitwarden_rs/backup"; backupDir = "/var/backup/vaultwarden";
config = { config = {
domain = "https://vault.graven.dev"; domain = "https://vault.graven.dev";
signupsAllowed = false; signupsAllowed = false;

View file

@ -5,10 +5,10 @@
"homepage": "https://github.com/nmattia/niv", "homepage": "https://github.com/nmattia/niv",
"owner": "nmattia", "owner": "nmattia",
"repo": "niv", "repo": "niv",
"rev": "df49d53b71ad5b6b5847b32e5254924d60703c46", "rev": "368268e45dee0c94d1cf898381a384856379ad76",
"sha256": "1j5p8mi1wi3pdcq0lfb881p97i232si07nb605dl92cjwnira88c", "sha256": "1k03n7qmaz6yf2r8i5sng4kii3rr1y36g8k70sg7piqz3npxisy3",
"type": "tarball", "type": "tarball",
"url": "https://github.com/nmattia/niv/archive/df49d53b71ad5b6b5847b32e5254924d60703c46.tar.gz", "url": "https://github.com/nmattia/niv/archive/368268e45dee0c94d1cf898381a384856379ad76.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"nixos-hardware": { "nixos-hardware": {
@ -17,22 +17,22 @@
"homepage": "", "homepage": "",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "feceb4d24f582817d8f6e737cd40af9e162dee05", "rev": "2096f3f411ce46e88a79ae4eafcfc9df8ed41c61",
"sha256": "1q92jq6xf5b1pshai9j72cj17r0ah3fhrx669h3vc58rj7xvgiw7", "sha256": "1al72rhlaa6g725syx72klpismv8xygdd55smqfwa9xglhv35r34",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixos-hardware/archive/feceb4d24f582817d8f6e737cd40af9e162dee05.tar.gz", "url": "https://github.com/NixOS/nixos-hardware/archive/2096f3f411ce46e88a79ae4eafcfc9df8ed41c61.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"nixpkgs": { "nixpkgs": {
"branch": "nixos-21.11", "branch": "nixos-25.11",
"description": "Nix Packages collection", "description": "Nix Packages collection",
"homepage": "", "homepage": "",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ccb90fb9e11459aeaf83cc28d5f8910816d90dd0", "rev": "a4bf06618f0b5ee50f14ed8f0da77d34ecc19160",
"sha256": "1jlyhw5nf7pcxg22k1bwkv13vm02p86d7jf6znihl3hczz1yfgi0", "sha256": "0vma331213djanwmb7ibgmi5290952h6ri123xwb66mg58k8r200",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/ccb90fb9e11459aeaf83cc28d5f8910816d90dd0.tar.gz", "url": "https://github.com/NixOS/nixpkgs/archive/a4bf06618f0b5ee50f14ed8f0da77d34ecc19160.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"nixus": { "nixus": {
@ -41,10 +41,10 @@
"homepage": "", "homepage": "",
"owner": "Infinisil", "owner": "Infinisil",
"repo": "nixus", "repo": "nixus",
"rev": "d1e1057a31f16a75d9f871e311c4aaaf664561b9", "rev": "b12665bc80134ac167eef1fff2f4e41e1f8925cb",
"sha256": "0d4576dssr6l4vdpi86rbf6dyn3jfl3csvmn9csd4n6dj53f5pqm", "sha256": "11894412807mhg0kgkrn4bjbdk9b2a89b0plh0bpdn06c8pfg11g",
"type": "tarball", "type": "tarball",
"url": "https://github.com/Infinisil/nixus/archive/d1e1057a31f16a75d9f871e311c4aaaf664561b9.tar.gz", "url": "https://github.com/Infinisil/nixus/archive/b12665bc80134ac167eef1fff2f4e41e1f8925cb.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
} }
} }

View file

@ -27,12 +27,33 @@ let
fetch_git = name: spec: fetch_git = name: spec:
let let
ref = ref =
if spec ? ref then spec.ref else spec.ref or (
if spec ? branch then "refs/heads/${spec.branch}" else if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
);
submodules = spec.submodules or false;
submoduleArg =
let
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
emptyArgWithWarning =
if submodules
then
builtins.trace
(
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
)
{ }
else { };
in in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }; if nixSupportsSubmodules
then { inherit submodules; }
else emptyArgWithWarning;
in
builtins.fetchGit
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
fetch_local = spec: spec.path; fetch_local = spec: spec.path;
@ -95,7 +116,7 @@ let
# the path directly as opposed to the fetched source. # the path directly as opposed to the fetched source.
replace = name: drv: replace = name: drv:
let let
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in in
if ersatz == "" then drv else if ersatz == "" then drv else
@ -131,7 +152,7 @@ let
inherit (builtins) lessThan nixVersion fetchTarball; inherit (builtins) lessThan nixVersion fetchTarball;
in in
if lessThan nixVersion "1.12" then if lessThan nixVersion "1.12" then
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
else else
fetchTarball attrs; fetchTarball attrs;
@ -141,25 +162,28 @@ let
inherit (builtins) lessThan nixVersion fetchurl; inherit (builtins) lessThan nixVersion fetchurl;
in in
if lessThan nixVersion "1.12" then if lessThan nixVersion "1.12" then
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
else else
fetchurl attrs; fetchurl attrs;
# Create the final "sources" from the config # Create the final "sources" from the config
mkSources = config: mkSources = config:
mapAttrs ( mapAttrs
(
name: spec: name: spec:
if builtins.hasAttr "outPath" spec if builtins.hasAttr "outPath" spec
then abort then
abort
"The values in sources.json should not have an 'outPath' attribute" "The values in sources.json should not have an 'outPath' attribute"
else else
spec // { outPath = replace name (fetch config.pkgs name spec); } spec // { outPath = replace name (fetch config.pkgs name spec); }
) config.sources; )
config.sources;
# The "config" used by the fetchers # The "config" used by the fetchers
mkConfig = mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) , sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem , system ? builtins.currentSystem
, pkgs ? mkPkgs sources system , pkgs ? mkPkgs sources system
}: rec { }: rec {

View file

@ -13,21 +13,21 @@ in import "${sources.nixus}" {} ({ config, ... }: {
nodes = { nodes = {
wind = { lib, config, ... }: { wind = { lib, config, ... }: {
host = "emelie@graven.dev"; host = "graven.dev";
configuration = ../config/hosts/wind/configuration.nix; configuration = ../config/hosts/wind/configuration.nix;
switchTimeout = 300; switchTimeout = 300;
successTimeout = 300; successTimeout = 300;
ignoreFailingSystemdUnits = true; ignoreFailingSystemdUnits = true;
}; };
grondahl = { lib, config, ... }: { grondahl = { lib, config, ... }: {
host = "emelie@anarkafem.dev"; host = "anarkafem.dev";
configuration = ../config/hosts/grondahl/configuration.nix; configuration = ../config/hosts/grondahl/configuration.nix;
successTimeout = 300; successTimeout = 300;
switchTimeout = 300; switchTimeout = 300;
ignoreFailingSystemdUnits = true; ignoreFailingSystemdUnits = true;
}; };
rudiger = { lib, config, ... }: { rudiger = { lib, config, ... }: {
host = "emelie@cloud.graven.dev"; host = "cloud.graven.dev";
configuration = ../config/hosts/rudiger/configuration.nix; configuration = ../config/hosts/rudiger/configuration.nix;
switchTimeout = 300; switchTimeout = 300;
successTimeout = 300; successTimeout = 300;

7
shell.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
packages = with pkgs; [
niv
];
}