From 84a4712bcb567905aeecf7afc009848fdc457ea4 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Wed, 31 Jan 2024 20:07:35 +0100 Subject: [PATCH 1/4] lib/tests/packages-from-directory: make sure all .nix files parse It is useful that all (or almost all) .nix files in nixpkgs at least parse since it allows for checking syntax in the repository programmatically without evaluating anything. --- .../packages-from-directory/c/not-a-namespace/not-a-package.nix | 1 + lib/tests/packages-from-directory/c/support-definitions.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/tests/packages-from-directory/c/not-a-namespace/not-a-package.nix b/lib/tests/packages-from-directory/c/not-a-namespace/not-a-package.nix index e69de29bb2d1..ffcd4415b08f 100644 --- a/lib/tests/packages-from-directory/c/not-a-namespace/not-a-package.nix +++ b/lib/tests/packages-from-directory/c/not-a-namespace/not-a-package.nix @@ -0,0 +1 @@ +{ } diff --git a/lib/tests/packages-from-directory/c/support-definitions.nix b/lib/tests/packages-from-directory/c/support-definitions.nix index e69de29bb2d1..ffcd4415b08f 100644 --- a/lib/tests/packages-from-directory/c/support-definitions.nix +++ b/lib/tests/packages-from-directory/c/support-definitions.nix @@ -0,0 +1 @@ +{ } From 8cf33c2dd1f3564187c063787109c000cb011f69 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Wed, 31 Jan 2024 20:11:21 +0100 Subject: [PATCH 2/4] flutter: remove path interpolation Path interpolation is not supported in Nix 2.3 which nixpkgs maintains support for. --- .../compilers/flutter/artifacts/prepare-artifacts.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/flutter/artifacts/prepare-artifacts.nix b/pkgs/development/compilers/flutter/artifacts/prepare-artifacts.nix index 9309c6429828..def75e280da7 100644 --- a/pkgs/development/compilers/flutter/artifacts/prepare-artifacts.nix +++ b/pkgs/development/compilers/flutter/artifacts/prepare-artifacts.nix @@ -20,7 +20,7 @@ runHook postInstall ''; }).overrideAttrs ( - if builtins.pathExists ./overrides/${src.flutterPlatform}.nix - then callPackage ./overrides/${src.flutterPlatform}.nix { } + if builtins.pathExists (./overrides + "/${src.flutterPlatform}.nix") + then callPackage (./overrides + "/${src.flutterPlatform}.nix") { } else ({ ... }: { }) ) From 6dc3672c15b6022112b6e511605f0da45c8a8965 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Wed, 31 Jan 2024 20:26:24 +0100 Subject: [PATCH 3/4] flutter/update: add .in extensions to Nix expression template files Use autotools inspired extensions (as syntax sort of matches) to make clear that these are not Nix expressions yet and don't necessarily parse or evaluate. --- .../{get-artifact-hashes.nix => get-artifact-hashes.nix.in} | 0 .../update/{get-dart-hashes.nix => get-dart-hashes.nix.in} | 0 .../flutter/update/{get-flutter.nix => get-flutter.nix.in} | 0 .../update/{get-pubspec-lock.nix => get-pubspec-lock.nix.in} | 0 pkgs/development/compilers/flutter/update/update.py | 2 +- 5 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/development/compilers/flutter/update/{get-artifact-hashes.nix => get-artifact-hashes.nix.in} (100%) rename pkgs/development/compilers/flutter/update/{get-dart-hashes.nix => get-dart-hashes.nix.in} (100%) rename pkgs/development/compilers/flutter/update/{get-flutter.nix => get-flutter.nix.in} (100%) rename pkgs/development/compilers/flutter/update/{get-pubspec-lock.nix => get-pubspec-lock.nix.in} (100%) diff --git a/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix b/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in similarity index 100% rename from pkgs/development/compilers/flutter/update/get-artifact-hashes.nix rename to pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in diff --git a/pkgs/development/compilers/flutter/update/get-dart-hashes.nix b/pkgs/development/compilers/flutter/update/get-dart-hashes.nix.in similarity index 100% rename from pkgs/development/compilers/flutter/update/get-dart-hashes.nix rename to pkgs/development/compilers/flutter/update/get-dart-hashes.nix.in diff --git a/pkgs/development/compilers/flutter/update/get-flutter.nix b/pkgs/development/compilers/flutter/update/get-flutter.nix.in similarity index 100% rename from pkgs/development/compilers/flutter/update/get-flutter.nix rename to pkgs/development/compilers/flutter/update/get-flutter.nix.in diff --git a/pkgs/development/compilers/flutter/update/get-pubspec-lock.nix b/pkgs/development/compilers/flutter/update/get-pubspec-lock.nix.in similarity index 100% rename from pkgs/development/compilers/flutter/update/get-pubspec-lock.nix rename to pkgs/development/compilers/flutter/update/get-pubspec-lock.nix.in diff --git a/pkgs/development/compilers/flutter/update/update.py b/pkgs/development/compilers/flutter/update/update.py index c622487cf9dc..618fae5468e5 100755 --- a/pkgs/development/compilers/flutter/update/update.py +++ b/pkgs/development/compilers/flutter/update/update.py @@ -23,7 +23,7 @@ NIXPKGS_ROOT = subprocess.Popen(['git', def load_code(name, **kwargs): - with open(f"{NIXPKGS_ROOT}/pkgs/development/compilers/flutter/update/{name}", 'r') as f: + with open(f"{NIXPKGS_ROOT}/pkgs/development/compilers/flutter/update/{name}.in", 'r') as f: code = f.read() for (key, value) in kwargs.items(): From 488b4c9fa1cdd283a7d6a1afe82bb7f6d1135c61 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Wed, 31 Jan 2024 21:17:41 +0100 Subject: [PATCH 4/4] flutter/update: provide fake hashes of the proper length --- .../compilers/flutter/update/get-artifact-hashes.nix.in | 2 +- .../compilers/flutter/update/get-dart-hashes.nix.in | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in b/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in index 89343a323165..069bcdb95718 100644 --- a/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in +++ b/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in @@ -35,7 +35,7 @@ let flutter = flutterPackages."v${flutterCompactVersion}"; inherit flutterPlatform; inherit systemPlatform; - hash = ""; + hash = lib.fakeSha256; }) systemPlatforms) ) [ ] diff --git a/pkgs/development/compilers/flutter/update/get-dart-hashes.nix.in b/pkgs/development/compilers/flutter/update/get-dart-hashes.nix.in index 4122110bccaa..f900c863195a 100644 --- a/pkgs/development/compilers/flutter/update/get-dart-hashes.nix.in +++ b/pkgs/development/compilers/flutter/update/get-dart-hashes.nix.in @@ -6,21 +6,21 @@ in x86_64-linux = { fetchzip }: fetchzip { url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-linux-x64-release.zip"; - sha256 = ""; + sha256 = "0000000000000000000000000000000000000000000000000000"; }; aarch64-linux = { fetchzip }: fetchzip { url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-linux-arm64-release.zip"; - sha256 = ""; + sha256 = "0000000000000000000000000000000000000000000000000000"; }; x86_64-darwin = { fetchzip }: fetchzip { url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-macos-x64-release.zip"; - sha256 = ""; + sha256 = "0000000000000000000000000000000000000000000000000000"; }; aarch64-darwin = { fetchzip }: fetchzip { url = "https://storage.googleapis.com/dart-archive/channels/stable/release/${dartVersion}/sdk/dartsdk-macos-arm64-release.zip"; - sha256 = ""; + sha256 = "0000000000000000000000000000000000000000000000000000"; }; }.${platform}