Skip to content

Commit 4d8e7c4

Browse files
Merge staging-next into staging
2 parents 406fffd + c461182 commit 4d8e7c4

62 files changed

Lines changed: 1951 additions & 1342 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/tests/modules.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,10 @@ checkConfigError 'In module .*/options-type-error-configuration.nix: expected an
717717
# Check that that merging of option collisions doesn't depend on type being set
718718
checkConfigError 'The option .group..*would be a parent of the following options, but its type .<no description>. does not support nested options.\n\s*- option.s. with prefix .group.enable..*' config.group.enable ./merge-typeless-option.nix
719719

720+
# types.optionDeclaration
721+
checkConfigOutput '^10$' config.anOption ./option.nix
722+
checkConfigError 'A definition for option .aBadOptionDef. is not of type .option declaration.' config.aBadOptionDef ./option.nix
723+
720724
# Test that types.optionType merges types correctly
721725
checkConfigOutput '^10$' config.theOption.int ./optionTypeMerging.nix
722726
checkConfigOutput '^"hello"$' config.theOption.str ./optionTypeMerging.nix

lib/tests/modules/option.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
config,
3+
lib,
4+
options,
5+
...
6+
}:
7+
{
8+
options = {
9+
theOption = lib.mkOption {
10+
type = lib.types.optionDeclaration;
11+
};
12+
anOption = config.theOption;
13+
aBadOptionDef = lib.mkOption {
14+
type = lib.types.optionDeclaration;
15+
description = ''
16+
This option is perfectly fine, but will have a bad definition.
17+
'';
18+
};
19+
};
20+
config = {
21+
theOption = lib.mkOption {
22+
type = lib.types.int;
23+
};
24+
anOption = 10;
25+
aBadOptionDef = options.theOption; # Not a declaration
26+
};
27+
}

lib/types.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,13 @@ rec {
11801180
};
11811181
};
11821182

1183+
optionDeclaration = mkOptionType {
1184+
name = "optionDeclaration";
1185+
description = "option declaration";
1186+
descriptionClass = "noun";
1187+
check = opt: isType "option" opt && !(opt ? value);
1188+
};
1189+
11831190
# The type of a type!
11841191
optionType = mkOptionType {
11851192
name = "optionType";

maintainers/maintainer-list.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19104,6 +19104,12 @@
1910419104
githubId = 349360;
1910519105
name = "Brandon Bennett";
1910619106
};
19107+
neo = {
19108+
github = "chojs23";
19109+
githubId = 55792153;
19110+
name = "neo";
19111+
email = "chojs990222@gmail.com";
19112+
};
1910719113
neosimsim = {
1910819114
email = "me@abn.sh";
1910919115
github = "neosimsim";

nixos/doc/manual/development/option-types.section.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,22 @@ Users must still be careful about how they reference these paths.
137137
multiple option definitions are correctly merged together. The main use
138138
case is as the type of the `_module.freeformType` option.
139139

140+
`types.optionDeclaration`
141+
142+
: The type of a module system option declaration, as created by `lib.mkOption`.
143+
This allows an option to hold another option declaration as its value, which
144+
can then be spliced into a module's `options` attrset. Note that this only
145+
accepts option declarations, not evaluated options (i.e. options that have
146+
been processed by `evalModules` and have a `value` field).
147+
148+
::: {.warning}
149+
Use of this type is a form of metaprogramming that makes modules harder
150+
to reason about, since options and their types become dynamic values
151+
rather than statically declared structure. Prefer conventional module
152+
patterns where possible, and only reach for `types.optionDeclaration` when the
153+
added complexity is justified.
154+
:::
155+
140156
`types.attrs`
141157

142158
: A free-form attribute set.

nixos/modules/programs/nix-required-mounts.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ let
4343
the `paths` contain symlinks. This may not work correctly with glob
4444
patterns.
4545
'';
46+
options.safePrefixes = lib.mkOption {
47+
default = [ builtins.storeDir ];
48+
type = listOf path;
49+
description = "A list of path prefixes that do not need and shall not be searched recursively for further symlink targets. Everything in the nix store does not need to be searched as the derivation already calculcated the full closure of all nix store paths for the drivers package.";
50+
};
4651
}
4752
);
4853

