about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/zseri/store-ref-scanner/.gitignore1
-rw-r--r--users/zseri/store-ref-scanner/Cargo.lock87
-rw-r--r--users/zseri/store-ref-scanner/Cargo.nix940
-rw-r--r--users/zseri/store-ref-scanner/Cargo.toml1
-rw-r--r--users/zseri/store-ref-scanner/default.nix50
-rw-r--r--users/zseri/store-ref-scanner/fuzz/Cargo.lock80
-rw-r--r--users/zseri/store-ref-scanner/src/hbm.rs28
-rw-r--r--users/zseri/store-ref-scanner/tests.nix32
8 files changed, 96 insertions, 1123 deletions
diff --git a/users/zseri/store-ref-scanner/.gitignore b/users/zseri/store-ref-scanner/.gitignore
new file mode 100644
index 000000000000..5a44eef09a54
--- /dev/null
+++ b/users/zseri/store-ref-scanner/.gitignore
@@ -0,0 +1 @@
+/Cargo.lock
diff --git a/users/zseri/store-ref-scanner/Cargo.lock b/users/zseri/store-ref-scanner/Cargo.lock
deleted file mode 100644
index f6c466b04e29..000000000000
--- a/users/zseri/store-ref-scanner/Cargo.lock
+++ /dev/null
@@ -1,87 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.34"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1"
-dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "proc_unroll"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ab97d993c96374333148bad5043d3c85a572c1ca81d13b9cf92f23f5ef72f54"
-dependencies = [
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "store-ref-scanner"
-version = "0.1.0"
-dependencies = [
- "proc_unroll",
-]
-
-[[package]]
-name = "syn"
-version = "1.0.83"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23a1dfb999630e338648c83e91c59a4e9fb7620f520c3194b6b89e276f2f1959"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
-]
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
-
-[[package]]
-name = "version_check"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
diff --git a/users/zseri/store-ref-scanner/Cargo.nix b/users/zseri/store-ref-scanner/Cargo.nix
deleted file mode 100644
index efe6306eccb7..000000000000
--- a/users/zseri/store-ref-scanner/Cargo.nix
+++ /dev/null
@@ -1,940 +0,0 @@
-
-# This file was @generated by crate2nix 0.10.0 with the command:
-#   "generate"
-# See https://github.com/kolloch/crate2nix for more info.
-
-{ nixpkgs ? <nixpkgs>
-, pkgs ? import nixpkgs { config = {}; }
-, lib ? pkgs.lib
-, stdenv ? pkgs.stdenv
-, buildRustCrateForPkgs ? if buildRustCrate != null
-    then lib.warn "crate2nix: Passing `buildRustCrate` as argument to Cargo.nix is deprecated. If you don't customize `buildRustCrate`, replace `callPackage ./Cargo.nix {}` by `import ./Cargo.nix { inherit pkgs; }`, and if you need to customize `buildRustCrate`, use `buildRustCrateForPkgs` instead." (_: buildRustCrate)
-    else pkgs: pkgs.buildRustCrate
-  # Deprecated
-, buildRustCrate ? null
-  # This is used as the `crateOverrides` argument for `buildRustCrate`.
-, defaultCrateOverrides ? pkgs.defaultCrateOverrides
-  # The features to enable for the root_crate or the workspace_members.
-, rootFeatures ? [ "default" ]
-  # If true, throw errors instead of issueing deprecation warnings.
-, strictDeprecation ? false
-  # Used for conditional compilation based on CPU feature detection.
-, targetFeatures ? []
-  # Whether to perform release builds: longer compile times, faster binaries.
-, release ? true
-  # Additional crate2nix configuration if it exists.
-, crateConfig
-  ? if builtins.pathExists ./crate-config.nix
-    then pkgs.callPackage ./crate-config.nix {}
-    else {}
-}:
-
-rec {
-  #
-  # "public" attributes that we attempt to keep stable with new versions of crate2nix.
-  #
-
-  rootCrate = rec {
-    packageId = "store-ref-scanner";
-
-    # Use this attribute to refer to the derivation building your root crate package.
-    # You can override the features with rootCrate.build.override { features = [ "default" "feature1" ... ]; }.
-    build = internal.buildRustCrateWithFeatures {
-      inherit packageId;
-    };
-
-    # Debug support which might change between releases.
-    # File a bug if you depend on any for non-debug work!
-    debug = internal.debugCrate { inherit packageId; };
-  };
-  # Refer your crate build derivation by name here.
-  # You can override the features with
-  # workspaceMembers."${crateName}".build.override { features = [ "default" "feature1" ... ]; }.
-  workspaceMembers = {
-    "store-ref-scanner" = rec {
-      packageId = "store-ref-scanner";
-      build = internal.buildRustCrateWithFeatures {
-        packageId = "store-ref-scanner";
-      };
-
-      # Debug support which might change between releases.
-      # File a bug if you depend on any for non-debug work!
-      debug = internal.debugCrate { inherit packageId; };
-    };
-  };
-
-  # A derivation that joins the outputs of all workspace members together.
-  allWorkspaceMembers = pkgs.symlinkJoin {
-      name = "all-workspace-members";
-      paths =
-        let members = builtins.attrValues workspaceMembers;
-        in builtins.map (m: m.build) members;
-  };
-
-  #
-  # "internal" ("private") attributes that may change in every new version of crate2nix.
-  #
-
-  internal = rec {
-    # Build and dependency information for crates.
-    # Many of the fields are passed one-to-one to buildRustCrate.
-    #
-    # Noteworthy:
-    # * `dependencies`/`buildDependencies`: similar to the corresponding fields for buildRustCrate.
-    #   but with additional information which is used during dependency/feature resolution.
-    # * `resolvedDependencies`: the selected default features reported by cargo - only included for debugging.
-    # * `devDependencies` as of now not used by `buildRustCrate` but used to
-    #   inject test dependencies into the build
-
-    crates = {
-      "proc-macro-error" = rec {
-        crateName = "proc-macro-error";
-        version = "1.0.4";
-        edition = "2018";
-        sha256 = "1373bhxaf0pagd8zkyd03kkx6bchzf6g0dkwrwzsnal9z47lj9fs";
-        authors = [
-          "CreepySkeleton <creepy-skeleton@yandex.ru>"
-        ];
-        dependencies = [
-          {
-            name = "proc-macro-error-attr";
-            packageId = "proc-macro-error-attr";
-          }
-          {
-            name = "proc-macro2";
-            packageId = "proc-macro2";
-          }
-          {
-            name = "quote";
-            packageId = "quote";
-          }
-          {
-            name = "syn";
-            packageId = "syn";
-            optional = true;
-            usesDefaultFeatures = false;
-          }
-        ];
-        buildDependencies = [
-          {
-            name = "version_check";
-            packageId = "version_check";
-          }
-        ];
-        features = {
-          "default" = [ "syn-error" ];
-          "syn-error" = [ "syn" ];
-        };
-        resolvedDefaultFeatures = [ "default" "syn" "syn-error" ];
-      };
-      "proc-macro-error-attr" = rec {
-        crateName = "proc-macro-error-attr";
-        version = "1.0.4";
-        edition = "2018";
-        sha256 = "0sgq6m5jfmasmwwy8x4mjygx5l7kp8s4j60bv25ckv2j1qc41gm1";
-        procMacro = true;
-        authors = [
-          "CreepySkeleton <creepy-skeleton@yandex.ru>"
-        ];
-        dependencies = [
-          {
-            name = "proc-macro2";
-            packageId = "proc-macro2";
-          }
-          {
-            name = "quote";
-            packageId = "quote";
-          }
-        ];
-        buildDependencies = [
-          {
-            name = "version_check";
-            packageId = "version_check";
-          }
-        ];
-
-      };
-      "proc-macro2" = rec {
-        crateName = "proc-macro2";
-        version = "1.0.34";
-        edition = "2018";
-        sha256 = "1c93jhwl8lv3hiqqvdhd2d2xhjryh5bqb9w5icr5i7bw1wnfk11g";
-        authors = [
-          "David Tolnay <dtolnay@gmail.com>"
-          "Alex Crichton <alex@alexcrichton.com>"
-        ];
-        dependencies = [
-          {
-            name = "unicode-xid";
-            packageId = "unicode-xid";
-          }
-        ];
-        features = {
-          "default" = [ "proc-macro" ];
-        };
-        resolvedDefaultFeatures = [ "default" "proc-macro" ];
-      };
-      "proc_unroll" = rec {
-        crateName = "proc_unroll";
-        version = "0.1.1";
-        edition = "2018";
-        sha256 = "0m1gyxg3zwljrywi67d83hn5fnn8sd1m1bcb2hrl6dwn7jcpvfca";
-        procMacro = true;
-        authors = [
-          "leo60228 <leo@60228.dev>"
-        ];
-        dependencies = [
-          {
-            name = "proc-macro-error";
-            packageId = "proc-macro-error";
-          }
-          {
-            name = "proc-macro2";
-            packageId = "proc-macro2";
-          }
-          {
-            name = "quote";
-            packageId = "quote";
-          }
-          {
-            name = "syn";
-            packageId = "syn";
-            features = [ "full" "fold" ];
-          }
-        ];
-
-      };
-      "quote" = rec {
-        crateName = "quote";
-        version = "1.0.10";
-        edition = "2018";
-        sha256 = "01ff7a76f871ggnby57iagw6499vci4bihcr11g6bqzjlp38rg1q";
-        authors = [
-          "David Tolnay <dtolnay@gmail.com>"
-        ];
-        dependencies = [
-          {
-            name = "proc-macro2";
-            packageId = "proc-macro2";
-            usesDefaultFeatures = false;
-          }
-        ];
-        features = {
-          "default" = [ "proc-macro" ];
-          "proc-macro" = [ "proc-macro2/proc-macro" ];
-        };
-        resolvedDefaultFeatures = [ "default" "proc-macro" ];
-      };
-      "store-ref-scanner" = rec {
-        crateName = "store-ref-scanner";
-        version = "0.1.0";
-        edition = "2021";
-        src = lib.cleanSourceWith { filter = sourceFilter;  src = ./.; };
-        dependencies = [
-          {
-            name = "proc_unroll";
-            packageId = "proc_unroll";
-          }
-        ];
-
-      };
-      "syn" = rec {
-        crateName = "syn";
-        version = "1.0.83";
-        edition = "2018";
-        sha256 = "0n8r5xpjg7mqnsa3232j1xibg7sfkb2r2gn8923363k3k6wxz893";
-        authors = [
-          "David Tolnay <dtolnay@gmail.com>"
-        ];
-        dependencies = [
-          {
-            name = "proc-macro2";
-            packageId = "proc-macro2";
-            usesDefaultFeatures = false;
-          }
-          {
-            name = "quote";
-            packageId = "quote";
-            optional = true;
-            usesDefaultFeatures = false;
-          }
-          {
-            name = "unicode-xid";
-            packageId = "unicode-xid";
-          }
-        ];
-        features = {
-          "default" = [ "derive" "parsing" "printing" "clone-impls" "proc-macro" ];
-          "printing" = [ "quote" ];
-          "proc-macro" = [ "proc-macro2/proc-macro" "quote/proc-macro" ];
-          "test" = [ "syn-test-suite/all-features" ];
-        };
-        resolvedDefaultFeatures = [ "clone-impls" "default" "derive" "fold" "full" "parsing" "printing" "proc-macro" "quote" ];
-      };
-      "unicode-xid" = rec {
-        crateName = "unicode-xid";
-        version = "0.2.2";
-        edition = "2015";
-        sha256 = "1wrkgcw557v311dkdb6n2hrix9dm2qdsb1zpw7pn79l03zb85jwc";
-        authors = [
-          "erick.tryzelaar <erick.tryzelaar@gmail.com>"
-          "kwantam <kwantam@gmail.com>"
-          "Manish Goregaokar <manishsmail@gmail.com>"
-        ];
-        features = {
-        };
-        resolvedDefaultFeatures = [ "default" ];
-      };
-      "version_check" = rec {
-        crateName = "version_check";
-        version = "0.9.3";
-        edition = "2015";
-        sha256 = "1zmkcgj2m0pq0l4wnhrp1wl1lygf7x2h5p7pvjwc4719lnlxrv2z";
-        authors = [
-          "Sergio Benitez <sb@sergio.bz>"
-        ];
-
-      };
-    };
-
-    #
-# crate2nix/default.nix (excerpt start)
-#
-
-  /* Target (platform) data for conditional dependencies.
-    This corresponds roughly to what buildRustCrate is setting.
-  */
-  defaultTarget = {
-    unix = true;
-    windows = false;
-    fuchsia = true;
-    test = false;
-
-    # This doesn't appear to be officially documented anywhere yet.
-    # See https://github.com/rust-lang-nursery/rust-forge/issues/101.
-    os =
-      if stdenv.hostPlatform.isDarwin
-      then "macos"
-      else stdenv.hostPlatform.parsed.kernel.name;
-    arch = stdenv.hostPlatform.parsed.cpu.name;
-    family = "unix";
-    env = "gnu";
-    endian =
-      if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian"
-      then "little" else "big";
-    pointer_width = toString stdenv.hostPlatform.parsed.cpu.bits;
-    vendor = stdenv.hostPlatform.parsed.vendor.name;
-    debug_assertions = false;
-  };
-
-  /* Filters common temp files and build files. */
-  # TODO(pkolloch): Substitute with gitignore filter
-  sourceFilter = name: type:
-    let
-      baseName = builtins.baseNameOf (builtins.toString name);
-    in
-      ! (
-        # Filter out git
-        baseName == ".gitignore"
-        || (type == "directory" && baseName == ".git")
-
-        # Filter out build results
-        || (
-          type == "directory" && (
-            baseName == "target"
-            || baseName == "_site"
-            || baseName == ".sass-cache"
-            || baseName == ".jekyll-metadata"
-            || baseName == "build-artifacts"
-          )
-        )
-
-        # Filter out nix-build result symlinks
-        || (
-          type == "symlink" && lib.hasPrefix "result" baseName
-        )
-
-        # Filter out IDE config
-        || (
-          type == "directory" && (
-            baseName == ".idea" || baseName == ".vscode"
-          )
-        ) || lib.hasSuffix ".iml" baseName
-
-        # Filter out nix build files
-        || baseName == "Cargo.nix"
-
-        # Filter out editor backup / swap files.
-        || lib.hasSuffix "~" baseName
-        || builtins.match "^\\.sw[a-z]$$" baseName != null
-        || builtins.match "^\\..*\\.sw[a-z]$$" baseName != null
-        || lib.hasSuffix ".tmp" baseName
-        || lib.hasSuffix ".bak" baseName
-        || baseName == "tests.nix"
-      );
-
-  /* Returns a crate which depends on successful test execution
-    of crate given as the second argument.
-
-    testCrateFlags: list of flags to pass to the test exectuable
-    testInputs: list of packages that should be available during test execution
-  */
-  crateWithTest = { crate, testCrate, testCrateFlags, testInputs, testPreRun, testPostRun }:
-    assert builtins.typeOf testCrateFlags == "list";
-    assert builtins.typeOf testInputs == "list";
-    assert builtins.typeOf testPreRun == "string";
-    assert builtins.typeOf testPostRun == "string";
-    let
-      # override the `crate` so that it will build and execute tests instead of
-      # building the actual lib and bin targets We just have to pass `--test`
-      # to rustc and it will do the right thing.  We execute the tests and copy
-      # their log and the test executables to $out for later inspection.
-      test =
-        let
-          drv = testCrate.override
-            (
-              _: {
-                buildTests = true;
-              }
-            );
-          # If the user hasn't set any pre/post commands, we don't want to
-          # insert empty lines. This means that any existing users of crate2nix
-          # don't get a spurious rebuild unless they set these explicitly.
-          testCommand = pkgs.lib.concatStringsSep "\n"
-            (pkgs.lib.filter (s: s != "") [
-              testPreRun
-              "$f $testCrateFlags 2>&1 | tee -a $out"
-              testPostRun
-            ]);
-        in
-        pkgs.runCommand "run-tests-${testCrate.name}"
-          {
-            inherit testCrateFlags;
-            buildInputs = testInputs;
-          } ''
-          set -ex
-
-          export RUST_BACKTRACE=1
-
-          # recreate a file hierarchy as when running tests with cargo
-
-          # the source for test data
-          ${pkgs.xorg.lndir}/bin/lndir ${crate.src}
-
-          # build outputs
-          testRoot=target/debug
-          mkdir -p $testRoot
-
-          # executables of the crate
-          # we copy to prevent std::env::current_exe() to resolve to a store location
-          for i in ${crate}/bin/*; do
-            cp "$i" "$testRoot"
-          done
-          chmod +w -R .
-
-          # test harness executables are suffixed with a hash, like cargo does
-          # this allows to prevent name collision with the main
-          # executables of the crate
-          hash=$(basename $out)
-          for file in ${drv}/tests/*; do
-            f=$testRoot/$(basename $file)-$hash
-            cp $file $f
-            ${testCommand}
-          done
-        '';
-    in
-    pkgs.runCommand "${crate.name}-linked"
-      {
-        inherit (crate) outputs crateName;
-        passthru = (crate.passthru or { }) // {
-          inherit test;
-        };
-      } ''
-      echo tested by ${test}
-      ${lib.concatMapStringsSep "\n" (output: "ln -s ${crate.${output}} ${"$"}${output}") crate.outputs}
-    '';
-
-  /* A restricted overridable version of builtRustCratesWithFeatures. */
-  buildRustCrateWithFeatures =
-    { packageId
-    , features ? rootFeatures
-    , crateOverrides ? defaultCrateOverrides
-    , buildRustCrateForPkgsFunc ? null
-    , runTests ? false
-    , testCrateFlags ? [ ]
-    , testInputs ? [ ]
-      # Any command to run immediatelly before a test is executed.
-    , testPreRun ? ""
-      # Any command run immediatelly after a test is executed.
-    , testPostRun ? ""
-    }:
-    lib.makeOverridable
-      (
-        { features
-        , crateOverrides
-        , runTests
-        , testCrateFlags
-        , testInputs
-        , testPreRun
-        , testPostRun
-        }:
-        let
-          buildRustCrateForPkgsFuncOverriden =
-            if buildRustCrateForPkgsFunc != null
-            then buildRustCrateForPkgsFunc
-            else
-              (
-                if crateOverrides == pkgs.defaultCrateOverrides
-                then buildRustCrateForPkgs
-                else
-                  pkgs: (buildRustCrateForPkgs pkgs).override {
-                    defaultCrateOverrides = crateOverrides;
-                  }
-              );
-          builtRustCrates = builtRustCratesWithFeatures {
-            inherit packageId features;
-            buildRustCrateForPkgsFunc = buildRustCrateForPkgsFuncOverriden;
-            runTests = false;
-          };
-          builtTestRustCrates = builtRustCratesWithFeatures {
-            inherit packageId features;
-            buildRustCrateForPkgsFunc = buildRustCrateForPkgsFuncOverriden;
-            runTests = true;
-          };
-          drv = builtRustCrates.crates.${packageId};
-          testDrv = builtTestRustCrates.crates.${packageId};
-          derivation =
-            if runTests then
-              crateWithTest
-                {
-                  crate = drv;
-                  testCrate = testDrv;
-                  inherit testCrateFlags testInputs testPreRun testPostRun;
-                }
-            else drv;
-        in
-        derivation
-      )
-      { inherit features crateOverrides runTests testCrateFlags testInputs testPreRun testPostRun; };
-
-  /* Returns an attr set with packageId mapped to the result of buildRustCrateForPkgsFunc
-    for the corresponding crate.
-  */
-  builtRustCratesWithFeatures =
-    { packageId
-    , features
-    , crateConfigs ? crates
-    , buildRustCrateForPkgsFunc
-    , runTests
-    , target ? defaultTarget
-    } @ args:
-      assert (builtins.isAttrs crateConfigs);
-      assert (builtins.isString packageId);
-      assert (builtins.isList features);
-      assert (builtins.isAttrs target);
-      assert (builtins.isBool runTests);
-      let
-        rootPackageId = packageId;
-        mergedFeatures = mergePackageFeatures
-          (
-            args // {
-              inherit rootPackageId;
-              target = target // { test = runTests; };
-            }
-          );
-        # Memoize built packages so that reappearing packages are only built once.
-        builtByPackageIdByPkgs = mkBuiltByPackageIdByPkgs pkgs;
-        mkBuiltByPackageIdByPkgs = pkgs:
-          let
-            self = {
-              crates = lib.mapAttrs (packageId: value: buildByPackageIdForPkgsImpl self pkgs packageId) crateConfigs;
-              build = mkBuiltByPackageIdByPkgs pkgs.buildPackages;
-            };
-          in
-          self;
-        buildByPackageIdForPkgsImpl = self: pkgs: packageId:
-          let
-            features = mergedFeatures."${packageId}" or [ ];
-            crateConfig' = crateConfigs."${packageId}";
-            crateConfig =
-              builtins.removeAttrs crateConfig' [ "resolvedDefaultFeatures" "devDependencies" ];
-            devDependencies =
-              lib.optionals
-                (runTests && packageId == rootPackageId)
-                (crateConfig'.devDependencies or [ ]);
-            dependencies =
-              dependencyDerivations {
-                inherit features target;
-                buildByPackageId = depPackageId:
-                  # proc_macro crates must be compiled for the build architecture
-                  if crateConfigs.${depPackageId}.procMacro or false
-                  then self.build.crates.${depPackageId}
-                  else self.crates.${depPackageId};
-                dependencies =
-                  (crateConfig.dependencies or [ ])
-                  ++ devDependencies;
-              };
-            buildDependencies =
-              dependencyDerivations {
-                inherit features target;
-                buildByPackageId = depPackageId:
-                  self.build.crates.${depPackageId};
-                dependencies = crateConfig.buildDependencies or [ ];
-              };
-            filterEnabledDependenciesForThis = dependencies: filterEnabledDependencies {
-              inherit dependencies features target;
-            };
-            dependenciesWithRenames =
-              lib.filter (d: d ? "rename")
-                (
-                  filterEnabledDependenciesForThis
-                    (
-                      (crateConfig.buildDependencies or [ ])
-                      ++ (crateConfig.dependencies or [ ])
-                      ++ devDependencies
-                    )
-                );
-            # Crate renames have the form:
-            #
-            # {
-            #    crate_name = [
-            #       { version = "1.2.3"; rename = "crate_name01"; }
-            #    ];
-            #    # ...
-            # }
-            crateRenames =
-              let
-                grouped =
-                  lib.groupBy
-                    (dependency: dependency.name)
-                    dependenciesWithRenames;
-                versionAndRename = dep:
-                  let
-                    package = crateConfigs."${dep.packageId}";
-                  in
-                  { inherit (dep) rename; version = package.version; };
-              in
-              lib.mapAttrs (name: choices: builtins.map versionAndRename choices) grouped;
-          in
-          buildRustCrateForPkgsFunc pkgs
-            (
-              crateConfig // {
-                src = crateConfig.src or (
-                  pkgs.fetchurl rec {
-                    name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
-                    # https://www.pietroalbini.org/blog/downloading-crates-io/
-                    # Not rate-limited, CDN URL.
-                    url = "https://static.crates.io/crates/${crateConfig.crateName}/${crateConfig.crateName}-${crateConfig.version}.crate";
-                    sha256 =
-                      assert (lib.assertMsg (crateConfig ? sha256) "Missing sha256 for ${name}");
-                      crateConfig.sha256;
-                  }
-                );
-                extraRustcOpts = lib.lists.optional (targetFeatures != [ ]) "-C target-feature=${lib.concatMapStringsSep "," (x: "+${x}") targetFeatures}";
-                inherit features dependencies buildDependencies crateRenames release;
-              }
-            );
-      in
-      builtByPackageIdByPkgs;
-
-  /* Returns the actual derivations for the given dependencies. */
-  dependencyDerivations =
-    { buildByPackageId
-    , features
-    , dependencies
-    , target
-    }:
-      assert (builtins.isList features);
-      assert (builtins.isList dependencies);
-      assert (builtins.isAttrs target);
-      let
-        enabledDependencies = filterEnabledDependencies {
-          inherit dependencies features target;
-        };
-        depDerivation = dependency: buildByPackageId dependency.packageId;
-      in
-      map depDerivation enabledDependencies;
-
-  /* Returns a sanitized version of val with all values substituted that cannot
-    be serialized as JSON.
-  */
-  sanitizeForJson = val:
-    if builtins.isAttrs val
-    then lib.mapAttrs (n: v: sanitizeForJson v) val
-    else if builtins.isList val
-    then builtins.map sanitizeForJson val
-    else if builtins.isFunction val
-    then "function"
-    else val;
-
-  /* Returns various tools to debug a crate. */
-  debugCrate = { packageId, target ? defaultTarget }:
-    assert (builtins.isString packageId);
-    let
-      debug = rec {
-        # The built tree as passed to buildRustCrate.
-        buildTree = buildRustCrateWithFeatures {
-          buildRustCrateForPkgsFunc = _: lib.id;
-          inherit packageId;
-        };
-        sanitizedBuildTree = sanitizeForJson buildTree;
-        dependencyTree = sanitizeForJson
-          (
-            buildRustCrateWithFeatures {
-              buildRustCrateForPkgsFunc = _: crate: {
-                "01_crateName" = crate.crateName or false;
-                "02_features" = crate.features or [ ];
-                "03_dependencies" = crate.dependencies or [ ];
-              };
-              inherit packageId;
-            }
-          );
-        mergedPackageFeatures = mergePackageFeatures {
-          features = rootFeatures;
-          inherit packageId target;
-        };
-        diffedDefaultPackageFeatures = diffDefaultPackageFeatures {
-          inherit packageId target;
-        };
-      };
-    in
-    { internal = debug; };
-
-  /* Returns differences between cargo default features and crate2nix default
-    features.
-
-    This is useful for verifying the feature resolution in crate2nix.
-  */
-  diffDefaultPackageFeatures =
-    { crateConfigs ? crates
-    , packageId
-    , target
-    }:
-      assert (builtins.isAttrs crateConfigs);
-      let
-        prefixValues = prefix: lib.mapAttrs (n: v: { "${prefix}" = v; });
-        mergedFeatures =
-          prefixValues
-            "crate2nix"
-            (mergePackageFeatures { inherit crateConfigs packageId target; features = [ "default" ]; });
-        configs = prefixValues "cargo" crateConfigs;
-        combined = lib.foldAttrs (a: b: a // b) { } [ mergedFeatures configs ];
-        onlyInCargo =
-          builtins.attrNames
-            (lib.filterAttrs (n: v: !(v ? "crate2nix") && (v ? "cargo")) combined);
-        onlyInCrate2Nix =
-          builtins.attrNames
-            (lib.filterAttrs (n: v: (v ? "crate2nix") && !(v ? "cargo")) combined);
-        differentFeatures = lib.filterAttrs
-          (
-            n: v:
-              (v ? "crate2nix")
-              && (v ? "cargo")
-              && (v.crate2nix.features or [ ]) != (v."cargo".resolved_default_features or [ ])
-          )
-          combined;
-      in
-      builtins.toJSON {
-        inherit onlyInCargo onlyInCrate2Nix differentFeatures;
-      };
-
-  /* Returns an attrset mapping packageId to the list of enabled features.
-
-    If multiple paths to a dependency enable different features, the
-    corresponding feature sets are merged. Features in rust are additive.
-  */
-  mergePackageFeatures =
-    { crateConfigs ? crates
-    , packageId
-    , rootPackageId ? packageId
-    , features ? rootFeatures
-    , dependencyPath ? [ crates.${packageId}.crateName ]
-    , featuresByPackageId ? { }
-    , target
-      # Adds devDependencies to the crate with rootPackageId.
-    , runTests ? false
-    , ...
-    } @ args:
-      assert (builtins.isAttrs crateConfigs);
-      assert (builtins.isString packageId);
-      assert (builtins.isString rootPackageId);
-      assert (builtins.isList features);
-      assert (builtins.isList dependencyPath);
-      assert (builtins.isAttrs featuresByPackageId);
-      assert (builtins.isAttrs target);
-      assert (builtins.isBool runTests);
-      let
-        crateConfig = crateConfigs."${packageId}" or (builtins.throw "Package not found: ${packageId}");
-        expandedFeatures = expandFeatures (crateConfig.features or { }) features;
-        enabledFeatures = enableFeatures (crateConfig.dependencies or [ ]) expandedFeatures;
-        depWithResolvedFeatures = dependency:
-          let
-            packageId = dependency.packageId;
-            features = dependencyFeatures enabledFeatures dependency;
-          in
-          { inherit packageId features; };
-        resolveDependencies = cache: path: dependencies:
-          assert (builtins.isAttrs cache);
-          assert (builtins.isList dependencies);
-          let
-            enabledDependencies = filterEnabledDependencies {
-              inherit dependencies target;
-              features = enabledFeatures;
-            };
-            directDependencies = map depWithResolvedFeatures enabledDependencies;
-            foldOverCache = op: lib.foldl op cache directDependencies;
-          in
-          foldOverCache
-            (
-              cache: { packageId, features }:
-                let
-                  cacheFeatures = cache.${packageId} or [ ];
-                  combinedFeatures = sortedUnique (cacheFeatures ++ features);
-                in
-                if cache ? ${packageId} && cache.${packageId} == combinedFeatures
-                then cache
-                else
-                  mergePackageFeatures {
-                    features = combinedFeatures;
-                    featuresByPackageId = cache;
-                    inherit crateConfigs packageId target runTests rootPackageId;
-                  }
-            );
-        cacheWithSelf =
-          let
-            cacheFeatures = featuresByPackageId.${packageId} or [ ];
-            combinedFeatures = sortedUnique (cacheFeatures ++ enabledFeatures);
-          in
-          featuresByPackageId // {
-            "${packageId}" = combinedFeatures;
-          };
-        cacheWithDependencies =
-          resolveDependencies cacheWithSelf "dep"
-            (
-              crateConfig.dependencies or [ ]
-              ++ lib.optionals
-                (runTests && packageId == rootPackageId)
-                (crateConfig.devDependencies or [ ])
-            );
-        cacheWithAll =
-          resolveDependencies
-            cacheWithDependencies "build"
-            (crateConfig.buildDependencies or [ ]);
-      in
-      cacheWithAll;
-
-  /* Returns the enabled dependencies given the enabled features. */
-  filterEnabledDependencies = { dependencies, features, target }:
-    assert (builtins.isList dependencies);
-    assert (builtins.isList features);
-    assert (builtins.isAttrs target);
-
-    lib.filter
-      (
-        dep:
-        let
-          targetFunc = dep.target or (features: true);
-        in
-        targetFunc { inherit features target; }
-        && (
-          !(dep.optional or false)
-          || builtins.any (doesFeatureEnableDependency dep) features
-        )
-      )
-      dependencies;
-
-  /* Returns whether the given feature should enable the given dependency. */
-  doesFeatureEnableDependency = { name, rename ? null, ... }: feature:
-    let
-      prefix = "${name}/";
-      len = builtins.stringLength prefix;
-      startsWithPrefix = builtins.substring 0 len feature == prefix;
-    in
-    (rename == null && feature == name)
-    || (rename != null && rename == feature)
-    || startsWithPrefix;
-
-  /* Returns the expanded features for the given inputFeatures by applying the
-    rules in featureMap.
-
-    featureMap is an attribute set which maps feature names to lists of further
-    feature names to enable in case this feature is selected.
-  */
-  expandFeatures = featureMap: inputFeatures:
-    assert (builtins.isAttrs featureMap);
-    assert (builtins.isList inputFeatures);
-    let
-      expandFeature = feature:
-        assert (builtins.isString feature);
-        [ feature ] ++ (expandFeatures featureMap (featureMap."${feature}" or [ ]));
-      outFeatures = lib.concatMap expandFeature inputFeatures;
-    in
-    sortedUnique outFeatures;
-
-  /* This function adds optional dependencies as features if they are enabled
-    indirectly by dependency features. This function mimics Cargo's behavior
-    described in a note at:
-    https://doc.rust-lang.org/nightly/cargo/reference/features.html#dependency-features
-  */
-  enableFeatures = dependencies: features:
-    assert (builtins.isList features);
-    assert (builtins.isList dependencies);
-    let
-      additionalFeatures = lib.concatMap
-        (
-          dependency:
-            assert (builtins.isAttrs dependency);
-            let
-              enabled = builtins.any (doesFeatureEnableDependency dependency) features;
-            in
-            if (dependency.optional or false) && enabled then [ dependency.name ] else [ ]
-        )
-        dependencies;
-    in
-    sortedUnique (features ++ additionalFeatures);
-
-  /*
-    Returns the actual features for the given dependency.
-
-    features: The features of the crate that refers this dependency.
-  */
-  dependencyFeatures = features: dependency:
-    assert (builtins.isList features);
-    assert (builtins.isAttrs dependency);
-    let
-      defaultOrNil =
-        if dependency.usesDefaultFeatures or true
-        then [ "default" ]
-        else [ ];
-      explicitFeatures = dependency.features or [ ];
-      additionalDependencyFeatures =
-        let
-          dependencyPrefix = (dependency.rename or dependency.name) + "/";
-          dependencyFeatures =
-            builtins.filter (f: lib.hasPrefix dependencyPrefix f) features;
-        in
-        builtins.map (lib.removePrefix dependencyPrefix) dependencyFeatures;
-    in
-    defaultOrNil ++ explicitFeatures ++ additionalDependencyFeatures;
-
-  /* Sorts and removes duplicates from a list of strings. */
-  sortedUnique = features:
-    assert (builtins.isList features);
-    assert (builtins.all builtins.isString features);
-    let
-      outFeaturesSet = lib.foldl (set: feature: set // { "${feature}" = 1; }) { } features;
-      outFeaturesUnique = builtins.attrNames outFeaturesSet;
-    in
-    builtins.sort (a: b: a < b) outFeaturesUnique;
-
-  deprecationWarning = message: value:
-    if strictDeprecation
-    then builtins.throw "strictDeprecation enabled, aborting: ${message}"
-    else builtins.trace message value;
-
-  #
-  # crate2nix/default.nix (excerpt end)
-  #
-  };
-}
-
diff --git a/users/zseri/store-ref-scanner/Cargo.toml b/users/zseri/store-ref-scanner/Cargo.toml
index 20b055a9083f..ad565f09af2e 100644
--- a/users/zseri/store-ref-scanner/Cargo.toml
+++ b/users/zseri/store-ref-scanner/Cargo.toml
@@ -4,4 +4,3 @@ version = "0.1.0"
 edition = "2021"
 
 [dependencies]
