refactor: nix fmt classic to nix fmt
This commit is contained in:
parent
ca78adc858
commit
f9614371a3
57 changed files with 923 additions and 493 deletions
|
|
@ -1,37 +1,51 @@
|
|||
{ config, lib, pkgs, user, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
user,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
mkEnableOption mkOption mkIf types mkMerge mkAfter optionals mkDefault;
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
mkMerge
|
||||
mkAfter
|
||||
optionals
|
||||
mkDefault
|
||||
;
|
||||
cfg = config.rsydn.containerization;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.rsydn.containerization = {
|
||||
podman = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"Enable Podman for rootless containers as the primary engine.";
|
||||
description = "Enable Podman for rootless containers as the primary engine.";
|
||||
};
|
||||
|
||||
dockerCompat = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"Expose the Docker-compatible socket for CLI compatibility.";
|
||||
description = "Expose the Docker-compatible socket for CLI compatibility.";
|
||||
};
|
||||
|
||||
enableDnsnamePlugin = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"Enable the dnsname CNI plugin so containers can resolve each other.";
|
||||
description = "Enable the dnsname CNI plugin so containers can resolve each other.";
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = with pkgs; [ podman-compose podman-tui ];
|
||||
description =
|
||||
"Additional Podman-related packages to install system-wide.";
|
||||
default = with pkgs; [
|
||||
podman-compose
|
||||
podman-tui
|
||||
];
|
||||
description = "Additional Podman-related packages to install system-wide.";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -39,8 +53,7 @@ in {
|
|||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description =
|
||||
"Enable the Docker daemon alongside Podman when explicitly requested.";
|
||||
description = "Enable the Docker daemon alongside Podman when explicitly requested.";
|
||||
};
|
||||
|
||||
autoPrune = mkOption {
|
||||
|
|
@ -49,18 +62,19 @@ in {
|
|||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"Automatically prune unused Docker data on a schedule.";
|
||||
description = "Automatically prune unused Docker data on a schedule.";
|
||||
};
|
||||
dates = mkOption {
|
||||
type = types.str;
|
||||
default = "weekly";
|
||||
description =
|
||||
"Systemd calendar expression for docker system prune.";
|
||||
description = "Systemd calendar expression for docker system prune.";
|
||||
};
|
||||
flags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "--all" "--volumes" ];
|
||||
default = [
|
||||
"--all"
|
||||
"--volumes"
|
||||
];
|
||||
description = "Extra flags passed to docker system prune.";
|
||||
};
|
||||
};
|
||||
|
|
@ -71,11 +85,13 @@ in {
|
|||
};
|
||||
|
||||
k3s = {
|
||||
enable =
|
||||
mkEnableOption "Run a lightweight Kubernetes control plane with k3s.";
|
||||
enable = mkEnableOption "Run a lightweight Kubernetes control plane with k3s.";
|
||||
|
||||
role = mkOption {
|
||||
type = types.enum [ "server" "agent" ];
|
||||
type = types.enum [
|
||||
"server"
|
||||
"agent"
|
||||
];
|
||||
default = "server";
|
||||
description = "Choose whether this node runs as a k3s server or agent.";
|
||||
};
|
||||
|
|
@ -99,14 +115,18 @@ in {
|
|||
environment.systemPackages = mkAfter cfg.podman.extraPackages;
|
||||
|
||||
users.users.${user} = {
|
||||
subUidRanges = mkDefault [{
|
||||
startUid = 100000;
|
||||
count = 65536;
|
||||
}];
|
||||
subGidRanges = mkDefault [{
|
||||
startGid = 100000;
|
||||
count = 65536;
|
||||
}];
|
||||
subUidRanges = mkDefault [
|
||||
{
|
||||
startUid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
subGidRanges = mkDefault [
|
||||
{
|
||||
startGid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
};
|
||||
})
|
||||
|
||||
|
|
@ -130,8 +150,7 @@ in {
|
|||
extraFlags = cfg.k3s.extraFlags;
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts =
|
||||
mkAfter (optionals (cfg.k3s.role == "server") [ 6443 ]);
|
||||
networking.firewall.allowedTCPPorts = mkAfter (optionals (cfg.k3s.role == "server") [ 6443 ]);
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue