diff options
author | Karel Kočí <cynerd@email.cz> | 2022-04-14 10:51:54 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-04-14 10:51:54 +0200 |
commit | a9b89caad886c98de675028f8b6c26ecff2c7254 (patch) | |
tree | fccc33b333c2399ce74d0b5f7b5b8884d2604446 /lib/default.nix | |
parent | 77b0186c29996be84d4c3f967e2bcf3f63d543a3 (diff) | |
download | nixturris-a9b89caad886c98de675028f8b6c26ecff2c7254.tar.gz nixturris-a9b89caad886c98de675028f8b6c26ecff2c7254.tar.bz2 nixturris-a9b89caad886c98de675028f8b6c26ecff2c7254.zip |
lib: move library to its own directory
Diffstat (limited to 'lib/default.nix')
-rw-r--r-- | lib/default.nix | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..163e06b --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,49 @@ +{ self, nixpkgs-stable }: 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; + } // 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 // { + nixpkgs = nixpkgs; + modules = modules ++ [ ../nixos/nixos-modules-minfake.nix ]; + override = { + baseModules = import ../nixos/nixos-modules.nix nixpkgs; + }; + }); + +} |