treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
# This module creates netboot media containing the given NixOS
|
||||
# configuration.
|
||||
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -36,43 +42,50 @@ with lib;
|
||||
# here and it causes a cyclic dependency.
|
||||
boot.loader.grub.enable = false;
|
||||
|
||||
fileSystems."/" = mkImageMediaOverride
|
||||
{ fsType = "tmpfs";
|
||||
options = [ "mode=0755" ];
|
||||
};
|
||||
fileSystems."/" = mkImageMediaOverride {
|
||||
fsType = "tmpfs";
|
||||
options = [ "mode=0755" ];
|
||||
};
|
||||
|
||||
# In stage 1, mount a tmpfs on top of /nix/store (the squashfs
|
||||
# image) to make this a live CD.
|
||||
fileSystems."/nix/.ro-store" = mkImageMediaOverride
|
||||
{ fsType = "squashfs";
|
||||
device = "../nix-store.squashfs";
|
||||
options = [ "loop" ] ++ lib.optional (config.boot.kernelPackages.kernel.kernelAtLeast "6.2") "threads=multi";
|
||||
neededForBoot = true;
|
||||
fileSystems."/nix/.ro-store" = mkImageMediaOverride {
|
||||
fsType = "squashfs";
|
||||
device = "../nix-store.squashfs";
|
||||
options = [
|
||||
"loop"
|
||||
] ++ lib.optional (config.boot.kernelPackages.kernel.kernelAtLeast "6.2") "threads=multi";
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
fileSystems."/nix/.rw-store" = mkImageMediaOverride {
|
||||
fsType = "tmpfs";
|
||||
options = [ "mode=0755" ];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
fileSystems."/nix/store" = mkImageMediaOverride {
|
||||
overlay = {
|
||||
lowerdir = [ "/nix/.ro-store" ];
|
||||
upperdir = "/nix/.rw-store/store";
|
||||
workdir = "/nix/.rw-store/work";
|
||||
};
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
fileSystems."/nix/.rw-store" = mkImageMediaOverride
|
||||
{ fsType = "tmpfs";
|
||||
options = [ "mode=0755" ];
|
||||
neededForBoot = true;
|
||||
};
|
||||
boot.initrd.availableKernelModules = [
|
||||
"squashfs"
|
||||
"overlay"
|
||||
];
|
||||
|
||||
fileSystems."/nix/store" = mkImageMediaOverride
|
||||
{ overlay = {
|
||||
lowerdir = [ "/nix/.ro-store" ];
|
||||
upperdir = "/nix/.rw-store/store";
|
||||
workdir = "/nix/.rw-store/work";
|
||||
};
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
boot.initrd.availableKernelModules = [ "squashfs" "overlay" ];
|
||||
|
||||
boot.initrd.kernelModules = [ "loop" "overlay" ];
|
||||
boot.initrd.kernelModules = [
|
||||
"loop"
|
||||
"overlay"
|
||||
];
|
||||
|
||||
# Closures to be copied to the Nix store, namely the init
|
||||
# script and the top-level system configuration directory.
|
||||
netboot.storeContents =
|
||||
[ config.system.build.toplevel ];
|
||||
netboot.storeContents = [ config.system.build.toplevel ];
|
||||
|
||||
# Create the squashfs image that contains the Nix store.
|
||||
system.build.squashfsStore = pkgs.callPackage ../../../lib/make-squashfs.nix {
|
||||
@@ -80,17 +93,17 @@ with lib;
|
||||
comp = config.netboot.squashfsCompression;
|
||||
};
|
||||
|
||||
|
||||
# Create the initrd
|
||||
system.build.netbootRamdisk = pkgs.makeInitrdNG {
|
||||
inherit (config.boot.initrd) compressor;
|
||||
prepend = [ "${config.system.build.initialRamdisk}/initrd" ];
|
||||
|
||||
contents =
|
||||
[ { source = config.system.build.squashfsStore;
|
||||
target = "/nix-store.squashfs";
|
||||
}
|
||||
];
|
||||
contents = [
|
||||
{
|
||||
source = config.system.build.squashfsStore;
|
||||
target = "/nix-store.squashfs";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" ''
|
||||
@@ -137,16 +150,18 @@ with lib;
|
||||
image.filePath = "tarball/${config.image.fileName}";
|
||||
system.nixos.tags = [ "kexec" ];
|
||||
system.build.image = config.system.build.kexecTarball;
|
||||
system.build.kexecTarball = pkgs.callPackage "${toString modulesPath}/../lib/make-system-tarball.nix" {
|
||||
fileName = config.image.baseName;
|
||||
storeContents = [
|
||||
system.build.kexecTarball =
|
||||
pkgs.callPackage "${toString modulesPath}/../lib/make-system-tarball.nix"
|
||||
{
|
||||
object = config.system.build.kexecScript;
|
||||
symlink = "/kexec_nixos";
|
||||
}
|
||||
];
|
||||
contents = [];
|
||||
};
|
||||
fileName = config.image.baseName;
|
||||
storeContents = [
|
||||
{
|
||||
object = config.system.build.kexecScript;
|
||||
symlink = "/kexec_nixos";
|
||||
}
|
||||
];
|
||||
contents = [ ];
|
||||
};
|
||||
|
||||
boot.loader.timeout = 10;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user