Skip to content

Commit

Permalink
Merge branch 'NixOS:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
fe2-Nyxar authored Nov 24, 2024
2 parents f52eb3c + 8ccdb34 commit 15d0ed5
Show file tree
Hide file tree
Showing 275 changed files with 5,028 additions and 16,616 deletions.
4 changes: 0 additions & 4 deletions doc/build-helpers/trivial-build-helpers.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,6 @@ This creates a derivation with a directory structure like the following:
...
```

## `writeReferencesToFile` {#trivial-builder-writeReferencesToFile}

Deprecated. Use [`writeClosure`](#trivial-builder-writeClosure) instead.

## `writeClosure` {#trivial-builder-writeClosure}

Given a list of [store paths](https://nixos.org/manual/nix/stable/glossary#gloss-store-path) (or string-like expressions coercible to store paths), write their collective [closure](https://nixos.org/manual/nix/stable/glossary#gloss-closure) to a text file.
Expand Down
6 changes: 2 additions & 4 deletions doc/redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -1421,11 +1421,9 @@
"trivial-builder-symlinkJoin": [
"index.html#trivial-builder-symlinkJoin"
],
"trivial-builder-writeReferencesToFile": [
"index.html#trivial-builder-writeReferencesToFile"
],
"trivial-builder-writeClosure": [
"index.html#trivial-builder-writeClosure"
"index.html#trivial-builder-writeClosure",
"index.html#trivial-builder-writeReferencesToFile"
],
"trivial-builder-writeDirectReferencesToFile": [
"index.html#trivial-builder-writeDirectReferencesToFile"
Expand Down
2 changes: 1 addition & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ let
scrubOptionValue literalExpression literalExample
showOption showOptionWithDefLocs showFiles
unknownModule mkOption mkPackageOption mkPackageOptionMD
mdDoc literalMD;
literalMD;
inherit (self.types) isType setType defaultTypeMerge defaultFunctor
isOptionType mkOptionType;
inherit (self.asserts)
Expand Down
7 changes: 0 additions & 7 deletions lib/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,6 @@ rec {

literalExample = lib.warn "lib.literalExample is deprecated, use lib.literalExpression instead, or use lib.literalMD for a non-Nix description." literalExpression;

/* Transition marker for documentation that's already migrated to markdown
syntax. Has been a no-op for some while and been removed from nixpkgs.
Kept here to alert downstream users who may not be aware of the migration's
completion that it should be removed from modules.
*/
mdDoc = lib.warn "lib.mdDoc will be removed from nixpkgs in 24.11. Option descriptions are now in Markdown by default; you can remove any remaining uses of lib.mdDoc.";

/* For use in the `defaultText` and `example` option attributes. Causes the
given MD text to be inserted verbatim in the documentation, for when
a `literalExpression` would be too hard to read.
Expand Down
4 changes: 4 additions & 0 deletions lib/tests/modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ checkConfigError 'The option .theOption.nested. in .other.nix. is already declar
# Test that types.optionType leaves types untouched as long as they don't need to be merged
checkConfigOutput 'ok' config.freeformItems.foo.bar ./adhoc-freeformType-survives-type-merge.nix

# Test that specifying both functor.wrapped and functor.payload isn't allowed
checkConfigError 'Type foo defines both `functor.payload` and `functor.wrapped` at the same time, which is not supported.' config.result ./default-type-merge-both.nix


# Anonymous submodules don't get nixed by import resolution/deduplication
# because of an `extendModules` bug, issue 168767.
checkConfigOutput '^1$' config.sub.specialisation.value ./extendModules-168767-imports.nix
Expand Down
28 changes: 28 additions & 0 deletions lib/tests/modules/default-type-merge-both.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ lib, options, ... }:
let
foo = lib.mkOptionType {
name = "foo";
functor = lib.types.defaultFunctor "foo" // {
wrapped = lib.types.int;
payload = 10;
};
};
in
{
imports = [
{
options.foo = lib.mkOption {
type = foo;
};
}
{
options.foo = lib.mkOption {
type = foo;
};
}
];

options.result = lib.mkOption {
default = builtins.seq options.foo null;
};
}
42 changes: 28 additions & 14 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,37 @@ rec {
# Default type merging function
# takes two type functors and return the merged type
defaultTypeMerge = f: f':
let wrapped = f.wrapped.typeMerge f'.wrapped.functor;
payload = f.binOp f.payload f'.payload;
let mergedWrapped = f.wrapped.typeMerge f'.wrapped.functor;
mergedPayload = f.binOp f.payload f'.payload;

hasPayload = assert (f'.payload != null) == (f.payload != null); f.payload != null;
hasWrapped = assert (f'.wrapped != null) == (f.wrapped != null); f.wrapped != null;
in
# cannot merge different types
# Abort early: cannot merge different types
if f.name != f'.name
then null
# simple types
else if (f.wrapped == null && f'.wrapped == null)
&& (f.payload == null && f'.payload == null)
then f.type
# composed types
else if (f.wrapped != null && f'.wrapped != null) && (wrapped != null)
then f.type wrapped
# value types
else if (f.payload != null && f'.payload != null) && (payload != null)
then f.type payload
else null;
else

if hasPayload then
if hasWrapped then
# Has both wrapped and payload
throw ''
Type ${f.name} defines both `functor.payload` and `functor.wrapped` at the same time, which is not supported.
Use either `functor.payload` or `functor.wrapped` but not both.
If your code worked before remove `functor.payload` from the type definition.
''
else
# Has payload
if mergedPayload == null then null else f.type mergedPayload
else
if hasWrapped then
# Has wrapped
# TODO(@hsjobeki): This could also be a warning and removed in the future
if mergedWrapped == null then null else f.type mergedWrapped
else
f.type;

# Default type functor
defaultFunctor = name: {
Expand Down
9 changes: 7 additions & 2 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4987,8 +4987,7 @@
githubId = 28595242;
name = "DataHearth";
keys = [
{ fingerprint = "A129 2547 0298 BFEE 7EE0 92B3 946E 2D0C 410C 7B3D"; }
{ fingerprint = "FFC4 92C1 5320 B05D 0F8D 7D58 ABF6 737C 6339 6D35"; }
{ fingerprint = "E8F9 0B80 908E 723D 0EDF 0916 5803 CDA5 9C26 A96A"; }
];
};
davegallant = {
Expand Down Expand Up @@ -11438,6 +11437,12 @@
githubId = 15373888;
name = "Claudius Holeksa";
};
keller00 = {
name = "Mark Keller";
email = "[email protected]";
github = "keller00";
githubId = 8452750;
};
kennyballou = {
email = "[email protected]";
github = "kennyballou";
Expand Down
4 changes: 4 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@
rather than dotnet 6. For packages that still need dotnet 6, use
`dotnet-sdk_6`, etc.

- torq has been removed because upstreamed went closed source.

## Other Notable Changes {#sec-release-24.11-notable-changes}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
Expand Down Expand Up @@ -867,6 +869,8 @@

- The `shadowstack` hardening flag has been added, though disabled by default.

- `writeReferencesToFile` has been removed after its deprecation in 24.05. Use the trivial build helper `writeClosure` instead.

- `xxd` is now provided by the `tinyxxd` package rather than `vim.xxd` to reduce closure size and vulnerability impact. Since it has the same options and semantics as Vim's `xxd` utility, there is no user impact. Vim's `xxd` remains available as the `vim.xxd` package.

- `restic` module now has an option for inhibiting system sleep while backups are running, defaulting to off (not inhibiting sleep). Available as [`services.restic.backups.<name>.inhibitsSleep`](#opt-services.restic.backups._name_.inhibitsSleep).
Expand Down
16 changes: 0 additions & 16 deletions nixos/lib/make-options-doc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
}
```
## optionsDocBook
deprecated since 23.11 and will be removed in 24.05.
## optionsAsciiDoc
Documentation rendered as AsciiDoc. This is useful for e.g. man pages.
Expand Down Expand Up @@ -111,18 +107,8 @@
# instead of printing warnings for eg options with missing descriptions (which may be lost
# by nix build unless -L is given), emit errors instead and fail the build
, warningsAreErrors ? true
# allow docbook option docs if `true`. only markdown documentation is allowed when set to
# `false`, and a different renderer may be used with different bugs and performance
# characteristics but (hopefully) indistinguishable output.
# deprecated since 23.11.
# TODO remove in a while.
, allowDocBook ? false
# TODO remove in a while (see https://github.com/NixOS/nixpkgs/issues/300735)
, markdownByDefault ? true
}:

