1{ config, lib, pkgs, ... }:
2
3with lib;
4
5{
6 imports = [
7 ../profiles/qemu-guest.nix
8 ../profiles/headless.nix
9 ./grow-partition.nix
10 ];
11
12 config = {
13 fileSystems."/" = {
14 device = "/dev/disk/by-label/nixos";
15 autoResize = true;
16 };
17
18 virtualisation.growPartition = true;
19
20 boot.kernelParams = [ "console=ttyS0" ];
21 boot.loader.grub.device = "/dev/vda";
22 boot.loader.timeout = 0;
23
24 # Allow root logins
25 services.openssh.enable = true;
26 services.openssh.permitRootLogin = "prohibit-password";
27
28 # Put /tmp and /var on /ephemeral0, which has a lot more space.
29 # Unfortunately we can't do this with the `fileSystems' option
30 # because it has no support for creating the source of a bind
31 # mount. Also, "move" /nix to /ephemeral0 by layering a unionfs-fuse
32 # mount on top of it so we have a lot more space for Nix operations.
33
34 /*
35 boot.initrd.postMountCommands =
36 ''
37 mkdir -m 1777 -p $targetRoot/ephemeral0/tmp
38 mkdir -m 1777 -p $targetRoot/tmp
39 mount --bind $targetRoot/ephemeral0/tmp $targetRoot/tmp
40
41 mkdir -m 755 -p $targetRoot/ephemeral0/var
42 mkdir -m 755 -p $targetRoot/var
43 mount --bind $targetRoot/ephemeral0/var $targetRoot/var
44
45 mkdir -p /unionfs-chroot/ro-nix
46 mount --rbind $targetRoot/nix /unionfs-chroot/ro-nix
47
48 mkdir -p /unionfs-chroot/rw-nix
49 mkdir -m 755 -p $targetRoot/ephemeral0/nix
50 mount --rbind $targetRoot/ephemeral0/nix /unionfs-chroot/rw-nix
51 unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-nix=RW:/ro-nix=RO $targetRoot/nix
52 '';
53
54 boot.initrd.supportedFilesystems = [ "unionfs-fuse" ];
55 */
56 };
57}