Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. pkgs = import <nixpkgs> {};
  2. lib = pkgs.lib;
  3. dom0_config = { pkgs, ... }:
  4. {
  5. virtualisation.xen = {
  6. enable = true;
  7. bootParams = [ "loglvl=all guest_loglvl=all com1=38400,8n1 console=com1" ];
  8. };
  9. fileSystems = {
  10. "/" = { device = "LABEL=nixos"; fsType = "ext4"; };
  11. "/stuff" = { device = "/dev/sdb"; fsType = "ext4"; autoFormat = true; };
  12. };
  13. boot = {
  14. loader.grub = {
  15. enable = true;
  16. device = "/dev/vda";
  17. };
  18. kernelParams = [ "console=hvc0 earlyprintk=xen" ];
  19. };
  20. services.mingetty.autologinUser = "root";
  21. systemd.services.xentest = {
  22. after = [ "xen-bridge.service" "xen-qemu.service" ];
  23. description = "xen automated testing";
  24. wantedBy = [ "multi-user.target" ];
  25. path = with pkgs; [ xen e2fsprogs utillinux ];
  26. script = ''
  27. exec > /dev/hvc0 2>&1
  28. xl list
  29. touch /stuff/stuff
  30. #shutdown -h now
  31. '';
  32. };
  33. };
  34. dom0_build = import <nixpkgs/nixos> { configuration = dom0_config; };
  35. rootDisk = import <nixpkgs/nixos/lib/make-disk-image.nix> {
  36. # ~5mins to build
  37. name = "xen-rootfs";
  38. inherit pkgs lib;
  39. config = dom0_build.config;
  40. partitioned = true;
  41. installBootLoader = true;
  42. diskSize = 4096;
  43. fixValidity = false;
  44. };
  45. rootDisk;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement