Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide/nixos: remove with lib; part 4 #335631

Merged
merged 148 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
a15394d
nixos/iso-image: remove `with lib;`
Stunkymonkey Aug 28, 2024
e6da97a
nixos/installation-cd-graphical-base: remove `with lib;`
Stunkymonkey Aug 28, 2024
de2bbeb
nixos/installer.scan: remove `with lib;`
Stunkymonkey Aug 28, 2024
6af918a
nixos/flake: remove `with lib;`
Stunkymonkey Aug 28, 2024
609e574
nixos/nixpkgs: remove `with lib;`
Stunkymonkey Aug 28, 2024
30c85fe
nixos/wordlist: remove `with lib;`
Stunkymonkey Aug 28, 2024
c99cbe6
nixos/security: remove `with lib;`
Stunkymonkey Aug 28, 2024
b0d5545
nixos/security.pam: remove `with lib;`
Stunkymonkey Aug 28, 2024
5e67f3e
nixos/services.pgadmin: remove `with lib;`
Stunkymonkey Aug 28, 2024
02145eb
nixos/services.mysqlBackup: remove `with lib;`
Stunkymonkey Aug 28, 2024
5c0e7f7
nixos/services.postgresqlBackup: remove `with lib;`
Stunkymonkey Aug 28, 2024
dee892a
nixos/services.postgresqlWalReceiver: remove `with lib;`
Stunkymonkey Aug 28, 2024
9ad1866
nixos/services.restic.server: remove `with lib;`
Stunkymonkey Aug 28, 2024
27f54eb
nixos/services.restic.backups: remove `with lib;`
Stunkymonkey Aug 28, 2024
dfb290a
nixos/services.rsnapshot: remove `with lib;`
Stunkymonkey Aug 28, 2024
4682ba9
nixos/services.sanoid: remove `with lib;`
Stunkymonkey Aug 28, 2024
48d4627
nixos/services.snapraid: remove `with lib;`
Stunkymonkey Aug 28, 2024
8442ed3
nixos/services.syncoid: remove `with lib;`
Stunkymonkey Aug 28, 2024
e53c595
nixos/services.tarsnap: remove `with lib;`
Stunkymonkey Aug 28, 2024
8a7d699
nixos/services.zfs.autoReplication: remove `with lib;`
Stunkymonkey Aug 28, 2024
561d58c
nixos/services.zrepl: remove `with lib;`
Stunkymonkey Aug 28, 2024
bf759e5
nixos/services.erigon: remove `with lib;`
Stunkymonkey Aug 28, 2024
1674361
nixos/services.geth: remove `with lib;`
Stunkymonkey Aug 28, 2024
1a51976
nixos/services.lighthouse: remove `with lib;`
Stunkymonkey Aug 28, 2024
6ebec4f
nixos/services.k3s: remove `with lib;`
Stunkymonkey Aug 28, 2024
980a655
nixos/services.kubernetes.addons.dns: remove `with lib;`
Stunkymonkey Aug 28, 2024
7b141e6
nixos/services.pacemaker: remove `with lib;`
Stunkymonkey Aug 28, 2024
92566fa
nixos/services.patroni: remove `with lib;`
Stunkymonkey Aug 28, 2024
7e25c52
nixos/services.rke2: remove `with lib;`
Stunkymonkey Aug 28, 2024
400d31a
nixos/services.spark: remove `with lib;`
Stunkymonkey Aug 28, 2024
c37db9c
nixos/services.boinc: remove `with lib;`
Stunkymonkey Aug 28, 2024
af42ae4
nixos/services.foldingathome: remove `with lib;`
Stunkymonkey Aug 28, 2024
7108ded
nixos/services.slurm: remove `with lib;`
Stunkymonkey Aug 28, 2024
5b4982c
nixos/services.torque.mom: remove `with lib;`
Stunkymonkey Aug 28, 2024
2dc19bf
nixos/services.torque.server: remove `with lib;`
Stunkymonkey Aug 28, 2024
d43e167
nixos/services.buildbot-master: remove `with lib;`
Stunkymonkey Aug 28, 2024
7d32787
nixos/services.etcd: remove `with lib;`
Stunkymonkey Aug 28, 2024
13c9b59
nixos/services.accounts-daemon: remove `with lib;`
Stunkymonkey Aug 28, 2024
9faf712
nixos/services.bamf: remove `with lib;`
Stunkymonkey Aug 28, 2024
4b4b2cc
nixos/services.rspamd-trainer: remove `with lib;`
Stunkymonkey Aug 28, 2024
a19107d
nixos/services.rss2email: remove `with lib;`
Stunkymonkey Aug 28, 2024
691cc44
nixos/services.gitolite: remove `with lib;`
Stunkymonkey Aug 28, 2024
d70aff4
nixos/services.gogs: remove `with lib;`
Stunkymonkey Aug 28, 2024
c51036c
nixos/services.kbfs: remove `with lib;`
Stunkymonkey Aug 28, 2024
8f72002
nixos/services.kubo: remove `with lib;`
Stunkymonkey Aug 28, 2024
6bf4d51
nixos/services.litestream: remove `with lib;`
Stunkymonkey Aug 28, 2024
fb9b81c
nixos/services.moosefs: remove `with lib;`
Stunkymonkey Aug 28, 2024
808c6a9
nixos/services.netatalk: remove `with lib;`
Stunkymonkey Aug 28, 2024
e14a371
nixos/services.nfs.server: remove `with lib;`
Stunkymonkey Aug 28, 2024
6f4eeb7
nixos/services.orangefs.client: remove `with lib;`
Stunkymonkey Aug 28, 2024
23fed45
nixos/services.orangefs.server: remove `with lib;`
Stunkymonkey Aug 28, 2024
442fa2e
nixos/services.rsyncd: remove `with lib;`
Stunkymonkey Aug 28, 2024
4174027
nixos/services.samba-wsdd: remove `with lib;`
Stunkymonkey Aug 28, 2024
f0f841b
nixos/services.samba: remove `with lib;`
Stunkymonkey Aug 28, 2024
443dc60
nixos/services.tahoe: remove `with lib;`
Stunkymonkey Aug 28, 2024
43235a1
nixos/services.u9fs: remove `with lib;`
Stunkymonkey Aug 28, 2024
e71c09b
nixos/services.webdav-server-rs: remove `with lib;`
Stunkymonkey Aug 28, 2024
9ffa253
nixos/services.webdav: remove `with lib;`
Stunkymonkey Aug 28, 2024
bc58f67
nixos/services.xtreemfs: remove `with lib;`
Stunkymonkey Aug 28, 2024
76831f7
nixos/services.yandex-disk: remove `with lib;`
Stunkymonkey Aug 28, 2024
02bb53f
nixos/services._3proxy: remove `with lib;`
Stunkymonkey Aug 28, 2024
b1bbe81
nixos/services.adguardhome: remove `with lib;`
Stunkymonkey Aug 28, 2024
46dc82d
nixos/services.alice-lg: remove `with lib;`
Stunkymonkey Aug 28, 2024
d631468
nixos/services.amule: remove `with lib;`
Stunkymonkey Aug 28, 2024
681161a
nixos/services.asterisk: remove `with lib;`
Stunkymonkey Aug 28, 2024
06032d6
nixos/services.atftpd: remove `with lib;`
Stunkymonkey Aug 28, 2024
d861803
nixos/services.autossh: remove `with lib;`
Stunkymonkey Aug 28, 2024
eb8d4ed
nixos/services.avahi: remove `with lib;`
Stunkymonkey Aug 28, 2024
7da36d7
nixos/services.babeld: remove `with lib;`
Stunkymonkey Aug 28, 2024
6bf37cd
nixos/services.bee: remove `with lib;`
Stunkymonkey Aug 28, 2024
42facf7
nixos/services.biboumi: remove `with lib;`
Stunkymonkey Aug 28, 2024
9ce866b
nixos/services.bind: remove `with lib;`
Stunkymonkey Aug 28, 2024
c666e7b
nixos/services.bird-lg: remove `with lib;`
Stunkymonkey Aug 28, 2024
416649c
nixos/services.birdwatcher: remove `with lib;`
Stunkymonkey Aug 28, 2024
d9c47da
nixos/services.bitlbee: remove `with lib;`
Stunkymonkey Aug 28, 2024
939ba8a
nixos/services.blockbook-frontend: remove `with lib;`
Stunkymonkey Aug 28, 2024
8e6795a
nixos/services.blocky: remove `with lib;`
Stunkymonkey Aug 28, 2024
87c989d
nixos/services.cgit: remove `with lib;`
Stunkymonkey Aug 28, 2024
f6077c6
nixos/services.chisel-server: remove `with lib;`
Stunkymonkey Aug 28, 2024
742185f
nixos/services.cjdns: remove `with lib;`
Stunkymonkey Aug 28, 2024
a3c69c1
nixos/services.clatd: remove `with lib;`
Stunkymonkey Aug 28, 2024
14f2d0a
nixos/services.cloudflare-dyndns: remove `with lib;`
Stunkymonkey Aug 28, 2024
5506afa
nixos/services.cloudflared: remove `with lib;`
Stunkymonkey Aug 28, 2024
5438332
nixos/services.cntlm: remove `with lib;`
Stunkymonkey Aug 28, 2024
6c6b5e7
nixos/services.consul: remove `with lib;`
Stunkymonkey Aug 28, 2024
c4bbbbb
nixos/services.coredns: remove `with lib;`
Stunkymonkey Aug 28, 2024
bd2d5c8
nixos/services.corerad: remove `with lib;`
Stunkymonkey Aug 28, 2024
7fcd972
nixos/services.coturn: remove `with lib;`
Stunkymonkey Aug 28, 2024
4589149
nixos/services.create_ap: remove `with lib;`
Stunkymonkey Aug 28, 2024
657cd33
nixos/services.dante: remove `with lib;`
Stunkymonkey Aug 28, 2024
8681b42
nixos/services.ddclient: remove `with lib;`
Stunkymonkey Aug 28, 2024
630754a
nixos/networking.dhcpcd: remove `with lib;`
Stunkymonkey Aug 28, 2024
56576f9
nixos/services.dnscache: remove `with lib;`
Stunkymonkey Aug 28, 2024
3a05a07
nixos/services.dnsdist: remove `with lib;`
Stunkymonkey Aug 28, 2024
504abe1
nixos/services.dnsmasq: remove `with lib;`
Stunkymonkey Aug 28, 2024
e59cdc8
nixos/services.doh-proxy-rust: remove `with lib;`
Stunkymonkey Aug 28, 2024
aa2c039
nixos/services.ejabberd: remove `with lib;`
Stunkymonkey Aug 28, 2024
a09250d
nixos/services.envoy: remove `with lib;`
Stunkymonkey Aug 28, 2024
6233a59
nixos/services.epmd: remove `with lib;`
Stunkymonkey Aug 28, 2024
19e8895
nixos/services.eternal-terminal: remove `with lib;`
Stunkymonkey Aug 28, 2024
abc0a6e
nixos/services.expressvpn: remove `with lib;`
Stunkymonkey Aug 28, 2024
17f8650
nixos/services.ferm: remove `with lib;`
Stunkymonkey Aug 28, 2024
f12d3df
nixos/services.fireqos: remove `with lib;`
Stunkymonkey Aug 28, 2024
15edaa6
nixos/networking.firewall.iptables: remove `with lib;`
Stunkymonkey Aug 28, 2024
e915ced
nixos/networking.firewall.nftables: remove `with lib;`
Stunkymonkey Aug 28, 2024
00d0e3b
nixos/networking.firewall: remove `with lib;`
Stunkymonkey Aug 28, 2024
688b089
nixos/services.flannel: remove `with lib;`
Stunkymonkey Aug 28, 2024
a49fa6e
nixos/services.freenet: remove `with lib;`
Stunkymonkey Aug 28, 2024
7cc9538
nixos/services.freeradius: remove `with lib;`
Stunkymonkey Aug 28, 2024
fdcec05
nixos/services.frp: remove `with lib;`
Stunkymonkey Aug 28, 2024
191b68c
nixos/services.frr: remove `with lib;`
Stunkymonkey Aug 28, 2024
d090122
nixos/services.gateone: remove `with lib;`
Stunkymonkey Aug 28, 2024
0b86552
nixos/services.gdomap: remove `with lib;`
Stunkymonkey Aug 28, 2024
878c5dc
nixos/services.gitDaemon: remove `with lib;`
Stunkymonkey Aug 28, 2024
7a65f58
nixos/services.globalprotect: remove `with lib;`
Stunkymonkey Aug 28, 2024
3e72e14
nixos/services.gnunet: remove `with lib;`
Stunkymonkey Aug 28, 2024
9ca9ac0
nixos/services.go-autoconfig: remove `with lib;`
Stunkymonkey Aug 28, 2024
2ec7078
nixos/services.go-neb: remove `with lib;`
Stunkymonkey Aug 28, 2024
90a98fc
nixos/services.go-shadowsocks2: remove `with lib;`
Stunkymonkey Aug 28, 2024
a811ef8
nixos/services.gobgpd: remove `with lib;`
Stunkymonkey Aug 28, 2024
f30e72f
nixos/services.hans: remove `with lib;`
Stunkymonkey Aug 28, 2024
9ceab68
nixos/services.haproxy: remove `with lib;`
Stunkymonkey Aug 28, 2024
49224ec
nixos/services.htpdate: remove `with lib;`
Stunkymonkey Aug 28, 2024
f69dd2d
nixos/services.i2p: remove `with lib;`
Stunkymonkey Aug 28, 2024
b610b3c
nixos/services.inadyn: remove `with lib;`
Stunkymonkey Aug 28, 2024
aa27551
nixos/services.iodine: remove `with lib;`
Stunkymonkey Aug 28, 2024
050c819
nixos/services.ivpn: remove `with lib;`
Stunkymonkey Aug 28, 2024
0cca8e9
nixos/services.jicofo: remove `with lib;`
Stunkymonkey Aug 28, 2024
fee0a07
nixos/services.jigasi: remove `with lib;`
Stunkymonkey Aug 28, 2024
6c50168
nixos/services.jitsi-videobridge: remove `with lib;`
Stunkymonkey Aug 28, 2024
f3bb24e
nixos/services.jotta-cli: remove `with lib;`
Stunkymonkey Aug 28, 2024
081c71d
nixos/services.keybase: remove `with lib;`
Stunkymonkey Aug 28, 2024
0d57426
nixos/services.lambdabot: remove `with lib;`
Stunkymonkey Aug 28, 2024
196a14a
nixos/services.lldpd: remove `with lib;`
Stunkymonkey Aug 28, 2024
2e30f07
nixos/services.logmein-hamachi: remove `with lib;`
Stunkymonkey Aug 28, 2024
252e9bb
nixos/services.lxd-image-server: remove `with lib;`
Stunkymonkey Aug 28, 2024
1cd7970
nixos/services.matterbridge: remove `with lib;`
Stunkymonkey Aug 28, 2024
91cb759
nixos/boot.initrd.clevis: remove `with lib;`
Stunkymonkey Aug 28, 2024
0a51fdb
nixos/systemd.enableEmergencyMode: remove `with lib;`
Stunkymonkey Aug 28, 2024
2f7c0a1
nixos/boot.loader.efi: remove `with lib;`
Stunkymonkey Aug 28, 2024
a83ffb4
nixos/boot.tmp: remove `with lib;`
Stunkymonkey Aug 28, 2024
dd7ab59
nixos/services.nfs: remove `with lib;`
Stunkymonkey Aug 28, 2024
3cd35f7
nixos/virtualisation.docker.rootless: remove `with lib;`
Stunkymonkey Aug 28, 2024
49fe5ca
nixos/virtualisation.virtualbox.guest: remove `with lib;`
Stunkymonkey Aug 28, 2024
2175574
nixos/virtualisation.virtualbox.host: remove `with lib;`
Stunkymonkey Aug 28, 2024
7d7e294
nixos/virtualbox-image: remove `with lib;`
Stunkymonkey Aug 28, 2024
f1dfc8d
nixos/virtualisation.vmware.guest: remove `with lib;`
Stunkymonkey Aug 28, 2024
b4b8ef5
nixos/network-filesystems/samba: fix eval
Mic92 Sep 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions nixos/modules/installer/cd-dvd/installation-cd-base.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# This module contains the basic configuration for building a NixOS
# installation CD.

