aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: ad1be3e3f241d779a05baf20bbbc5af82c5b8979 (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
{
  description = "Turris flake";

  outputs = { self, flake-utils, nixpkgs }:
  with flake-utils.lib;
  let
    supportedHostSystems = (
      # Note: crossTarball* targets are broken on darwin so it gets disabled here
      with builtins; filter (system: match ".*-darwin" system == null) defaultSystems
    ) ++ [system.armv7l-linux];
  in {

      overlays.default = final: prev: import ./pkgs { nixpkgs = prev; };
      nixosModules = import ./nixos self;
      lib = import ./lib { inherit self; nixpkgsDefault = nixpkgs; };

      nixosConfigurations = {
        mox = self.lib.nixturrisSystem { board = "mox"; nixpkgs = nixpkgs; };
        omnia = self.lib.nixturrisSystem { board = "omnia"; nixpkgs = nixpkgs; };
      };

    } // eachSystem supportedHostSystems (
      system: {

        packages = let
          tarball = nixos: nixos.config.system.build.tarball;
        in {

          tarballMox = tarball self.nixosConfigurations.mox;
          tarballOmnia = tarball self.nixosConfigurations.omnia;

          crossTarballMox = tarball self.nixosConfigurations.mox.config.system.build.cross.${system};
          crossTarballOmnia = tarball self.nixosConfigurations.omnia.config.system.build.cross.${system};

        } // filterPackages system (flattenTree (
          import ./pkgs { nixpkgs = nixpkgs.legacyPackages."${system}"; }
        ));

        # The legacyPackages imported as overlay allows us to use pkgsCross to
        # cross-compile those packages.
        legacyPackages = import nixpkgs {
          inherit system;
          overlays = [ self.overlays.default ];
          crossOverlays = [ self.overlays.default ];
        };

      }
    );
}