apps/run-workflow-with-vm: add extra-config as part of include path

This commit is contained in:
Gabriel Arazas 2024-03-03 16:40:31 +08:00
parent ba6b30ca95
commit 7c34617479
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
5 changed files with 24 additions and 6 deletions

View File

@ -2,9 +2,12 @@
workflow=$1
shift 1
# shellcheck disable=SC2068
nix-build -A config.system.build.vm -k \
--argstr workflow "$workflow" \
@datadir@/@projectname@/configuration.nix \
@inputsArgs@ \
$@ \
-I extra-config=@datadir@/@projectname@ \
${NIX_EXTRA_ARGS[@]}

View File

@ -2,7 +2,7 @@
# 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 ? [ ] }:
{ workflow }:
let
pkgs = import <nixpkgs> { };
@ -14,14 +14,18 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
specialArgs = {
foodogsquaredUtils = import <config/lib/utils/nixos.nix> { inherit lib; };
};
modules = extraModules ++ [
modules = [
# You can include an extra set by setting `extra-config` as part of the
# include path. It is expected that this will not be overridden by the
# script or the build process.
<extra-config/modules/nixos>
<config/modules/nixos>
<config/modules/nixos/_private>
<config/modules/nixos/profiles/generic.nix>
<config/modules/nixos/profiles/nix-conf.nix>
<config/modules/nixos/profiles/desktop>
<home-manager/nixos>
<disko/module.nix>
<sops-nix/modules/sops>
<nixos-generators/formats/vm.nix>
<nixos-generators/format-module.nix>
({ config, lib, pkgs, foodogsquaredUtils, ... }: {
@ -43,7 +47,10 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
# Configure home-manager-related stuff.
home-manager.useUserPackages = lib.mkDefault true;
home-manager.useGlobalPkgs = lib.mkDefault true;
home-manager.sharedModules = extraHomeModules ++ [
home-manager.sharedModules = [
# Same with home-manager modules.
<extra-config/modules/nixos>
<config/modules/home-manager>
<config/modules/home-manager/_private>
<sops-nix/modules/home-manager/sops.nix>

View File

@ -29,5 +29,8 @@ configure_file(
install_data(
'./configuration.nix',
install_mode: 'r--r--r--'
'./modules/home-manager/default.nix',
'./modules/nixos/default.nix',
install_mode: 'r--r--r--',
preserve_path: true,
)

View File

@ -0,0 +1,2 @@
# It's just be empty like your soul, probably.
{ imports = [ ]; }

View File

@ -0,0 +1,3 @@
# Just an extra set of modules, if you count zero modules as one. Or I guess
# technically this is one module, just an empty one.
{ imports = [ ]; }