aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-04-12 14:46:33 +0200
committerKarel Kočí <cynerd@email.cz>2022-04-12 21:48:07 +0200
commitc2219a58525f02be455480bbd63c14455345c352 (patch)
tree0e2e94e2c7d3c13e615095e38f94c7a144b7c95a
parent32239620945c9468ba0e3c92d2cd8e4b4c34d246 (diff)
downloadnixturris-c2219a58525f02be455480bbd63c14455345c352.tar.gz
nixturris-c2219a58525f02be455480bbd63c14455345c352.tar.bz2
nixturris-c2219a58525f02be455480bbd63c14455345c352.zip
flake: allow cross compilation of tarballs
-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;