summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authorAntoine Eiche <lewo@abesis.fr>2017-02-24 22:17:52 +0100
committerAntoine Eiche <lewo@abesis.fr>2017-02-24 22:17:52 +0100
commitdec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242 (patch)
treeffdb87e39e2bc52d613f77a6349a22bcefc9d6b6 /nixos/modules/virtualisation
parent1c555e772e3ce080184225d1074e9eb0cc99f94d (diff)
downloadnixlib-dec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242.tar
nixlib-dec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242.tar.gz
nixlib-dec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242.tar.bz2
nixlib-dec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242.tar.lz
nixlib-dec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242.tar.xz
nixlib-dec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242.tar.zst
nixlib-dec7ecbbbcc5f68ab8c96d39ba3c62eaf0326242.zip
nova-image: refactoring
The nova image configuration is separated from the image build.
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/nova-config.nix51
-rw-r--r--nixos/modules/virtualisation/nova-image.nix65
2 files changed, 51 insertions, 65 deletions
diff --git a/nixos/modules/virtualisation/nova-config.nix b/nixos/modules/virtualisation/nova-config.nix
new file mode 100644
index 000000000000..6bcc05d3c1e7
--- /dev/null
+++ b/nixos/modules/virtualisation/nova-config.nix
@@ -0,0 +1,51 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+  imports = [
+    ../profiles/qemu-guest.nix
+    ../profiles/headless.nix
+  ];
+
+  config = {
+    fileSystems."/".device = "/dev/disk/by-label/nixos";
+
+    boot.kernelParams = [ "console=ttyS0" ];
+    boot.loader.grub.device = "/dev/vda";
+    boot.loader.timeout = 0;
+
+    # Allow root logins
+    services.openssh.enable = true;
+    services.openssh.permitRootLogin = "prohibit-password";
+
+    # Put /tmp and /var on /ephemeral0, which has a lot more space.
+    # Unfortunately we can't do this with the `fileSystems' option
+    # because it has no support for creating the source of a bind
+    # mount.  Also, "move" /nix to /ephemeral0 by layering a unionfs-fuse
+    # mount on top of it so we have a lot more space for Nix operations.
+
+    /*
+    boot.initrd.postMountCommands =
+      ''
+        mkdir -m 1777 -p $targetRoot/ephemeral0/tmp
+        mkdir -m 1777 -p $targetRoot/tmp
+        mount --bind $targetRoot/ephemeral0/tmp $targetRoot/tmp
+
+        mkdir -m 755 -p $targetRoot/ephemeral0/var
+        mkdir -m 755 -p $targetRoot/var
+        mount --bind $targetRoot/ephemeral0/var $targetRoot/var
+
+        mkdir -p /unionfs-chroot/ro-nix
+        mount --rbind $targetRoot/nix /unionfs-chroot/ro-nix
+
+        mkdir -p /unionfs-chroot/rw-nix
+        mkdir -m 755 -p $targetRoot/ephemeral0/nix
+        mount --rbind $targetRoot/ephemeral0/nix /unionfs-chroot/rw-nix
+        unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-nix=RW:/ro-nix=RO $targetRoot/nix
+      '';
+
+      boot.initrd.supportedFilesystems = [ "unionfs-fuse" ];
+    */
+  };
+}
diff --git a/nixos/modules/virtualisation/nova-image.nix b/nixos/modules/virtualisation/nova-image.nix
deleted file mode 100644
index e253c77ebb4f..000000000000
--- a/nixos/modules/virtualisation/nova-image.nix
+++ /dev/null
@@ -1,65 +0,0 @@
-# Usage:
-# $ NIXOS_CONFIG=`pwd`/nixos/modules/virtualisation/nova-image.nix nix-build '<nixpkgs/nixos>' -A config.system.build.novaImage
-
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-{
-  system.build.novaImage = import ../../lib/make-disk-image.nix {
-    inherit pkgs lib config;
-    partitioned = true;
-    diskSize = 1 * 1024;
-    configFile = pkgs.writeText "configuration.nix"
-      ''
-        {
-          imports = [ <nixpkgs/nixos/modules/virtualisation/nova-image.nix> ];
-        }
-      '';
-  };
-
-  imports = [
-    ../profiles/qemu-guest.nix
-    ../profiles/headless.nix
-  ];
-
-  fileSystems."/".device = "/dev/disk/by-label/nixos";
-
-  boot.kernelParams = [ "console=ttyS0" ];
-  boot.loader.grub.device = "/dev/vda";
-  boot.loader.timeout = 0;
-
-  # Allow root logins
-  services.openssh.enable = true;
-  services.openssh.permitRootLogin = "prohibit-password";
-
-  # Put /tmp and /var on /ephemeral0, which has a lot more space.
-  # Unfortunately we can't do this with the `fileSystems' option
-  # because it has no support for creating the source of a bind
-  # mount.  Also, "move" /nix to /ephemeral0 by layering a unionfs-fuse
-  # mount on top of it so we have a lot more space for Nix operations.
-
-  /*
-  boot.initrd.postMountCommands =
-    ''
-      mkdir -m 1777 -p $targetRoot/ephemeral0/tmp
-      mkdir -m 1777 -p $targetRoot/tmp
-      mount --bind $targetRoot/ephemeral0/tmp $targetRoot/tmp
-
-      mkdir -m 755 -p $targetRoot/ephemeral0/var
-      mkdir -m 755 -p $targetRoot/var
-      mount --bind $targetRoot/ephemeral0/var $targetRoot/var
-
-      mkdir -p /unionfs-chroot/ro-nix
-      mount --rbind $targetRoot/nix /unionfs-chroot/ro-nix
-
-      mkdir -p /unionfs-chroot/rw-nix
-      mkdir -m 755 -p $targetRoot/ephemeral0/nix
-      mount --rbind $targetRoot/ephemeral0/nix /unionfs-chroot/rw-nix
-      unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-nix=RW:/ro-nix=RO $targetRoot/nix
-    '';
-
-    boot.initrd.supportedFilesystems = [ "unionfs-fuse" ];
-  */
-
-}