Skip to content

Commit 99c6360

Browse files
committed
export examples as nixosConfigurations
1 parent bc66492 commit 99c6360

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

flake.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,27 @@
88
outputs = inp:
99
let
1010
lib = inp.nixpkgs.lib;
11+
12+
inherit (lib) mapAttrs' removeSuffix makeOverridable nixosSystem mapAttrs;
13+
14+
vms = mapAttrs' (file: _: {
15+
name = removeSuffix ".nix" file;
16+
value = import (./examples + "/${file}");
17+
}) (builtins.readDir ./examples);
18+
19+
mkSystem = pkgs: config: makeOverridable nixosSystem {
20+
system = "x86_64-linux";
21+
modules = [ config ];
22+
};
23+
1124
supportedSystems = [ "x86_64-linux" ];
1225
in
26+
{
27+
nixosConfigurations = mapAttrs (_name: config: mkSystem inp.nixpkgs config) vms;
28+
}
29+
30+
//
31+
1332
lib.foldl' lib.recursiveUpdate {} (lib.forEach supportedSystems (system: rec {
1433

1534
packages."${system}".nixos-shell = import ./default.nix {

0 commit comments

Comments
 (0)