summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 390d1d95e37f6a134d3f7e4a6daa223d8c7cee20 (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
{
  description = "Flake for ktest kernel builds";

  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs;
    utils.url = "github:numtide/flake-utils";
    src.url = "https://evilpiepirate.org/git/bcachefs.git";
    src.flake = false;
    buildRoot.url = "path:dummy-kernel-build";
    buildRoot.flake = false;
  };

  outputs = { self, utils, src,
              buildRoot,
              nixpkgs }:

    utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        ## TODO plumb kernel version automatically in to builds.
        preBuiltKernel = pkgs.callPackage ./kernel_install.nix {
                            inherit src buildRoot;
                          };
        srcBuildKernel =  pkgs.buildLinux { inherit src; };
      in {
        packages = {
          inherit preBuiltKernel srcBuildKernel;
          default = if (import buildRoot).isPreBuilt then preBuiltKernel else srcBuildKernel;
        };
    });
}