nixos/modules/services/misc/recyclarr.nix

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let
1010
cfg = config.services.recyclarr;
1111
format = pkgs.formats.yaml { };
1212
stateDir = "/var/lib/recyclarr";
13-
configPath = "${stateDir}/config.json";
13+
configPath = "${stateDir}/config.yml";
1414
secretsReplacement = utils.genJqSecretsReplacement {
1515
loadCredential = true;
1616
} cfg.configuration configPath;
@@ -25,24 +25,24 @@ in
2525
type = format.type;
2626
default = { };
2727
example = {
28-
sonarr = [
29-
{
28+
sonarr = {
29+
sonarr-main = {
3030
instance_name = "main";
3131
base_url = "http://localhost:8989";
3232
api_key = {
3333
_secret = "/run/credentials/recyclarr.service/sonarr-api_key";
3434
};
35-
}
36-
];
37-
radarr = [
38-
{
35+
};
36+
};
37+
radarr = {
38+
radarr-main = {
3939
instance_name = "main";
4040
base_url = "http://localhost:7878";
4141
api_key = {
4242
_secret = "/run/credentials/recyclarr.service/radarr-api_key";
4343
};
44-
}
45-
];
44+
};
45+
};
4646
};
4747
description = ''
4848
Recyclarr YAML configuration as a Nix attribute set.
@@ -98,15 +98,18 @@ in
9898
systemd.services.recyclarr = {
9999
description = "Recyclarr Service";
100100

101-
# YAML is a JSON super-set
102101
preStart = secretsReplacement.script;
103102

104103
serviceConfig = {
105104
Type = "oneshot";
106105
User = cfg.user;
107106
Group = cfg.group;
108107
StateDirectory = "recyclarr";
109-
ExecStart = "${lib.getExe cfg.package} ${cfg.command} --app-data ${stateDir} --config ${configPath}";
108+
Environment = [
109+
"RECYCLARR_CONFIG_DIR=${stateDir}"
110+
"RECYCLARR_DATA_DIR=${stateDir}"
111+
];
112+
ExecStart = "${lib.getExe cfg.package} ${cfg.command} --config ${configPath}";
110113
LoadCredential = secretsReplacement.credentials;
111114

112115
ProtectSystem = "strict";
@@ -151,4 +154,6 @@ in
151154
};
152155
};
153156
};
157+
158+
meta.maintainers = [ lib.maintainers.josephst ];
154159
}

nixos/tests/all-tests.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,7 @@ in
14771477
smokeping = runTest ./smokeping.nix;
14781478
snapcast = runTest ./snapcast.nix;
14791479
snapper = runTest ./snapper.nix;
1480+
snid = runTest ./snid.nix;
14801481
snipe-it = runTest ./web-apps/snipe-it.nix;
14811482
snips-sh = runTest ./snips-sh.nix;
14821483
snmpd = runTest ./snmpd.nix;

nixos/tests/snid.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{ lib, ... }:
2+
{
3+
_class = "nixosTest";
4+
name = "snid";
5+
6+
nodes = {
7+
machine =
8+
{ pkgs, ... }:
9+
{
10+
system.services.snid = {
11+
imports = [ pkgs.snid.services.default ];
12+
snid = {
13+
listen = [ "tcp:8443" ];
14+
mode = "tcp";
15+
backendCidrs = [ "127.0.0.0/8" ];
16+
};
17+
};
18+
19+
networking.firewall.allowedTCPPorts = [ 8443 ];
20+
};
21+
};
22+
23+
testScript = ''
24+
start_all()
25+
machine.wait_for_unit("multi-user.target")
26+
machine.wait_for_unit("snid.service")
27+
machine.wait_for_open_port(8443)
28+
'';
29+
30+
meta.maintainers = with lib.maintainers; [ tomfitzhenry ];
31+
}

pkgs/by-name/be/beans/package.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
lib,
33
buildGoModule,
44
fetchFromGitHub,
5+
installShellFiles,
6+
stdenv,
57
versionCheckHook,
68
}:
79

@@ -18,13 +20,22 @@ buildGoModule (finalAttrs: {
1820

1921
vendorHash = "sha256-TprfPZ/clb7PLMAkxF0y78bCef4XarhgHlIhIPn1nQA=";
2022

23+
nativeBuildInputs = [ installShellFiles ];
24+
2125
ldflags = [
2226
"-s"
2327
"-X github.com/hmans/beans/cmd.version=${finalAttrs.version}"
2428
"-X github.com/hmans/beans/cmd.commit=${finalAttrs.src.rev}"
2529
"-X github.com/hmans/beans/cmd.date=unknown"
2630
];
2731

32+
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
33+
installShellCompletion --cmd beans \
34+
--bash <($out/bin/beans completion bash) \
35+
--fish <($out/bin/beans completion fish) \
36+
--zsh <($out/bin/beans completion zsh)
37+
'';
38+
2839
doInstallCheck = true;
2940
nativeInstallCheckInputs = [ versionCheckHook ];
3041
versionCheckProgramArg = "version";

0 commit comments

Comments
 (0)