2022-12-14 17:32:53 +01:00
|
|
|
{
|
|
|
|
description = "NixOS images";
|
|
|
|
|
2024-06-23 17:19:43 +02:00
|
|
|
#inputs.nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
|
|
|
inputs.nixos-unstable.url = "github:jmbaur/nixpkgs/etc-overlay-cross";
|
2024-06-07 10:25:52 +02:00
|
|
|
inputs.nixos-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
2022-12-16 13:44:26 +01:00
|
|
|
|
2024-06-07 10:43:38 +02:00
|
|
|
nixConfig.extra-substituters = [ "https://nix-community.cachix.org" ];
|
2024-06-23 15:13:27 +02:00
|
|
|
nixConfig.extra-trusted-public-keys = [
|
|
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
|
|
];
|
2022-12-16 13:44:26 +01:00
|
|
|
|
2024-06-23 15:13:27 +02:00
|
|
|
outputs =
|
|
|
|
{
|
|
|
|
self,
|
|
|
|
nixos-unstable,
|
|
|
|
nixos-stable,
|
|
|
|
}:
|
2023-11-02 11:09:47 +01:00
|
|
|
let
|
2024-06-23 15:13:27 +02:00
|
|
|
supportedSystems = [
|
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
2023-11-02 11:09:47 +01:00
|
|
|
forAllSystems = nixos-unstable.lib.genAttrs supportedSystems;
|
2024-06-23 15:13:27 +02:00
|
|
|
|
|
|
|
packages = forAllSystems (
|
|
|
|
system:
|
2023-11-02 11:09:47 +01:00
|
|
|
let
|
|
|
|
netboot = nixpkgs: (import (nixpkgs + "/nixos/release.nix") { }).netboot.${system};
|
2024-06-23 15:13:27 +02:00
|
|
|
kexec-installer =
|
|
|
|
nixpkgs: modules:
|
|
|
|
(nixpkgs.legacyPackages.${system}.nixos (modules ++ [ self.nixosModules.kexec-installer ]))
|
|
|
|
.config.system.build.kexecTarball;
|
|
|
|
netboot-installer =
|
|
|
|
nixpkgs:
|
|
|
|
(nixpkgs.legacyPackages.${system}.nixos [ self.nixosModules.netboot-installer ])
|
|
|
|
.config.system.build.netboot;
|
|
|
|
image-installer =
|
|
|
|
nixpkgs:
|
|
|
|
(nixpkgs.legacyPackages.${system}.nixos [ self.nixosModules.image-installer ])
|
|
|
|
.config.system.build.isoImage;
|
2023-11-02 11:09:47 +01:00
|
|
|
in
|
2023-11-02 10:57:25 +01:00
|
|
|
{
|
2023-11-02 11:09:47 +01:00
|
|
|
netboot-nixos-unstable = netboot nixos-unstable;
|
2024-06-07 10:25:52 +02:00
|
|
|
netboot-nixos-stable = netboot nixos-stable;
|
2023-11-02 11:09:47 +01:00
|
|
|
kexec-installer-nixos-unstable = kexec-installer nixos-unstable [ ];
|
2024-06-07 10:25:52 +02:00
|
|
|
kexec-installer-nixos-stable = kexec-installer nixos-stable [ ];
|
2023-05-14 20:59:46 +02:00
|
|
|
|
2024-04-17 12:24:41 +02:00
|
|
|
image-installer-nixos-unstable = image-installer nixos-unstable;
|
2024-06-07 10:25:52 +02:00
|
|
|
image-installer-nixos-stable = image-installer nixos-stable;
|
2024-04-16 12:23:50 +02:00
|
|
|
|
2023-11-02 11:09:47 +01:00
|
|
|
kexec-installer-nixos-unstable-noninteractive = kexec-installer nixos-unstable [
|
2024-06-23 15:13:27 +02:00
|
|
|
{ system.kexec-installer.name = "nixos-kexec-installer-noninteractive"; }
|
2023-11-02 11:09:47 +01:00
|
|
|
self.nixosModules.noninteractive
|
|
|
|
];
|
2024-06-07 10:25:52 +02:00
|
|
|
kexec-installer-nixos-stable-noninteractive = kexec-installer nixos-stable [
|
2024-06-23 15:13:27 +02:00
|
|
|
{ system.kexec-installer.name = "nixos-kexec-installer-noninteractive"; }
|
2023-11-02 11:09:47 +01:00
|
|
|
self.nixosModules.noninteractive
|
|
|
|
];
|
|
|
|
|
2023-12-10 11:57:48 +01:00
|
|
|
netboot-installer-nixos-unstable = netboot-installer nixos-unstable;
|
2024-06-07 10:25:52 +02:00
|
|
|
netboot-installer-nixos-stable = netboot-installer nixos-stable;
|
2024-06-23 15:13:27 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
crossPackages = {
|
|
|
|
x86_64-linux =
|
|
|
|
let
|
|
|
|
kexec-installer =
|
|
|
|
nixpkgs: modules:
|
|
|
|
(nixpkgs.legacyPackages.x86_64-linux.pkgsCross.riscv64.nixos (
|
|
|
|
modules
|
|
|
|
++ [
|
|
|
|
self.nixosModules.kexec-installer
|
|
|
|
self.nixosModules.noninteractive
|
|
|
|
]
|
|
|
|
)).config.system.build.kexecTarball;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
kexec-installer-nixos-unstable-noninteractive-riscv64 = kexec-installer nixos-unstable [ ];
|
2024-06-27 08:35:30 +02:00
|
|
|
# needs a backport to nixpkgs-24.05
|
|
|
|
#kexec-installer-nixos-stable-noninteractive-riscv64 = kexec-installer nixos-stable [ ];
|
2024-06-23 15:13:27 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
packages = nixos-unstable.lib.recursiveUpdate packages crossPackages;
|
2023-11-02 11:09:47 +01:00
|
|
|
nixosModules = {
|
|
|
|
kexec-installer = ./nix/kexec-installer/module.nix;
|
|
|
|
noninteractive = ./nix/noninteractive.nix;
|
|
|
|
# TODO: also add a test here once we have https://github.com/NixOS/nixpkgs/pull/228346 merged
|
|
|
|
netboot-installer = ./nix/netboot-installer/module.nix;
|
2024-04-16 12:23:50 +02:00
|
|
|
image-installer = ./nix/image-installer/module.nix;
|
2023-05-14 21:31:12 +02:00
|
|
|
};
|
2023-12-22 12:47:54 +01:00
|
|
|
checks =
|
2023-11-02 11:09:47 +01:00
|
|
|
let
|
2023-12-22 12:47:54 +01:00
|
|
|
# re-export the packages as checks
|
2024-06-23 15:13:27 +02:00
|
|
|
packages = forAllSystems (
|
|
|
|
system:
|
|
|
|
nixos-unstable.lib.mapAttrs' (
|
|
|
|
n: nixos-unstable.lib.nameValuePair "package-${n}"
|
|
|
|
) self.packages.${system}
|
|
|
|
);
|
2023-12-22 12:47:54 +01:00
|
|
|
checks =
|
|
|
|
let
|
|
|
|
pkgs = nixos-unstable.legacyPackages.x86_64-linux;
|
|
|
|
in
|
2023-11-02 11:09:47 +01:00
|
|
|
{
|
2023-12-22 12:47:54 +01:00
|
|
|
kexec-installer-unstable = pkgs.callPackage ./nix/kexec-installer/test.nix {
|
|
|
|
kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-unstable-noninteractive;
|
|
|
|
};
|
2024-06-23 15:13:27 +02:00
|
|
|
shellcheck = pkgs.runCommand "shellcheck" { nativeBuildInputs = [ pkgs.shellcheck ]; } ''
|
|
|
|
shellcheck ${(pkgs.nixos [ self.nixosModules.kexec-installer ]).config.system.build.kexecRun}
|
2023-12-22 12:47:54 +01:00
|
|
|
touch $out
|
|
|
|
'';
|
2024-06-23 15:13:27 +02:00
|
|
|
kexec-installer-stable =
|
|
|
|
nixos-stable.legacyPackages.x86_64-linux.callPackage ./nix/kexec-installer/test.nix
|
|
|
|
{ kexecTarball = self.packages.x86_64-linux.kexec-installer-nixos-stable-noninteractive; };
|
2023-12-22 12:47:54 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
nixos-unstable.lib.recursiveUpdate packages { x86_64-linux = checks; };
|
2022-12-16 13:44:26 +01:00
|
|
|
};
|
2022-12-14 17:32:53 +01:00
|
|
|
}
|