Common modules used by my nixos servers
Find a file
forge 6eec5f96a2 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/b211b392b8486ee79df6cdfb1157ad2133427a29?narHash=sha256-CLU5Tsg24Ke4%2B7sH8azHWXKd0CFd4mhLWfhYgUiDBpQ%3D' (2024-05-07)
  → 'github:nixos/nixpkgs/f1010e0469db743d14519a1efd37e23f8513d714?narHash=sha256-doPgfj%2B7FFe9rfzWo1siAV2mVCasW%2BBh8I1cToAXEE4%3D' (2024-05-09)
2024-05-10 21:10:34 +00:00
.gitea/workflows Fix workflow 2024-05-07 15:47:23 +03:00
modules Add users options as those were hardcoded apperently 2024-04-16 10:14:43 +03:00
flake.lock flake.lock: Update 2024-05-10 21:10:34 +00:00
flake.nix First commit 2024-03-29 23:04:40 +02:00
README.md Move roblox-account-value-api to upstream repo 2024-04-04 10:35:03 +03:00

common.nix

Nix modules i use on my servers

Usage

# flake.nix
inputs = {
    common-modules.url = "git+https://forge.catnip.ee/batteredbunny/common.nix";
};
# configuration.nix
# import any modules you want to use
imports = [
    inputs.common-modules.nixosModules.nixos-upgrade
    inputs.common-modules.nixosModules.qbittorrent-nox
    inputs.common-modules.nixosModules.unpackerr
];

Modules

Auto upgrade

Adds a few new options to system.autoUpgrade

updateFlake pulls in new changes from git repo of your flake and updates the lock file. Make sure your flake parameter is a directory not a flake url, otherwise it wont work.

failureNotification sends a notification to a ntfy topic on an auto upgrade failure

system.autoUpgrade = {
    enable = true;
    allowReboot = true;
    flake = "/etc/nixos";

    # New options
    updateFlake = true;
    failureNotification = {
      enable = true;

      # NTFY_URL=https://ntfy.example.com/topic
      ntfyUrlFile = "/etc/secrets/failureNotification.env";
    };
};

Unpackerr

services.unpackerr = {
    enable = true;

    # Stores your api keys and other sensitive things you dont want to include in nix config, example: UN_SONARR_0_API_KEY,UN_RADARR_0_API_KEY
    environmentFile = "/etc/secrets/unpackerr.env";

    # Defaults to unpackerr:unpackerr, so make sure the user has right file permissions
    # user = "";
    # group = "";

    # Look up default unpackerr config, its in toml format
    settings = {
        sonarr = [{
            url = "http://localhost:8989";
            protocols = "torrent";
            timeout = "100s";
            delete_delay = "10m";
        }];

        radarr = [{
            url = "http://localhost:7878";
            protocols = "torrent";
            timeout = "100s";
            delete_delay = "10m";
        }];
    };
};

Qbittorrent

Becuase nixos doesnt have one yet, mostly the one from PR but slightly modified.

services.qbittorrent-nox = {
    enable = true;
    openFirewall = true;
    webuiPort = 8080;
    torrentingPort = 345677;
};