Skip to content

Instantly share code, notes, and snippets.

@clefru
Created August 26, 2019 11:23
Show Gist options
  • Save clefru/7a44edd81f00ae7d03358ae2c96ebb02 to your computer and use it in GitHub Desktop.
Save clefru/7a44edd81f00ae7d03358ae2c96ebb02 to your computer and use it in GitHub Desktop.
vm-test2.nix
let pkgs = import <nixpkgs> {};
config = (import <nixpkgs/nixos/lib/eval-config.nix> {
system=pkgs.system;
modules = [ {
fileSystems."/".device = "/dev/disk/by-label/nixos";
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda";
boot.loader.timeout = 0;
services.openssh.enable = true;
services.openssh.startWhenNeeded = false;
services.openssh.extraConfig = "UseDNS no";
} ];
}).config;
in
import <nixpkgs/nixos/lib/make-disk-image.nix> {
name = "libvirtd-ssh-image";
format = "qcow2";
diskSize = 800;
config = config;
contents = [{
source = (pkgs.writeText "aaaa" "bbb");
target = "/etc/ssh/authorized_keys.d/root";
}];
lib=pkgs.lib;
inherit pkgs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment