yes
This commit is contained in:
parent
b24763471f
commit
8d1438c222
@ -1,14 +1,17 @@
|
|||||||
{ pkgs, inputs, lib, ... }:
|
{
|
||||||
|
pkgs,
|
||||||
let
|
inputs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
username = "guest";
|
username = "guest";
|
||||||
|
|
||||||
commonModule = { config, ... }: {
|
commonModule = {config, ...}: {
|
||||||
users.users.${username} = {
|
users.users.${username} = {
|
||||||
description = "Guest";
|
description = "Guest";
|
||||||
hashedPassword = "";
|
hashedPassword = "";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = [ "wheel" ];
|
extraGroups = ["wheel"];
|
||||||
};
|
};
|
||||||
|
|
||||||
security.sudo.wheelNeedsPassword = false;
|
security.sudo.wheelNeedsPassword = false;
|
||||||
@ -25,83 +28,83 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
autoload = builtins.concatLists
|
autoload =
|
||||||
|
builtins.concatLists
|
||||||
(lib.mapAttrsToList
|
(lib.mapAttrsToList
|
||||||
(name: _:
|
(
|
||||||
let testbed = {
|
name: _: let
|
||||||
inherit name;
|
testbed = {
|
||||||
module = "${inputs.self}/modules/${name}/testbed.nix";
|
inherit name;
|
||||||
};
|
module = "${inputs.self}/modules/${name}/testbed.nix";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
lib.optional (builtins.pathExists testbed.module) testbed
|
lib.optional (builtins.pathExists testbed.module) testbed
|
||||||
)
|
)
|
||||||
(builtins.readDir "${inputs.self}/modules"));
|
(builtins.readDir "${inputs.self}/modules"));
|
||||||
|
|
||||||
makeTestbed =
|
makeTestbed = testbed: stylix: let
|
||||||
testbed: stylix:
|
name = "testbed-${testbed.name}-${stylix.polarity}";
|
||||||
let
|
|
||||||
name = "testbed-${testbed.name}-${stylix.polarity}";
|
|
||||||
|
|
||||||
system = lib.nixosSystem {
|
system = lib.nixosSystem {
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
commonModule
|
commonModule
|
||||||
inputs.self.nixosModules.stylix
|
inputs.self.nixosModules.stylix
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
testbed.module
|
testbed.module
|
||||||
|
|
||||||
{
|
{
|
||||||
inherit stylix;
|
inherit stylix;
|
||||||
system.name = name;
|
system.name = name;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
script = pkgs.writeShellApplication {
|
script = pkgs.writeShellApplication {
|
||||||
inherit name;
|
inherit name;
|
||||||
text = ''
|
text = ''
|
||||||
cleanup() {
|
cleanup() {
|
||||||
if rm --recursive "$directory"; then
|
if rm --recursive "$directory"; then
|
||||||
printf '%s\n' 'Virtualisation disk image removed.'
|
printf '%s\n' 'Virtualisation disk image removed.'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# We create a temporary directory rather than a temporary file, since
|
# We create a temporary directory rather than a temporary file, since
|
||||||
# temporary files are created empty and are not valid disk images.
|
# temporary files are created empty and are not valid disk images.
|
||||||
directory="$(mktemp --directory)"
|
directory="$(mktemp --directory)"
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
NIX_DISK_IMAGE="$directory/nixos.qcow2" \
|
NIX_DISK_IMAGE="$directory/nixos.qcow2" \
|
||||||
${lib.getExe system.config.system.build.vm}
|
${lib.getExe system.config.system.build.vm}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.nameValuePair name script;
|
lib.nameValuePair name script;
|
||||||
|
|
||||||
# This generates a copy of each testbed for each of the following themes.
|
# This generates a copy of each testbed for each of the following themes.
|
||||||
makeTestbeds = testbed: map (makeTestbed testbed) [
|
makeTestbeds = testbed:
|
||||||
{
|
map (makeTestbed testbed) [
|
||||||
enable = true;
|
{
|
||||||
image = pkgs.fetchurl {
|
enable = true;
|
||||||
name = "three-bicycles.jpg";
|
image = pkgs.fetchurl {
|
||||||
url = "https://unsplash.com/photos/hwLAI5lRhdM/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzYxNDcwfA&force=true";
|
name = "three-bicycles.jpg";
|
||||||
hash = "sha256-S0MumuBGJulUekoGI2oZfUa/50Jw0ZzkqDDu1nRkFUA=";
|
url = "https://unsplash.com/photos/hwLAI5lRhdM/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzYxNDcwfA&force=true";
|
||||||
};
|
hash = "sha256-S0MumuBGJulUekoGI2oZfUa/50Jw0ZzkqDDu1nRkFUA=";
|
||||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
|
};
|
||||||
polarity = "light";
|
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
|
||||||
}
|
polarity.force = "light";
|
||||||
{
|
}
|
||||||
enable = true;
|
{
|
||||||
image = pkgs.fetchurl {
|
enable = true;
|
||||||
name = "mountains.jpg";
|
image = pkgs.fetchurl {
|
||||||
url = "https://unsplash.com/photos/ZqLeQDjY6fY/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzY1NDY4fA&force=true";
|
name = "mountains.jpg";
|
||||||
hash = "sha256-Dm/0nKiTFOzNtSiARnVg7zM0J1o+EuIdUQ3OAuasM58=";
|
url = "https://unsplash.com/photos/ZqLeQDjY6fY/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzE2MzY1NDY4fA&force=true";
|
||||||
};
|
hash = "sha256-Dm/0nKiTFOzNtSiARnVg7zM0J1o+EuIdUQ3OAuasM58=";
|
||||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml";
|
};
|
||||||
polarity = "dark";
|
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml";
|
||||||
}
|
polarity.force = "dark";
|
||||||
];
|
}
|
||||||
|
];
|
||||||
in
|
in
|
||||||
lib.listToAttrs (lib.flatten (map makeTestbeds autoload))
|
lib.listToAttrs (lib.flatten (map makeTestbeds autoload))
|
||||||
|
Loading…
Reference in New Issue
Block a user