blob: 331bf79fd491e04b97d21f429566ae617e4afcaa (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
{
description = "Turris flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
outputs = { self, flake-utils, nixpkgs }: {
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 = {
# The full NixOS system
nixturrisSystem = {board, modules ? [], override ? {}}: let
pkgs = if board == "omnia"
then nixpkgs.legacyPackages.armv7l-linux
else nixpkgs.legacyPackages.aarch64-linux;
in nixpkgs.lib.nixosSystem ({
system = pkgs.system;
modules = [
self.nixosModule
{ turris.board = board; }
] ++ modules;
} // override);
# The minimalized system to decrease amount of ram needed for rebuild
# TODO this does not work right now as it requires just load of work to do
nixturrisMinSystem = {modules, ...} @args:
self.lib.nixturrisSystem (args // {
modules = modules ++ [ ./nixos/nixos-modules-minfake.nix ];
override = {
baseModules = import ./nixos/nixos-modules.nix nixpkgs;
};
});
};
} // flake-utils.lib.eachSystem (flake-utils.lib.defaultSystems ++ ["armv7l-linux"]) (
system: {
packages = let
createMedkit = board: (self.lib.nixturrisSystem {
board = board;
modules = [ (import ./medkit.nix board) ];
}).config.system.build.tarball;
in {
medkit-mox = createMedkit "mox";
medkit-omnia = createMedkit "omnia";
} // flake-utils.lib.filterPackages system (flake-utils.lib.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.overlay ];
crossOverlays = [ self.overlay ];
};
}
);
}
|