apps/run-workflow-with-vm: update host config

This commit is contained in:
Gabriel Arazas 2024-01-06 19:11:19 +08:00
parent 1957df91ea
commit 8b1c513e7f
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -1,31 +1,25 @@
# 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.
{ workflow }: { workflow }:
let let
pkgs = import <nixpkgs> { }; pkgs = import <nixpkgs> { };
config' = import <config> { inherit pkgs; }; config' = import <config> { inherit pkgs; };
lib = pkgs.lib.extend (self: super: lib = pkgs.lib.extend (import <config/lib/extras/extend-lib.nix>);
let
publicLib = import <config/lib> { lib = super; };
in
{
inherit (publicLib) countAttrs getSecrets attachSopsPathPrefix;
# Until I figure out how to properly add them only for their respective
# environment, this is the working solution for now. Not really perfect
# since we use one nixpkgs instance for each configuration (home-manager or
# otherwise).
private = publicLib
// import <config/lib/private.nix> { lib = self; }
// import <config/lib/home-manager.nix> { lib = self; };
});
modules = import <config/modules/nixos> { inherit lib; isInternal = true; }; modules = import <config/modules/nixos> { inherit lib; isInternal = true; };
hmModules = import <config/modules/home-manager> { inherit lib; isInternal = true; }; hmModules = import <config/modules/home-manager> { inherit lib; isInternal = true; };
extraArgs = {
nix-colors = import <nix-colors> { };
};
in in
import <nixpkgs/nixos/lib/eval-config.nix> { import <nixpkgs/nixos/lib/eval-config.nix> {
inherit lib; inherit lib;
modules = modules ++ [ modules = modules ++ [
<home-manager/nixos> <home-manager/nixos>
<disko/module.nix>
<sops-nix/modules/sops>
<nixos-generators/formats/vm.nix> <nixos-generators/formats/vm.nix>
<nixos-generators/format-module.nix> <nixos-generators/format-module.nix>
({ config, lib, pkgs, ... }: { ({ config, lib, pkgs, ... }: {
@ -48,11 +42,18 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
]; ];
config = { config = {
home-manager.sharedModules = hmModules; home-manager.sharedModules = hmModules ++ [
<sops-nix/modules/home-manager/sops.nix>
({ config, lib, ... }: {
_module.args = extraArgs;
_module.args = { nixpkgs.overlays = [
nix-colors = import <nix-colors> { }; config'.overlays.default
}; ];
})
];
_module.args = extraArgs;
virtualisation.qemu.options = [ virtualisation.qemu.options = [
"-vga virtio" "-vga virtio"
@ -66,6 +67,9 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
]; ];
system.stateVersion = "23.11"; system.stateVersion = "23.11";
home-manager.useUserPackages = lib.mkDefault true;
home-manager.useGlobalPkgs = lib.mkDefault true;
}; };
}) })
]; ];