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

  outputs = { self, flake-utils, nixpkgs }:
  with nixpkgs.lib;
  with flake-utils.lib;
  let
    supportedHostSystems = (
      # Note: crossTarball* targets are broken on darwin so it gets disabled here
      with builtins; filter (system: hasSuffix "-darwin" system) 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 ];
        };

      }
    );
}