Skip to content

Commit da66e7c

Browse files
committed
Add c3.small.x86 instance type
Mostly copied from c2.medium.x86 with tweaks after doing an install (kernel modules, second serial port, cpu core count). Am I doing this right? How do we get packet.net to pick up the new image(s)?
1 parent 6074bf4 commit da66e7c

File tree

4 files changed

+99
-0
lines changed

4 files changed

+99
-0
lines changed

default.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,4 +560,35 @@ in rec {
560560
mount -L nixos /mnt
561561
'';
562562
};
563+
564+
c3-small-x86 = mkPXEInstaller {
565+
name = "c3.small.x86";
566+
system = "x86_64-linux";
567+
img = "bzImage";
568+
kexec = true;
569+
570+
configFiles = [
571+
./instances/standard.nix
572+
./instances/c3.small.x86/hardware.nix
573+
];
574+
575+
runTimeConfigFiles = [
576+
./instances/c3.small.x86/installed.nix
577+
];
578+
579+
partition = partitionLinuxWithBootSwap "/dev/sda";
580+
581+
format = ''
582+
mkfs.vfat /dev/sda1
583+
mkswap -L swap /dev/sda2
584+
mkfs.ext4 -L nixos /dev/sda3
585+
'';
586+
587+
mount = ''
588+
swapon -L swap
589+
mount -L nixos /mnt
590+
mkdir -p /mnt/boot/efi
591+
mount /dev/sda1 /mnt/boot/efi
592+
'';
593+
};
563594
}

expect-tests/testall.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ check c1.large.arm.xda
2424
check c1.small.x86
2525
check c1.xlarge.x86
2626
check c2.medium.x86
27+
check c3.small.x86
2728
check g2.large.x86
2829
check m1.xlarge.x86
2930
check m2.xlarge.x86

instances/c3.small.x86/hardware.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{ config, lib, pkgs, ... }:
2+
{
3+
nixpkgs = {
4+
config = {
5+
allowUnfree = true;
6+
};
7+
};
8+
9+
boot.loader.grub = {
10+
version = 2;
11+
efiSupport = true;
12+
device = "nodev";
13+
efiInstallAsRemovable = true;
14+
extraConfig = ''
15+
serial --unit=1 --speed=115200 --word=8 --parity=no --stop=1
16+
terminal_output serial console
17+
terminal_input serial console
18+
'';
19+
};
20+
21+
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
22+
boot.kernelModules = [ "kvm_intel" ];
23+
boot.kernelParams = [ "console=ttyS1,115200n8" ];
24+
boot.extraModulePackages = [ ];
25+
26+
hardware.enableAllFirmware = true;
27+
28+
nix.maxJobs = 16;
29+
}

instances/c3.small.x86/installed.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{ lib, ... }:
2+
{
3+
boot = {
4+
loader = {
5+
systemd-boot.enable = lib.mkForce false;
6+
grub = {
7+
enable = true;
8+
extraConfig = ''
9+
serial --unit=1 --speed=115200 --word=8 --parity=no --stop=1
10+
terminal_output serial console
11+
terminal_input serial console
12+
'';
13+
14+
};
15+
efi = {
16+
efiSysMountPoint = "/boot/efi";
17+
canTouchEfiVariables = lib.mkForce false;
18+
};
19+
};
20+
};
21+
22+
fileSystems = {
23+
"/" = {
24+
label = "nixos";
25+
fsType = "ext4";
26+
};
27+
"/boot/efi" = {
28+
device = "/dev/sda1";
29+
fsType = "vfat";
30+
};
31+
};
32+
33+
swapDevices = [
34+
{
35+
label = "swap";
36+
}
37+
];
38+
}

0 commit comments

Comments
 (0)