Add container system module
This commit is contained in:
99
system/modules/containers/default.nix
Normal file
99
system/modules/containers/default.nix
Normal file
@ -0,0 +1,99 @@
|
||||
{
|
||||
config,
|
||||
nixosConfig,
|
||||
lib,
|
||||
mylib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with mylib.virtualisation;
|
||||
with mylib.modules; let
|
||||
cfg = config.modules.containers;
|
||||
in {
|
||||
options.modules.containers = import ./options.nix {inherit lib mylib;};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers = {
|
||||
# Home Automation
|
||||
homeassistant = mkIf cfg.homeassistant.enable mkOciContainer {
|
||||
image = "homeassistant/home-assistant:2023:5";
|
||||
id-ports = [8123];
|
||||
vols = [
|
||||
"homeassistant-config:/config:Z"
|
||||
];
|
||||
};
|
||||
|
||||
# Multimedia
|
||||
jellyfin = mkIf cfg.jellyfin.enable mkOciContainer {
|
||||
image = "linuxserver/jellyfin:10.8.10";
|
||||
id-ports = [8096];
|
||||
vols = [
|
||||
"jellyfin-cache:/cache:Z"
|
||||
"jellyfin-config:/config:Z"
|
||||
"/home/christoph/Videos/Video:/media/Video"
|
||||
"/home/christoph/Videos/Picture:/media/Picture"
|
||||
"/home/christoph/GameHDD/Video:/media/Video2"
|
||||
];
|
||||
};
|
||||
|
||||
fileflows = mkIf cfg.fileflows.enable mkOciContainer {
|
||||
image = "revenz/fileflows";
|
||||
id-ports = [5000];
|
||||
vols = [
|
||||
"fileflows-cache:/temp:Z"
|
||||
"fileflows-data:/app/Data:Z"
|
||||
"/home/christoph/Videos/Video:/media"
|
||||
];
|
||||
};
|
||||
|
||||
# Errr...
|
||||
sonarr = mkIf cfg.sonarr.enable mkOciContainer {
|
||||
image = "linuxserver/sonarr:3.0.10";
|
||||
id-ports = [8989];
|
||||
vols = [
|
||||
"sonarr-config:/config:Z"
|
||||
"/home/christoph/Videos/Shows:/tv"
|
||||
"/home/christoph/Videos/SabNzbd:/downloads"
|
||||
];
|
||||
netns = "wg0-de-115";
|
||||
netdns = "10.2.0.1";
|
||||
};
|
||||
|
||||
radarr = mkIf cfg.radarr.enable mkOciContainer {
|
||||
image = "linuxserver/radarr:4.4.4";
|
||||
id-ports = [7878];
|
||||
vols = [
|
||||
"radarr-config:/config:Z"
|
||||
"/home/christoph/Videos/Movies:/movies"
|
||||
"/home/christoph/Videos/SabNzbd:/downloads"
|
||||
];
|
||||
netns = "wg0-de-115";
|
||||
netdns = "10.2.0.1";
|
||||
};
|
||||
|
||||
hydra = mkIf cfg.hydra.enable mkOciContainer {
|
||||
image = "linuxserver/nzbhydra2:5.1.8";
|
||||
id-ports = [5076];
|
||||
vols = [
|
||||
"hydra-config:/config:Z"
|
||||
"/home/christoph/Videos/SabNzbd:/downloads"
|
||||
];
|
||||
netns = "wg0-de-115";
|
||||
netdns = "10.2.0.1";
|
||||
};
|
||||
|
||||
sabnzbd = mkIf cfg.sabnzbd.enable mkOciContainer {
|
||||
image = "linuxserver/sabnzbd:4.0.1";
|
||||
id-ports = [8080];
|
||||
vols = [
|
||||
"sabnzbd-config:/config:Z"
|
||||
"/home/christoph/Videos/SabNzbd:/downloads"
|
||||
"/home/christoph/Videos/.sabnzbd:/incomplete-downloads"
|
||||
];
|
||||
netns = "wg0-de-115";
|
||||
netdns = "10.2.0.1";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
45
system/modules/containers/options.nix
Normal file
45
system/modules/containers/options.nix
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
lib,
|
||||
mylib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with mylib.modules; {
|
||||
enable = mkEnableOpt "Enable OCI Containers";
|
||||
|
||||
homeassistant = {
|
||||
enable = mkEnableOpt "Enable HomeAssistant Container";
|
||||
};
|
||||
jellyfin = {
|
||||
enable = mkEnableOpt "Enable Jellyfin Container";
|
||||
};
|
||||
fileflows = {
|
||||
enable = mkEnableOpt "Enable FileFlows Container";
|
||||
};
|
||||
sonarr = {
|
||||
enable = mkEnableOpt "Enable Sonarr Container";
|
||||
};
|
||||
radarr = {
|
||||
enable = mkEnableOpt "Enable Radarr Container";
|
||||
};
|
||||
hydra = {
|
||||
enable = mkEnableOpt "Enable Hydra Container";
|
||||
};
|
||||
sabnzbd = {
|
||||
enable = mkEnableOpt "Enable SabNzbd Container";
|
||||
};
|
||||
|
||||
# TODO: I need to set the keys through the hyprland module
|
||||
# and generate the menu through the rofi module
|
||||
rofiIntegration = {
|
||||
enable = mkEnableOpt "Enable Rofi Menu for Container Servicing";
|
||||
hotkey = mkOption {
|
||||
type = types.str;
|
||||
example = ''
|
||||
"$mainMod, D"
|
||||
'';
|
||||
default = "$mainMod, D";
|
||||
description = "What Key should trigger the Menu";
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user