From 8149a03a69a5e95e02ceb2f7628ca8d31ff7b569 Mon Sep 17 00:00:00 2001 From: bgl gwyng Date: Fri, 24 Jan 2025 17:25:08 +0900 Subject: [PATCH] Recover `services.k3s.extraFlags`. --- modules/nixos/containerd.nix | 7 ++++--- modules/nixos/k3s.nix | 25 ++++--------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/modules/nixos/containerd.nix b/modules/nixos/containerd.nix index 7c5c46c..c6ea9f5 100644 --- a/modules/nixos/containerd.nix +++ b/modules/nixos/containerd.nix @@ -10,7 +10,8 @@ let ]; }; -in { +in +{ imports = [ ../common/containerd.nix ./k3s.nix @@ -41,7 +42,7 @@ in { systemd.services.containerd.path = cfg.path; } (lib.mkIf cfg.k3sIntegration { - services.k3s.moreFlags = [ + services.k3s.extraFlags = [ "--container-runtime-endpoint unix:///run/containerd/containerd.sock" ]; @@ -75,7 +76,7 @@ in { }; }) (lib.mkIf (cfg.k3sIntegration && cfg.nixSnapshotterIntegration) { - services.k3s.moreFlags = [ + services.k3s.extraFlags = [ "--image-service-endpoint unix:///run/nix-snapshotter/nix-snapshotter.sock" ]; }) diff --git a/modules/nixos/k3s.nix b/modules/nixos/k3s.nix index 5f4b168..48a8026 100644 --- a/modules/nixos/k3s.nix +++ b/modules/nixos/k3s.nix @@ -3,29 +3,18 @@ let inherit (lib) mkOption types - ; + ; cfg = config.services.k3s; -in { +in +{ imports = [ ../common/k3s.nix ]; - options = { - services.k3s = { - # This was introduced to provide a mergeable listOf type. - moreFlags = mkOption { - type = types.listOf types.str; - description = lib.mdDoc "Extra flags to pass to the k3s command."; - default = []; - example = [ "--no-deploy traefik" "--cluster-cidr 10.24.0.0/16" ]; - }; - }; - }; - config = lib.mkIf cfg.enable { - environment.extraInit = + environment.extraInit = (lib.optionalString cfg.setEmbeddedContainerd '' if [ -z "$CONTAINERD_ADDRESS" ]; then export CONTAINERD_ADDRESS="/run/k3s/containerd/containerd.sock" @@ -43,12 +32,6 @@ in { fi ''); - services.k3s = { - moreFlags = [ "--snapshotter ${cfg.snapshotter}" ]; - - extraFlags = toString cfg.moreFlags; - }; - systemd.services.k3s.path = lib.mkIf (cfg.snapshotter == "nix") [ pkgs.nix ];