nixos-config/apps/run-workflow-with-vm/configuration.nix
Gabriel Arazas 03590ad834
nixos/workflows: disable display manager services
This is now on the individual configurations to enable them since most
workflows are expected to be quite similar to desktop environments like from
default NixOS modules.
2024-02-15 23:14:33 +08:00

70 lines
2.2 KiB
Nix

# 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. Just take note this is
# executed on a separate directory as its own so relative paths are moot.
{ workflow, extraModules ? [ ], extraHomeModules ? [ ] }:
let
pkgs = import <nixpkgs> { };
config' = import <config> { };
lib = pkgs.lib;
in
import <nixpkgs/nixos/lib/eval-config.nix> {
inherit lib;
modules = extraModules ++ [
<config/modules/nixos>
<config/modules/nixos/_private>
<config/modules/nixos/profiles/generic.nix>
<config/modules/nixos/profiles/nix-conf.nix>
<home-manager/nixos>
<disko/module.nix>
<sops-nix/modules/sops>
<nixos-generators/formats/vm.nix>
<nixos-generators/format-module.nix>
({ config, lib, pkgs, ... }: {
imports = [
(lib.private.mapHomeManagerUser "alice" {
password = "";
extraGroups = [ "wheel" ];
description = "There is no password";
isNormalUser = true;
createHome = true;
home = "/home/alice";
})
];
config = {
# Enable the display manager of choice.
services.xserver.displayManager.gdm.enable = true;
# Configure home-manager-related stuff.
home-manager.useUserPackages = lib.mkDefault true;
home-manager.useGlobalPkgs = lib.mkDefault true;
home-manager.sharedModules = extraHomeModules ++ [
<config/modules/home-manager>
<config/modules/home-manager/_private>
<sops-nix/modules/home-manager/sops.nix>
({ config, lib, ... }: {
xdg.userDirs.createDirectories = lib.mkForce true;
_module.args.foodogsquaredLib =
import ../../lib/extras/home-manager-set.nix { inherit lib; };
})
];
# Set up our own library.
_module.args.foodogsquaredLib =
import ../../lib/extras/nixos-set.nix { inherit lib; };
# The main function of the configuration.
workflows.workflows.${workflow}.enable = true;
nixpkgs.overlays = [
config'.overlays.default
];
system.stateVersion = "23.11";
};
})
];
}