image build

Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
Cadey Ratio 2021-08-11 11:22:24 -04:00
parent 9a7cf7e1dd
commit 80236629ec
4 changed files with 10 additions and 8 deletions

1
images/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
result

View File

@ -1,9 +1,13 @@
let let
sources = import ../nix/sources.nix; sources = import ../nix/sources.nix;
pkgs = import sources.nixpkgs { }; pkgs = import sources.nixpkgs { };
sys = (import "${sources.nixpkgs}/nixos/lib/eval-config.nix" { config = (import "${sources.nixpkgs}/nixos/lib/eval-config.nix" {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ ./configuration.nix ]; modules = [ ./configuration.nix ];
}); });
in sys.config.system.build.toplevel
in import ./make-image.nix {
inherit (config) config pkgs;
inherit (config.pkgs) lib;
format = "vpc"; # change this for other clouds
}

View File

@ -17,9 +17,8 @@
contents ? [] contents ? []
, # The initial NixOS configuration file to be copied to , # The initial NixOS configuration file to be copied to
# /etc/nixos/configuration.nix. This configuration will be embedded # /etc/nixos/configuration.nix.
# inside a configuration which includes the described ZFS fileSystems. configFile ? ./configuration.nix
configFile ? null
, # Shell code executed after the VM has finished. , # Shell code executed after the VM has finished.
postVM ? "" postVM ? ""
@ -155,8 +154,7 @@ let
# Install a configuration.nix # Install a configuration.nix
mkdir -p /mnt/etc/nixos mkdir -p /mnt/etc/nixos
# `cat` so it is mutable on the fs # `cat` so it is mutable on the fs
cat ${./configuration.nix} > /mnt/etc/nixos/configuration.nix cat ${configFile} > /mnt/etc/nixos/configuration.nix
cat ${./hardware-configuration.nix} > /mnt/etc/nixos/hardware-configuration.nix
export NIX_STATE_DIR=$TMPDIR/state export NIX_STATE_DIR=$TMPDIR/state
nix-store --load-db < ${closureInfo}/registration nix-store --load-db < ${closureInfo}/registration

View File

@ -1 +0,0 @@
/nix/store/37g7indpvgc8pyismi03g1vcsyzvpdgc-nixos-system-unnamed-21.05pre-git