From 55e09c0ed6c1dd89e97f603fcff14e7ab55c184b Mon Sep 17 00:00:00 2001 From: klarkc Date: Wed, 21 Jun 2023 20:08:00 -0300 Subject: [PATCH] feat(recover): add recover and recover-vm --- flake.nix | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 9412ae0..2cdb779 100644 --- a/flake.nix +++ b/flake.nix @@ -12,28 +12,50 @@ nixosConfigurations = self.packages.${system}; networking = import ./networking.nix; users = import ./users.nix; - recover = inputs.nixpkgs.lib.nixosSystem - { - inherit system; - modules = - [ - inputs.microvm.nixosModules.microvm - networking - users - ]; - }; + mkSystem = options: + let + inherit (inputs.nixpkgs.lib) nixosSystem; + inherit (builtins) removeAttrs; + unmakeOverridable = r: removeAttrs r [ + "override" + "overrideDerivation" + ]; + in nixosSystem (unmakeOverridable options); + systemOptions = + let + inherit (pkgs.lib) makeOverridable; + inherit (pkgs.lib.trivial) id; + in pkgs.lib.makeOverridable id + { + inherit system; + modules = + [ + networking + users + ]; + }; + recover = mkSystem systemOptions; + recover-vm = mkSystem systemOptions.override { + modules = systemOptions.modules ++ [ + inputs.microvm.nixosModules.microvm + ]; + }; in { nixosConfigurations = { inherit recover; }; + packages.${system} = { + inherit recover; + }; + devShells.${system}.default = pkgs.mkShell { packages = let - inherit (recover.config.microvm.runner) qemu; + inherit (recover-vm.config.microvm.runner) qemu; in with pkgs; [