···308308309309The `name` argument is the name of the derivation output, which defaults to `fromImage.name`.310310311311-## shadowSetup {#ssec-pkgs-dockerTools-shadowSetup}311311+## Environment Helpers {#ssec-pkgs-dockerTools-helpers}312312+313313+Some packages expect certain files to be available globally.314314+When building an image from scratch (i.e. without `fromImage`), these files are missing.315315+`pkgs.dockerTools` provides some helpers to set up an environment with the necessary files.316316+You can include them in `copyToRoot` like this:317317+318318+```nix319319+buildImage {320320+ name = "environment-example";321321+ copyToRoot = with pkgs.dockerTools; [322322+ usrBinEnv323323+ binSh324324+ caCertificates325325+ fakeNss326326+ ];327327+}328328+```329329+330330+### usrBinEnv {#sssec-pkgs-dockerTools-helpers-usrBinEnv}331331+332332+This provides the `env` utility at `/usr/bin/env`.333333+334334+### binSh {#sssec-pkgs-dockerTools-helpers-binSh}335335+336336+This provides `bashInteractive` at `/bin/sh`.337337+338338+### caCertificates {#sssec-pkgs-dockerTools-helpers-caCertificates}339339+340340+This sets up `/etc/ssl/certs/ca-certificates.crt`.341341+342342+### fakeNss {#sssec-pkgs-dockerTools-helpers-fakeNss}343343+344344+Provides `/etc/passwd` and `/etc/group` that contain root and nobody.345345+Useful when packaging binaries that insist on using nss to look up346346+username/groups (like nginx).347347+348348+### shadowSetup {#ssec-pkgs-dockerTools-shadowSetup}312349313350This constant string is a helper for setting up the base files for managing users and groups, only if such files don't exist already. It is suitable for being used in a [`buildImage` `runAsRoot`](#ex-dockerTools-buildImage-runAsRoot) script for cases like in the example below:314351
+3-1
lib/modules.nix
···433433 # modules recursively. It returns the final list of unique-by-key modules434434 filterModules = modulesPath: { disabled, modules }:435435 let436436- moduleKey = m: if isString m then toString modulesPath + "/" + m else toString m;436436+ moduleKey = m: if isString m && (builtins.substring 0 1 m != "/")437437+ then toString modulesPath + "/" + m438438+ else toString m;437439 disabledKeys = map moduleKey disabled;438440 keyFilter = filter (attrs: ! elem attrs.key disabledKeys);439441 in map (attrs: attrs.module) (builtins.genericClosure {
+1
lib/tests/modules.sh
···130130set -- config.enable ./define-enable.nix ./declare-enable.nix131131checkConfigOutput '^true$' "$@"132132checkConfigOutput '^false$' "$@" ./disable-define-enable.nix133133+checkConfigOutput '^false$' "$@" ./disable-define-enable-string-path.nix133134checkConfigError "The option .*enable.* does not exist. Definition values:\n\s*- In .*: true" "$@" ./disable-declare-enable.nix134135checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-define-enable.nix ./disable-declare-enable.nix135136checkConfigError "attribute .*enable.* in selection path .*config.enable.* not found" "$@" ./disable-enable-modules.nix
···441441 due to upstream dropping support.442442 </para>443443 </listitem>444444+ <listitem>445445+ <para>446446+ <literal>k3s</literal> supports <literal>clusterInit</literal>447447+ option, and it is enabled by default, for servers.448448+ </para>449449+ </listitem>444450 </itemizedlist>445451 </section>446452 <section xml:id="sec-release-22.11-notable-changes">
+2
nixos/doc/manual/release-notes/rl-2211.section.md
···154154155155- `k3s` no longer supports docker as runtime due to upstream dropping support.156156157157+- `k3s` supports `clusterInit` option, and it is enabled by default, for servers.158158+157159<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->158160159161## Other Notable Changes {#sec-release-22.11-notable-changes}
+52-4
nixos/modules/services/cluster/k3s/default.nix
···2525 role = mkOption {2626 description = lib.mdDoc ''2727 Whether k3s should run as a server or agent.2828- Note that the server, by default, also runs as an agent.2828+2929+ If it's a server:3030+3131+ - By default it also runs workloads as an agent.3232+ - Starts by default as a standalone server using an embedded sqlite datastore.3333+ - Configure `clusterInit = true` to switch over to embedded etcd datastore and enable HA mode.3434+ - Configure `serverAddr` to join an already-initialized HA cluster.3535+3636+ If it's an agent:3737+3838+ - `serverAddr` is required.2939 '';3040 default = "server";3141 type = types.enum [ "server" "agent" ];···43334434 serverAddr = mkOption {4535 type = types.str;4646- description = lib.mdDoc "The k3s server to connect to. This option only makes sense for an agent.";3636+ description = lib.mdDoc ''3737+ The k3s server to connect to.3838+3939+ Servers and agents need to communicate each other. Read4040+ [the networking docs](https://rancher.com/docs/k3s/latest/en/installation/installation-requirements/#networking)4141+ to know how to configure the firewall.4242+ '';4743 example = "https://10.0.0.10:6443";4844 default = "";4545+ };4646+4747+ clusterInit = mkOption {4848+ type = types.bool;4949+ default = false;5050+ description = lib.mdDoc ''5151+ Initialize HA cluster using an embedded etcd datastore.5252+5353+ If this option is `false` and `role` is `server`5454+5555+ On a server that was using the default embedded sqlite backend,5656+ enabling this option will migrate to an embedded etcd DB.5757+5858+ If an HA cluster using the embedded etcd datastore was already initialized,5959+ this option has no effect.6060+6161+ This option only makes sense in a server that is not connecting to another server.6262+6363+ If you are configuring an HA cluster with an embedded etcd,6464+ the 1st server must have `clusterInit = true`6565+ and other servers must connect to it using `serverAddr`.6666+ '';4967 };50685169 token = mkOption {5270 type = types.str;5371 description = lib.mdDoc ''5454- The k3s token to use when connecting to the server. This option only makes sense for an agent.7272+ The k3s token to use when connecting to a server.7373+5574 WARNING: This option will expose store your token unencrypted world-readable in the nix store.5675 If this is undesired use the tokenFile option instead.5776 '';···89509051 tokenFile = mkOption {9152 type = types.nullOr types.path;9292- description = lib.mdDoc "File path containing k3s token to use when connecting to the server. This option only makes sense for an agent.";5353+ description = lib.mdDoc "File path containing k3s token to use when connecting to the server.";9354 default = null;9455 };9556···12586 assertion = cfg.role == "agent" -> cfg.configPath != null || cfg.tokenFile != null || cfg.token != "";12687 message = "token or tokenFile or configPath (with 'token' or 'token-file' keys) should be set if role is 'agent'";12788 }8989+ {9090+ assertion = cfg.role == "agent" -> !cfg.disableAgent;9191+ message = "disableAgent must be false if role is 'agent'";9292+ }9393+ {9494+ assertion = cfg.role == "agent" -> !cfg.clusterInit;9595+ message = "clusterInit must be false if role is 'agent'";9696+ }12897 ];1299813099 environment.systemPackages = [ config.services.k3s.package ];···158111 [159112 "${cfg.package}/bin/k3s ${cfg.role}"160113 ]114114+ ++ (optional cfg.clusterInit "--cluster-init")161115 ++ (optional cfg.disableAgent "--disable-agent")162116 ++ (optional (cfg.serverAddr != "") "--server ${cfg.serverAddr}")163117 ++ (optional (cfg.token != "") "--token ${cfg.token}")
+4-2
nixos/modules/services/web-apps/keycloak.nix
···2525 catAttrs2626 collect2727 splitString2828+ hasPrefix2829 ;29303031 inherit (builtins)···313312314313 http-relative-path = mkOption {315314 type = str;316316- default = "";315315+ default = "/";317316 example = "/auth";317317+ apply = x: if !(hasPrefix "/") x then "/" + x else x;318318 description = ''319319 The path relative to <literal>/</literal> for serving320320 resources.···660658 '' + ''661659 export KEYCLOAK_ADMIN=admin662660 export KEYCLOAK_ADMIN_PASSWORD=${cfg.initialAdminPassword}663663- kc.sh start661661+ kc.sh start --optimized664662 '';665663 };666664
···792792 ln -s ${bashInteractive}/bin/bash $out/bin/sh793793 '';794794795795+ # This provides the ca bundle in common locations796796+ caCertificates = runCommand "ca-certificates" { } ''797797+ # Old NixOS compatibility.798798+ ln -s ${cacert}/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/certs/ca-bundle.crt799799+ # NixOS canonical location + Debian/Ubuntu/Arch/Gentoo compatibility.800800+ ln -s ${cacert}/etc/ssl/certs/ca-bundle.crt $out/etc/ssl/certs/ca-certificates.crt801801+ # CentOS/Fedora compatibility.802802+ ln -s ${cacert}/etc/ssl/certs/ca-bundle.crt $out/etc/pki/tls/certs/ca-bundle.crt803803+ '';804804+795805 # Build an image and populate its nix database with the provided796806 # contents. The main purpose is to be able to use nix commands in797807 # the container.
···1212 };1313 inherit version;1414 defaultVersion = with versions; switch coq.version [1515- { case = range "8.10" "8.15"; out = "1.0.1"; }1515+ { case = isGe "8.10" ; out = "1.0.1"; }1616 { case = range "8.5" "8.14"; out = "1.0.0"; }1717 ] null;1818
···1919 owner = "math-comp";2020 withDoc = single && (args.withDoc or false);2121 defaultVersion = with versions; switch coq.coq-version [2222+ { case = range "8.14" "8.16"; out = "1.15.0"; }2223 { case = range "8.11" "8.15"; out = "1.14.0"; }2324 { case = range "8.11" "8.15"; out = "1.13.0"; }2425 { case = range "8.10" "8.13"; out = "1.12.0"; }···3130 { case = range "8.5" "8.7"; out = "1.6.4"; }3231 ] null;3332 release = {3333+ "1.15.0".sha256 = "1bp0jxl35ms54s0mdqky15w9af03f3i0n06qk12k4gw1xzvwqv21";3434 "1.14.0".sha256 = "07yamlp1c0g5nahkd2gpfhammcca74ga2s6qr7a3wm6y6j5pivk9";3535 "1.13.0".sha256 = "0j4cz2y1r1aw79snkcf1pmicgzf8swbaf9ippz0vg99a572zqzri";3636 "1.12.0".sha256 = "1ccfny1vwgmdl91kz5xlmhq4wz078xm4z5wpd0jy5rn890dx03wp";
···6677buildPythonPackage rec {88 pname = "versioneer";99- version = "0.23";99+ version = "0.24";1010 format = "setuptools";11111212 disabled = pythonOlder "3.7";13131414 src = fetchPypi {1515 inherit pname version;1616- hash = "sha256-1rbWjCmWU3NqKfGZMJ7kMG6XoPDQp47LceIckM4TIrs=";1616+ hash = "sha256-G426nlHi8OBMfoVFIW7s3qLWPhvVVpRI7mbFSffneC8=";1717 };18181919 # Couldn't get tests to work because, for instance, they used virtualenv and