nixos-images/flake.nix

86 lines
4.1 KiB
Nix
Raw Permalink Normal View History

{
description = "NixOS images";
2024-09-03 07:56:00 +02:00
inputs.nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
2024-09-16 04:46:31 +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" ];
nixConfig.extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
2022-12-16 13:44:26 +01:00
2024-06-07 10:25:52 +02:00
outputs = { self, nixos-unstable, nixos-stable }:
let
2024-10-23 20:49:48 +02:00
supportedSystems = [ "riscv64-linux" ];
forAllSystems = nixos-unstable.lib.genAttrs supportedSystems;
in
{
2024-10-23 20:49:48 +02:00
hydraJobs = { inherit (self) checks; };
packages = forAllSystems (system:
let
netboot = nixpkgs: (import (nixpkgs + "/nixos/release.nix") { }).netboot.${system};
kexec-installer = nixpkgs: module: (nixpkgs.legacyPackages.${system}.nixos [ module 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;
in
{
netboot-nixos-unstable = netboot nixos-unstable;
2024-06-07 10:25:52 +02:00
netboot-nixos-stable = netboot nixos-stable;
kexec-installer-nixos-unstable = kexec-installer nixos-unstable {};
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;
kexec-installer-nixos-unstable-noninteractive = kexec-installer nixos-unstable {
_file = __curPos.file;
system.kexec-installer.name = "nixos-kexec-installer-noninteractive";
imports = [
self.nixosModules.noninteractive
];
};
kexec-installer-nixos-stable-noninteractive = kexec-installer nixos-stable {
_file = __curPos.file;
system.kexec-installer.name = "nixos-kexec-installer-noninteractive";
imports = [
self.nixosModules.noninteractive
];
};
netboot-installer-nixos-unstable = netboot-installer nixos-unstable;
2024-06-07 10:25:52 +02:00
netboot-installer-nixos-stable = netboot-installer nixos-stable;
});
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;
image-installer = ./nix/image-installer/module.nix;
};
2023-12-22 12:47:54 +01:00
checks =
let
2023-12-22 12:47:54 +01:00
# re-export the packages as checks
packages = forAllSystems (system: nixos-unstable.lib.mapAttrs' (n: nixos-unstable.lib.nameValuePair "package-${n}") self.packages.${system});
checks =
let
2024-10-23 20:49:48 +02:00
pkgsUnstable = nixos-unstable.legacyPackages.riscv64-linux;
pkgsStable = nixos-stable.legacyPackages.riscv64-linux;
2024-09-18 17:28:56 +02:00
bootTests = pkgs: channel: suffix: pkgs.lib.mapAttrs' (name: pkgs.lib.nameValuePair "${name}${suffix}") (pkgs.callPackages ./nix/image-installer/tests.nix {
nixpkgs = channel;
nixosModules = self.nixosModules;
});
2023-12-22 12:47:54 +01:00
in
{
2024-09-18 17:28:56 +02:00
kexec-installer-unstable = pkgsUnstable.callPackage ./nix/kexec-installer/test.nix {
2024-10-23 20:49:48 +02:00
kexecTarball = self.packages.riscv64-linux.kexec-installer-nixos-unstable-noninteractive;
2023-12-22 12:47:54 +01:00
};
2024-09-18 17:28:56 +02:00
2024-10-23 20:49:48 +02:00
kexec-installer-stable = nixos-stable.legacyPackages.riscv64-linux.callPackage ./nix/kexec-installer/test.nix {
kexecTarball = self.packages.riscv64-linux.kexec-installer-nixos-stable-noninteractive;
2024-09-18 17:21:05 +02:00
};
2024-09-18 17:28:56 +02:00
} // (bootTests pkgsUnstable nixos-unstable "-nixos-unstable")
// (bootTests pkgsStable nixos-stable "-nixos-stable");
2023-12-22 12:47:54 +01:00
in
2024-10-23 20:49:48 +02:00
nixos-unstable.lib.recursiveUpdate packages { riscv64-linux = checks; };
2022-12-16 13:44:26 +01:00
};
}