From db1b484d986440256b32c898dd44985bf98401c0 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Wed, 16 Oct 2024 08:34:44 -0700 Subject: [PATCH 1/3] flake.nix: exclude armv6-linux and riscv64-linux from checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, `nix flake check --all-systems --json` fails with: error: … while calling the 'head' builtin at /nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/lib/attrsets.nix:1575:11: 1574| || pred here (elemAt values 1) (head values) then 1575| head values | ^ 1576| else … while evaluating the attribute 'value' at /nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/lib/modules.nix:816:9: 815| in warnDeprecation opt // 816| { value = addErrorContext "while evaluating the option `${showOption loc}':" value; | ^ 817| inherit (res.defsFinal') highestPrio; … while evaluating the option `system.build.toplevel': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/activation/top-level.nix': … while evaluating the option `system.systemBuilderArgs': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/activation/activatable-system.nix': … while evaluating the option `system.activationScripts.etc.text': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/etc/etc-activation.nix': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/etc/etc.nix': … while evaluating the option `environment.etc.dbus-1.source': (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: cannot bootstrap GHC on this platform ('riscv64-linux' with libc 'defaultLibc') --- flake.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 950eb2b5c4d1..f67d2724bce8 100644 --- a/flake.nix +++ b/flake.nix @@ -80,8 +80,17 @@ checks = forAllSystems (system: { tarball = jobs.${system}.tarball; - # Exclude power64 due to "libressl is not available on the requested hostPlatform" with hostPlatform being power64 - } // lib.optionalAttrs (self.legacyPackages.${system}.stdenv.hostPlatform.isLinux && !self.legacyPackages.${system}.targetPlatform.isPower64) { + } // lib.optionalAttrs + ( + self.legacyPackages.${system}.stdenv.hostPlatform.isLinux + # Exclude power64 due to "libressl is not available on the requested hostPlatform" with hostPlatform being power64 + && !self.legacyPackages.${system}.targetPlatform.isPower64 + # Exclude armv6l-linux due to "cannot bootstrap GHC on this platform ('armv6l-linux' with libc 'defaultLibc')" + && system != "armv6l-linux" + # Exclude riscv64-linux due to "cannot bootstrap GHC on this platform ('riscv64-linux' with libc 'defaultLibc')" + && system != "riscv64-linux" + ) + { # Test that ensures that the nixosSystem function can accept a lib argument # Note: prefer not to extend or modify `lib`, especially if you want to share reusable modules # alternatives include: `import` a file, or put a custom library in an option or in `_module.args.` From ccb779782ccb471954971697fcdf1c2331cd906b Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Wed, 16 Oct 2024 08:46:44 -0700 Subject: [PATCH 2/3] flake.nix: exclude armv6-linux, riscv64-linux, and FreeBSD from devShells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nixfmt-rfc-style is built with Haskell, and the packaged GHC compiler does not support any of these platforms (currently?). error: … while checking flake output 'devShells' at /nix/store/p36amaznf46ic90fb2rw5c952mgj6mfi-source/flake.nix:123:7: 122| 123| devShells = forAllSystems (system: { } // lib.optionalAttrs (system != "armv6l-linux" && system != "riscv64-linux") { | ^ 124| /** A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix. */ … while checking the derivation 'devShells.x86_64-freebsd.default' at /nix/store/p36amaznf46ic90fb2rw5c952mgj6mfi-source/flake.nix:125:9: 124| /** A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix. */ 125| default = import ./shell.nix { inherit system; }; | ^ 126| }); (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: Package ‘ghc-9.6.6’ in /nix/store/8akjd9ngyzhzi1412nxmw26rnj93l3gp-source/pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform: hostPlatform.config = "x86_64-unknown-freebsd" package.meta.platforms = [ "aarch64-darwin" "aarch64-linux" "i686-linux" "x86_64-darwin" "x86_64-linux" ] package.meta.badPlatforms = [ ] , refusing to evaluate. --- flake.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index f67d2724bce8..9873c1c94971 100644 --- a/flake.nix +++ b/flake.nix @@ -120,10 +120,20 @@ }).nixos.manual; }; - devShells = forAllSystems (system: { - /** A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix. */ - default = import ./shell.nix { inherit system; }; - }); + devShells = forAllSystems (system: + { } // lib.optionalAttrs + ( + # Exclude armv6l-linux because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform" + system != "armv6l-linux" + # Exclude riscv64-linux because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform" + && system != "riscv64-linux" + # Exclude FreeBSD because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform" + && !self.legacyPackages.${system}.stdenv.hostPlatform.isFreeBSD + ) + { + /** A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix. */ + default = import ./shell.nix { inherit system; }; + }); /** A nested structure of [packages](https://nix.dev/manual/nix/latest/glossary#package-attribute-set) and other values. From 705fdd9ccc0f8dccade08344cdfb75593b7f91d0 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Wed, 16 Oct 2024 08:49:28 -0700 Subject: [PATCH 3/3] ci/basic-eval: check that flake outputs are valid --- .github/workflows/basic-eval.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/basic-eval.yml b/.github/workflows/basic-eval.yml index 5a8f20eb711d..b3a85c297925 100644 --- a/.github/workflows/basic-eval.yml +++ b/.github/workflows/basic-eval.yml @@ -26,5 +26,6 @@ jobs: # This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere. name: nixpkgs-ci signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + - run: nix --experimental-features 'nix-command flakes' flake check --all-systems --no-build # explicit list of supportedSystems is needed until aarch64-darwin becomes part of the trunk jobset - run: nix-build pkgs/top-level/release.nix -A release-checks --arg supportedSystems '[ "aarch64-darwin" "aarch64-linux" "x86_64-linux" "x86_64-darwin" ]'