chore(3p/sources): bump to OpenSSH vulnerability hotfix

See https://github.com/NixOS/nixpkgs/pull/323753 for details.

Changes:

* git: temporarily comment out dottime patch (it doesn't apply, but it's not critical)
* third-party/cgit: use an older git version where dottime patch still applies
* 3p/crate2nix: remove crate2nix patches included in latest release
* tvix: remove unneeded defaultCrateOverrides (upstreamed to nixpkgs)
* tvix: regenerate Cargo.nix
* tvix/nix-compat: remove unnused AtermWriteable::aterm_bytes pub(crate) function
* tvix/nix-compat: remove redundant trait bounds
* tvix/glue: use clone_into() to set drv.{builder,system}
* tools/crate2nix: apply workaround for https://github.com/numtide/treefmt/issues/327
* toold/depotfmt: expose treefmt config as passthru
* tools/crate2nix: undo some more hacks in the crate2nix-check drv

Change-Id: Ifbcedeb3e8f81b2f6ec1dbf10189bfa6dfd9c75c
Co-Authored-By: Florian Klink <flokli@flokli.de>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11907
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2024-07-01 12:47:15 +03:00 committed by tazjin
parent 17bdf9a574
commit 4b2f3c5454
15 changed files with 124 additions and 230 deletions

View file

@ -1,6 +1,6 @@
# See README.md # See README.md
{ depot ? import ../. {}, ... }: { depot ? import ../. { }, ... }:
depot.third_party.nixpkgs.extend(_: _: { depot.third_party.nixpkgs.extend (_: _: {
tvl = depot; tvl = depot;
}) })

View file

@ -27,9 +27,22 @@ stdenv.mkDerivation rec {
# #
# TODO(tazjin): Add an assert for this somewhere so we notice it on # TODO(tazjin): Add an assert for this somewhere so we notice it on
# channel bumps. # channel bumps.
preBuild = '' preBuild =
let
# we have to give cgit a git with dottime support to build
git' = pkgs.git.overrideAttrs (old: {
src = pkgs.fetchurl {
url = "https://github.com/git/git/archive/refs/tags/v2.44.2.tar.gz";
hash = "sha256-3h0LBfAD4MXfZc0tjWQDO81UdbRo3w5C0W7j7rr9m9I=";
};
patches = (old.patches or [ ]) ++ [
../git/0001-feat-third_party-git-date-add-dottime-format.patch
];
});
in
''
rm -rf git # remove submodule dir ... rm -rf git # remove submodule dir ...
cp -r --no-preserve=ownership,mode ${pkgs.srcOnly depot.third_party.git} git cp -r --no-preserve=ownership,mode ${pkgs.srcOnly git'} git
makeFlagsArray+=(prefix="$out" CGIT_SCRIPT_PATH="$out/cgit/") makeFlagsArray+=(prefix="$out" CGIT_SCRIPT_PATH="$out/cgit/")
cat tvl-extra.css >> cgit.css cat tvl-extra.css >> cgit.css
''; '';

View file

@ -4,6 +4,6 @@
pkgs.git.overrideAttrs (old: { pkgs.git.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ patches = (old.patches or [ ]) ++ [
./0001-feat-third_party-git-date-add-dottime-format.patch # ./0001-feat-third_party-git-date-add-dottime-format.patch
]; ];
}) })

View file

