Compare commits

...

4 Commits

7 changed files with 51 additions and 110 deletions

View File

@ -95,24 +95,6 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -222,43 +204,10 @@
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1701263465,
"narHash": "sha256-lNXUIlkfyDyp9Ox21hr+wsEf/IBklLvb6bYcyeXbdRc=",
"path": "/nix/store/7i525k013ds687vgp12lyhwmx79qd4qj-source",
"rev": "50aa30a13c4ab5e7ba282da460a3e3d44e9d0eb3",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"rachelcafe": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1705262863,
"narHash": "sha256-gAn/k4uHl+qiZY3l4gtQd4RZ/QJSSYCqrDu/9JdzTMo=",
"ref": "refs/heads/master",
"rev": "b01d01e7b5e43424440dba2f732610710698e8e6",
"revCount": 88,
"type": "git",
"url": "https://githug.xyz/rachel/rachel.cafe"
},
"original": {
"type": "git",
"url": "https://githug.xyz/rachel/rachel.cafe"
}
},
"root": {
"inputs": {
"nixos-config": "nixos-config",
"nixpkgs": "nixpkgs_3",
"rachelcafe": "rachelcafe"
"nixpkgs": "nixpkgs_3"
}
},
"slippi-desktop": {
@ -310,21 +259,6 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -4,10 +4,12 @@
inputs = {
nixpkgs.url = "github:NixOs/nixpkgs/nixos-24.05";
nixos-config.url = "git+https://githug.xyz/rachel/nixos-config";
rachelcafe.url = "git+https://githug.xyz/rachel/rachel.cafe";
# rachelcafe.url = "git+https://githug.xyz/rachel/rachel.cafe";
};
outputs = inputs@{ self, nixpkgs, nixos-config, rachelcafe, ... }:
outputs = inputs@{ self, nixpkgs, nixos-config,
#rachelcafe,
... }:
let nix-config-module =
{
nix.registry.nixpkgs.flake = nixpkgs;

View File

@ -90,7 +90,8 @@ lib.flatMap ({ name, config, ip, ports, volumes, ... }:
then {}
else {
"${host}" = {
# enableACME = true;
enableACME = true;
forceSSL = true;
locations."/".proxyPass =
"http://${ip}:${builtins.toString ports.http}";
};
@ -99,6 +100,10 @@ lib.flatMap ({ name, config, ip, ports, volumes, ... }:
) services;
};
# [ACME]
security.acme.acceptTerms = true;
security.acme.defaults.email = "depsterr@protonmail.com";
# [SSHD]
services.openssh = {
enable = true;
@ -155,43 +160,43 @@ lib.flatMap ({ name, config, ip, ports, volumes, ... }:
};
# [BACKUPS]
systemd = {
timers.backup-container-storage = {
enable = true;
description = "Backup container volumes";
wantedBy = ["multi-user.target"];
timerConfig = {
OnCalendar = "*-*-* 02:00:00";
Unit = "backup-container-storage.service";
};
};
services.backup-container-storage = {
description = "Backup container volumes";
startLimitBurst = 1;
startLimitIntervalSec = 1800;
script = with builtins; let
volumes = concatMap (s: s.volumes) services;
backupVolumes = filter (v: if v ? backup then v.backup else true) volumes;
backupMountpoints = map (v: hostVolumeDir + v.name) backupVolumes;
in ''
PATH="$PATH:${pkgs.lib.makeBinPath [
pkgs.gnutar
pkgs.gzip
]}"
mountpoint ${hostBackupDir} || {
echo "${hostBackupDir} is not a mountpoint!"
exit 7
}
echo "Starting Backup"
# 7 days of backups
rm -rf ${hostBackupDir}/backup.7.tgz
for x in $(seq 6); do
mv "${hostBackupDir}/backup.$x.tgz" "${hostBackupDir}/backup.$((x+1)).tgz"
done
tar -zcvpf ${hostBackupDir}/backup.1.tgz ${toString backupMountpoints}
'';
};
};
# systemd = {
# timers.backup-container-storage = {
# enable = true;
# description = "Backup container volumes";
# wantedBy = ["multi-user.target"];
# timerConfig = {
# OnCalendar = "*-*-* 02:00:00";
# Unit = "backup-container-storage.service";
# };
# };
# services.backup-container-storage = {
# description = "Backup container volumes";
# startLimitBurst = 1;
# startLimitIntervalSec = 1800;
# script = with builtins; let
# volumes = concatMap (s: s.volumes) services;
# backupVolumes = filter (v: if v ? backup then v.backup else true) volumes;
# backupMountpoints = map (v: hostVolumeDir + v.name) backupVolumes;
# in ''
# PATH="$PATH:${pkgs.lib.makeBinPath [
# pkgs.gnutar
# pkgs.gzip
# ]}"
# mountpoint ${hostBackupDir} || {
# echo "${hostBackupDir} is not a mountpoint!"
# exit 7
# }
# echo "Starting Backup"
# # 7 days of backups
# rm -rf ${hostBackupDir}/backup.7.tgz
# for x in $(seq 6); do
# mv "${hostBackupDir}/backup.$x.tgz" "${hostBackupDir}/backup.$((x+1)).tgz"
# done
# tar -zcvpf ${hostBackupDir}/backup.1.tgz ${toString backupMountpoints}
# '';
# };
# };
# [SECURITY]
security.sudo.execWheelOnly = true;

BIN
secrets/id_nopass.pub Normal file

Binary file not shown.

View File

@ -11,7 +11,7 @@
enable = true;
recommendedOptimisation = true;
virtualHosts."rachel.cafe" = {
root = "${lib.rachelcafe.packages.x86_64-linux.default}";
# root = "${lib.rachelcafe.packages.x86_64-linux.default}";
};
};
};

View File

@ -20,7 +20,7 @@
server = {
DOMAIN = "githug.xyz";
ROOT_URL = "https://githug.xyz/";
# COOKIE_SECURE = true;
COOKIE_SECURE = true;
HTTP_PORT = 3001;
OFFLINE_MODE = true;
};

View File

@ -19,7 +19,7 @@
users.users.media = {
isSystemUser = true;
group = "media";
openssh.authorizedKeys.keyFiles = [ ../secrets/id_ed25519.pub ];
openssh.authorizedKeys.keyFiles = [ ../secrets/id_nopass.pub ];
};
users.users.guest = {
isSystemUser = true;