mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-15 21:41:09 +01:00
treewide: reformat nixfmt-rfc-style
Reformat repository using new nixfmt-rfc-style.
This commit is contained in:
parent
5df48c4255
commit
cba2f9ce95
1051 changed files with 37028 additions and 26594 deletions
|
|
@ -1,11 +1,17 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.podman;
|
||||
|
||||
podman-lib = import ./podman-lib.nix { inherit pkgs lib config; };
|
||||
|
||||
createQuadletSource = name: buildDef:
|
||||
createQuadletSource =
|
||||
name: buildDef:
|
||||
let
|
||||
quadlet = podman-lib.deepMerge {
|
||||
Build = {
|
||||
|
|
@ -13,7 +19,9 @@ let
|
|||
Environment = buildDef.environment;
|
||||
File = buildDef.file;
|
||||
ImageTag = [ "homemanager/${name}" ] ++ buildDef.tags;
|
||||
Label = buildDef.labels // { "nix.home-manager.managed" = true; };
|
||||
Label = buildDef.labels // {
|
||||
"nix.home-manager.managed" = true;
|
||||
};
|
||||
PodmanArgs = buildDef.extraPodmanArgs;
|
||||
SetWorkingDirectory = buildDef.workingDirectory;
|
||||
TLSVerify = buildDef.tlsVerify;
|
||||
|
|
@ -28,9 +36,12 @@ let
|
|||
TimeoutStartSec = 300;
|
||||
RemainAfterExit = "yes";
|
||||
};
|
||||
Unit = { Description = buildDef.description; };
|
||||
Unit = {
|
||||
Description = buildDef.description;
|
||||
};
|
||||
} buildDef.extraConfig;
|
||||
in {
|
||||
in
|
||||
{
|
||||
attrs = quadlet;
|
||||
text = ''
|
||||
# Automatically generated by home-manager for podman build configuration
|
||||
|
|
@ -41,133 +52,139 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
toQuadletInternal = name: buildDef:
|
||||
let src = createQuadletSource name buildDef;
|
||||
in {
|
||||
toQuadletInternal =
|
||||
name: buildDef:
|
||||
let
|
||||
src = createQuadletSource name buildDef;
|
||||
in
|
||||
{
|
||||
assertions = podman-lib.buildConfigAsserts name buildDef.extraConfig;
|
||||
serviceName =
|
||||
"podman-${name}"; # generated service name: 'podman-<name>-build.service
|
||||
serviceName = "podman-${name}"; # generated service name: 'podman-<name>-build.service
|
||||
source = podman-lib.removeBlankLines src.text;
|
||||
resourceType = "build";
|
||||
};
|
||||
in let
|
||||
buildDefinitionType = types.submodule ({ name, ... }: {
|
||||
options = {
|
||||
in
|
||||
let
|
||||
buildDefinitionType = types.submodule (
|
||||
{ name, ... }:
|
||||
{
|
||||
options = {
|
||||
|
||||
autoStart = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"Whether to start the build on boot. Requires user lingering.";
|
||||
};
|
||||
|
||||
authFile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
description = "Path of the authentication file.";
|
||||
};
|
||||
|
||||
description = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "Service for build ${name}";
|
||||
defaultText = "Service for build \${name}";
|
||||
example = "My Build";
|
||||
description = "The description of the build.";
|
||||
};
|
||||
|
||||
environment = mkOption {
|
||||
type = podman-lib.primitiveAttrs;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
VAR1 = "0:100";
|
||||
VAR2 = true;
|
||||
VAR3 = 5;
|
||||
}
|
||||
'';
|
||||
description = "Environment variables to set in the build.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = podman-lib.extraConfigType;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
Build = {
|
||||
Arch = "aarch64";
|
||||
};
|
||||
Service = {
|
||||
TimeoutStartSec = 15;
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = "INI sections and values to populate the Build Quadlet.";
|
||||
};
|
||||
|
||||
extraPodmanArgs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "--retries 5" ];
|
||||
description = "Extra arguments to pass to the podman build command.";
|
||||
};
|
||||
|
||||
file = mkOption {
|
||||
type = types.str;
|
||||
example = literalExpression ''
|
||||
`"xdg.configFile."containerfiles/my-img/Containerfile"`
|
||||
or
|
||||
`"https://github.com/.../my-img/Containerfile"`
|
||||
'';
|
||||
description =
|
||||
"Path to a Containerfile which contains instructions to build the image.";
|
||||
};
|
||||
|
||||
tags = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Name associated with the build.
|
||||
First tag will always be "homemanager/<name>".
|
||||
'';
|
||||
};
|
||||
|
||||
labels = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
example = {
|
||||
app = "myapp";
|
||||
some-label = "somelabel";
|
||||
autoStart = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to start the build on boot. Requires user lingering.";
|
||||
};
|
||||
description = "The labels to apply to the build.";
|
||||
};
|
||||
|
||||
tlsVerify = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"Require HTTPS and verification of certificates when contacting registries.";
|
||||
};
|
||||
authFile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
description = "Path of the authentication file.";
|
||||
};
|
||||
|
||||
workingDirectory = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
description = "WorkingDirectory of the systemd unit file.";
|
||||
description = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "Service for build ${name}";
|
||||
defaultText = "Service for build \${name}";
|
||||
example = "My Build";
|
||||
description = "The description of the build.";
|
||||
};
|
||||
|
||||
environment = mkOption {
|
||||
type = podman-lib.primitiveAttrs;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
VAR1 = "0:100";
|
||||
VAR2 = true;
|
||||
VAR3 = 5;
|
||||
}
|
||||
'';
|
||||
description = "Environment variables to set in the build.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = podman-lib.extraConfigType;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
Build = {
|
||||
Arch = "aarch64";
|
||||
};
|
||||
Service = {
|
||||
TimeoutStartSec = 15;
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = "INI sections and values to populate the Build Quadlet.";
|
||||
};
|
||||
|
||||
extraPodmanArgs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "--retries 5" ];
|
||||
description = "Extra arguments to pass to the podman build command.";
|
||||
};
|
||||
|
||||
file = mkOption {
|
||||
type = types.str;
|
||||
example = literalExpression ''
|
||||
`"xdg.configFile."containerfiles/my-img/Containerfile"`
|
||||
or
|
||||
`"https://github.com/.../my-img/Containerfile"`
|
||||
'';
|
||||
description = "Path to a Containerfile which contains instructions to build the image.";
|
||||
};
|
||||
|
||||
tags = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Name associated with the build.
|
||||
First tag will always be "homemanager/<name>".
|
||||
'';
|
||||
};
|
||||
|
||||
labels = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
example = {
|
||||
app = "myapp";
|
||||
some-label = "somelabel";
|
||||
};
|
||||
description = "The labels to apply to the build.";
|
||||
};
|
||||
|
||||
tlsVerify = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Require HTTPS and verification of certificates when contacting registries.";
|
||||
};
|
||||
|
||||
workingDirectory = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
description = "WorkingDirectory of the systemd unit file.";
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
in {
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
options.services.podman.builds = mkOption {
|
||||
type = types.attrsOf buildDefinitionType;
|
||||
default = { };
|
||||
description = "Defines Podman build quadlet configurations.";
|
||||
};
|
||||
|
||||
config = let buildQuadlets = mapAttrsToList toQuadletInternal cfg.builds;
|
||||
in mkIf cfg.enable {
|
||||
services.podman.internal.quadletDefinitions = buildQuadlets;
|
||||
assertions = flatten (map (build: build.assertions) buildQuadlets);
|
||||
config =
|
||||
let
|
||||
buildQuadlets = mapAttrsToList toQuadletInternal cfg.builds;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
services.podman.internal.quadletDefinitions = buildQuadlets;
|
||||
assertions = flatten (map (build: build.assertions) buildQuadlets);
|
||||
|
||||
xdg.configFile."podman/images.manifest".text =
|
||||
podman-lib.generateManifestText buildQuadlets;
|
||||
};
|
||||
xdg.configFile."podman/images.manifest".text = podman-lib.generateManifestText buildQuadlets;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue