mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-13 04:04:35 +03:00
examples/testing/nixos-integration: Add no-op validation system
There is also a minimal stage-1 validation since it's important to compare an "unconfigured" NixOS stage-1 with an "unconfigured" Mobile NixOS stage-1.
This commit is contained in:
parent
b37d79a344
commit
5317caf159
22
examples/testing/nixos-integration/configuration.nix
Normal file
22
examples/testing/nixos-integration/configuration.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
# This system is not expected to be bootable.
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "tmpfs";
|
||||||
|
fsType = "tmpfs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
boot.loader.grub.enable = false;
|
||||||
|
boot.loader.generic-extlinux-compatible.enable = false;
|
||||||
|
|
||||||
|
# Documentation build will be different, so comparing `toplevel` would fail.
|
||||||
|
# Different why? New options!
|
||||||
|
documentation.enable = lib.mkOverride 10 false;
|
||||||
|
|
||||||
|
# Unimportant, but keeps the eval log cleaner.
|
||||||
|
system.stateVersion = "22.05";
|
||||||
|
|
||||||
|
# ¯\_(ツ)_/¯
|
||||||
|
services.getty.autologinUser = "root";
|
||||||
|
}
|
52
examples/testing/nixos-integration/default.nix
Normal file
52
examples/testing/nixos-integration/default.nix
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{ pkgs ? (import ../../../pkgs.nix {})
|
||||||
|
}@args':
|
||||||
|
let args = args' // { inherit pkgs; }; in
|
||||||
|
|
||||||
|
let
|
||||||
|
eval = configuration: import (pkgs.path + "/nixos") {
|
||||||
|
configuration = {
|
||||||
|
imports = [ configuration ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# A "clean" NixOS eval
|
||||||
|
nixos-eval = eval {
|
||||||
|
imports = [
|
||||||
|
./configuration.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# A Mobile NixOS eval that should be a no-op
|
||||||
|
mobile-nixos-eval = eval {
|
||||||
|
imports = [
|
||||||
|
./configuration.nix
|
||||||
|
(import ../../../lib/configuration.nix { })
|
||||||
|
];
|
||||||
|
mobile.enable = false;
|
||||||
|
};
|
||||||
|
# A Mobile NixOS eval that should be a no-op
|
||||||
|
mobile-nixos-stage-1-eval = eval {
|
||||||
|
imports = [
|
||||||
|
./configuration.nix
|
||||||
|
(import ../../../lib/configuration.nix { })
|
||||||
|
];
|
||||||
|
mobile.enable = false;
|
||||||
|
mobile.boot.stage-1.enable = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit
|
||||||
|
nixos-eval
|
||||||
|
mobile-nixos-eval
|
||||||
|
mobile-nixos-stage-1-eval
|
||||||
|
;
|
||||||
|
|
||||||
|
# Use this output to check that the product works as expected.
|
||||||
|
# (The bogus rootfs will be overriden by the VM config.)
|
||||||
|
default =
|
||||||
|
assert nixos-eval.config.system.build.toplevel == mobile-nixos-eval.config.system.build.toplevel;
|
||||||
|
assert nixos-eval.config.system.build.vm == mobile-nixos-eval.config.system.build.vm;
|
||||||
|
mobile-nixos-eval.config.system.build.vm
|
||||||
|
;
|
||||||
|
|
||||||
|
mobile-nixos-stage-1 = mobile-nixos-stage-1-eval.config.system.build.vm;
|
||||||
|
}
|
8
examples/testing/nixos-integration/diff.sh
Executable file
8
examples/testing/nixos-integration/diff.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -p nix-diff -i bash
|
||||||
|
|
||||||
|
this_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)"
|
||||||
|
|
||||||
|
nix-diff \
|
||||||
|
"$(nix-instantiate "$this_dir"/default.nix -A nixos-eval.config.system.build.toplevel)" \
|
||||||
|
"$(nix-instantiate "$this_dir"/default.nix -A mobile-nixos-eval.config.system.build.toplevel)"
|
Loading…
Reference in New Issue
Block a user