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

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/d603719ec6e294f034936c0d0dc06f689d91b6c3?narHash=sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw%2B0Bwe5DLU%3D' (2024-06-20)
  → 'github:nixos/nixpkgs/a71e967ef3694799d0c418c98332f7ff4cc5f6af?narHash=sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo%3D' (2024-06-22)
2024-06-23 21:10:31 +00:00
.gitea/workflows Fix workflow 2024-05-07 15:47:23 +03:00
modules Formatting 2024-05-25 00:38:47 +03:00
flake.lock flake.lock: Update 2024-06-23 21:10:31 +00:00
flake.nix Formatting 2024-05-25 00:38:47 +03:00
README.md Update README.md 2024-05-25 00:41:20 +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

extraCommands extra commands to run during auto upgrade

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;
};