-
-
Save v1k0d3n/49d3ec2cf43f9827e7dfb86cee0341ba to your computer and use it in GitHub Desktop.
Revisions
-
tarnacious revised this gist
Apr 20, 2022 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,21 @@ { pkgs, lib, ... }: with lib; { imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ]; config = { fileSystems."/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; autoResize = true; }; boot.growPartition = true; boot.kernelParams = [ "console=ttyS0" ]; boot.loader.grub.device = "/dev/vda"; boot.loader.timeout = 0; -
tarnacious revised this gist
Dec 3, 2019 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,15 @@ Should create a `results` directory that symlinks to a qcow2 image in the store. I basically copied this from the [openstack image in nixpkgs][1] because I don't know a better way. Update: Thanks to @d-goldin I've just learnt I can start a VM using just: ``` nix-build '<nixpkgs/nixos>' -A vm -I nixos-config=./machine-config.nix build-vm ./result/bin/run-nixos-vm ``` Which is pretty neat, and I guess pretty common. [1]: https://github.com/NixOS/nixpkgs/blob/9e8140864bf629ea2d781a863abfedd6cab4229f/nixos/maintainers/scripts/openstack/openstack-image.nix -
tarnacious revised this gist
Dec 3, 2019 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,11 @@ Build a bare bones bootable nixos qcow2 image suitable for running with libvirt/qemu/kvm. ``` nix-build '<nixpkgs/nixos>' -A config.system.build.qcow2 --arg configuration "{ imports = [ ./build-qcow2.nix ]; }" ``` Should create a `results` directory that symlinks to a qcow2 image in the store. I basically copied this from the [openstack image in nixpkgs][1] because I don't know a better way. [1]: https://github.com/NixOS/nixpkgs/blob/9e8140864bf629ea2d781a863abfedd6cab4229f/nixos/maintainers/scripts/openstack/openstack-image.nix -
tarnacious created this gist
Dec 3, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ { config, lib, pkgs, ... }: with lib; { imports = [ <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix> ./machine-config.nix ]; system.build.qcow2 = import <nixpkgs/nixos/lib/make-disk-image.nix> { inherit lib config; pkgs = import <nixpkgs> { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package diskSize = 8192; format = "qcow2"; configFile = pkgs.writeText "configuration.nix" '' { imports = [ <./machine-config.nix> ]; } ''; }; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ { pkgs, lib, ... }: [3/1275] with lib; { imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ]; config = { fileSystems."/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; autoResize = true; }; boot.growPartition = true; boot.kernelParams = [ "console=ttyS0" ]; boot.loader.grub.device = "/dev/vda"; boot.loader.timeout = 0; users.extraUsers.root.password = ""; }; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Build a bare bones bootable nixos qcow2 image suitable for running with libvirt/qemu/kvm. ``` nix-build '<nixpkgs/nixos>' -A config.system.build.qcow2 --arg configuration "{ imports = [ ./build-qcow2.nix ]; }" ``` Should create a `results` directory that symlinks to a qcow2 image in the store.