parent
b837ee2943
commit
f277c78ac1
74 changed files with 7 additions and 6 deletions
devices
README.md
nas/modules
nos
default.nix
modules
arion
default.nix
mergerfs.nixforgejo
freshrss
gameyfin
hauk
homepage
immich
lineageos
media
bazarr
calibre
joal
prowlarr
radarr
sabnzbd
seerr
sonarr
music/jbots
nextcloud
resume
vaultwarden
wg-easy
qbittorrent
snapraid.nixservivi
|
@ -8,8 +8,8 @@ This directory encompasses every device's main configuration file.
|
|||
| ---------- | ------------------------------------------------------------------------------------------------------- |
|
||||
| `android` | My [Nix-On-Droid](https://github.com/nix-community/nix-on-droid) configuration for my OnePlus 9 Pro |
|
||||
| `binto` | My desktop PC with a multi-monitor setup and an NVIDIA (cringe) 3070 |
|
||||
| `cluster` | Two Lenovo mini pcs that make use of [NixOS-pcsd](https://github.com/matt1432/nixos-pcsd) to form a cluster |
|
||||
| `nas` | My current custom built server running Proxmox. Conversion to NixOS wip |
|
||||
| `cluster` | Two Lenovo mini PCs that make use of [NixOS-pcsd](https://github.com/matt1432/nixos-pcsd) to form a cluster |
|
||||
| `nos` | My current custom built server running Proxmox. Conversion to NixOS wip |
|
||||
| `oksys` | A very old Acer laptop that went from sailing the seas for years to becoming my web server and VPN host. It is now retired indefinitely. |
|
||||
| `servivi` | A gaming PC in a previous life, it is now used to slowly convert my Proxmox server to NixOS |
|
||||
| `wim` | My 2-1 Lenovo Laptop that I use for uni |
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) filterAttrs mapAttrs mkDefault mkOption types;
|
||||
|
||||
cfg = config.services.borgbackup;
|
||||
secrets = config.sops.secrets;
|
||||
in {
|
||||
# Make this file declare default settings
|
||||
options.services.borgbackup = {
|
||||
defaults = mkOption {
|
||||
type = types.attrs;
|
||||
};
|
||||
configs = mkOption {
|
||||
type = types.attrs;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
programs.ssh.knownHosts = {
|
||||
pve.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG/4mrp8E4Ittwg8feRmPtDHSDR2+Pq4uZHeF5MweVcW";
|
||||
};
|
||||
|
||||
services.borgbackup = {
|
||||
defaults = {
|
||||
environment = mkDefault {BORG_RSH = "ssh -i ${secrets.borg-ssh.path}";};
|
||||
|
||||
repo = mkDefault "ssh://matt@pve/data/backups/borg";
|
||||
encryption = mkDefault {
|
||||
mode = "repokey";
|
||||
passCommand = let
|
||||
cat = "${pkgs.coreutils}/bin/cat";
|
||||
key = secrets.borg-repo.path;
|
||||
in "${cat} ${key}";
|
||||
};
|
||||
|
||||
# Run every 3 hours
|
||||
startAt = mkDefault "00/3:00";
|
||||
compression = mkDefault "auto,lzma";
|
||||
};
|
||||
|
||||
jobs = let
|
||||
tempJobs = mapAttrs (_: v: cfg.defaults // v) cfg.configs;
|
||||
in
|
||||
mapAttrs (n: v: let
|
||||
attrs = filterAttrs (n: _: n != "preHook" || n != "postHook" || n != "paths") v;
|
||||
pathPrefix = "/root/snaps";
|
||||
snapPath = "${pathPrefix}/${n}";
|
||||
in
|
||||
attrs
|
||||
// {
|
||||
paths = map (x: snapPath + x) v.paths;
|
||||
|
||||
preHook =
|
||||
v.preHook
|
||||
or ""
|
||||
+
|
||||
/*
|
||||
bash
|
||||
*/
|
||||
''
|
||||
if [[ ! -d ${pathPrefix} ]]; then
|
||||
mkdir -p ${pathPrefix}
|
||||
fi
|
||||
|
||||
${pkgs.btrfs-progs}/bin/btrfs subvolume snapshot -r / ${snapPath}
|
||||
'';
|
||||
|
||||
postHook =
|
||||
/*
|
||||
bash
|
||||
*/
|
||||
''
|
||||
${pkgs.btrfs-progs}/bin/btrfs subvolume delete ${snapPath}
|
||||
''
|
||||
+ v.postHook or "";
|
||||
})
|
||||
tempJobs;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -2,9 +2,7 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./modules/arion
|
||||
./modules/borgbackup.nix
|
||||
./modules/mergerfs.nix
|
||||
./modules/nfs.nix
|
||||
./modules/qbittorrent
|
||||
];
|
||||
}
|
|
@ -10,9 +10,10 @@ in {
|
|||
|
||||
./modules/binary-cache.nix
|
||||
./modules/minecraft.nix
|
||||
./modules/nfs.nix
|
||||
|
||||
# WIP
|
||||
../nas
|
||||
../nos
|
||||
];
|
||||
|
||||
vars = {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# TODO: move this to NAS?
|
||||
{lib, ...}: let
|
||||
inherit (lib) concatMapStringsSep concatStringsSep;
|
||||
in {
|
Loading…
Add table
Add a link
Reference in a new issue