From c1533700f67a674e8f3c461adf98f4facf3f6961 Mon Sep 17 00:00:00 2001 From: klarkc Date: Tue, 19 Dec 2023 20:29:15 -0300 Subject: [PATCH] fix: vm generation --- flake.nix | 13 +++---------- setups/cache/default.nix | 14 ++++++++------ setups/recover/default.nix | 31 ++++++++++++++++--------------- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/flake.nix b/flake.nix index 41f992d..9fbc667 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,6 @@ # optimizations generators.inputs.nixpkgs.follows = "nixpkgs"; attic.inputs.nixpkgs.follows = "nixpkgs"; - everyday.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { self, ... }@inputs: @@ -23,18 +22,12 @@ inherit (inputs.nixpkgs.lib) nixosSystem; inherit (inputs.generators) nixosGenerate; inherit (builtins) hasAttr; + finalOptions = options // { inherit system; }; in if hasAttr "format" options then - nixosGenerate options + nixosGenerate finalOptions else - nixosSystem options; - vm = name: pkgs.writeShellApplication { - inherit name; - text = '' - export USE_TMPDIR=0 - ${self.nixosConfigurations.${name}.config.formats.vm-nogui} - ''; - }; + nixosSystem finalOptions; }; setups = import ./setups { inherit system pkgs; diff --git a/setups/cache/default.nix b/setups/cache/default.nix index c06eaa8..dc4e683 100644 --- a/setups/cache/default.nix +++ b/setups/cache/default.nix @@ -2,7 +2,7 @@ let inherit (flake.inputs.everyday.nixosModules) logger; inherit (flake.inputs.attic.nixosModules) atticd; - inherit (flake.outputs.lib) mkSystem vm; + inherit (flake.outputs.lib) mkSystem; domain = "cache.klarkc.is-a.dev"; cache-module = { config, ... }: { system.stateVersion = config.system.nixos.version; @@ -43,15 +43,17 @@ in rec { modules.cache = cache-module; + packages.cache-vm = mkSystem { + modules = with modules; [ cache ]; + format = "vm-nogui"; + }; + machines.cache_0 = mkSystem { - inherit system; - modules = [ - cache-module + modules = with modules; [ + cache { networking.hostName = "cache_0"; } ]; }; - - packages.cache-vm = vm "cache_0"; } diff --git a/setups/recover/default.nix b/setups/recover/default.nix index 35ed3ae..a2080fd 100644 --- a/setups/recover/default.nix +++ b/setups/recover/default.nix @@ -1,8 +1,8 @@ { system, pkgs, flake, ... }: let inherit (pkgs.lib) mkDefault version; - inherit (flake.outputs.lib) mkSystem vm; - recover-module = { config, ...}: { + inherit (flake.outputs.lib) mkSystem; + recover-module = { config, ... }: { system.stateVersion = config.system.nixos.version; nix = { extraOptions = '' @@ -121,23 +121,24 @@ in rec { modules.recover = recover-module; - machines.recover_0 = mkSystem { - inherit system; - modules = [ - recover-module - { - networking.hostName = "recover_0"; - } - ]; - }; - packages = { recover-efi = mkSystem { - inherit system; - modules = [ recover-module ]; + modules = with modules; [ recover ]; format = "raw-efi"; }; - recover-vm = vm "recover_0"; + recover-vm = mkSystem { + modules = with modules; [ recover ]; + format = "vm-nogui"; + }; + }; + + machines.recover_0 = mkSystem { + modules = with modules; [ + recover + { + networking.hostName = "recover_0"; + } + ]; }; }