common.nix/README.md

93 lines
2.2 KiB
Markdown
Raw Normal View History

2024-03-29 22:36:02 +02:00
# common.nix
Nix modules i use on my servers
# Usage
```nix
# flake.nix
inputs = {
2024-03-29 23:11:36 +02:00
common-modules.url = "git+https://forge.catnip.ee/batteredbunny/common.nix";
2024-03-29 22:36:02 +02:00
};
```
```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``
2024-03-29 23:06:12 +02:00
``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.
2024-03-29 22:36:02 +02:00
``failureNotification`` sends a notification to a ntfy topic on an auto upgrade failure
2024-05-25 00:41:20 +03:00
``extraCommands`` extra commands to run during auto upgrade
2024-03-29 22:36:02 +02:00
```nix
system.autoUpgrade = {
enable = true;
allowReboot = true;
flake = "/etc/nixos";
# New options
updateFlake = true;
failureNotification = {
enable = true;
2024-03-29 23:19:40 +02:00
# NTFY_URL=https://ntfy.example.com/topic
2024-03-29 22:36:02 +02:00
ntfyUrlFile = "/etc/secrets/failureNotification.env";
};
};
```
## Unpackerr
```nix
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
2024-10-31 13:06:50 +02:00
Becuase nixos doesnt have one yet, mostly [the one from PR](https://github.com/NixOS/nixpkgs/pull/287923) but slightly modified.
2024-03-29 22:36:02 +02:00
```nix
services.qbittorrent-nox = {
2024-03-29 22:36:02 +02:00
enable = true;
openFirewall = true;
webuiPort = 8080;
torrentingPort = 345677;
};
```