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