Skip to content

Commit

Permalink
use iso image for nixos qemu test
Browse files Browse the repository at this point in the history
  • Loading branch information
DavHau committed Apr 28, 2021
1 parent a0ea21a commit 98e1acc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
1 change: 0 additions & 1 deletion .github/workflows/nix-portable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install
extra_nix_config: |
experimental-features = nix-command flakes
system-features = benchmark big-parallel kvm nixos-test recursive-nix
- uses: cachix/cachix-action@v8
with:
Expand Down
5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
excludeRuntimes = [ "bwrap" ];
};
nixos = {
# use iso image for nixos because building a qcow2 would require KVM
img = (toString (nixosSystem {
system = "x86_64-linux";
modules = [(import ./testing/nixos-qcow2.nix)];
}).config.system.build.qcow) + "/nixos.qcow2";
modules = [(import ./testing/nixos-iso.nix)];
}).config.system.build.isoImage) + "/iso/nixos.iso";
};
ubuntu = {
url = "https://cloud-images.ubuntu.com/focal/20210415/focal-server-cloudimg-amd64.img";
Expand Down
29 changes: 29 additions & 0 deletions testing/nixos-iso.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ config, lib, pkgs, modulesPath, ... }:
with builtins;
with lib;
{
imports = [
"${toString modulesPath}/installer/cd-dvd/iso-image.nix"
];

boot.loader.timeout = mkForce 0;

fileSystems."/" = {
fsType = "tmpfs";
options = [ "mode=0755" "size=2G" ];
};

# EFI booting
isoImage.makeEfiBootable = true;

# USB booting
isoImage.makeUsbBootable = true;

isoImage.squashfsCompression = "zstd -Xcompression-level 5";

users.users.test.isNormalUser = true;
users.users.test.openssh.authorizedKeys.keys = [ (readFile ./id_ed25519.pub) ];
users.users.root.openssh.authorizedKeys.keys = config.users.users.test.openssh.authorizedKeys.keys;
services.openssh.enable = true;

}
23 changes: 0 additions & 23 deletions testing/nixos-qcow2.nix

This file was deleted.

0 comments on commit 98e1acc

Please sign in to comment.