Compare commits

..

2 commits

Author SHA1 Message Date
089d87bc9d
fix: auto-sync passwords
Some checks are pending
quality / changes (push) Waiting to run
quality / Nix Format Check (push) Blocked by required conditions
quality / Deadnix Check (push) Blocked by required conditions
quality / Statix Check (push) Blocked by required conditions
quality / Lua Format Check (push) Blocked by required conditions
quality / Lua Lint Check (push) Blocked by required conditions
quality / Prettier Format Check (push) Blocked by required conditions
2026-03-13 18:00:21 -04:00
02c1a6d037
feat(server): forgejo config 2026-03-13 11:33:25 -04:00
2 changed files with 93 additions and 3 deletions

View file

@ -1,15 +1,25 @@
{ pkgs, ... }: { pkgs, modulesPath, ... }:
{ {
imports = [ ./disk-config.nix ]; imports = [
./disk-config.nix
./hardware-configuration.nix
(modulesPath + "/profiles/minimal.nix")
(modulesPath + "/profiles/headless.nix")
];
boot.loader.grub = { boot.loader.grub = {
enable = true; enable = true;
efiSupport = true; efiSupport = true;
efiInstallAsRemovable = true; efiInstallAsRemovable = true;
device = "nodev"; device = "nodev";
configurationLimit = 3;
}; };
documentation.enable = false;
hardware.enableRedistributableFirmware = false;
fonts.fontconfig.enable = false;
networking = { networking = {
hostName = "netcup"; hostName = "netcup";
useDHCP = false; useDHCP = false;
@ -67,6 +77,7 @@
enable = true; enable = true;
recommendedProxySettings = true; recommendedProxySettings = true;
recommendedTlsSettings = true; recommendedTlsSettings = true;
clientMaxBodySize = "512m";
virtualHosts."vault.barrettruth.com" = { virtualHosts."vault.barrettruth.com" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
@ -93,21 +104,71 @@
services.forgejo = { services.forgejo = {
enable = true; enable = true;
user = "git";
group = "git";
settings = { settings = {
server = { server = {
DOMAIN = "git.barrettruth.com"; DOMAIN = "git.barrettruth.com";
ROOT_URL = "https://git.barrettruth.com/"; ROOT_URL = "https://git.barrettruth.com/";
HTTP_PORT = 3000; HTTP_PORT = 3000;
SSH_DOMAIN = "git.barrettruth.com";
}; };
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
session.COOKIE_SECURE = true;
}; };
}; };
users.users.git = {
isSystemUser = true;
home = "/var/lib/forgejo";
group = "git";
shell = "${pkgs.bash}/bin/bash";
};
users.groups.git = { };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim
git git
]; ];
systemd.services.vaultwarden-r2-backup = {
description = "Backup Vaultwarden to Cloudflare R2";
after = [ "backup-vaultwarden.service" ];
serviceConfig = {
Type = "oneshot";
EnvironmentFile = "/etc/vaultwarden-r2-backup.env";
};
path = [ pkgs.awscli2 pkgs.gawk ];
script = ''
export AWS_ACCESS_KEY_ID="$R2_ACCESS_KEY_ID"
export AWS_SECRET_ACCESS_KEY="$R2_SECRET_ACCESS_KEY"
ENDPOINT="$R2_ENDPOINT"
DATE=$(date +%Y-%m-%d)
aws s3 cp /var/backup/vaultwarden/db.sqlite3 \
"s3://vaultwarden/$DATE/db.sqlite3" \
--endpoint-url "$ENDPOINT"
CUTOFF=$(date -d '30 days ago' +%Y-%m-%d)
aws s3 ls s3://vaultwarden/ --endpoint-url "$ENDPOINT" \
| awk '{print $2}' | tr -d '/' \
| while read dir; do
if [ "$dir" \< "$CUTOFF" ]; then
aws s3 rm "s3://vaultwarden/$dir" --recursive --endpoint-url "$ENDPOINT"
fi
done
'';
};
systemd.timers.vaultwarden-r2-backup = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "daily";
Persistent = true;
};
};
nix.settings = { nix.settings = {
auto-optimise-store = true; auto-optimise-store = true;
experimental-features = [ experimental-features = [
@ -119,8 +180,13 @@
nix.gc = { nix.gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "weekly";
options = "--delete-older-than 7d"; options = "--delete-older-than 3d";
}; };
nix.extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
system.stateVersion = "24.11"; system.stateVersion = "24.11";
} }

View file

@ -0,0 +1,24 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}