diff options
-rw-r--r-- | flake.lock | 21 | ||||
-rw-r--r-- | flake.nix | 33 | ||||
-rw-r--r-- | lib/default.nix | 8 | ||||
-rw-r--r-- | nixos/default.nix | 1 | ||||
-rw-r--r-- | nixos/modules/turris-defaults.nix | 6 | ||||
-rw-r--r-- | nixos/modules/turris-wifi.nix | 33 | ||||
-rw-r--r-- | pkgs/default.nix | 17 |
7 files changed, 60 insertions, 59 deletions
@@ -14,13 +14,27 @@ "type": "indirect" } }, + "nixpkgs": { + "locked": { + "lastModified": 1651146972, + "narHash": "sha256-on1R40AlYKbngH2p+cqvhMt9P5oEUWAh9xTVtE70YFA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6ff202cb7be0c92c81b4db0f4b7b8c8e969e8001", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "nixpkgs-stable": { "locked": { - "lastModified": 1650244918, - "narHash": "sha256-DsS5nxjTpnoUC4pNXJI1rit7TnDTij8vQDa5PtcDCD0=", + "lastModified": 1651310835, + "narHash": "sha256-MLk/zsLlbPhwFucxL64Fr+oIrvQC2/76Ap2F7ekbPNI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7b38b03d76ab71bdc8dc325e3f6338d984cc35ca", + "rev": "fd3e33d696b81e76b30160dfad2efb7ac1f19879", "type": "github" }, "original": { @@ -33,6 +47,7 @@ "root": { "inputs": { "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable" } } @@ -3,7 +3,7 @@ inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-21.11"; - outputs = { self, flake-utils, nixpkgs-stable }: { + outputs = { self, flake-utils, nixpkgs, nixpkgs-stable }: { overlays.default = final: prev: import ./pkgs { nixpkgs = prev; }; overlay = self.overlays.default; # Backward compatibility @@ -14,27 +14,38 @@ nixpkgs.overlays = [ self.overlay ]; }; - lib = import ./lib { self = self; nixpkgs-stable = nixpkgs-stable; }; + lib = import ./lib self; nixosConfigurations = { - tarballMox = self.lib.nixturrisTarballSystem { board = "mox"; }; - tarballOmnia = self.lib.nixturrisTarballSystem { board = "omnia"; }; + tarballMox = self.lib.nixturrisTarballSystem { board = "mox"; nixpkgs = nixpkgs; }; + tarballOmnia = self.lib.nixturrisTarballSystem { board = "omnia"; nixpkgs = nixpkgs; }; + stableTarballMox = self.lib.nixturrisTarballSystem { board = "mox"; nixpkgs = nixpkgs-stable; }; + stableTarballOmnia = self.lib.nixturrisTarballSystem { board = "omnia"; nixpkgs = nixpkgs-stable; }; }; } // flake-utils.lib.eachSystem (flake-utils.lib.defaultSystems ++ ["armv7l-linux"]) ( system: { - packages = { - tarballMox = self.nixosConfigurations.tarballMox.config.system.build.tarball; - tarballOmnia = self.nixosConfigurations.tarballOmnia.config.system.build.tarball; - crossTarballMox = (self.lib.nixturrisTarballSystem { board = "mox"; system = system; }).config.system.build.tarball; - crossTarballOmnia = (self.lib.nixturrisTarballSystem { board = "omnia"; system = system; }).config.system.build.tarball; + packages = let + tarball = nixos: nixos.config.system.build.tarball; + in { + + tarballMox = tarball self.nixosConfigurations.tarballMox; + tarballOmnia = tarball self.nixosConfigurations.tarballOmnia; + stableTarballMox = tarball self.nixosConfigurations.stableTarballMox; + stableTarballOmnia = tarball self.nixosConfigurations.stableTarballOmnia; + + crossTarballMox = tarball (self.lib.nixturrisTarballSystem { board = "mox"; nixpkgs = nixpkgs; system = system; }); + crossTarballOmnia = tarball (self.lib.nixturrisTarballSystem { board = "omnia"; nixpkgs = nixpkgs; system = system; }); + stableCrossTarballMox = tarball (self.lib.nixturrisTarballSystem { board = "mox"; nixpkgs = nixpkgs-stable; system = system; }); + stableCrossTarballOmnia = tarball (self.lib.nixturrisTarballSystem { board = "omnia"; nixpkgs = nixpkgs-stable; system = system; }); + } // flake-utils.lib.filterPackages system (flake-utils.lib.flattenTree ( - import ./pkgs { nixpkgs = nixpkgs-stable.legacyPackages."${system}"; } + import ./pkgs { nixpkgs = nixpkgs.legacyPackages."${system}"; } )); # The legacyPackages imported as overlay allows us to use pkgsCross to # cross-compile those packages. - legacyPackages = import nixpkgs-stable { + legacyPackages = import nixpkgs { inherit system; overlays = [ self.overlay ]; crossOverlays = [ self.overlay ]; diff --git a/lib/default.nix b/lib/default.nix index 5627879..fab13b6 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,4 @@ -{ self, nixpkgs-stable }: rec { +self: rec { # Mapping of board name to the appropriate system boardSystem = { @@ -16,8 +16,8 @@ # NixOS system for specific Turris board nixturrisSystem = { board, + nixpkgs, system ? boardSystem.${board}.system, - nixpkgs ? nixpkgs-stable, modules ? [], override ? {} }: nixpkgs.lib.nixosSystem ({ @@ -35,8 +35,8 @@ # 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, + nixpkgs, + modules ? [], ... } @args: self.lib.nixturrisSystem (args // { nixpkgs = nixpkgs; diff --git a/nixos/default.nix b/nixos/default.nix index 05d804d..e7c8f00 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,5 +1,4 @@ { turris-board = import ./modules/turris-board.nix; turris-defaults = import ./modules/turris-defaults.nix; - turris-wifi = import ./modules/turris-wifi.nix; } diff --git a/nixos/modules/turris-defaults.nix b/nixos/modules/turris-defaults.nix index fe9c4be..01c3deb 100644 --- a/nixos/modules/turris-defaults.nix +++ b/nixos/modules/turris-defaults.nix @@ -44,6 +44,10 @@ in { # Use the latest kernel boot.kernelPackages = mkDefault pkgs.linuxPackages_latest; + #boot.kernelPackages = mkDefault (if (config.turris.board == "mox") then + # pkgs.linuxPackages_latest + #else + # pkgs.linuxPackages_5_15); # The supported deployment is on BTRFS boot.supportedFilesystems = [ "btrfs" ]; @@ -77,7 +81,7 @@ in { environment.systemPackages = with pkgs; [ htop ] ++ optionals (config.turris.board == "mox") [ - libatsha204 + mox-otp ] ++ optionals (config.turris.board == "omnia") [ libatsha204 ]; diff --git a/nixos/modules/turris-wifi.nix b/nixos/modules/turris-wifi.nix deleted file mode 100644 index bd74523..0000000 --- a/nixos/modules/turris-wifi.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cnf = config.turris.wifi; - -in { - - options = { - turris.wifi = { - enable = mkOption { - type = types.bool; - default = true; - description = "Enable Turris WiFi configuration"; - }; - }; - }; - - config = mkIf cnf.enable { - # Needed for Ath10k firmware - hardware.firmware = with pkgs; [ firmwareLinuxNonfree ]; - - # The additional administration packages - environment.systemPackages = with pkgs; [ - iw - ] ++ optionals (config.turris.board == "mox") [ - ] ++ optionals (config.turris.board == "omnia") [ - ]; - - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index 50d6f13..abbea4f 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,11 +4,12 @@ let pkgs = nixpkgs // turrispkgs; callPackage = nixlib.callPackageWith pkgs; - armv7lDisableCheck = pkg: if nixpkgs.system != "armv7l-linux" then pkg - else pkg.overrideAttrs (oldAttrs: { - doCheck = false; - doInstallCheck = false; - }); + disableCheck = pkg: pkg.overrideAttrs (oldAttrs: { + doCheck = false; + doInstallCheck = false; + }); + armv7lDisableCheck = pkg: if nixpkgs.system != "armv7l-linux" then pkg else disableCheck pkg; + aarch64DisableCheck = pkg: if nixpkgs.system != "aarch64-linux" then pkg else disableCheck pkg; turrispkgs = with pkgs; { @@ -16,7 +17,8 @@ let libatsha204 = callPackage ./libatsha204 { }; mox-otp = python3Packages.callPackage ./mox-otp { }; - # Overrides to get armv7 to work + # Overrides to get build to work + patchelf = armv7lDisableCheck nixpkgs.patchelf; bison = armv7lDisableCheck nixpkgs.bison; findutils = armv7lDisableCheck nixpkgs.findutils; libuv = armv7lDisableCheck nixpkgs.libuv; @@ -29,6 +31,9 @@ let polkit = armv7lDisableCheck nixpkgs.polkit; udisks2 = armv7lDisableCheck nixpkgs.udisks2; udisks = udisks2; + llvm = armv7lDisableCheck nixpkgs.llvm; + llvm_14 = armv7lDisableCheck nixpkgs.llvm_14; + jemalloc = armv7lDisableCheck nixpkgs.jemalloc; }; |