2024-01-06 11:11:19 +00:00
|
|
|
# A very basic NixOS VM configuration intended for testing out the given
|
|
|
|
# workflow module. It's a good thing the baseline for the configuration is not
|
|
|
|
# tedious to set up for simpler configs like this.
|
2024-01-05 12:20:37 +00:00
|
|
|
{ workflow }:
|
|
|
|
|
|
|
|
let
|
|
|
|
pkgs = import <nixpkgs> { };
|
2024-01-12 11:24:59 +00:00
|
|
|
config' = import <config>;
|
2024-01-06 11:11:19 +00:00
|
|
|
lib = pkgs.lib.extend (import <config/lib/extras/extend-lib.nix>);
|
2024-01-05 12:20:37 +00:00
|
|
|
|
|
|
|
modules = import <config/modules/nixos> { inherit lib; isInternal = true; };
|
|
|
|
hmModules = import <config/modules/home-manager> { inherit lib; isInternal = true; };
|
2024-01-06 11:11:19 +00:00
|
|
|
extraArgs = {
|
|
|
|
nix-colors = import <nix-colors> { };
|
|
|
|
};
|
2024-01-05 12:20:37 +00:00
|
|
|
in
|
|
|
|
import <nixpkgs/nixos/lib/eval-config.nix> {
|
|
|
|
inherit lib;
|
|
|
|
modules = modules ++ [
|
|
|
|
<home-manager/nixos>
|
2024-01-06 11:11:19 +00:00
|
|
|
<disko/module.nix>
|
|
|
|
<sops-nix/modules/sops>
|
2024-01-05 12:20:37 +00:00
|
|
|
<nixos-generators/formats/vm.nix>
|
|
|
|
<nixos-generators/format-module.nix>
|
|
|
|
({ config, lib, pkgs, ... }: {
|
|
|
|
imports = [
|
|
|
|
(
|
|
|
|
let
|
|
|
|
password = "nixos";
|
|
|
|
in
|
|
|
|
lib.private.mapHomeManagerUser "alice" {
|
|
|
|
inherit password;
|
|
|
|
extraGroups = [
|
|
|
|
"wheel"
|
|
|
|
];
|
|
|
|
description = "The password is '${password}'";
|
|
|
|
isNormalUser = true;
|
|
|
|
createHome = true;
|
|
|
|
home = "/home/alice";
|
|
|
|
}
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
2024-01-06 11:11:19 +00:00
|
|
|
home-manager.sharedModules = hmModules ++ [
|
|
|
|
<sops-nix/modules/home-manager/sops.nix>
|
|
|
|
({ config, lib, ... }: {
|
|
|
|
_module.args = extraArgs;
|
2024-01-05 12:20:37 +00:00
|
|
|
|
2024-01-06 11:11:19 +00:00
|
|
|
nixpkgs.overlays = [
|
|
|
|
config'.overlays.default
|
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
_module.args = extraArgs;
|
2024-01-05 12:20:37 +00:00
|
|
|
|
|
|
|
virtualisation.qemu.options = [
|
|
|
|
"-vga virtio"
|
|
|
|
"-display gtk,gl=on"
|
|
|
|
];
|
|
|
|
|
|
|
|
workflows.workflows.${workflow}.enable = true;
|
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
config'.overlays.default
|
|
|
|
];
|
|
|
|
|
|
|
|
system.stateVersion = "23.11";
|
2024-01-06 11:11:19 +00:00
|
|
|
|
|
|
|
home-manager.useUserPackages = lib.mkDefault true;
|
|
|
|
home-manager.useGlobalPkgs = lib.mkDefault true;
|
2024-01-05 12:20:37 +00:00
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|