-proc_unroll = "0.1"
diff --git a/users/zseri/store-ref-scanner/default.nix b/users/zseri/store-ref-scanner/default.nix
index b78cbfbc6588..38f3fd64ecd7 100644
--- a/users/zseri/store-ref-scanner/default.nix
+++ b/users/zseri/store-ref-scanner/default.nix
@@ -1,5 +1,49 @@
-{ depot, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
+
+let
+  sourceFilter = name: type:
+    let
+      baseName = builtins.baseNameOf (builtins.toString name);
+    in
+    (baseName == "Cargo.toml")
+    || (type == "directory" && baseName == "src")
+    || (lib.hasSuffix ".rs" baseName)
+  ;
+in
+
+pkgs.buildRustCrate rec {
+  pname = "store-ref-scanner";
+  crateName = "store-ref-scanner";
+  version = "0.1.0";
+  edition = "2021";
+  src = lib.cleanSourceWith { filter = sourceFilter; src = ./.; };
+
+  passthru.tests = pkgs.buildRustCrate {
+    pname = "store-ref-scanner-tests";
+    inherit crateName src version edition;
+    buildTests = true;
+    postInstall = ''
+      set -ex
+      export RUST_BACKTRACE=1
+      # recreate a file hierarchy as when running tests with cargo
+      # the source for test data
+      # build outputs
+      testRoot=target/debug
+      mkdir -p $testRoot
+      chmod +w -R .
+      # test harness executables are suffixed with a hash,
+      # like cargo does this allows to prevent name collision
+      # with the main executables of the crate
+      hash=$(basename $out)
+      ls -lasR $out
+      for file in $out/tests/*; do
+        f=$testRoot/$(basename $file)-$hash
+        cp $file $f
+        $f 2>&1 | tee -a $out/tests.log
+      done
+      rm -rf $out/tests
+      set +ex
+    '';
+  };
 
-(import ./Cargo.nix { inherit pkgs; }).rootCrate.build.override {
-  runTests = true;
 }
diff --git a/users/zseri/store-ref-scanner/fuzz/Cargo.lock b/users/zseri/store-ref-scanner/fuzz/Cargo.lock
index 8399066b3cdf..7395dec05e45 100644
--- a/users/zseri/store-ref-scanner/fuzz/Cargo.lock
+++ b/users/zseri/store-ref-scanner/fuzz/Cargo.lock
@@ -32,65 +32,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
 
 [[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.34"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1"
-dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "proc_unroll"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ab97d993c96374333148bad5043d3c85a572c1ca81d13b9cf92f23f5ef72f54"
-dependencies = [
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
 name = "store-ref-scanner"
 version = "0.1.0"
-dependencies = [
- "proc_unroll",
-]
 
 [[package]]
 name = "store-ref-scanner-fuzz"
@@ -99,26 +42,3 @@ dependencies = [
  "libfuzzer-sys",
  "store-ref-scanner",
 ]
-
-[[package]]
-name = "syn"
-version = "1.0.83"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23a1dfb999630e338648c83e91c59a4e9fb7620f520c3194b6b89e276f2f1959"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
-]
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
-
-[[package]]
-name = "version_check"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
diff --git a/users/zseri/store-ref-scanner/src/hbm.rs b/users/zseri/store-ref-scanner/src/hbm.rs
index c2fd2950d5f1..2520efd8363d 100644
--- a/users/zseri/store-ref-scanner/src/hbm.rs
+++ b/users/zseri/store-ref-scanner/src/hbm.rs
@@ -15,17 +15,19 @@ impl HalfBytesMask {
     ]);
 
     #[inline]
-    #[proc_unroll::unroll]
     pub const fn from_expanded(x: [bool; 128]) -> Self {
         let mut ret = [0u8; 16];
-        for idx in 0..16 {
-            let mut tmp = 0;
+        let mut idx = 0;
+        while idx < 16 {
             let fin = idx * 8;
-            macro_rules! bitx {
-                ($($a:expr),+) => {{ $( if x[fin + $a] { tmp += (1 << $a) as u8; } )+ }}
+            let mut idx2 = 0;
+            while idx2 < 8 {
+                if x[fin + idx2] {
+                    ret[idx] += (1 << idx2) as u8;
+                }
+                idx2 += 1;
             }
-            bitx!(0, 1, 2, 3, 4, 5, 6, 7);
-            ret[idx] = tmp;
+            idx += 1;
         }
         Self(ret)
     }
@@ -38,17 +40,19 @@ impl HalfBytesMask {
         })
     }
 
-    #[proc_unroll::unroll]
     pub const fn into_expanded(self) -> [bool; 128] {
         let Self(ihbm) = self;
         let mut ret = [false; 128];
-        for idx in 0..16 {
+        let mut idx = 0;
+        while idx < 16 {
             let fin = idx * 8;
             let curi = ihbm[idx];
-            macro_rules! bitx {
-                ($($a:expr),+) => {{ $( ret[fin + $a] = (curi >> $a) & 0b1 != 0; )+ }}
+            let mut idx2 = 0;
+            while idx2 < 8 {
+                ret[fin + idx2] = (curi >> idx2) & 0b1 != 0;
+                idx2 += 1;
             }
-            bitx!(0, 1, 2, 3, 4, 5, 6, 7);
+            idx += 1;
         }
         ret
     }
diff --git a/users/zseri/store-ref-scanner/tests.nix b/users/zseri/store-ref-scanner/tests.nix
new file mode 100644
index 000000000000..a4c82fe3a936
--- /dev/null
+++ b/users/zseri/store-ref-scanner/tests.nix
@@ -0,0 +1,32 @@
+{ depot, lib, pkgs, ... }:
+
+let
+  parent = depot.users.zseri.store-ref-scanner;
+in
+pkgs.buildRustCrate {
+  pname = "store-ref-scanner-tests";
+  inherit (parent) crateName src version edition;
+  buildTests = true;
+  postInstall = ''
+    set -ex
+    export RUST_BACKTRACE=1
+    # recreate a file hierarchy as when running tests with cargo
+    # the source for test data
+    # build outputs
+    testRoot=target/debug
+    mkdir -p $testRoot
+    chmod +w -R .
+    # test harness executables are suffixed with a hash,
+    # like cargo does this allows to prevent name collision
+    # with the main executables of the crate
+    hash=$(basename $out)
+    ls -lasR $out
+    for file in $out/tests/*; do
+      f=$testRoot/$(basename $file)-$hash
+      cp $file $f
+      $f 2>&1 | tee -a $out/tests.log
+    done
+    rm -rf $out/tests
+    set +ex
+  '';
+}