From 7c346174792f27835101f1bf3c9cfeb9febdcc17 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sun, 3 Mar 2024 16:40:31 +0800 Subject: [PATCH] apps/run-workflow-with-vm: add `extra-config` as part of include path --- apps/run-workflow-with-vm/app.sh | 3 +++ apps/run-workflow-with-vm/configuration.nix | 17 ++++++++++++----- apps/run-workflow-with-vm/meson.build | 5 ++++- .../modules/home-manager/default.nix | 2 ++ .../modules/nixos/default.nix | 3 +++ 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 apps/run-workflow-with-vm/modules/home-manager/default.nix create mode 100644 apps/run-workflow-with-vm/modules/nixos/default.nix diff --git a/apps/run-workflow-with-vm/app.sh b/apps/run-workflow-with-vm/app.sh index add5fa38..eca99875 100644 --- a/apps/run-workflow-with-vm/app.sh +++ b/apps/run-workflow-with-vm/app.sh @@ -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[@]} diff --git a/apps/run-workflow-with-vm/configuration.nix b/apps/run-workflow-with-vm/configuration.nix index a4b6b6eb..91764492 100644 --- a/apps/run-workflow-with-vm/configuration.nix +++ b/apps/run-workflow-with-vm/configuration.nix @@ -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 { }; @@ -14,14 +14,18 @@ import { specialArgs = { foodogsquaredUtils = import { 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. + + + - - ({ config, lib, pkgs, foodogsquaredUtils, ... }: { @@ -43,7 +47,10 @@ import { # 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. + + diff --git a/apps/run-workflow-with-vm/meson.build b/apps/run-workflow-with-vm/meson.build index 6b29bb41..0cbbbc04 100644 --- a/apps/run-workflow-with-vm/meson.build +++ b/apps/run-workflow-with-vm/meson.build @@ -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, ) diff --git a/apps/run-workflow-with-vm/modules/home-manager/default.nix b/apps/run-workflow-with-vm/modules/home-manager/default.nix new file mode 100644 index 00000000..cf25d998 --- /dev/null +++ b/apps/run-workflow-with-vm/modules/home-manager/default.nix @@ -0,0 +1,2 @@ +# It's just be empty like your soul, probably. +{ imports = [ ]; } diff --git a/apps/run-workflow-with-vm/modules/nixos/default.nix b/apps/run-workflow-with-vm/modules/nixos/default.nix new file mode 100644 index 00000000..9d0801c6 --- /dev/null +++ b/apps/run-workflow-with-vm/modules/nixos/default.nix @@ -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 = [ ]; }