diff --git a/maintenance/dev-shells/default.nix b/maintenance/dev-shells/default.nix index d16c16d1d..f250c0749 100644 --- a/maintenance/dev-shells/default.nix +++ b/maintenance/dev-shells/default.nix @@ -15,7 +15,9 @@ let pkgs = applyOverlay { inherit nyxPkgs; pkgs = nixPkgs; replace = true; merge = true; }; inherit (pkgs) callPackage mkShell; - nyxRecursionHelper = callPackage ../../shared/recursion-helper.nix { }; + nyxRecursionHelper = callPackage ../../shared/recursion-helper.nix { + inherit (pkgs.stdenv) system; + }; # Matches build.yml and full-bump.yml pinnedNix = pkgs.nixVersions.nix_2_19; diff --git a/maintenance/dev/default.nix b/maintenance/dev/default.nix index 98f2bd916..4b75add36 100644 --- a/maintenance/dev/default.nix +++ b/maintenance/dev/default.nix @@ -1,17 +1,24 @@ { flakes, nixConfig, utils, self ? flakes.self }: flakes.yafas.withAllSystems { } (universals: { system, ... }: let - pkgs = import flakes.nixpkgs { + nixPkgs = import flakes.nixpkgs { inherit system; config = { allowUnfree = true; + allowUnsupportedSystem = true; nvidia.acceptLicense = true; }; }; + nyxPkgs = utils.applyOverlay { pkgs = nixPkgs; }; in with universals; { - packages = utils.applyOverlay { inherit pkgs; }; - nixpkgs = pkgs; + packages = nyxPkgs; + nixpkgs = nixPkgs; + mergedPkgs = utils.applyOverlay { + pkgs = nixPkgs; + merge = true; + replace = true; + }; system = flakes.nixpkgs.lib.nixosSystem { inherit system; modules = [ self.nixosModules.default ]; diff --git a/maintenance/failures.aarch64-linux.nix b/maintenance/failures.aarch64-linux.nix new file mode 100644 index 000000000..ffcd4415b --- /dev/null +++ b/maintenance/failures.aarch64-linux.nix @@ -0,0 +1 @@ +{ } diff --git a/maintenance/failures.nix b/maintenance/failures.x86_64-linux.nix similarity index 100% rename from maintenance/failures.nix rename to maintenance/failures.x86_64-linux.nix diff --git a/maintenance/schemas/home-manager-modules/inventory.nix b/maintenance/schemas/home-manager-modules/inventory.nix index 4235fc598..01c3cf81f 100644 --- a/maintenance/schemas/home-manager-modules/inventory.nix +++ b/maintenance/schemas/home-manager-modules/inventory.nix @@ -7,7 +7,7 @@ let shared = import ../shared/options.nix; inherit (shared) optionMap optionWarn; - nyxRecursionHelper = pkgs.callPackage ../../../shared/recursion-helper.nix { }; + nyxRecursionHelper = pkgs.callPackage ../../../shared/recursion-helper.nix { inherit (pkgs.stdenv) system; }; loadedHomeManagerModule = homeManagerConfiguration { modules = [ diff --git a/maintenance/schemas/nixos-modules/inventory.nix b/maintenance/schemas/nixos-modules/inventory.nix index 1129652cf..34b39af40 100644 --- a/maintenance/schemas/nixos-modules/inventory.nix +++ b/maintenance/schemas/nixos-modules/inventory.nix @@ -6,7 +6,7 @@ let shared = import ../shared/options.nix; inherit (shared) optionMap optionWarn; - nyxRecursionHelper = pkgs.callPackage ../../../shared/recursion-helper.nix { }; + nyxRecursionHelper = pkgs.callPackage ../../../shared/recursion-helper.nix { inherit (pkgs.stdenv) system; }; nixosEval = nyxRecursionHelper.options optionWarn optionMap nyxosConfiguration.options.chaotic; diff --git a/maintenance/schemas/packages/inventory.nix b/maintenance/schemas/packages/inventory.nix index c8f2686ff..4b056e06c 100644 --- a/maintenance/schemas/packages/inventory.nix +++ b/maintenance/schemas/packages/inventory.nix @@ -1,10 +1,10 @@ { nixpkgs }: output: let - mkPackages = nyxPkgs: + mkPackages = system: nyxPkgs: let inherit (nixpkgs) lib; - nyxRecursionHelper = import ../../../shared/recursion-helper.nix { inherit lib; }; + nyxRecursionHelper = import ../../../shared/recursion-helper.nix { inherit lib system; }; derivationMap = k: v: { @@ -42,7 +42,7 @@ in children = { x86_64-linux.forSystems = [ "x86_64-linux" ]; x86_64-linux.children = - mkPackages output.x86_64-linux; + mkPackages "x86_64-linux" output.x86_64-linux; aarch64-linux.forSystems = [ "aarch64-linux" ]; aarch64-linux.children = let @@ -59,6 +59,6 @@ in "vkshade32_git" ]; in - mkPackages (remove32 output.aarch64-linux); + mkPackages "aarch64-linux" (remove32 output.aarch64-linux); }; } diff --git a/maintenance/tools/builder/default.nix b/maintenance/tools/builder/default.nix index 018928187..59ad8c7c9 100644 --- a/maintenance/tools/builder/default.nix +++ b/maintenance/tools/builder/default.nix @@ -30,7 +30,7 @@ let builtins.map (xsx: xsx.drv) (lib.lists.filter (xsx: xsx.drv != null) packagesEval); - brokenOutPaths = builtins.attrValues (import ../../failures.nix); + brokenOutPaths = builtins.attrValues (import "${flakeSelf}/maintenance/failures.${hostPlatform.system}.nix"); depVar = drv: "_dep_${nyxUtils.drvHash drv}"; @@ -111,6 +111,11 @@ writeShellScriptBin "chaotic-nyx-build" '' NYX_SOURCE="''${NYX_SOURCE:-${flakeSelf}}" NYX_TARGET="''${NYX_TARGET:-${hostPlatform.system}}" + NYX_PREFIX="" + if [ -z "$NYX_PREFIX" ] && [ "$NYX_TARGET" != 'x86_64-linux' ]; then + NYX_PREFIX="''${NYX_TARGET%-linux}." + fi + # All the required functions source ${./lib.sh} diff --git a/maintenance/tools/builder/lib.sh b/maintenance/tools/builder/lib.sh index 0910e5417..deb1bb724 100755 --- a/maintenance/tools/builder/lib.sh +++ b/maintenance/tools/builder/lib.sh @@ -58,7 +58,7 @@ function cached() { # Helper to zip-merge _ALL_OUT_KEYS and _ALL_OUT_PATHS function zip_path() { for (( i=0; i<${#_ALL_OUT_KEYS[*]}; ++i)); do - echo "${_ALL_OUT_KEYS[$i]}" "${_ALL_OUT_PATHS[$i]}" + echo "${NYX_PREFIX:-}${_ALL_OUT_KEYS[$i]}" "${_ALL_OUT_PATHS[$i]}" done } diff --git a/pkgs/linux-cachyos/kernel.nix b/pkgs/linux-cachyos/kernel.nix index c649290af..58ac4221d 100644 --- a/pkgs/linux-cachyos/kernel.nix +++ b/pkgs/linux-cachyos/kernel.nix @@ -33,7 +33,7 @@ in extraMeta = { maintainers = with lib.maintainers; [ dr460nf1r3 pedrohlc ]; # at the time of this writing, they don't have config files for aarch64 - broken = stdenv.system == "aarch64-linux"; + platforms = [ "x86_64-linux" ]; }; } ).overrideAttrs (prevAttrs: { diff --git a/pkgs/linux-cachyos/make.nix b/pkgs/linux-cachyos/make.nix index 11330361b..8cc5189f0 100644 --- a/pkgs/linux-cachyos/make.nix +++ b/pkgs/linux-cachyos/make.nix @@ -78,11 +78,14 @@ let basePackages = linuxPackagesFor kernel; packagesWithZFS = basePackages.extend addZFS; packagesWithoutUpdateScript = nyxUtils.dropAttrsUpdateScript packagesWithZFS; + packagesWithRightPlatforms = nyxUtils.setAttrsPlatforms supportedPlatforms packagesWithoutUpdateScript; + + supportedPlatforms = [ (with lib.systems.inspect.patterns; isx86_64 // isLinux) "x86_64-linux" ]; versionSuffix = "+C${nyxUtils.shorter versions.config.rev}+P${nyxUtils.shorter versions.patches.rev}" + lib.strings.optionalString withBCacheFS "+bcachefs"; in -packagesWithoutUpdateScript // { +packagesWithRightPlatforms // { _description = "Kernel and modules for ${description}"; _version = "${versions.linux.version}${versionSuffix}"; inherit (basePackages) kernel; # This one still has the updateScript diff --git a/shared/recursion-helper.nix b/shared/recursion-helper.nix index f69e4a62f..03fcfae51 100644 --- a/shared/recursion-helper.nix +++ b/shared/recursion-helper.nix @@ -1,4 +1,7 @@ -{ lib }: +{ lib, system }: +let + parsedSystem = lib.systems.parse.mkSystemFromString system; +in rec { join = namespace: current: if namespace != "" then @@ -21,6 +24,18 @@ rec { (if lib.attrsets.isDerivation v then (if (v.meta.broken or true) then warnFn fullKey v "marked broken" + else if ((v.meta.platforms or [ ]) != [ ] && + !(builtins.elem system v.meta.platforms || + lib.systems.inspect.matchAnyAttrs + (builtins.filter builtins.isAttrs v.meta.platforms) + parsedSystem)) then + warnFn fullKey v "not marked compatible" + else if ((v.meta.badPlatforms or [ ]) != [ ] && + (builtins.elem system v.meta.badPlatforms || + lib.systems.inspect.matchAnyAttrs + (builtins.filter builtins.isAttrs v.meta.badPlatforms) + parsedSystem)) then + warnFn fullKey v "marked incompatible" else if (v.meta.unfree or true && !(v.meta.nyx.bypassLicense or false) && v.meta.license != lib.licenses.unfreeRedistributable) then warnFn fullKey v "unfree" else diff --git a/shared/utils.nix b/shared/utils.nix index 0098b9aa4..103864b68 100644 --- a/shared/utils.nix +++ b/shared/utils.nix @@ -94,6 +94,20 @@ rec { x ); + # Helps when batch-overriding. + setAttrsPlatforms = platforms: builtins.mapAttrs (_k: v: + if (v ? "overrideAttrs") then + v.overrideAttrs + (prevAttrs: { + meta = (prevAttrs.meta or { }) // { + platforms = lib.lists.intersectLists (prevAttrs.meta.platforms or [ ]) platforms; + platformsOrig = prevAttrs.meta.platforms or [ ]; + badPlatforms = [ ]; + }; + }) + else v + ); + # For revs shorter = builtins.substring 0 7;