summaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2020-09-10 23:12:58 -0700
committerCole Helbling <cole.e.helbling@outlook.com>2020-09-17 11:44:47 -0700
commite26b348689f64832dee634dea20f4bbf76340aed (patch)
tree534c7439971d9b989caeeb2fa6aea5b286b7b788 /flake.nix
parent98a3c772969e1432bb4caeb6d40a9e0cce8b57bd (diff)
nixos-rebuild: add flake support for build-vm
This relies on users using `nixpkgs.lib.nixosSystem` to define their system; otherwise, the `vm` and `vmWithBootLoader` attributes will not exist.
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix26
1 files changed, 23 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index e7c04417ac81..8440c460b16c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -5,7 +5,6 @@
outputs = { self }:
let
-
jobs = import ./pkgs/top-level/release.nix {
nixpkgs = self;
};
@@ -28,10 +27,31 @@
lib = lib.extend (final: prev: {
nixosSystem = { modules, ... } @ args:
import ./nixos/lib/eval-config.nix (args // {
- modules = modules ++
- [ { system.nixos.versionSuffix =
+ modules =
+ let
+ vmConfig = (import ./nixos/lib/eval-config.nix
+ (args // {
+ modules = modules ++ [ ./nixos/modules/virtualisation/qemu-vm.nix ];
+ })).config;
+
+ vmWithBootLoaderConfig = (import ./nixos/lib/eval-config.nix
+ (args // {
+ modules = modules ++ [
+ ./nixos/modules/virtualisation/qemu-vm.nix
+ { virtualisation.useBootLoader = true; }
+ ];
+ })).config;
+ in
+ modules ++ [
+ {
+ system.nixos.versionSuffix =
".${final.substring 0 8 (self.lastModifiedDate or self.lastModified)}.${self.shortRev or "dirty"}";
system.nixos.revision = final.mkIf (self ? rev) self.rev;
+
+ system.build = {
+ vm = vmConfig.system.build.vm;
+ vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
+ };
}
];
});