@ -1,22 +0,0 @@
From 0209f258cda8a9972a785e26d92fb477ce4d1b0e Mon Sep 17 00:00:00 2001
From: Ilan Joselevich <personal@ilanjoselevich.com>
Date: Tue, 11 Jun 2024 18:14:06 +0300
Subject: [PATCH] Get rid of dontStrip for Darwin as it's no longer needed
Fixed in https://github.com/NixOS/nixpkgs/pull/255900
---
templates/nix/crate2nix/default.nix | 2 --
diff --git a/templates/nix/crate2nix/default.nix b/templates/nix/crate2nix/default.nix
index 95d3730f..c53925e7 100644
--- a/templates/nix/crate2nix/default.nix
+++ b/templates/nix/crate2nix/default.nix
@@ -349,8 +349,6 @@ rec {
buildRustCrateForPkgsFunc pkgs
(
crateConfig // {
- # https://github.com/NixOS/nixpkgs/issues/218712
- dontStrip = stdenv.hostPlatform.isDarwin;
src = crateConfig.src or (
pkgs.fetchurl rec {
name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";

View file

@ -1,69 +0,0 @@
From 7cf084f73f7d15fe0538a625182fa7179c083b3d Mon Sep 17 00:00:00 2001
From: Raito Bezarius <masterancpp@gmail.com>
Date: Tue, 16 Jan 2024 02:10:48 +0100
Subject: [PATCH] fix(template): run tests in `/build/source` instead `/build`
Previously, the source tree was located inline in `/build` during tests, this was a mistake
because the crates more than often are built in `/build/source` as per the `sourceRoot` system.
This can cause issues with test binaries hardcoding `/build/source/...` as their choice for doing things,
causing them to be confused in the test phase which is relocated without rewriting the paths inside test binaries.
We fix that by relocating ourselves in the right hierarchy.
This is a "simple" fix in the sense that more edge cases could exist but they are hard to reason about
because they would be crates using custom `sourceRoot`, i.e. having `crate.sourceRoot` set and then it becomes
a bit hard to reproduce the hierarchy, you need to analyze whether the path is absolute or relative,
If it's relative, you can just reuse it and reproduce that specific hierarchy.
If it's absolute, you need to cut the "absolute" meaningless part, e.g. `$NIX_BUILD_TOP/` and proceed like
it's a relative path IMHO.
---
crate2nix/Cargo.nix | 10 ++++++++++
crate2nix/templates/nix/crate2nix/default.nix | 10 ++++++++++
diff --git a/Cargo.nix b/Cargo.nix
index 6ef7a49..172ff34 100644
--- a/Cargo.nix
+++ b/Cargo.nix
@@ -2889,6 +2889,16 @@ rec {
# recreate a file hierarchy as when running tests with cargo
# the source for test data
+ # It's necessary to locate the source in $NIX_BUILD_TOP/source/
+ # instead of $NIX_BUILD_TOP/
+ # because we compiled those test binaries in the former and not the latter.
+ # So all paths will expect source tree to be there and not in the build top directly.
+ # For example: $NIX_BUILD_TOP := /build in general, if you ask yourself.
+ # TODO(raitobezarius): I believe there could be more edge cases if `crate.sourceRoot`
+ # do exist but it's very hard to reason about them, so let's wait until the first bug report.
+ mkdir -p source/
+ cd source/
+
${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src}
# build outputs
diff --git a/crate2nix/templates/nix/crate2nix/default.nix b/crate2nix/templates/nix/crate2nix/default.nix
index e4fc2e9..dfb14c4 100644
--- a/templates/nix/crate2nix/default.nix
+++ b/templates/nix/crate2nix/default.nix
@@ -135,6 +135,16 @@ rec {
# recreate a file hierarchy as when running tests with cargo
# the source for test data
+ # It's necessary to locate the source in $NIX_BUILD_TOP/source/
+ # instead of $NIX_BUILD_TOP/
+ # because we compiled those test binaries in the former and not the latter.
+ # So all paths will expect source tree to be there and not in the build top directly.
+ # For example: $NIX_BUILD_TOP := /build in general, if you ask yourself.
+ # TODO(raitobezarius): I believe there could be more edge cases if `crate.sourceRoot`
+ # do exist but it's very hard to reason about them, so let's wait until the first bug report.
+ mkdir -p source/
+ cd source/
+
${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src}
# build outputs
--
2.43.0

View file

@ -0,0 +1,43 @@
From 601af097720079ea40db100b1dd6aefba4685e7c Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Mon, 1 Jul 2024 17:34:08 +0300
Subject: [PATCH] fix: only try opening the cache if cache is enabled
Otherwise `--no-cache` still fails to open the cache.
---
cli/format.go | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/cli/format.go b/cli/format.go
index 492a4f3..8ccf578 100644
--- a/cli/format.go
+++ b/cli/format.go
@@ -118,9 +118,11 @@ func (f *Format) Run() (err error) {
f.formatters[name] = formatter
}
- // open the cache
- if err = cache.Open(f.TreeRoot, f.ClearCache, f.formatters); err != nil {
- return err
+ // open the cache if configured
+ if !f.NoCache {
+ if cache.Open(f.TreeRoot, f.ClearCache, f.formatters); err != nil {
+ return err
+ }
}
// create an app context and listen for shutdown
@@ -148,7 +150,9 @@ func (f *Format) Run() (err error) {
f.processedCh = make(chan *walk.File, cap(f.filesCh))
// start concurrent processing tasks in reverse order
- eg.Go(f.updateCache(ctx))
+ if !f.NoCache {
+ eg.Go(f.updateCache(ctx))
+ }
eg.Go(f.applyFormatters(ctx))
eg.Go(f.walkFilesystem(ctx))
--
2.44.1

View file

@ -101,8 +101,6 @@ depot.nix.readTree.drvTargets {
patches = old.patches or [ ] ++ [ patches = old.patches or [ ] ++ [
# https://github.com/nix-community/crate2nix/pull/301 # https://github.com/nix-community/crate2nix/pull/301
./patches/crate2nix-tests-debug.patch ./patches/crate2nix-tests-debug.patch
# TODO(Kranzes): drop on next release
./patches/crate2nix-drop-darwin-explicit-dontstrip.patch
]; ];
}); });
@ -135,4 +133,9 @@ depot.nix.readTree.drvTargets {
hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ="; hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ=";
}; };
}) else super.fuse; }) else super.fuse;
treefmt = super.treefmt.overrideAttrs (old: {
# https://github.com/numtide/treefmt/pull/328
patches = old.patches or [ ] ++ [ ./patches/treefmt-fix-no-cache.patch ];
});
} }

