Skip to content

Commit

Permalink
Merge pull request #376 from phaer/dedup-modules
Browse files Browse the repository at this point in the history
Cleanup, De-duplicate with upstream nixpkgs
  • Loading branch information
Lassulus authored Nov 11, 2024
2 parents 9f101f4 + 85c198f commit 3a5bf19
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 70 deletions.
1 change: 0 additions & 1 deletion formats/docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"${toString modulesPath}/virtualisation/docker-image.nix"
];

boot.isContainer = true;
boot.loader.grub.enable = lib.mkForce false;
boot.loader.systemd-boot.enable = lib.mkForce false;
services.journald.console = "/dev/console";
Expand Down
10 changes: 2 additions & 8 deletions formats/install-iso-hyperv.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{
config,
lib,
modulesPath,
...
}: {
imports = [
"${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix"
./install-iso.nix
];

# override installation-cd-base and enable wpa and sshd start at boot
systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"];
systemd.services.wpa_supplicant.wantedBy = lib.mkOverride 40 [];
virtualisation.hypervGuest.enable = true;

formatAttr = "isoImage";
fileExtension = ".iso";
}
4 changes: 0 additions & 4 deletions formats/install-iso.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
config,
lib,
modulesPath,
...
Expand All @@ -12,9 +11,6 @@
systemd.services.wpa_supplicant.wantedBy = lib.mkForce ["multi-user.target"];
systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"];

# Much faster than xz
isoImage.squashfsCompression = lib.mkDefault "zstd";

formatAttr = "isoImage";
fileExtension = ".iso";
}
4 changes: 0 additions & 4 deletions formats/iso.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
lib,
modulesPath,
...
}: {
Expand All @@ -13,9 +12,6 @@
# USB booting
isoImage.makeUsbBootable = true;

# Much faster than xz
isoImage.squashfsCompression = lib.mkDefault "zstd";

formatAttr = "isoImage";
fileExtension = ".iso";
}
47 changes: 4 additions & 43 deletions formats/linode.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,29 @@
...
}: {
imports = [
"${toString modulesPath}/profiles/qemu-guest.nix"
"${toString modulesPath}/virtualisation/linode-image.nix"
];

formatAttr = "linode";
formatAttr = "linodeImage";
fileExtension = ".img.gz";

system.build.linode = import "${toString modulesPath}/../lib/make-disk-image.nix" {
system.build.linodeImage = lib.mkForce (import "${toString modulesPath}/../lib/make-disk-image.nix" {
inherit lib config pkgs;
partitionTableType = "none";
format = "raw";
postVM = ''
${pkgs.pigz}/bin/pigz -9 $out/nixos.img
'';
};

# Set up filesystems according to Linode preference:
fileSystems."/" = {
device = "/dev/sda";
fsType = "ext4";
autoResize = true;
};

swapDevices = [{device = "/dev/sdb";}];
});

# Enable LISH and Linode booting w/ GRUB
boot = {
# Add kernel modules detected by nixos-generate-config:
initrd.availableKernelModules = [
"virtio_pci"
"virtio_scsi"
"ahci"
"sd_mod"
];

growPartition = true;

# Set up LISH serial connection:
kernelParams = ["console=ttyS0,19200n8"];

loader = {
# Increase timeout to allow LISH connection:
timeout = lib.mkForce 10;

grub = {
enable = true;
forceInstall = true;
device = "nodev";
fsIdentifier = "label";

# Allow serial connection for GRUB to be able to use LISH:
extraConfig = ''
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1;
terminal_input serial;
terminal_output serial
'';

# Link /boot/grub2 to /boot/grub:
extraInstallCommands = ''
${pkgs.coreutils}/bin/ln -fs /boot/grub /boot/grub2
Expand All @@ -78,17 +45,11 @@

# Install diagnostic tools for Linode support:
environment.systemPackages = with pkgs; [
inetutils
mtr
sysstat
linode-cli
];

networking = {
enableIPv6 = true;
tempAddresses = "disabled";
useDHCP = true;
usePredictableInterfaceNames = false;
interfaces.eth0 = {
tempAddress = "disabled";
useDHCP = true;
Expand Down
11 changes: 1 addition & 10 deletions formats/openstack.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
modulesPath,
lib,
...
}:
if lib.pathExists "${toString modulesPath}/../maintainers/scripts/openstack/nova-image.nix"
then {
imports = [
"${toString modulesPath}/../maintainers/scripts/openstack/nova-image.nix"
];

formatAttr = "novaImage";
}
else {
{
imports = [
"${toString modulesPath}/../maintainers/scripts/openstack/openstack-image.nix"
];
Expand Down

0 comments on commit 3a5bf19

Please sign in to comment.