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

  inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-21.11";

  outputs = { self, flake-utils, nixpkgs-stable }: {

      overlays.default = final: prev: import ./pkgs { nixpkgs = prev; };
      overlay = self.overlays.default; # Backward compatibility

      nixosModules = import ./nixos;
      nixosModule = {
        imports = builtins.attrValues self.nixosModules;
        nixpkgs.overlays = [ self.overlay ];
      };

      lib = import ./lib { self = self; nixpkgs-stable = nixpkgs-stable; };

    } // flake-utils.lib.eachSystem (flake-utils.lib.defaultSystems ++ ["armv7l-linux"]) (
      system: {
        packages = let

          createTarball = {...} @args: (self.lib.nixturrisSystem ({
              modules = [ (import ./tarball.nix args.board) ];
            } // args)).config.system.build.tarball;

        in {

          tarballMox = createTarball { board = "mox"; };
          tarballOmnia = createTarball { board = "omnia"; };
          crossTarballMox = createTarball { board = "mox"; system = system; };
          crossTarballOmnia = createTarball { board = "omnia"; system = system; };

        } // flake-utils.lib.filterPackages system (flake-utils.lib.flattenTree (
          import ./pkgs { nixpkgs = nixpkgs-stable.legacyPackages."${system}"; }
        ));

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