View file

@ -65,10 +65,10 @@
"homepage": "", "homepage": "",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "051f920625ab5aabe37c920346e3e69d7d34400e", "rev": "7f993cdf26ccef564eabf31fdb40d140821e12bc",
"sha256": "08lin51g5x2vv89rs6vmqxnyy8pfysh0wdp6mdxw6l86dpm2rbg2", "sha256": "0dypbvibfdmv14rqlamf451625fw2fyk11prw9bbywi0q2i313d5",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/051f920625ab5aabe37c920346e3e69d7d34400e.tar.gz", "url": "https://github.com/NixOS/nixpkgs/archive/7f993cdf26ccef564eabf31fdb40d140821e12bc.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"nixpkgs-stable": { "nixpkgs-stable": {

View file

@ -37,20 +37,23 @@ let
# helper tool for formatting the depot interactively # helper tool for formatting the depot interactively
depotfmt = pkgs.writeShellScriptBin "depotfmt" '' depotfmt = pkgs.writeShellScriptBin "depotfmt" ''
exec ${pkgs.treefmt}/bin/treefmt ''${@} \ exec ${pkgs.treefmt}/bin/treefmt ''${@} \
--config-file ${config} \ --on-unmatched=debug \
--config-file=${config} \
--tree-root $(${pkgs.git}/bin/git rev-parse --show-toplevel) --tree-root $(${pkgs.git}/bin/git rev-parse --show-toplevel)
''; '';
# wrapper script for running formatting checks in CI # wrapper script for running formatting checks in CI
check = pkgs.writeShellScript "depotfmt-check" '' check = pkgs.writeShellScript "depotfmt-check" ''
${pkgs.treefmt}/bin/treefmt \ ${pkgs.treefmt}/bin/treefmt \
--clear-cache \ --no-cache \
--on-unmatched=debug \
--fail-on-change \ --fail-on-change \
--config-file ${config} \ --config-file=${config} \
--tree-root . --tree-root=.
''; '';
in in
depotfmt.overrideAttrs (_: { depotfmt.overrideAttrs (_: {
passthru.config = config;
passthru.meta.ci.extraSteps.check = { passthru.meta.ci.extraSteps.check = {
label = "depot formatting check"; label = "depot formatting check";
command = check; command = check;

View file

@ -1,4 +1,4 @@
# This file was @generated by crate2nix 0.14.0 with the command: # This file was @generated by crate2nix 0.14.1 with the command:
# "generate" "--all-features" # "generate" "--all-features"
# See https://github.com/kolloch/crate2nix for more info. # See https://github.com/kolloch/crate2nix for more info.
@ -13,6 +13,8 @@
, rootFeatures ? [ "default" ] , rootFeatures ? [ "default" ]
# If true, throw errors instead of issueing deprecation warnings. # If true, throw errors instead of issueing deprecation warnings.
, strictDeprecation ? false , strictDeprecation ? false
# Elements to add to the `-C target-feature=` argument passed to `rustc`
# (separated by `,`, prefixed with `+`).
# Used for conditional compilation based on CPU feature detection. # Used for conditional compilation based on CPU feature detection.
, targetFeatures ? [ ] , targetFeatures ? [ ]
# Whether to perform release builds: longer compile times, faster binaries. # Whether to perform release builds: longer compile times, faster binaries.
@ -2281,7 +2283,7 @@ rec {
{ {
name = "libc"; name = "libc";
packageId = "libc"; packageId = "libc";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "aarch64-linux-android"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "aarch64-linux-android");
} }
{ {
name = "libc"; name = "libc";
@ -6385,12 +6387,7 @@ rec {
requiredFeatures = [ ]; requiredFeatures = [ ];
} }
]; ];
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./nix-compat; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./nix-compat; }
else ./nix-compat;
dependencies = [ dependencies = [
{ {
name = "bitflags"; name = "bitflags";
@ -13284,12 +13281,7 @@ rec {
requiredFeatures = [ ]; requiredFeatures = [ ];
} }
]; ];
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./build; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./build; }
else ./build;
dependencies = [ dependencies = [
{ {
name = "bytes"; name = "bytes";
@ -13373,12 +13365,7 @@ rec {
crateName = "tvix-castore"; crateName = "tvix-castore";
version = "0.1.0"; version = "0.1.0";
edition = "2021"; edition = "2021";
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./castore; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./castore; }
else ./castore;
dependencies = [ dependencies = [
{ {
name = "async-compression"; name = "async-compression";
@ -13638,12 +13625,7 @@ rec {
requiredFeatures = [ ]; requiredFeatures = [ ];
} }
]; ];
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./cli; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./cli; }
else ./cli;
dependencies = [ dependencies = [
{ {
name = "bytes"; name = "bytes";
@ -13730,12 +13712,7 @@ rec {
crateName = "tvix-eval"; crateName = "tvix-eval";
version = "0.1.0"; version = "0.1.0";
edition = "2021"; edition = "2021";
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./eval; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./eval; }
else ./eval;
libName = "tvix_eval"; libName = "tvix_eval";
dependencies = [ dependencies = [
{ {
@ -13897,12 +13874,7 @@ rec {
crateName = "tvix-eval-builtin-macros"; crateName = "tvix-eval-builtin-macros";
version = "0.0.1"; version = "0.0.1";
edition = "2021"; edition = "2021";
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./eval/builtin-macros; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./eval/builtin-macros; }
else ./eval/builtin-macros;
procMacro = true; procMacro = true;
authors = [ authors = [
"Griffin Smith <root@gws.fyi>" "Griffin Smith <root@gws.fyi>"
@ -13934,12 +13906,7 @@ rec {
crateName = "tvix-glue"; crateName = "tvix-glue";
version = "0.1.0"; version = "0.1.0";
edition = "2021"; edition = "2021";
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./glue; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./glue; }
else ./glue;
dependencies = [ dependencies = [
{ {
name = "async-compression"; name = "async-compression";
@ -14106,12 +14073,7 @@ rec {
crateName = "tvix-serde"; crateName = "tvix-serde";
version = "0.1.0"; version = "0.1.0";
edition = "2021"; edition = "2021";
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./serde; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./serde; }
else ./serde;
dependencies = [ dependencies = [
{ {
name = "bstr"; name = "bstr";
@ -14141,12 +14103,7 @@ rec {
requiredFeatures = [ ]; requiredFeatures = [ ];
} }
]; ];
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./store; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./store; }
else ./store;
dependencies = [ dependencies = [
{ {
name = "anyhow"; name = "anyhow";
@ -14368,12 +14325,7 @@ rec {
crateName = "tvix-tracing"; crateName = "tvix-tracing";
version = "0.1.0"; version = "0.1.0";
edition = "2021"; edition = "2021";
# We can't filter paths with references in Nix 2.4 src = lib.cleanSourceWith { filter = sourceFilter; src = ./tracing; };
# See https://github.com/NixOS/nix/issues/5410
src =
if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion))
then lib.cleanSourceWith { filter = sourceFilter; src = ./tracing; }
else ./tracing;
dependencies = [ dependencies = [
{ {
name = "http"; name = "http";
@ -15940,12 +15892,12 @@ rec {
{ {
name = "winapi-i686-pc-windows-gnu"; name = "winapi-i686-pc-windows-gnu";
packageId = "winapi-i686-pc-windows-gnu"; packageId = "winapi-i686-pc-windows-gnu";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "i686-pc-windows-gnu"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "i686-pc-windows-gnu");
} }
{ {
name = "winapi-x86_64-pc-windows-gnu"; name = "winapi-x86_64-pc-windows-gnu";
packageId = "winapi-x86_64-pc-windows-gnu"; packageId = "winapi-x86_64-pc-windows-gnu";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "x86_64-pc-windows-gnu"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "x86_64-pc-windows-gnu");
} }
]; ];
features = { features = {
@ -17311,7 +17263,7 @@ rec {
{ {
name = "windows_aarch64_gnullvm"; name = "windows_aarch64_gnullvm";
packageId = "windows_aarch64_gnullvm 0.48.5"; packageId = "windows_aarch64_gnullvm 0.48.5";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "aarch64-pc-windows-gnullvm"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "aarch64-pc-windows-gnullvm");
} }
{ {
name = "windows_aarch64_msvc"; name = "windows_aarch64_msvc";
@ -17336,7 +17288,7 @@ rec {
{ {
name = "windows_x86_64_gnullvm"; name = "windows_x86_64_gnullvm";
packageId = "windows_x86_64_gnullvm 0.48.5"; packageId = "windows_x86_64_gnullvm 0.48.5";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "x86_64-pc-windows-gnullvm"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "x86_64-pc-windows-gnullvm");
} }
{ {
name = "windows_x86_64_msvc"; name = "windows_x86_64_msvc";
@ -17358,7 +17310,7 @@ rec {
{ {
name = "windows_aarch64_gnullvm"; name = "windows_aarch64_gnullvm";
packageId = "windows_aarch64_gnullvm 0.52.5"; packageId = "windows_aarch64_gnullvm 0.52.5";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "aarch64-pc-windows-gnullvm"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "aarch64-pc-windows-gnullvm");
} }
{ {
name = "windows_aarch64_msvc"; name = "windows_aarch64_msvc";
@ -17373,7 +17325,7 @@ rec {
{ {
name = "windows_i686_gnullvm"; name = "windows_i686_gnullvm";
packageId = "windows_i686_gnullvm"; packageId = "windows_i686_gnullvm";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "i686-pc-windows-gnullvm"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "i686-pc-windows-gnullvm");
} }
{ {
name = "windows_i686_msvc"; name = "windows_i686_msvc";
@ -17388,7 +17340,7 @@ rec {
{ {
name = "windows_x86_64_gnullvm"; name = "windows_x86_64_gnullvm";
packageId = "windows_x86_64_gnullvm 0.52.5"; packageId = "windows_x86_64_gnullvm 0.52.5";
target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "x86_64-pc-windows-gnullvm"); target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "x86_64-pc-windows-gnullvm");
} }
{ {
name = "windows_x86_64_msvc"; name = "windows_x86_64_msvc";
@ -17844,14 +17796,11 @@ rec {
fuchsia = true; fuchsia = true;
test = false; test = false;
/* We are choosing an arbitrary rust version to grab `lib` from, inherit (platform.rust.platform)
which is unfortunate, but `lib` has been version-agnostic the arch
whole time so this is good enough for now. os
*/ vendor;
os = pkgs.rust.lib.toTargetOs platform; family = platform.rust.platform.target-family;
arch = pkgs.rust.lib.toTargetArch platform;
family = pkgs.rust.lib.toTargetFamily platform;
vendor = pkgs.rust.lib.toTargetVendor platform;
env = "gnu"; env = "gnu";
endian = endian =
if platform.parsed.cpu.significantByte.name == "littleEndian" if platform.parsed.cpu.significantByte.name == "littleEndian"
@ -18095,7 +18044,7 @@ rec {
let let
self = { self = {
crates = lib.mapAttrs (packageId: value: buildByPackageIdForPkgsImpl self pkgs packageId) crateConfigs; crates = lib.mapAttrs (packageId: value: buildByPackageIdForPkgsImpl self pkgs packageId) crateConfigs;
target = makeTarget pkgs.stdenv.hostPlatform; target = makeTarget stdenv.hostPlatform;
build = mkBuiltByPackageIdByPkgs pkgs.buildPackages; build = mkBuiltByPackageIdByPkgs pkgs.buildPackages;
}; };
in in

View file

@ -14,22 +14,12 @@ let
# Load the crate2nix crate tree. # Load the crate2nix crate tree.
crates = pkgs.callPackage ./Cargo.nix { crates = pkgs.callPackage ./Cargo.nix {
defaultCrateOverrides = pkgs.defaultCrateOverrides // { defaultCrateOverrides = pkgs.defaultCrateOverrides // {
opentelemetry-proto = prev: { nix-compat = prev: {
nativeBuildInputs = protobufDep prev; src = depot.tvix.utils.filterRustCrateSrc rec {
root = prev.src.origSrc;
extraFileset = (root + "/testdata");
}; };
prost-build = prev: {
nativeBuildInputs = protobufDep prev;
}; };
prost-wkt-types = prev: {
nativeBuildInputs = protobufDep prev;
};
tonic-reflection = prev: {
nativeBuildInputs = protobufDep prev;
};
tvix-build = prev: { tvix-build = prev: {
src = depot.tvix.utils.filterRustCrateSrc rec { src = depot.tvix.utils.filterRustCrateSrc rec {
root = prev.src.origSrc; root = prev.src.origSrc;
@ -91,13 +81,6 @@ let
tvix-tracing = prev: { tvix-tracing = prev: {
src = depot.tvix.utils.filterRustCrateSrc { root = prev.src.origSrc; }; src = depot.tvix.utils.filterRustCrateSrc { root = prev.src.origSrc; };
}; };
nix-compat = prev: {
src = depot.tvix.utils.filterRustCrateSrc rec {
root = prev.src.origSrc;
extraFileset = (root + "/testdata");
};
};
}; };
}; };
@ -166,10 +149,12 @@ in
# minute or two. # minute or two.
cargo metadata > /dev/null cargo metadata > /dev/null
# running this command counteracts depotfmt brokenness ${pkgs.crate2nix}/bin/crate2nix generate --all-features
git init ${pkgs.treefmt}/bin/treefmt Cargo.nix \
--no-cache \
${depot.tools.crate2nix-generate}/bin/crate2nix-generate --on-unmatched=debug \
--config-file=${depot.tools.depotfmt.config} \
--tree-root=.
# technically unnecessary, but provides more-helpful output in case of error # technically unnecessary, but provides more-helpful output in case of error
diff -ur Cargo.nix ${src}/Cargo.nix diff -ur Cargo.nix ${src}/Cargo.nix

View file

@ -347,9 +347,9 @@ pub(crate) mod derivation_builtins {
input_context.mimic(&val_str); input_context.mimic(&val_str);
if arg_name == "builder" { if arg_name == "builder" {
drv.builder = val_str.to_str()?.to_owned(); val_str.to_str()?.clone_into(&mut drv.builder);
} else { } else {
drv.system = val_str.to_str()?.to_owned(); val_str.to_str()?.clone_into(&mut drv.system);
} }
// Either populate drv.environment or structured_attrs. // Either populate drv.environment or structured_attrs.

View file

@ -32,13 +32,6 @@ pub const QUOTE: char = '"';
/// the context a lot. /// the context a lot.
pub(crate) trait AtermWriteable { pub(crate) trait AtermWriteable {
fn aterm_write(&self, writer: &mut impl Write) -> std::io::Result<()>; fn aterm_write(&self, writer: &mut impl Write) -> std::io::Result<()>;
fn aterm_bytes(&self) -> Vec<u8> {
let mut bytes = Vec::new();
self.aterm_write(&mut bytes)
.expect("unexpected write errors to Vec");
bytes
}
} }
impl AtermWriteable for StorePathRef<'_> { impl AtermWriteable for StorePathRef<'_> {

View file

@ -33,12 +33,9 @@ const LEN_SIZE: usize = 8;
/// ///
/// This buffers the entire payload into memory, /// This buffers the entire payload into memory,
/// a streaming version is available at [crate::wire::bytes::BytesReader]. /// a streaming version is available at [crate::wire::bytes::BytesReader].
pub async fn read_bytes<R: ?Sized>( pub async fn read_bytes<R>(r: &mut R, allowed_size: RangeInclusive<usize>) -> io::Result<Vec<u8>>
r: &mut R,
allowed_size: RangeInclusive<usize>,
) -> io::Result<Vec<u8>>
where where
R: AsyncReadExt + Unpin, R: AsyncReadExt + Unpin + ?Sized,
{ {
// read the length field // read the length field
let len = r.read_u64_le().await?; let len = r.read_u64_le().await?;
@ -82,13 +79,13 @@ where
Ok(buf) Ok(buf)
} }
pub(crate) async fn read_bytes_buf<'a, const N: usize, R: ?Sized>( pub(crate) async fn read_bytes_buf<'a, const N: usize, R>(
reader: &mut R, reader: &mut R,
buf: &'a mut [MaybeUninit<u8>; N], buf: &'a mut [MaybeUninit<u8>; N],
allowed_size: RangeInclusive<usize>, allowed_size: RangeInclusive<usize>,
) -> io::Result<&'a [u8]> ) -> io::Result<&'a [u8]>
where where
R: AsyncReadExt + Unpin, R: AsyncReadExt + Unpin + ?Sized,
{ {
assert_eq!(N % 8, 0); assert_eq!(N % 8, 0);
assert!(*allowed_size.end() <= N); assert!(*allowed_size.end() <= N);

View file

@ -43,7 +43,6 @@ lib.fix (self: {
enableRedistributableFirmware = true; enableRedistributableFirmware = true;
opengl = { opengl = {
enable = true; enable = true;
driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
}; };