Skip to content

Commit

Permalink
fix: vm generation
Browse files Browse the repository at this point in the history
  • Loading branch information
klarkc committed Dec 19, 2023
1 parent 053c862 commit c153370
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
13 changes: 3 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# optimizations
generators.inputs.nixpkgs.follows = "nixpkgs";
attic.inputs.nixpkgs.follows = "nixpkgs";
everyday.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, ... }@inputs:
Expand All @@ -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;
Expand Down
14 changes: 8 additions & 6 deletions setups/cache/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
}
31 changes: 16 additions & 15 deletions setups/recover/default.nix
Original file line number Diff line number Diff line change
@@ -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 = ''
Expand Down Expand Up @@ -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";
}
];
};
}

0 comments on commit c153370

Please sign in to comment.