{ config, lib, options, pkgs, ... }:

with lib;

{
imports =
[ ./iso-image.nix
Expand Down Expand Up @@ -32,8 +28,8 @@ with lib;

# An installation media cannot tolerate a host config defined file
# system layout on a fresh machine, before it has been formatted.
swapDevices = mkImageMediaOverride [ ];
fileSystems = mkImageMediaOverride config.lib.isoFileSystems;
swapDevices = lib.mkImageMediaOverride [ ];
fileSystems = lib.mkImageMediaOverride config.lib.isoFileSystems;

boot.postBootCommands = ''
for o in $(</proc/cmdline); do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# This module contains the basic configuration for building a graphical NixOS
# installation CD.

{ lib, pkgs, ... }:

with lib;

{
imports = [ ./installation-cd-base.nix ];

Expand All @@ -26,7 +22,7 @@ with lib;

# Provide networkmanager for easy wireless configuration.
networking.networkmanager.enable = true;
networking.wireless.enable = mkImageMediaOverride false;
networking.wireless.enable = lib.mkImageMediaOverride false;

# KDE complains if power management is disabled (to be precise, if
# there is no power management backend such as upower).
Expand Down
5 changes: 1 addition & 4 deletions nixos/modules/installer/scan/detected.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# List all devices which are detected by nixos-generate-config.
# Common devices are enabled by default.
{ lib, ... }:

with lib;

{
config = mkDefault {
config = lib.mkDefault {
# Common firmware, i.e. for wifi cards
hardware.enableRedistributableFirmware = true;
};
Expand Down
27 changes: 12 additions & 15 deletions nixos/modules/misc/nixpkgs-flake.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
{ config, options, lib, pkgs, ... }:

with lib;

let
cfg = config.nixpkgs.flake;
in
{
options.nixpkgs.flake = {
source = mkOption {
source = lib.mkOption {
# In newer Nix versions, particularly with lazy trees, outPath of
# flakes becomes a Nix-language path object. We deliberately allow this
# to gracefully come through the interface in discussion with @roberth.
#
# See: https://github.com/NixOS/nixpkgs/pull/278522#discussion_r1460292639
type = types.nullOr (types.either types.str types.path);
type = lib.types.nullOr (lib.types.either lib.types.str lib.types.path);

default = null;
defaultText = "if (using nixpkgsFlake.lib.nixosSystem) then self.outPath else null";
Expand All @@ -34,8 +31,8 @@ in
'';
};

setNixPath = mkOption {
type = types.bool;
setNixPath = lib.mkOption {
type = lib.types.bool;

default = cfg.source != null;
defaultText = "config.nixpkgs.flake.source != null";
Expand All @@ -54,8 +51,8 @@ in
'';
};

setFlakeRegistry = mkOption {
type = types.bool;
setFlakeRegistry = lib.mkOption {
type = lib.types.bool;

default = cfg.source != null;
defaultText = "config.nixpkgs.flake.source != null";
Expand All @@ -75,7 +72,7 @@ in
};
};

config = mkIf (cfg.source != null) (mkMerge [
config = lib.mkIf (cfg.source != null) (lib.mkMerge [
{
assertions = [
{
Expand All @@ -87,19 +84,19 @@ in
}
];
}
(mkIf cfg.setFlakeRegistry {
nix.registry.nixpkgs.to = mkDefault {
(lib.mkIf cfg.setFlakeRegistry {
nix.registry.nixpkgs.to = lib.mkDefault {
type = "path";
path = cfg.source;
};
})
(mkIf cfg.setNixPath {
(lib.mkIf cfg.setNixPath {
# N.B. This does not include nixos-config in NIX_PATH unlike modules/config/nix-channel.nix
# because we would need some kind of evil shim taking the *calling* flake's self path,
# perhaps, to ever make that work (in order to know where the Nix expr for the system came
# from and how to call it).
nix.nixPath = mkDefault ([ "nixpkgs=flake:nixpkgs" ]
++ optional config.nix.channel.enable "/nix/var/nix/profiles/per-user/root/channels");
nix.nixPath = lib.mkDefault ([ "nixpkgs=flake:nixpkgs" ]
++ lib.optional config.nix.channel.enable "/nix/var/nix/profiles/per-user/root/channels");
})
]);
}
81 changes: 39 additions & 42 deletions nixos/modules/misc/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{ config, options, lib, pkgs, ... }:

with lib;

let
cfg = config.nixpkgs;
opt = options.nixpkgs;
Expand All @@ -19,54 +16,54 @@ let
lhs = optCall lhs_ { inherit pkgs; };
rhs = optCall rhs_ { inherit pkgs; };
in
recursiveUpdate lhs rhs //
optionalAttrs (lhs ? packageOverrides) {
lib.recursiveUpdate lhs rhs //
lib.optionalAttrs (lhs ? packageOverrides) {
packageOverrides = pkgs:
optCall lhs.packageOverrides pkgs //
optCall (attrByPath [ "packageOverrides" ] { } rhs) pkgs;
optCall (lib.attrByPath [ "packageOverrides" ] { } rhs) pkgs;
} //
optionalAttrs (lhs ? perlPackageOverrides) {
lib.optionalAttrs (lhs ? perlPackageOverrides) {
perlPackageOverrides = pkgs:
optCall lhs.perlPackageOverrides pkgs //
optCall (attrByPath [ "perlPackageOverrides" ] { } rhs) pkgs;
optCall (lib.attrByPath [ "perlPackageOverrides" ] { } rhs) pkgs;
};

configType = mkOptionType {
configType = lib.mkOptionType {
name = "nixpkgs-config";
description = "nixpkgs config";
check = x:
let traceXIfNot = c:
if c x then true
else lib.traceSeqN 1 x false;
in traceXIfNot isConfig;
merge = args: foldr (def: mergeConfig def.value) {};
merge = args: lib.foldr (def: mergeConfig def.value) {};
};

overlayType = mkOptionType {
overlayType = lib.mkOptionType {
name = "nixpkgs-overlay";
description = "nixpkgs overlay";
check = lib.isFunction;
merge = lib.mergeOneOption;
};

pkgsType = types.pkgs // {
pkgsType = lib.types.pkgs // {
# This type is only used by itself, so let's elaborate the description a bit
# for the purpose of documentation.
description = "An evaluation of Nixpkgs; the top level attribute set of packages";
};

hasBuildPlatform = opt.buildPlatform.highestPrio < (mkOptionDefault {}).priority;
hasBuildPlatform = opt.buildPlatform.highestPrio < (lib.mkOptionDefault {}).priority;
hasHostPlatform = opt.hostPlatform.isDefined;
hasPlatform = hasHostPlatform || hasBuildPlatform;

# Context for messages
hostPlatformLine = optionalString hasHostPlatform "${showOptionWithDefLocs opt.hostPlatform}";
buildPlatformLine = optionalString hasBuildPlatform "${showOptionWithDefLocs opt.buildPlatform}";
hostPlatformLine = lib.optionalString hasHostPlatform "${lib.showOptionWithDefLocs opt.hostPlatform}";
buildPlatformLine = lib.optionalString hasBuildPlatform "${lib.showOptionWithDefLocs opt.buildPlatform}";

legacyOptionsDefined =
optional (opt.localSystem.highestPrio < (mkDefault {}).priority) opt.system
++ optional (opt.localSystem.highestPrio < (mkOptionDefault {}).priority) opt.localSystem
++ optional (opt.crossSystem.highestPrio < (mkOptionDefault {}).priority) opt.crossSystem
lib.optional (opt.localSystem.highestPrio < (lib.mkDefault {}).priority) opt.system
++ lib.optional (opt.localSystem.highestPrio < (lib.mkOptionDefault {}).priority) opt.localSystem
++ lib.optional (opt.crossSystem.highestPrio < (lib.mkOptionDefault {}).priority) opt.crossSystem
;

defaultPkgs =
Expand Down Expand Up @@ -99,19 +96,19 @@ in
imports = [
./assertions.nix
./meta.nix
(mkRemovedOptionModule [ "nixpkgs" "initialSystem" ] "The NixOS options `nesting.clone` and `nesting.children` have been deleted, and replaced with named specialisation. Therefore `nixpgks.initialSystem` has no effect anymore.")
(lib.mkRemovedOptionModule [ "nixpkgs" "initialSystem" ] "The NixOS options `nesting.clone` and `nesting.children` have been deleted, and replaced with named specialisation. Therefore `nixpgks.initialSystem` has no effect lib.anymore.")
];

options.nixpkgs = {

pkgs = mkOption {
defaultText = literalExpression ''
pkgs = lib.mkOption {
defaultText = lib.literalExpression ''
import "''${nixos}/.." {
inherit (cfg) config overlays localSystem crossSystem;
}
'';
type = pkgsType;
example = literalExpression "import <nixpkgs> {}";
example = lib.literalExpression "import <nixpkgs> {}";
description = ''
If set, the pkgs argument to all NixOS modules is the value of
this option, extended with `nixpkgs.overlays`, if
Expand Down Expand Up @@ -145,9 +142,9 @@ in
'';
};

config = mkOption {
config = lib.mkOption {
default = {};
example = literalExpression
example = lib.literalExpression
''
{ allowBroken = true; allowUnfree = true; }
'';
Expand All @@ -160,9 +157,9 @@ in
'';
};

overlays = mkOption {
overlays = lib.mkOption {
default = [];
example = literalExpression
example = lib.literalExpression
''
[
(self: super: {
Expand All @@ -173,7 +170,7 @@ in
})
]
'';
type = types.listOf overlayType;
type = lib.types.listOf overlayType;
description = ''
List of overlays to apply to Nixpkgs.
This option allows modifying the Nixpkgs package set accessed through the `pkgs` module argument.
Expand All @@ -184,13 +181,13 @@ in
'';
};

hostPlatform = mkOption {
type = types.either types.str types.attrs; # TODO utilize lib.systems.parsedPlatform
hostPlatform = lib.mkOption {
type = lib.types.either lib.types.str lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
example = { system = "aarch64-linux"; };
# Make sure that the final value has all fields for sake of other modules
# referring to this. TODO make `lib.systems` itself use the module system.
apply = lib.systems.elaborate;
defaultText = literalExpression
defaultText = lib.literalExpression
''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
description = ''
Specifies the platform where the NixOS configuration will run.
Expand All @@ -201,8 +198,8 @@ in
'';
};

buildPlatform = mkOption {
type = types.either types.str types.attrs; # TODO utilize lib.systems.parsedPlatform
buildPlatform = lib.mkOption {
type = lib.types.either lib.types.str lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
default = cfg.hostPlatform;
example = { system = "x86_64-linux"; };
# Make sure that the final value has all fields for sake of other modules
Expand All @@ -212,7 +209,7 @@ in
in if lib.systems.equals elaborated cfg.hostPlatform
then cfg.hostPlatform # make identical, so that `==` equality works; see https://github.com/NixOS/nixpkgs/issues/278001
else elaborated;
defaultText = literalExpression
defaultText = lib.literalExpression
''config.nixpkgs.hostPlatform'';
description = ''
Specifies the platform on which NixOS should be built.
Expand All @@ -228,14 +225,14 @@ in
'';
};

localSystem = mkOption {
type = types.attrs; # TODO utilize lib.systems.parsedPlatform
localSystem = lib.mkOption {
type = lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
default = { inherit (cfg) system; };
example = { system = "aarch64-linux"; };
# Make sure that the final value has all fields for sake of other modules
# referring to this. TODO make `lib.systems` itself use the module system.
apply = lib.systems.elaborate;
defaultText = literalExpression
defaultText = lib.literalExpression
''(import "''${nixos}/../lib").lib.systems.examples.aarch64-multiplatform'';
description = ''
Systems with a recently generated `hardware-configuration.nix`
Expand All @@ -262,8 +259,8 @@ in
# TODO deprecate. "crossSystem" is a nonsense identifier, because "cross"
# is a relation between at least 2 systems in the context of a
# specific build step, not a single system.
crossSystem = mkOption {
type = types.nullOr types.attrs; # TODO utilize lib.systems.parsedPlatform
crossSystem = lib.mkOption {
type = lib.types.nullOr lib.types.attrs; # TODO utilize lib.systems.parsedPlatform
default = null;
example = { system = "aarch64-linux"; };
description = ''
Expand All @@ -283,8 +280,8 @@ in
'';
};

system = mkOption {
type = types.str;
system = lib.mkOption {
type = lib.types.str;
example = "i686-linux";
default =
if opt.hostPlatform.isDefined
Expand Down Expand Up @@ -372,12 +369,12 @@ in
{
assertion = constructedByMe -> hasPlatform -> legacyOptionsDefined == [];
message = ''
Your system configures nixpkgs with the platform parameter${optionalString hasBuildPlatform "s"}:
Your system configures nixpkgs with the platform parameter${lib.optionalString hasBuildPlatform "s"}:
${hostPlatformLine
}${buildPlatformLine
}
However, it also defines the legacy options:
${concatMapStrings showOptionWithDefLocs legacyOptionsDefined}
${lib.concatMapStrings lib.showOptionWithDefLocs legacyOptionsDefined}
For a future proof system configuration, we recommend to remove
the legacy definitions.
'';
Expand Down
Loading