aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix45
1 files changed, 34 insertions, 11 deletions
diff --git a/flake.nix b/flake.nix
index 850c6c9..739ba9e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -14,23 +14,45 @@
nixpkgs.overlays = [ self.overlay ];
};
- lib = {
- # The full NixOS system
- nixturrisSystem = {nixpkgs ? nixpkgs-stable, 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;
+ lib = rec {
+ # Mapping of board name to the appropriate system
+ boardSystem = {
+ omnia = {
+ config = "armv7l-unknown-linux-gnueabihf";
+ system = "armv7l-linux";
+ };
+ mox = {
+ config = "aarch64-unknown-linux-gnu";
+ system = "aarch64-linux";
+ };
+ };
+
+ # NixOS system for specific Turris board
+ nixturrisSystem = {
+ board,
+ system ? boardSystem.${board}.system,
+ nixpkgs ? nixpkgs-stable,
+ modules ? [],
+ override ? {}
+ }: nixpkgs.lib.nixosSystem ({
+ system = system;
modules = [
self.nixosModule
- { turris.board = board; }
+ ({
+ turris.board = board;
+ } // nixpkgs.lib.optionalAttrs (system != boardSystem.${board}.system) {
+ nixpkgs.crossSystem = boardSystem.${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 = {nixpkgs ? nixpkgs-stable, modules, ...} @args:
- self.lib.nixturrisSystem (args // {
+ nixturrisMinSystem = {
+ nixpkgs ? nixpkgs-stable,
+ modules,
+ ...
+ } @args: self.lib.nixturrisSystem (args // {
nixpkgs = nixpkgs;
modules = modules ++ [ ./nixos/nixos-modules-minfake.nix ];
override = {
@@ -44,6 +66,7 @@
packages = let
createTarball = board: (self.lib.nixturrisSystem {
+ system = system;
board = board;
modules = [ (import ./tarball.nix board) ];
}).config.system.build.tarball;