Skip to content

Commit

Permalink
REMOVE: helper to diff images against pinned master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
phaer committed Nov 18, 2024
1 parent ec15cab commit 8838a84
Showing 1 changed file with 221 additions and 0 deletions.
221 changes: 221 additions & 0 deletions images.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
pkgs ? import ./. { },
masterPkgs ? import (builtins.fetchTarball {
url = "https://api.github.com/repos/nixos/nixpkgs/tarball/6da9bf9e5e3bf436a6f4e53c87e25474d43a6b93";
}) { },
}:
let
inherit (pkgs) lib;

imageModules = {
amazon = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/../maintainers/scripts/ec2/amazon-image.nix") ];
builderAttr = "amazonImage";
}
)
];
azure = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/azure-image.nix") ];
builderAttr = "azureImage";
}
)
];
digital-ocean = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/digital-ocean-image.nix") ];
builderAttr = "digitalOceanImage";
}
)
];
google-compute = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/google-compute-image.nix") ];
builderAttr = "googleComputeImage";
}
)
];
hyperv = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/hyperv-image.nix") ];
builderAttr = "hypervImage";
}
)
];
linode = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/linode-image.nix") ];
builderAttr = "linodeImage";
}
)
];
oci = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/oci-image.nix") ];
builderAttr = "OCIImage";
}
)
];
openstack = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/../maintainers/scripts/openstack/openstack-image.nix") ];
builderAttr = "openstackImage";
}
)
];
openstack-zfs = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/../maintainers/scripts/openstack/openstack-image-zfs.nix") ];
builderAttr = "openstackImage";
}
)
];
proxmox = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/proxmox-image.nix") ];
builderAttr = "VMA";
}
)
];
kubevirt = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/kubevirt.nix") ];
builderAttr = "kubevirtImage";
}
)
];
vagrant-virtualbox = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/vagrant-virtualbox-image.nix") ];
builderAttr = "vagrantVirtualbox";
}
)
];
virtualbox = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/virtualbox-image.nix") ];
builderAttr = "virtualBoxOVA";
}
)
];
vmware = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/virtualisation/vmware-image.nix") ];
builderAttr = "vmwareImage";
}
)
];
iso = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/cd-dvd/iso-image.nix") ];
builderAttr = "isoImage";
}
)
];
iso-installer = [
(
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-base.nix") ];
builderAttr = "isoImage";
}
)
];
sd-card = [
(
{ modulesPath, ... }:
{
imports = [
(
let
module = modulesPath + "/installer/sd-card/sd-image-${pkgs.targetPlatform.linuxArch}.nix";
in
if builtins.pathExists module then module else throw "The module ${module} does not exist."
)
];
builderAttr = "sdImage";
}
)
];
};

base =
{ modulesPath, ... }:
{
imports = [ "${modulesPath}/profiles/minimal.nix" ];
options.builderAttr = lib.mkOption {
type = lib.types.str;
};
config = {
system.stateVersion = "24.11";
};
};

masterConfigs = lib.mapAttrs (
name: modules:
masterPkgs.nixos {
imports = modules ++ [ base ];
}
) imageModules;

masterImages = lib.mapAttrs (
name: conf: conf.config.system.build.${conf.config.builderAttr}
) masterConfigs;

nixos = pkgs.nixos {
imports = [
base
{
system.build.imageModules.linode = [
{ networking.hostName = "foobar"; }
];
}
];
};
images = nixos.config.system.build.images;
configs = lib.mapAttrs (n: v: v.passthru.config) images;
in
{
inherit
nixos
configs
masterConfigs
images
masterImages
;
all = pkgs.linkFarm "all" {
master = pkgs.linkFarm "all-master" masterImages;
new = pkgs.linkFarm "all-new" images;
};
}

0 comments on commit 8838a84

Please sign in to comment.