mirror of
https://github.com/0xbbjubjub/miniguest.git
synced 2024-09-11 05:55:35 +03:00
add miniguest.<guest>.system
This commit is contained in:
parent
8cd86fe145
commit
1f3ea3394e
@ -13,13 +13,13 @@
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
inputs:
|
||||
{ lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.miniguests = mkOption {
|
||||
description = "A set of NixOS configurations to be built and made available as miniguests.";
|
||||
default = { };
|
||||
type = types.attrsOf (types.submodule ({ config, options, name, ... }:
|
||||
type = types.attrsOf (types.submodule ({ options, name, ... }:
|
||||
{
|
||||
options = {
|
||||
configuration = mkOption {
|
||||
@ -32,6 +32,14 @@ with lib;
|
||||
merge = lib.options.mergeOneOption;
|
||||
};
|
||||
};
|
||||
system = mkOption {
|
||||
description = ''
|
||||
specifies the nix platform type for which the guest should be built.
|
||||
'';
|
||||
type = types.str;
|
||||
default = config.nixpkgs.initialSystem;
|
||||
defaultText = literalDocBook "same as the host";
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
|
@ -16,9 +16,9 @@ inputs@{ nixpkgs, ... }:
|
||||
{ baseModules, config, lib, pkgs, specialArgs, ... }:
|
||||
let
|
||||
hostPkgs = pkgs; # give the guest the packages from the host configuration
|
||||
mkGuest = name: configuration: nixpkgs.lib.nixosSystem {
|
||||
mkGuest = name: configuration: system: nixpkgs.lib.nixosSystem {
|
||||
inherit lib baseModules specialArgs;
|
||||
system = config.nixpkgs.initialSystem;
|
||||
inherit system;
|
||||
modules = [
|
||||
configuration
|
||||
../core
|
||||
@ -34,7 +34,7 @@ lib.mkIf (config.miniguests != { }) {
|
||||
environment.etc =
|
||||
with lib.attrsets;
|
||||
lib.flip mapAttrs' config.miniguests
|
||||
(name: { configuration, ... }: nameValuePair "miniguests/${name}" {
|
||||
source = (mkGuest name configuration).config.system.build.miniguest;
|
||||
(name: { configuration, system, ... }: nameValuePair "miniguests/${name}" {
|
||||
source = (mkGuest name configuration system).config.system.build.miniguest;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user