assert markdownByDefault && ! allowDocBook;

let
rawOpts = lib.optionAttrSetToDocList options;
transformedOpts = map transformOptions rawOpts;
Expand Down Expand Up @@ -229,6 +215,4 @@ in rec {
echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products
echo "file json-br $dst/options.json.br" >> $out/nix-support/hydra-build-products
'';

optionsDocBook = throw "optionsDocBook has been removed in 24.05";
}
9 changes: 0 additions & 9 deletions nixos/modules/programs/screen.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ in
};

config = lib.mkMerge [
{
# TODO: Added in 24.05, remove before 24.11
assertions = [
{
assertion = cfg.screenrc != "" -> cfg.enable;
message = "`programs.screen.screenrc` has been configured, but `programs.screen.enable` is not true";
}
];
}
(lib.mkIf cfg.enable {
environment.etc.screenrc = {
text = cfg.screenrc;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/rename.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ in
(mkRemovedOptionModule [ "services" "mailpile" ] "The corresponding package was removed from nixpkgs.")
(mkRemovedOptionModule [ "services" "marathon" ] "The corresponding package was removed from nixpkgs.")
(mkRemovedOptionModule [ "services" "mathics" ] "The Mathics module has been removed")
(mkRemovedOptionModule [ "services" "matrix-sliding-sync" ] "The matrix-sliding-sync package has been removed, since matrix-synapse incorporated its functionality. Simply remove `services.sliding-sync` from your NixOS Configuration, and the `.well-known` record for `org.matrix.msc3575.proxy` from your webserver")
(mkRemovedOptionModule [ "services" "matrix-sliding-sync" ] "The matrix-sliding-sync package has been removed, since matrix-synapse incorporated its functionality. Remove `services.sliding-sync` from your NixOS Configuration, and the `.well-known` record for `org.matrix.msc3575.proxy` from your webserver")
(mkRemovedOptionModule [ "services" "meguca" ] "Use meguca has been removed from nixpkgs")
(mkRemovedOptionModule [ "services" "mesos" ] "The corresponding package was removed from nixpkgs.")
(mkRemovedOptionModule [ "services" "mxisd" ] "The mxisd module has been removed as both mxisd and ma1sd got removed.")
Expand Down
50 changes: 21 additions & 29 deletions nixos/modules/services/audio/mopidy.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
{ config, lib, pkgs, ... }:

with pkgs;
with lib;

let
uid = config.ids.uids.mopidy;
gid = config.ids.gids.mopidy;
cfg = config.services.mopidy;

mopidyConf = writeText "mopidy.conf" cfg.configuration;
mopidyConf = pkgs.writeText "mopidy.conf" cfg.configuration;

mopidyEnv = buildEnv {
name = "mopidy-with-extensions-${mopidy.version}";
mopidyEnv = pkgs.buildEnv {
name = "mopidy-with-extensions-${pkgs.mopidy.version}";
ignoreCollisions = true;
paths = closePropagation cfg.extensionPackages;
pathsToLink = [ "/${mopidyPackages.python.sitePackages}" ];
nativeBuildInputs = [ makeWrapper ];
paths = lib.closePropagation cfg.extensionPackages;
pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
makeWrapper ${mopidy}/bin/mopidy $out/bin/mopidy \
--prefix PYTHONPATH : $out/${mopidyPackages.python.sitePackages}
makeWrapper ${lib.getExe pkgs.mopidy} $out/bin/mopidy \
--prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages}
'';
};
in {
Expand All @@ -27,49 +23,47 @@ in {

services.mopidy = {

enable = mkEnableOption "Mopidy, a music player daemon";
enable = lib.mkEnableOption "Mopidy, a music player daemon";

dataDir = mkOption {
dataDir = lib.mkOption {
default = "/var/lib/mopidy";
type = types.str;
type = lib.types.str;
description = ''
The directory where Mopidy stores its state.
'';
};

extensionPackages = mkOption {
extensionPackages = lib.mkOption {
default = [];
type = types.listOf types.package;
example = literalExpression "[ pkgs.mopidy-spotify ]";
type = lib.types.listOf lib.types.package;
example = lib.literalExpression "[ pkgs.mopidy-spotify ]";
description = ''
Mopidy extensions that should be loaded by the service.
'';
};

configuration = mkOption {
configuration = lib.mkOption {
default = "";
type = types.lines;
type = lib.types.lines;
description = ''
The configuration that Mopidy should use.
'';
};

extraConfigFiles = mkOption {
extraConfigFiles = lib.mkOption {
default = [];
type = types.listOf types.str;
type = lib.types.listOf lib.types.str;
description = ''
Extra config file read by Mopidy when the service starts.
Later files in the list overrides earlier configuration.
'';
};

};

};

###### implementation

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {

systemd.tmpfiles.settings."10-mopidy".${cfg.dataDir}.d = {
user = "mopidy";
Expand All @@ -82,15 +76,15 @@ in {
wants = [ "network-online.target" ];
description = "mopidy music player daemon";
serviceConfig = {
ExecStart = "${mopidyEnv}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}";
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}";
User = "mopidy";
};
};

systemd.services.mopidy-scan = {
description = "mopidy local files scanner";
serviceConfig = {
ExecStart = "${mopidyEnv}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan";
ExecStart = "${mopidyEnv}/bin/mopidy --config ${lib.concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan";
User = "mopidy";
Type = "oneshot";
};
Expand All @@ -105,7 +99,5 @@ in {
};

users.groups.mopidy.gid = gid;

};

}
10 changes: 9 additions & 1 deletion nixos/modules/services/databases/victoriametrics.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ let
in
{
options.services.victoriametrics = {
enable = mkEnableOption "VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database.";
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to enable VictoriaMetrics in single-node mode.
VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database.
'';
};
package = mkPackageOption pkgs "victoriametrics" { };

listenAddress = mkOption {
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/desktops/pipewire/pipewire.nix
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ in {
)
config.environment.etc
)) == 1;
message = "Using `environment.etc.\"pipewire<...>\"` directly is no longer supported in 24.05. Use `services.pipewire.extraConfig` or `services.pipewire.configPackages` instead.";
message = "Using `environment.etc.\"pipewire<...>\"` directly is no longer supported. Use `services.pipewire.extraConfig` or `services.pipewire.configPackages` instead.";
}
];

Expand Down
3 changes: 0 additions & 3 deletions nixos/modules/services/games/archisteamfarm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ in
};

config = lib.mkIf cfg.enable {
# TODO: drop with 24.11
services.archisteamfarm.dataDir = lib.mkIf (lib.versionAtLeast config.system.stateVersion "24.05") (lib.mkDefault "/var/lib/asf");

users = {
users.archisteamfarm = {
home = cfg.dataDir;
Expand Down
Loading

0 comments on commit 15d0ed5

Please sign in to comment.