mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 13:15:30 +03:00

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. (branch-equivalent to commit374e6bcc40
)
90 lines
2.7 KiB
Nix
90 lines
2.7 KiB
Nix
{ lib, pkgs, ... }:
|
|
|
|
let
|
|
initrdLowerdir = pkgs.runCommand "initrd-lowerdir" { } ''
|
|
mkdir -p $out
|
|
echo "initrd" > $out/initrd.txt
|
|
'';
|
|
initrdLowerdir2 = pkgs.runCommand "initrd-lowerdir-2" { } ''
|
|
mkdir -p $out
|
|
echo "initrd2" > $out/initrd2.txt
|
|
'';
|
|
userspaceLowerdir = pkgs.runCommand "userspace-lowerdir" { } ''
|
|
mkdir -p $out
|
|
echo "userspace" > $out/userspace.txt
|
|
'';
|
|
userspaceLowerdir2 = pkgs.runCommand "userspace-lowerdir-2" { } ''
|
|
mkdir -p $out
|
|
echo "userspace2" > $out/userspace2.txt
|
|
'';
|
|
in
|
|
{
|
|
|
|
name = "writable-overlays";
|
|
|
|
meta.maintainers = with lib.maintainers; [ nikstur ];
|
|
|
|
nodes.machine =
|
|
{ config, pkgs, ... }:
|
|
{
|
|
boot.initrd.systemd.enable = true;
|
|
|
|
virtualisation.fileSystems = {
|
|
"/initrd-overlay" = {
|
|
overlay = {
|
|
lowerdir = [ initrdLowerdir ];
|
|
upperdir = "/.rw-initrd-overlay/upper";
|
|
workdir = "/.rw-initrd-overlay/work";
|
|
};
|
|
neededForBoot = true;
|
|
};
|
|
"/userspace-overlay" = {
|
|
overlay = {
|
|
lowerdir = [ userspaceLowerdir ];
|
|
upperdir = "/.rw-userspace-overlay/upper";
|
|
workdir = "/.rw-userspace-overlay/work";
|
|
};
|
|
};
|
|
"/ro-initrd-overlay" = {
|
|
overlay.lowerdir = [
|
|
initrdLowerdir
|
|
initrdLowerdir2
|
|
];
|
|
neededForBoot = true;
|
|
};
|
|
"/ro-userspace-overlay" = {
|
|
overlay.lowerdir = [
|
|
userspaceLowerdir
|
|
userspaceLowerdir2
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
machine.wait_for_unit("default.target")
|
|
|
|
with subtest("Initrd overlay"):
|
|
machine.wait_for_file("/initrd-overlay/initrd.txt", 5)
|
|
machine.succeed("touch /initrd-overlay/writable.txt")
|
|
machine.succeed("findmnt --kernel --types overlay /initrd-overlay")
|
|
|
|
with subtest("Userspace overlay"):
|
|
machine.wait_for_file("/userspace-overlay/userspace.txt", 5)
|
|
machine.succeed("touch /userspace-overlay/writable.txt")
|
|
machine.succeed("findmnt --kernel --types overlay /userspace-overlay")
|
|
|
|
with subtest("Read only initrd overlay"):
|
|
machine.wait_for_file("/ro-initrd-overlay/initrd.txt", 5)
|
|
machine.wait_for_file("/ro-initrd-overlay/initrd2.txt", 5)
|
|
machine.fail("touch /ro-initrd-overlay/not-writable.txt")
|
|
machine.succeed("findmnt --kernel --types overlay /ro-initrd-overlay")
|
|
|
|
with subtest("Read only userspace overlay"):
|
|
machine.wait_for_file("/ro-userspace-overlay/userspace.txt", 5)
|
|
machine.wait_for_file("/ro-userspace-overlay/userspace2.txt", 5)
|
|
machine.fail("touch /ro-userspace-overlay/not-writable.txt")
|
|
machine.succeed("findmnt --kernel --types overlay /ro-userspace-overlay")
|
|
'';
|
|
|
|
}
|