aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: b235fa9ef5c1d7e68bb44eec07094011920eccb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
  inputs.nixpkgs = {
    type = "github";
    owner = "nixos";
    repo = "nixpkgs";
    ref = "master";
  };

  description = "A collections of derivations for coreboot and payloads";
  outputs = { self, nixpkgs }: let
    nixpkgsOptions = {
      system = "x86_64-linux";
      overlays = [
        (import ./pkgs/overlay.nix)
      ];
    };
    pkgs = import nixpkgs nixpkgsOptions;
    inherit (pkgs) lib;

    makeDevice = configFile: (lib.evalModules {
      modules = [
        ({ ... }: {
          nixpkgs = nixpkgsOptions;
        })
        ("${nixpkgs}/nixos/modules/misc/assertions.nix")
        ("${nixpkgs}/nixos/modules/misc/nixpkgs.nix")
        ./modules
        configFile
      ];
    }).config.corenix.rom;
  in {
    lib = {
      inherit makeDevice;
    };

    packages.x86_64-linux = {
      inherit (pkgs)
      coreboot
      coreboot-payload-grub2
      coreboot-payload-tianocore
      coreboot-payload-tint
      coreboot-payload-nvramcui
      coreboot-payload-coreinfo;

      milan-x1c = makeDevice ./configs/milan-x1c.nix;
      milan-x230t = makeDevice ./configs/milan-x230t.nix;
    };
  };
}