Changed option namespace for better compatibility
This commit is contained in:
parent
fe8045ee55
commit
8b25f46384
26 changed files with 407 additions and 232 deletions
|
|
@ -1,62 +1,30 @@
|
||||||
{ config, pkgs, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
# parameters = import ./parameters.nix { };
|
|
||||||
|
|
||||||
# GID = 888;
|
|
||||||
# user = "rtorrent";
|
|
||||||
# passwordHash = "$y$j9T$dA94KVg1/jYLqclQQbTDk.$cnfxBWUN8P4shr8Kkipv5bU/RCtQNoAwYFDZ0X/BYs5";
|
|
||||||
|
|
||||||
timeZone = "Europe/Rome";
|
|
||||||
defaultLocale = "en_US.UTF-8";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
my = {
|
||||||
|
utils.commons.enable = true;
|
||||||
|
|
||||||
commons.enable = true;
|
networking.tailscale = {
|
||||||
|
|
||||||
proxmox.enable = true;
|
|
||||||
|
|
||||||
download-pod = {
|
|
||||||
enable = false;
|
enable = false;
|
||||||
|
exitNode = "vps";
|
||||||
|
# authKeyFile = builtins.toFile "authKey" ''${parameters.tailscaleAuthKey}'';
|
||||||
|
};
|
||||||
|
|
||||||
|
services.download-pod = {
|
||||||
|
enable = true;
|
||||||
proxy.enable = false;
|
proxy.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.podmanPods = {
|
virtualisation = {
|
||||||
mywebapp = {
|
proxmox.enable = true;
|
||||||
name = "mywebapp";
|
|
||||||
ports = [
|
|
||||||
"9090:80"
|
|
||||||
"9443:443"
|
|
||||||
];
|
|
||||||
containers = {
|
|
||||||
webserver = {
|
|
||||||
enable = true;
|
|
||||||
image = "nginx";
|
|
||||||
volumes = [
|
|
||||||
"aaa:/config"
|
|
||||||
"bbb:/data"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
appserver = {
|
|
||||||
image = "my-custom-app:latest";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
database = {
|
time.timeZone = "Europe/Rome";
|
||||||
name = "database";
|
|
||||||
ports = [
|
|
||||||
"3333:4444"
|
|
||||||
"5432:5432"
|
|
||||||
];
|
|
||||||
containers = {
|
|
||||||
postgres = {
|
|
||||||
image = "postgres:13";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Extra packages
|
# Extra packages
|
||||||
environment.systemPackages = with pkgs; [ ];
|
environment.systemPackages = with pkgs; [ ];
|
||||||
|
|
@ -65,13 +33,5 @@ in
|
||||||
openssh.enable = true;
|
openssh.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
tailscale = {
|
|
||||||
enable = false;
|
|
||||||
exitNode = "vps";
|
|
||||||
# authKeyFile = builtins.toFile "authKey" ''${parameters.tailscaleAuthKey}'';
|
|
||||||
};
|
|
||||||
|
|
||||||
time.timeZone = timeZone;
|
|
||||||
|
|
||||||
system.stateVersion = "24.05";
|
system.stateVersion = "24.05";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
home-manager,
|
home-manager,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
@ -8,8 +9,6 @@
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
# home-manager.nixosModules.home-manager
|
# home-manager.nixosModules.home-manager
|
||||||
# ../../modules
|
|
||||||
# "${config.inputs.self}/modules"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Don't use the systemd-boot EFI boot loader.
|
# Don't use the systemd-boot EFI boot loader.
|
||||||
|
|
@ -38,6 +37,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
my = {
|
||||||
|
desktop = {
|
||||||
|
|
||||||
desktopUser = {
|
desktopUser = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = "pazpi";
|
userName = "pazpi";
|
||||||
|
|
@ -45,8 +47,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
audio.enable = false;
|
audio.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
# podman.enable = true;
|
};
|
||||||
|
|
||||||
# Vedi https://github.com/TLATER/dotfiles/blob/f989a86890f27f6b089e9d74b7e8356ec8e5683d/home-config/hosts/yui.nix
|
# Vedi https://github.com/TLATER/dotfiles/blob/f989a86890f27f6b089e9d74b7e8356ec8e5683d/home-config/hosts/yui.nix
|
||||||
# home-manager.users.pazpi = import "${flake-inputs.self}/home-config/hosts/deadbeef.nix";
|
# home-manager.users.pazpi = import "${flake-inputs.self}/home-config/hosts/deadbeef.nix";
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.audio;
|
cfg = config.my.desktop.audio;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.audio = {
|
options.my.desktop.audio = {
|
||||||
enable = lib.mkEnableOption "Enable sound module";
|
enable = lib.mkEnableOption "Enable sound module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.desktopUser;
|
cfg = config.my.desktop.desktopUser;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.desktopUser = {
|
options.my.desktop.desktopUser = {
|
||||||
enable = lib.mkEnableOption "Enable desktop user module";
|
enable = lib.mkEnableOption "Enable desktop user module";
|
||||||
|
|
||||||
userName = lib.mkOption {
|
userName = lib.mkOption {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.gnome;
|
cfg = config.my.desktop.gnome;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.gnome = {
|
options.my.desktop.gnome = {
|
||||||
enable = lib.mkEnableOption "Enable Gnome and apply customization module";
|
enable = lib.mkEnableOption "Enable Gnome and apply customization module";
|
||||||
|
|
||||||
keyboardLayout = lib.mkOption {
|
keyboardLayout = lib.mkOption {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.plymouth;
|
cfg = config.my.desktop.plymouth;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.plymouth = {
|
options.my.desktop.plymouth = {
|
||||||
enable = lib.mkEnableOption "Enable Plymouth and apply customization module";
|
enable = lib.mkEnableOption "Enable Plymouth and apply customization module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.steam;
|
cfg = config.my.desktop.steam;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.steam = {
|
options.my.desktop.steam = {
|
||||||
enable = lib.mkEnableOption "Enable Steam and apply customization module";
|
enable = lib.mkEnableOption "Enable Steam and apply customization module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.avahi;
|
cfg = config.my.networking.avahi;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.avahi = {
|
options.my.networking.avahi = {
|
||||||
enable = lib.mkEnableOption "Enable Avahi and apply customization module";
|
enable = lib.mkEnableOption "Enable Avahi and apply customization module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.tailscale;
|
cfg = config.my.networking.tailscale;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.tailscale = {
|
options.my.networking.tailscale = {
|
||||||
enable = lib.mkEnableOption "Enable Tailscale module";
|
enable = lib.mkEnableOption "Enable Tailscale module";
|
||||||
|
|
||||||
authKeyFile = lib.mkOption {
|
authKeyFile = lib.mkOption {
|
||||||
|
|
|
||||||
149
modules/services/download-pod copy.nix
Normal file
149
modules/services/download-pod copy.nix
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.my.services.download-pod;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.my.services.download-pod = {
|
||||||
|
enable = lib.mkEnableOption "Enable the download searcher stack";
|
||||||
|
|
||||||
|
proxy = {
|
||||||
|
enable = lib.mkEnableOption "Enable proxy for the services";
|
||||||
|
|
||||||
|
hostName = lib.mkOption {
|
||||||
|
default = "example.com";
|
||||||
|
type = lib.types.str;
|
||||||
|
description = ''
|
||||||
|
Top level hostname
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
serverName = lib.mkOption {
|
||||||
|
default = "localhost";
|
||||||
|
type = lib.types.str;
|
||||||
|
description = ''
|
||||||
|
Server name where Caddy is
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
my.virtualisation.podman.enable = true;
|
||||||
|
|
||||||
|
systemd.services.pod-download = {
|
||||||
|
description = "Start podman 'download' pod";
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
requiredBy = [
|
||||||
|
"podman-jackett.service"
|
||||||
|
"podman-radarr.service"
|
||||||
|
"podman-sabnzbd.service"
|
||||||
|
"podman-sonarr.service"
|
||||||
|
];
|
||||||
|
unitConfig = {
|
||||||
|
RequiresMountsFor = "/run/containers";
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
# - 7878: Radarr
|
||||||
|
# - 8080: Sabnzbd
|
||||||
|
# - 8989: Sonarr
|
||||||
|
# - 9117: Jackett
|
||||||
|
# - 9696: Prowlarr
|
||||||
|
ExecStart = "-${pkgs.podman}/bin/podman pod create -p 9117:9117 -p 7878:7878 -p 8080:8080 -p 8989:8989 -p 9696:9696 download";
|
||||||
|
};
|
||||||
|
path = [ pkgs.podman ];
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
|
||||||
|
my-pod = {
|
||||||
|
image = "k8s.gcr.io/pause:3.9";
|
||||||
|
extraOptions = [
|
||||||
|
"--pod=new:my-pod"
|
||||||
|
"--publish=8081:80" # Expose port 80 in the pod as 8080 on the host
|
||||||
|
"--publish=8082:82" # Expose port 82 in the pod as 8082 on the host
|
||||||
|
"--publish=83:9117" # Expose port 9117 in the pod as 83 on the host
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
jackett = {
|
||||||
|
image = "linuxserver/jackett";
|
||||||
|
autoStart = true;
|
||||||
|
extraOptions = [ "--pod=my-pod" ];
|
||||||
|
volumes = [
|
||||||
|
"jackett_config:/config"
|
||||||
|
"jackett_data:/data"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
radarr = {
|
||||||
|
image = "linuxserver/radarr";
|
||||||
|
autoStart = true;
|
||||||
|
extraOptions = [ "--pod=download" ];
|
||||||
|
volumes = [
|
||||||
|
"radarr_config:/config"
|
||||||
|
"radarr_data:/data"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
sabnzbd = {
|
||||||
|
image = "linuxserver/sabnzbd";
|
||||||
|
autoStart = true;
|
||||||
|
extraOptions = [ "--pod=download" ];
|
||||||
|
volumes = [
|
||||||
|
"sabnzbd_config:/config"
|
||||||
|
"sabnzbd_data:/data"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
sonarr = {
|
||||||
|
image = "linuxserver/sonarr";
|
||||||
|
autoStart = true;
|
||||||
|
extraOptions = [ "--pod=download" ];
|
||||||
|
volumes = [
|
||||||
|
"sonarr_config:/config"
|
||||||
|
"sonarr_data:/data"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
prowlarr = {
|
||||||
|
image = "linuxserver/prowlarr";
|
||||||
|
autoStart = true;
|
||||||
|
extraOptions = [ "--pod=download" ];
|
||||||
|
volumes = [ "prowlarr_config:/config" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
services.caddy = lib.mkIf cfg.proxy.enable {
|
||||||
|
enable = true;
|
||||||
|
enableReload = false;
|
||||||
|
virtualHosts = {
|
||||||
|
"jackett.${cfg.proxy.hostName}".extraConfig = ''
|
||||||
|
reverse_proxy http://${cfg.proxy.serverName}:9117
|
||||||
|
'';
|
||||||
|
"radarr.${cfg.proxy.hostName}".extraConfig = ''
|
||||||
|
reverse_proxy http://${cfg.proxy.serverName}:7878
|
||||||
|
'';
|
||||||
|
"sabnzbd.${cfg.proxy.hostName}".extraConfig = ''
|
||||||
|
reverse_proxy http://${cfg.proxy.serverName}:8080
|
||||||
|
'';
|
||||||
|
"sonarr.${cfg.proxy.hostName}".extraConfig = ''
|
||||||
|
reverse_proxy http://${cfg.proxy.serverName}:8989
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.download-pod-old;
|
cfg = config.my.services.download-pod-old;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.download-pod-old = {
|
options.my.services.download-pod-old = {
|
||||||
enable = lib.mkEnableOption "Enable download services module";
|
enable = lib.mkEnableOption "Enable download services module";
|
||||||
|
|
||||||
proxy = {
|
proxy = {
|
||||||
|
|
@ -43,7 +43,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
podman.enable = true;
|
my.virtualisation.podman.enable = true;
|
||||||
|
|
||||||
systemd.services.pod-download = {
|
systemd.services.pod-download = {
|
||||||
description = "Start podman 'download' pod";
|
description = "Start podman 'download' pod";
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,33 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.download-pod;
|
cfg = config.my.services.download-pod;
|
||||||
|
|
||||||
|
containers = {
|
||||||
|
webserver = {
|
||||||
|
enable = true;
|
||||||
|
image = "nginx";
|
||||||
|
volumes = [
|
||||||
|
"aaa:/config"
|
||||||
|
"bbb:/data"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
postgres = {
|
||||||
|
enable = false;
|
||||||
|
image = "postgres:13";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
enabledContainers =
|
||||||
|
containers:
|
||||||
|
lib.mapAttrs (name: container: lib.removeAttrs container [ "enable" ]) (
|
||||||
|
lib.filterAttrs (name: container: container.enable) containers
|
||||||
|
);
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.download-pod = {
|
options.my.services.download-pod = {
|
||||||
enable = lib.mkEnableOption "Enable the download searcher stack";
|
enable = lib.mkEnableOption "Enable the download searcher stack";
|
||||||
|
|
||||||
proxy = {
|
proxy = {
|
||||||
|
|
@ -36,93 +59,69 @@ in
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
podman.enable = true;
|
my.virtualisation.podmanPods = {
|
||||||
|
mywebapp = {
|
||||||
systemd.services.pod-download = {
|
name = "mywebapp";
|
||||||
description = "Start podman 'download' pod";
|
ports = [
|
||||||
wants = [ "network-online.target" ];
|
"9090:80"
|
||||||
after = [ "network-online.target" ];
|
"9443:443"
|
||||||
requiredBy = [
|
|
||||||
"podman-jackett.service"
|
|
||||||
"podman-radarr.service"
|
|
||||||
"podman-sabnzbd.service"
|
|
||||||
"podman-sonarr.service"
|
|
||||||
];
|
];
|
||||||
unitConfig = {
|
containers = enabledContainers containers;
|
||||||
RequiresMountsFor = "/run/containers";
|
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
# - 7878: Radarr
|
|
||||||
# - 8080: Sabnzbd
|
|
||||||
# - 8989: Sonarr
|
|
||||||
# - 9117: Jackett
|
|
||||||
# - 9696: Prowlarr
|
|
||||||
ExecStart = "-${pkgs.podman}/bin/podman pod create -p 9117:9117 -p 7878:7878 -p 8080:8080 -p 8989:8989 -p 9696:9696 download";
|
|
||||||
};
|
|
||||||
path = [ pkgs.podman ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualisation.oci-containers.containers = {
|
virtualisation.oci-containers.containers = enabledContainers containers;
|
||||||
|
|
||||||
my-pod = {
|
# virtualisation.oci-containers.containers = {
|
||||||
image = "k8s.gcr.io/pause:3.9";
|
|
||||||
extraOptions = [
|
|
||||||
"--pod=new:my-pod"
|
|
||||||
"--publish=8081:80" # Expose port 80 in the pod as 8080 on the host
|
|
||||||
"--publish=8082:82" # Expose port 82 in the pod as 8082 on the host
|
|
||||||
"--publish=83:9117" # Expose port 9117 in the pod as 83 on the host
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
jackett = {
|
# jackett = {
|
||||||
image = "linuxserver/jackett";
|
# image = "linuxserver/jackett";
|
||||||
autoStart = true;
|
# autoStart = true;
|
||||||
extraOptions = [ "--pod=my-pod" ];
|
# extraOptions = [ "--pod=my-pod" ];
|
||||||
volumes = [
|
# volumes = [
|
||||||
"jackett_config:/config"
|
# "jackett_config:/config"
|
||||||
"jackett_data:/data"
|
# "jackett_data:/data"
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
|
|
||||||
radarr = {
|
# radarr = {
|
||||||
image = "linuxserver/radarr";
|
# image = "linuxserver/radarr";
|
||||||
autoStart = true;
|
# autoStart = true;
|
||||||
extraOptions = [ "--pod=download" ];
|
# extraOptions = [ "--pod=download" ];
|
||||||
volumes = [
|
# volumes = [
|
||||||
"radarr_config:/config"
|
# "radarr_config:/config"
|
||||||
"radarr_data:/data"
|
# "radarr_data:/data"
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
|
|
||||||
sabnzbd = {
|
# sabnzbd = {
|
||||||
image = "linuxserver/sabnzbd";
|
# image = "linuxserver/sabnzbd";
|
||||||
autoStart = true;
|
# autoStart = true;
|
||||||
extraOptions = [ "--pod=download" ];
|
# extraOptions = [ "--pod=download" ];
|
||||||
volumes = [
|
# volumes = [
|
||||||
"sabnzbd_config:/config"
|
# "sabnzbd_config:/config"
|
||||||
"sabnzbd_data:/data"
|
# "sabnzbd_data:/data"
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
|
|
||||||
sonarr = {
|
# sonarr = {
|
||||||
image = "linuxserver/sonarr";
|
# image = "linuxserver/sonarr";
|
||||||
autoStart = true;
|
# autoStart = true;
|
||||||
extraOptions = [ "--pod=download" ];
|
# extraOptions = [ "--pod=download" ];
|
||||||
volumes = [
|
# volumes = [
|
||||||
"sonarr_config:/config"
|
# "sonarr_config:/config"
|
||||||
"sonarr_data:/data"
|
# "sonarr_data:/data"
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
|
|
||||||
prowlarr = {
|
# prowlarr = {
|
||||||
image = "linuxserver/prowlarr";
|
# image = "linuxserver/prowlarr";
|
||||||
autoStart = true;
|
# autoStart = true;
|
||||||
extraOptions = [ "--pod=download" ];
|
# extraOptions = [ "--pod=download" ];
|
||||||
volumes = [ "prowlarr_config:/config" ];
|
# volumes = [ "prowlarr_config:/config" ];
|
||||||
};
|
# };
|
||||||
|
|
||||||
};
|
# };
|
||||||
|
|
||||||
services.caddy = lib.mkIf cfg.proxy.enable {
|
services.caddy = lib.mkIf cfg.proxy.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,15 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.nextcloud-pd;
|
cfg = config.my.services.nextcloud-pd;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.nextcloud-pd = {
|
options.my.services.nextcloud-pd = {
|
||||||
enable = lib.mkEnableOption "Enable Nextcloud module";
|
enable = lib.mkEnableOption "Enable Nextcloud module";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
podman.enable = true;
|
my.virtualisation.podman.enable = true;
|
||||||
|
|
||||||
virtualisation.oci-containers.containers = { };
|
virtualisation.oci-containers.containers = { };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.rutorrent;
|
cfg = config.my.services.rutorrent;
|
||||||
|
|
||||||
rutorrentPkgs = import ../packages/rutorrent.nix {
|
rutorrentPkgs = import ../packages/rutorrent.nix {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
|
@ -44,7 +44,7 @@ let
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options.my = {
|
||||||
services.rutorrent = {
|
services.rutorrent = {
|
||||||
enable = mkEnableOption "ruTorrent";
|
enable = mkEnableOption "ruTorrent";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.btrfsAutoscrub;
|
cfg = config.my.system.btrfsAutoscrub;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.btrfsAutoscrub = {
|
options.my.system.btrfsAutoscrub = {
|
||||||
enable = lib.mkEnableOption "Enable BTRFS Auto Scrub module";
|
enable = lib.mkEnableOption "Enable BTRFS Auto Scrub module";
|
||||||
|
|
||||||
interval = lib.mkOption {
|
interval = lib.mkOption {
|
||||||
|
|
|
||||||
21
modules/systems/ssh.nix
Normal file
21
modules/systems/ssh.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.my.systems.ssh;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.my.systems.ssh = {
|
||||||
|
enable = lib.mkEnableOption "Enable SSH Server";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# require public key authentication for better security
|
||||||
|
settings.PasswordAuthentication = false;
|
||||||
|
settings.KbdInteractiveAuthentication = false;
|
||||||
|
settings.PermitRootLogin = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.commons;
|
cfg = config.my.utils.commons;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.commons = {
|
options.my.utils.commons = {
|
||||||
enable = lib.mkEnableOption "Enable commons stuff that are always nice to have";
|
enable = lib.mkEnableOption "Enable commons stuff that are always nice to have";
|
||||||
|
|
||||||
allowReboot = lib.mkOption {
|
allowReboot = lib.mkOption {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.serverNodeUsers;
|
cfg = config.my.utils.serverNodeUsers;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.serverNodeUsers = {
|
options.my.utils.serverNodeUsers = {
|
||||||
enable = lib.mkEnableOption "Set users for server hosts";
|
enable = lib.mkEnableOption "Set users for server hosts";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -24,9 +24,6 @@ in
|
||||||
|
|
||||||
users.root = {
|
users.root = {
|
||||||
hashedPassword = "!";
|
hashedPassword = "!";
|
||||||
openssh.authorizedKeys.keys = [
|
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhiGLc/whCY3lCmDiRlYnMJOLiO/gvcRj/sKVEFVAhQ pazpi@deadbeef"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
users.pazpi = {
|
users.pazpi = {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,5 @@
|
||||||
./lxc-guest.nix
|
./lxc-guest.nix
|
||||||
./podman.nix
|
./podman.nix
|
||||||
./podman-pod.nix
|
./podman-pod.nix
|
||||||
./proxmox.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.docker;
|
cfg = config.my.virtualisation.docker;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.docker = {
|
options.my.virtualisation.docker = {
|
||||||
enable = lib.mkEnableOption "Enable Docker module";
|
enable = lib.mkEnableOption "Enable Docker module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.libvirtd;
|
cfg = config.my.virtualisation.libvirtd;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.libvirtd = {
|
options.my.virtualisation.libvirtd = {
|
||||||
enable = lib.mkEnableOption "Enable libvirtd module";
|
enable = lib.mkEnableOption "Enable libvirtd module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.lxcGuest;
|
cfg = config.my.virtualisation.lxcGuest;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.lxcGuest = {
|
options.my.virtualisation.lxcGuest = {
|
||||||
enable = lib.mkEnableOption "NixOs inside LXC container";
|
enable = lib.mkEnableOption "NixOs inside LXC container";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.lxc;
|
cfg = config.my.virtualisation.lxc;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.lxc = {
|
options.my.virtualisation.lxc = {
|
||||||
enable = lib.mkEnableOption "Enable LXC module";
|
enable = lib.mkEnableOption "Enable LXC module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
# Save this as podman-pod.nix
|
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
|
@ -9,42 +8,65 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.podmanPods;
|
cfg = config.my.virtualisation.podmanPods;
|
||||||
|
|
||||||
# Get the options from the original oci-containers module
|
# Get the options from the original oci-containers module
|
||||||
containerOptions = (
|
# containerOptions = (
|
||||||
filterAttrs (
|
# filterAttrs (
|
||||||
n: v: n != "definition"
|
# n: v: n != "definition"
|
||||||
) config.virtualisation.oci-containers.containers.type.getSubOptions
|
# ) config.virtualisation.oci-containers.containers.type.getSubOptions
|
||||||
);
|
# );
|
||||||
|
|
||||||
|
# containerDefinition = mkOption {
|
||||||
|
# type = types.attrs;
|
||||||
|
# description = "The container definition, derived from virtualisation.oci-containers.containers.";
|
||||||
|
# example = {
|
||||||
|
# image = "nginx:latest";
|
||||||
|
# ports = [ "8080:80" ];
|
||||||
|
# };
|
||||||
|
# default = { };
|
||||||
|
# };
|
||||||
|
|
||||||
|
# containerDefinition = mkOption {
|
||||||
|
# type = types.attrs;
|
||||||
|
# description = "The container definition, derived from virtualisation.oci-containers.containers.";
|
||||||
|
# example = {
|
||||||
|
# image = "nginx:latest";
|
||||||
|
# ports = [ "8080:80" ];
|
||||||
|
# };
|
||||||
|
# default = {};
|
||||||
|
|
||||||
|
# };
|
||||||
|
# # config.virtualisation.oci-containers.containers.type.getSubOptions;
|
||||||
|
|
||||||
|
containerDefinition = config.virtualisation.oci-containers.containers.type.getSubOptions;
|
||||||
|
|
||||||
# Add our enable option
|
# Add our enable option
|
||||||
extendedContainerOptions = containerOptions // {
|
extendedContainerOptions = containerDefinition // {
|
||||||
enable = mkEnableOption "Enable this container";
|
enable = mkEnableOption "Enable this container";
|
||||||
};
|
};
|
||||||
|
|
||||||
podOptions =
|
podOptions = {
|
||||||
{ name, config, ... }:
|
options = with types; {
|
||||||
{
|
|
||||||
options = {
|
|
||||||
|
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
description = "Name of the pod";
|
description = "Name of the pod";
|
||||||
};
|
};
|
||||||
|
|
||||||
ports = mkOption {
|
ports = mkOption {
|
||||||
type = types.listOf types.str;
|
type = listOf str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = "List of port mappings (e.g. ['8080:80'])";
|
description = "List of port mappings (e.g. ['8080:80'])";
|
||||||
};
|
};
|
||||||
|
|
||||||
containers = mkOption {
|
containers = mkOption {
|
||||||
type = types.attrsOf (types.submodule { options = extendedContainerOptions; });
|
type = attrsOf (submodule {
|
||||||
|
options = extendedContainerOptions;
|
||||||
|
});
|
||||||
default = { };
|
default = { };
|
||||||
description = "Attribute set of OCI container configurations for this set";
|
description = "Attribute set of OCI container configurations for this set";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -82,27 +104,49 @@ let
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enabledContainers = lib.flatten (
|
# enabledContainers = lib.flatten (
|
||||||
mapAttrs (
|
# mapAttrs (
|
||||||
podName: podConfig: filterAttrs (name: value: value.enable or true) podConfig.containers
|
# podName: podConfig: filterAttrs (name: value: value.enable or true) podConfig.containers
|
||||||
) cfg
|
# ) cfg
|
||||||
);
|
# );
|
||||||
|
|
||||||
|
# flattenPodContainers =
|
||||||
|
# pods:
|
||||||
|
# mapAttrs' (
|
||||||
|
# podName: pod:
|
||||||
|
# mapAttrs' (
|
||||||
|
# containerName: container:
|
||||||
|
# nameValuePair "${podName}-${containerName}" (
|
||||||
|
# container
|
||||||
|
# # // {
|
||||||
|
# # inherit (pod) name;
|
||||||
|
# # extraOptions = (container.extraOptions or [ ]) ++ [ "--pod=${pod.name}" ];
|
||||||
|
# # }
|
||||||
|
# )
|
||||||
|
# ) (filterAttrs (n: v: v.enable or true) pod.containers)
|
||||||
|
# ) pods;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.podmanPods = mkOption {
|
options.my.virtualisation.podmanPods = mkOption {
|
||||||
type = types.attrsOf (types.submodule podOptions);
|
type = types.attrsOf (types.submodule podOptions);
|
||||||
default = { };
|
default = { };
|
||||||
description = "Podman pods to create";
|
description = "Podman pods to create";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg != { }) {
|
config = mkIf (cfg != { }) {
|
||||||
virtualisation.podman.enable = true;
|
|
||||||
virtualisation.oci-containers.backend = "podman";
|
my.virtualisation.podman.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.jq ];
|
environment.systemPackages = [ pkgs.jq ];
|
||||||
|
|
||||||
virtualisation.oci-containers.containers = enabledContainers;
|
# virtualisation.oci-containers.containers = enabledContainers;
|
||||||
|
|
||||||
|
# virtualisation.oci-containers.containers = flattenPodContainers cfg;
|
||||||
|
|
||||||
|
# virtualisation.oci-containers.containers = lib.mkMerge (
|
||||||
|
# map (entry: entry.container) (filter (entry: entry.enable) cfg.containers)
|
||||||
|
# );
|
||||||
|
|
||||||
# virtualisation.oci-containers.containers = listToAttrs (flatten (mapAttrsToList
|
# virtualisation.oci-containers.containers = listToAttrs (flatten (mapAttrsToList
|
||||||
# (podName: podDef:
|
# (podName: podDef:
|
||||||
|
|
@ -159,6 +203,7 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
}
|
}
|
||||||
) cfg;
|
) cfg;
|
||||||
|
|
||||||
containerServices = mapAttrs' (
|
containerServices = mapAttrs' (
|
||||||
name: container:
|
name: container:
|
||||||
nameValuePair "podman-${name}" {
|
nameValuePair "podman-${name}" {
|
||||||
|
|
@ -166,8 +211,9 @@ in
|
||||||
requires = [ "podman-pod-${lib.head (lib.splitString "-" name)}.service" ];
|
requires = [ "podman-pod-${lib.head (lib.splitString "-" name)}.service" ];
|
||||||
partOf = [ "podman-pod-${lib.head (lib.splitString "-" name)}.service" ];
|
partOf = [ "podman-pod-${lib.head (lib.splitString "-" name)}.service" ];
|
||||||
}
|
}
|
||||||
) config.virtualisation.oci-containers.containers;
|
) config.containers;
|
||||||
in
|
in
|
||||||
podServices // containerServices;
|
podServices // containerServices;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.podman;
|
cfg = config.my.virtualisation.podman;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.podman = {
|
options.my.virtualisation.podman = {
|
||||||
enable = lib.mkEnableOption "Enable Podman module";
|
enable = lib.mkEnableOption "Enable Podman module";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,16 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.proxmox;
|
cfg = config.my.virtualisation.proxmox;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
options.proxmox = {
|
options.my.virtualisation.proxmox = {
|
||||||
enable = lib.mkEnableOption "If this host is running inside Proxmox";
|
enable = lib.mkEnableOption "If this host is running inside Proxmox";
|
||||||
|
|
||||||
privileged = lib.mkOption {
|
privileged = lib.mkOption {
|
||||||
|
|
@ -50,7 +51,7 @@ in
|
||||||
manageHostName = cfg.manageHostName;
|
manageHostName = cfg.manageHostName;
|
||||||
};
|
};
|
||||||
|
|
||||||
serverNodeUsers.enable = true;
|
my.utils.serverNodeUsers.enable = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue