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 5 #335647

Draft
wants to merge 148 commits into
base: master
Choose a base branch
from
Draft
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
5eacedd
nixos/modules/installer/sd-card/sd-image.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
821eb09
nixos/modules/profiles/clone-config.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6dc7e6d
nixos/modules/profiles/hardened.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
2519576
nixos/modules/profiles/minimal.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
c361d31
nixos/modules/security/ca.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
1d49320
nixos/modules/security/chromium-suid-sandbox.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
fb512d3
nixos/modules/security/doas.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
84e1848
nixos/modules/security/duosec.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
1a1aff3
nixos/modules/security/google_oslogin.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
205f287
nixos/modules/security/lock-kernel-modules.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
1dd7463
nixos/modules/security/pam_mount.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
aebbc8e
nixos/modules/security/sudo.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
59f11f8
nixos/modules/services/cluster/corosync/default.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
96718d4
nixos/modules/services/cluster/hadoop/default.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
b259441
nixos/modules/services/cluster/hadoop/hbase.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
7a948bb
nixos/modules/services/cluster/hadoop/hdfs.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
ee6c100
nixos/modules/services/cluster/hadoop/yarn.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
4d36106
nixos/modules/services/cluster/kubernetes/addon-manager.nix: remove `…
Stunkymonkey Aug 28, 2024
473a462
nixos/modules/services/cluster/kubernetes/apiserver.nix: remove `with…
Stunkymonkey Aug 28, 2024
e0aa834
nixos/modules/services/cluster/kubernetes/controller-manager.nix: rem…
Stunkymonkey Aug 28, 2024
d8acb07
nixos/modules/services/cluster/kubernetes/default.nix: remove `with l…
Stunkymonkey Aug 28, 2024
d05c096
nixos/modules/services/cluster/kubernetes/scheduler.nix: remove `with…
Stunkymonkey Aug 28, 2024
c148403
nixos/modules/services/continuous-integration/buildbot/worker.nix: re…
Stunkymonkey Aug 28, 2024
b9dce7b
nixos/modules/services/continuous-integration/github-runner/options.n…
Stunkymonkey Aug 28, 2024
ef69e6a
nixos/modules/services/continuous-integration/github-runner/service.n…
Stunkymonkey Aug 28, 2024
41d023c
nixos/modules/services/continuous-integration/gocd-agent/default.nix:…
Stunkymonkey Aug 28, 2024
05f296d
nixos/modules/services/continuous-integration/jenkins/slave.nix: remo…
Stunkymonkey Aug 28, 2024
23eb9fc
nixos/modules/services/databases/aerospike.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
9e56f17
nixos/modules/services/databases/clickhouse.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
e8138a0
nixos/modules/services/databases/cockroachdb.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6523c71
nixos/modules/services/databases/memcached.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
3bff7bd
nixos/modules/services/databases/monetdb.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
18f05dc
nixos/modules/services/databases/mongodb.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
3f59181
nixos/modules/services/databases/redis.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
d4b766a
nixos/modules/services/desktops/deepin/dde-daemon.nix: remove `with l…
Stunkymonkey Aug 28, 2024
09cd147
nixos/modules/services/desktops/espanso.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
4bc78cc
nixos/modules/services/desktops/geoclue2.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
b96ca16
nixos/modules/services/desktops/malcontent.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
453afb5
nixos/modules/services/desktops/zeitgeist.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
9575907
nixos/modules/services/development/bloop.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
79d3e69
nixos/modules/services/development/gemstash.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
d411761
nixos/modules/services/games/mchprs.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
abe0fa5
nixos/modules/services/hardware/actkbd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
77a5175
nixos/modules/services/hardware/sane_extra_backends/brscan4.nix: remo…
Stunkymonkey Aug 28, 2024
1dcea34
nixos/modules/services/hardware/sane_extra_backends/brscan5.nix: remo…
Stunkymonkey Aug 28, 2024
4297c04
nixos/modules/services/hardware/sane_extra_backends/dsseries.nix: rem…
Stunkymonkey Aug 28, 2024
91207cb
nixos/modules/services/hardware/trezord.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
9a366bf
nixos/modules/services/hardware/usbrelayd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
bb6b91d
nixos/modules/services/home-automation/ebusd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
9de133a
nixos/modules/services/home-automation/evcc.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
a3f83e9
nixos/modules/services/networking/minidlna.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
c2425ad
nixos/modules/services/networking/miniupnpd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
39e1243
nixos/modules/services/networking/miredo.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
4e23980
nixos/modules/services/networking/mjpg-streamer.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6f59657
nixos/modules/services/networking/mmsd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
2b652e2
nixos/modules/services/networking/morty.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6514a22
nixos/modules/services/networking/mstpd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
3504816
nixos/modules/services/networking/mtprotoproxy.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
b6df135
nixos/modules/services/networking/mullvad-vpn.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
8c3676a
nixos/modules/services/networking/murmur.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
5153e7a
nixos/modules/services/networking/namecoind.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
7dd39d0
nixos/modules/services/networking/nar-serve.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
85586be
nixos/modules/services/networking/nat-iptables.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
1eef7c1
nixos/modules/services/networking/nat-nftables.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
8e0830f
nixos/modules/services/networking/nat.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
a90edb3
nixos/modules/services/networking/nats.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
b8b8525
nixos/modules/services/networking/nbd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
f58a131
nixos/modules/services/networking/ndppd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
e796057
nixos/modules/services/networking/networkd-dispatcher.nix: remove `wi…
Stunkymonkey Aug 28, 2024
b0562f8
nixos/modules/services/networking/networkmanager.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
9d09b25
nixos/modules/services/networking/nextdns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
7a04333
nixos/modules/services/networking/ngircd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
96486f6
nixos/modules/services/networking/nix-serve.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
d9eee79
nixos/modules/services/networking/nix-store-gcs-proxy.nix: remove `wi…
Stunkymonkey Aug 28, 2024
0fdb25b
nixos/modules/services/networking/nixops-dns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
29dcf0a
nixos/modules/services/networking/nncp.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
e245a9a
nixos/modules/services/networking/nntp-proxy.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
4fe3286
nixos/modules/services/networking/nomad.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
89b0777
nixos/modules/services/networking/ntopng.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
de4faf8
nixos/modules/services/networking/ocserv.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
ef86fc2
nixos/modules/services/networking/ofono.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
0d44d38
nixos/modules/services/networking/oidentd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
ec18bdb
nixos/modules/services/networking/openconnect.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
7e73ac4
nixos/modules/services/networking/openvpn.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
1666cf2
nixos/modules/services/networking/ostinato.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
0f5b6c0
nixos/modules/services/networking/owamp.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
75942d5
nixos/modules/services/networking/pdns-recursor.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
226fc21
nixos/modules/services/networking/pdnsd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
02aeb16
nixos/modules/services/networking/peroxide.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
a83a903
nixos/modules/services/networking/picosnitch.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
729f1f4
nixos/modules/services/networking/pixiecore.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
b0b1244
nixos/modules/services/networking/polipo.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
98b0883
nixos/modules/services/networking/powerdns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
11e234a
nixos/modules/services/networking/pppd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
8218720
nixos/modules/services/networking/pptpd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
89c5dfb
nixos/modules/services/networking/privoxy.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
353c889
nixos/modules/services/networking/quassel.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
1a493b8
nixos/modules/services/networking/r53-ddns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
f4938a2
nixos/modules/services/networking/radicale.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
cf7c7dd
nixos/modules/services/networking/radvd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
100d6cb
nixos/modules/services/networking/rdnssd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
cd539c6
nixos/modules/services/networking/redsocks.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
a1991ba
nixos/modules/services/networking/resilio.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
2e128c3
nixos/modules/services/networking/robustirc-bridge.nix: remove `with …
Stunkymonkey Aug 28, 2024
5259db9
nixos/modules/services/networking/routedns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
d599009
nixos/modules/services/networking/rpcbind.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
d3facf1
nixos/modules/services/networking/rxe.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
072090c
nixos/modules/services/networking/sabnzbd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
a742bc5
nixos/modules/services/networking/searx.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6945b79
nixos/modules/services/networking/shadowsocks.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
fab738a
nixos/modules/services/networking/shairport-sync.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
b1ff96d
nixos/modules/services/networking/shellhub-agent.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6d1bb6f
nixos/modules/services/networking/skydns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
a11f3b6
nixos/modules/services/networking/smartdns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
c3d3684
nixos/modules/services/networking/smokeping.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
5bfb3bd
nixos/modules/services/networking/sniproxy.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
62b4054
nixos/modules/services/networking/snowflake-proxy.nix: remove `with l…
Stunkymonkey Aug 28, 2024
754cd06
nixos/modules/services/networking/softether.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
5205463
nixos/modules/services/networking/soju.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
eed0392
nixos/modules/services/networking/spacecookie.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
0bc2444
nixos/modules/services/networking/spiped.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
17a1557
nixos/modules/services/networking/squid.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
ece4e47
nixos/modules/services/networking/sslh.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
e34bf93
nixos/modules/services/networking/stubby.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
24921a5
nixos/modules/services/networking/supplicant.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
a886180
nixos/modules/services/networking/supybot.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
86a82cd
nixos/modules/services/networking/syncplay.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
aaf8423
nixos/modules/services/networking/syncthing-relay.nix: remove `with l…
Stunkymonkey Aug 28, 2024
aff36b1
nixos/modules/services/networking/syncthing.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6381889
nixos/modules/services/networking/tailscale.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
65ccb78
nixos/modules/services/networking/tayga.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
66e2b07
nixos/modules/services/networking/tcpcrypt.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
ddbe45d
nixos/modules/services/networking/teamspeak3.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
4b490d6
nixos/modules/services/networking/teleport.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
3d4054b
nixos/modules/services/networking/tftpd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
5354fc3
nixos/modules/services/networking/thelounge.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
6f46a90
nixos/modules/services/networking/tinc.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
cc159d0
nixos/modules/services/networking/tinydns.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
13fd4cf
nixos/modules/services/networking/tinyproxy.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
cc7dcf0
nixos/modules/services/networking/tmate-ssh-server.nix: remove `with …
Stunkymonkey Aug 28, 2024
c7fd487
nixos/modules/services/networking/tox-bootstrapd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
642e1dd
nixos/modules/services/networking/tox-node.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
0cdf909
nixos/modules/services/networking/toxvpn.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
cdcc594
nixos/modules/services/networking/trickster.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
0c2fd1f
nixos/modules/services/networking/ucarp.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
cbf1486
nixos/modules/services/networking/unbound.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
98d80af
nixos/modules/services/networking/uptermd.nix: remove `with lib;`
Stunkymonkey Aug 28, 2024
203f700
nixos/modules/services/networking/v2ray.nix: remove `with lib;`
Stunkymonkey Aug 28, 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
64 changes: 30 additions & 34 deletions nixos/modules/installer/sd-card/sd-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,53 +10,49 @@
#
# The derivation for the SD image will be placed in
# config.system.build.sdImage

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

with lib;

let
rootfsImage = pkgs.callPackage ../../../lib/make-ext4-fs.nix ({
inherit (config.sdImage) storePaths;
compressImage = config.sdImage.compressImage;
populateImageCommands = config.sdImage.populateRootCommands;
volumeLabel = "NIXOS_SD";
} // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
} // lib.optionalAttrs (config.sdImage.rootPartitionUUID != null) {
uuid = config.sdImage.rootPartitionUUID;
});
in
{
imports = [
(mkRemovedOptionModule [ "sdImage" "bootPartitionID" ] "The FAT partition for SD image now only holds the Raspberry Pi firmware files. Use firmwarePartitionID to configure that partition's ID.")
(mkRemovedOptionModule [ "sdImage" "bootSize" ] "The boot files for SD image have been moved to the main ext4 partition. The FAT partition now only holds the Raspberry Pi firmware files. Changing its size may not be required.")
(lib.mkRemovedOptionModule [ "sdImage" "bootPartitionID" ] "The FAT lib.partition for SD image now only holds the Raspberry Pi firmware files. Use firmwarePartitionID to configure that lib.partition's ID.")
(lib.mkRemovedOptionModule [ "sdImage" "bootSize" ] "The boot files for SD image have been moved to the main ext4 lib.partition. The FAT lib.partition now only holds the Raspberry Pi firmware files. Changing its size may not be required.")
../../profiles/all-hardware.nix
];

options.sdImage = {
imageName = mkOption {
imageName = lib.mkOption {
default = "${config.sdImage.imageBaseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.img";
description = ''
Name of the generated image file.
'';
};

imageBaseName = mkOption {
imageBaseName = lib.mkOption {
default = "nixos-sd-image";
description = ''
Prefix of the name of the generated image file.
'';
};

storePaths = mkOption {
type = with types; listOf package;
example = literalExpression "[ pkgs.stdenv ]";
storePaths = lib.mkOption {
type = with lib.types; listOf package;
example = lib.literalExpression "[ pkgs.stdenv ]";
description = ''
Derivations to be included in the Nix store in the generated SD image.
'';
};

firmwarePartitionOffset = mkOption {
type = types.int;
firmwarePartitionOffset = lib.mkOption {
type = lib.types.int;
default = 8;
description = ''
Gap in front of the /boot/firmware partition, in mebibytes (1024×1024
Expand All @@ -71,52 +67,52 @@ in
'';
};

firmwarePartitionID = mkOption {
type = types.str;
firmwarePartitionID = lib.mkOption {
type = lib.types.str;
default = "0x2178694e";
description = ''
Volume ID for the /boot/firmware partition on the SD card. This value
must be a 32-bit hexadecimal number.
'';
};

firmwarePartitionName = mkOption {
type = types.str;
firmwarePartitionName = lib.mkOption {
type = lib.types.str;
default = "FIRMWARE";
description = ''
Name of the filesystem which holds the boot firmware.
'';
};

rootPartitionUUID = mkOption {
type = types.nullOr types.str;
rootPartitionUUID = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "14e19a7b-0ae0-484d-9d54-43bd6fdc20c7";
description = ''
UUID for the filesystem on the main NixOS partition on the SD card.
'';
};

firmwareSize = mkOption {
type = types.int;
firmwareSize = lib.mkOption {
type = lib.types.int;
# As of 2019-08-18 the Raspberry pi firmware + u-boot takes ~18MiB
default = 30;
description = ''
Size of the /boot/firmware partition, in megabytes.
'';
};

populateFirmwareCommands = mkOption {
example = literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''";
populateFirmwareCommands = lib.mkOption {
example = lib.literalExpression "'' cp \${pkgs.myBootLoader}/u-boot.bin firmware/ ''";
description = ''
Shell commands to populate the ./firmware directory.
All files in that directory are copied to the
/boot/firmware partition on the SD image.
'';
};

populateRootCommands = mkOption {
example = literalExpression "''\${config.boot.loader.generic-extlinux-compatible.populateCmd} -c \${config.system.build.toplevel} -d ./files/boot''";
populateRootCommands = lib.mkOption {
example = lib.literalExpression "''\${config.boot.loader.generic-extlinux-compatible.populateCmd} -c \${config.system.build.toplevel} -d ./files/boot''";
description = ''
Shell commands to populate the ./files directory.
All files in that directory are copied to the
Expand All @@ -125,34 +121,34 @@ in
'';
};

postBuildCommands = mkOption {
example = literalExpression "'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''";
postBuildCommands = lib.mkOption {
example = lib.literalExpression "'' dd if=\${pkgs.myBootLoader}/SPL of=$img bs=1024 seek=1 conv=notrunc ''";
default = "";
description = ''
Shell commands to run after the image is built.
Can be used for boards requiring to dd u-boot SPL before actual partitions.
'';
};

compressImage = mkOption {
type = types.bool;
compressImage = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether the SD image should be compressed using
{command}`zstd`.
'';
};

expandOnBoot = mkOption {
type = types.bool;
expandOnBoot = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to configure the sd image to expand it's partition on boot.
'';
};

nixPathRegistrationFile = mkOption {
type = types.str;
nixPathRegistrationFile = lib.mkOption {
type = lib.types.str;
default = "/nix-path-registration";
description = ''
Location of the file containing the input for nix-store --load-db once the machine has booted.
Expand Down
23 changes: 10 additions & 13 deletions nixos/modules/profiles/clone-config.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{ config, lib, pkgs, modules, ... }:

with lib;

let

# Location of the repository on the harddrive
Expand All @@ -10,29 +7,29 @@ let
# Check if the path is from the NixOS repository
isNixOSFile = path:
let s = toString path; in
removePrefix nixosPath s != s;
lib.removePrefix nixosPath s != s;

# Copy modules given as extra configuration files. Unfortunately, we
# cannot serialized attribute set given in the list of modules (that's why
# you should use files).
moduleFiles =
# FIXME: use typeOf (Nix 1.6.1).
filter (x: !isAttrs x && !lib.isFunction x) modules;
lib.filter (x: !lib.isAttrs x && !lib.isFunction x) modules;

# Partition module files because between NixOS and non-NixOS files. NixOS
# files may change if the repository is updated.
partitionedModuleFiles =
let p = partition isNixOSFile moduleFiles; in
lib.partitionedModuleFiles =
let p = lib.partition isNixOSFile moduleFiles; in
{ nixos = p.right; others = p.wrong; };

# Path transformed to be valid on the installation device. Thus the
# device configuration could be rebuild.
relocatedModuleFiles =
let
relocateNixOS = path:
"<nixpkgs/nixos" + removePrefix nixosPath (toString path) + ">";
"<nixpkgs/nixos" + lib.removePrefix nixosPath (toString path) + ">";
in
{ nixos = map relocateNixOS partitionedModuleFiles.nixos;
{ nixos = map relocateNixOS lib.partitionedModuleFiles.nixos;
others = []; # TODO: copy the modules to the install-device repository.
};

Expand All @@ -59,23 +56,23 @@ in

options = {

installer.cloneConfig = mkOption {
installer.cloneConfig = lib.mkOption {
default = true;
description = ''
Try to clone the installation-device configuration by re-using it's
profile from the list of imported modules.
'';
};

installer.cloneConfigIncludes = mkOption {
installer.cloneConfigIncludes = lib.mkOption {
default = [];
example = [ "./nixos/modules/hardware/network/rt73.nix" ];
description = ''
List of modules used to re-build this installation device profile.
'';
};

installer.cloneConfigExtra = mkOption {
installer.cloneConfigExtra = lib.mkOption {
default = "";
description = ''
Extra text to include in the cloned configuration.nix included in this
Expand All @@ -94,7 +91,7 @@ in
# Provide a mount point for nixos-install.
mkdir -p /mnt

${optionalString config.installer.cloneConfig ''
${lib.optionalString config.installer.cloneConfig ''
# Provide a configuration for the CD/DVD itself, to allow users
# to run nixos-rebuild to change the configuration of the
# running system on the CD/DVD.
Expand Down
62 changes: 29 additions & 33 deletions nixos/modules/profiles/hardened.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,34 @@
# stability. If you experience any stability issues when using the
# profile, try disabling it. If you report an issue and use this
# profile, always mention that you do.

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

with lib;

{
meta = {
maintainers = [ maintainers.joachifm maintainers.emily ];
maintainers = [ lib.maintainers.joachifm lib.maintainers.emily ];
};

boot.kernelPackages = mkDefault pkgs.linuxPackages_hardened;
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_hardened;

nix.settings.allowed-users = mkDefault [ "@users" ];
nix.settings.allowed-users = lib.mkDefault [ "@users" ];

environment.memoryAllocator.provider = mkDefault "scudo";
environment.variables.SCUDO_OPTIONS = mkDefault "ZeroContents=1";
environment.memoryAllocator.provider = lib.mkDefault "scudo";
environment.variables.SCUDO_OPTIONS = lib.mkDefault "ZeroContents=1";

security.lockKernelModules = mkDefault true;
security.lockKernelModules = lib.mkDefault true;

security.protectKernelImage = mkDefault true;
security.protectKernelImage = lib.mkDefault true;

security.allowSimultaneousMultithreading = mkDefault false;
security.allowSimultaneousMultithreading = lib.mkDefault false;

security.forcePageTableIsolation = mkDefault true;
security.forcePageTableIsolation = lib.mkDefault true;

# This is required by podman to run containers in rootless mode.
security.unprivilegedUsernsClone = mkDefault config.virtualisation.containers.enable;
security.unprivilegedUsernsClone = lib.mkDefault config.virtualisation.containers.enable;

security.virtualisation.flushL1DataCache = mkDefault "always";
security.virtualisation.flushL1DataCache = lib.mkDefault "always";

security.apparmor.enable = mkDefault true;
security.apparmor.killUnconfinedConfinables = mkDefault true;
security.apparmor.enable = lib.mkDefault true;
security.apparmor.killUnconfinedConfinables = lib.mkDefault true;

boot.kernelParams = [
# Don't merge slabs
Expand Down Expand Up @@ -83,35 +79,35 @@ with lib;
];

# Hide kptrs even for processes with CAP_SYSLOG
boot.kernel.sysctl."kernel.kptr_restrict" = mkOverride 500 2;
boot.kernel.sysctl."kernel.kptr_restrict" = lib.mkOverride 500 2;

# Disable bpf() JIT (to eliminate spray attacks)
boot.kernel.sysctl."net.core.bpf_jit_enable" = mkDefault false;
boot.kernel.sysctl."net.core.bpf_jit_enable" = lib.mkDefault false;

# Disable ftrace debugging
boot.kernel.sysctl."kernel.ftrace_enabled" = mkDefault false;
boot.kernel.sysctl."kernel.ftrace_enabled" = lib.mkDefault false;

# Enable strict reverse path filtering (that is, do not attempt to route
# packets that "obviously" do not belong to the iface's network; dropped
# packets are logged as martians).
boot.kernel.sysctl."net.ipv4.conf.all.log_martians" = mkDefault true;
boot.kernel.sysctl."net.ipv4.conf.all.rp_filter" = mkDefault "1";
boot.kernel.sysctl."net.ipv4.conf.default.log_martians" = mkDefault true;
boot.kernel.sysctl."net.ipv4.conf.default.rp_filter" = mkDefault "1";
boot.kernel.sysctl."net.ipv4.conf.all.log_martians" = lib.mkDefault true;
boot.kernel.sysctl."net.ipv4.conf.all.rp_filter" = lib.mkDefault "1";
boot.kernel.sysctl."net.ipv4.conf.default.log_martians" = lib.mkDefault true;
boot.kernel.sysctl."net.ipv4.conf.default.rp_filter" = lib.mkDefault "1";

# Ignore broadcast ICMP (mitigate SMURF)
boot.kernel.sysctl."net.ipv4.icmp_echo_ignore_broadcasts" = mkDefault true;
boot.kernel.sysctl."net.ipv4.icmp_echo_ignore_broadcasts" = lib.mkDefault true;

# Ignore incoming ICMP redirects (note: default is needed to ensure that the
# setting is applied to interfaces added after the sysctls are set)
boot.kernel.sysctl."net.ipv4.conf.all.accept_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.all.secure_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.default.accept_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.default.secure_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv6.conf.all.accept_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv6.conf.default.accept_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.all.accept_redirects" = lib.mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.all.secure_redirects" = lib.mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.default.accept_redirects" = lib.mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.default.secure_redirects" = lib.mkDefault false;
boot.kernel.sysctl."net.ipv6.conf.all.accept_redirects" = lib.mkDefault false;
boot.kernel.sysctl."net.ipv6.conf.default.accept_redirects" = lib.mkDefault false;

# Ignore outgoing ICMP redirects (this is ipv4 only)
boot.kernel.sysctl."net.ipv4.conf.all.send_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.default.send_redirects" = mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.all.send_redirects" = lib.mkDefault false;
boot.kernel.sysctl."net.ipv4.conf.default.send_redirects" = lib.mkDefault false;
}
Loading