Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
368 changes: 368 additions & 0 deletions .cargo/config.toml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ main.rs
# `perf record` files
/*perf.data*
/tmp
vendor
!Makefile
process-repo.log
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,007 changes: 2,007 additions & 0 deletions Cargo.nix

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
edition = "2018"
# dev-dependencies require 1.65, but the main code doesn't
# This option was added in 1.56, keep it for when we bump MSRV.
rust-version = "1.48.0"
# rust-version = "1.48.0"

[[bench]]
name = "benchmarks"
Expand Down Expand Up @@ -50,10 +50,15 @@ default = ["std"]
alloc = []
std = ["alloc"]

[profile.bench]
# Useful for better disassembly when using `perf record` and `perf annotate`
debug = true
# [profile.bench]
# # Useful for better disassembly when using `perf record` and `perf annotate`
# debug = true

[profile.test]
# Faster tests save much more than the increase in compilation time
opt-level = 3
# [profile.test]
# # Faster tests save much more than the increase in compilation time
# opt-level = 3

#[workspace]

[package.metadata.cargo2nix]
cargo2nix_path = "/data/data/com.termux.nix/files/home/pick-up-nix2/vendor/rust/cargo2nix/target/debug/cargo2nix"
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Makefile.submodule
# This Makefile is intended to be copied into submodules and invoked recursively.

.PHONY: submodule-build-and-push clean

CARGO_GIT_MANAGE_BIN := $(CARGO2NIX_ROOT)/submodules/cargo/cargo-submodule-tool/target/debug/cargo-git-manage

CARGO_GIT_MANAGE_BIN_PATH := $(CARGO2NIX_ROOT)/submodules/cargo/target/debug/cargo-git-manage
CARGO2NIX_BIN_PATH := $(CARGO2NIX_ROOT)/target/debug/cargo2nix

submodule-build-and-push:
@echo "Building and pushing submodule $(notdir $(CURDIR)) (Depth: $(CURRENT_RECURSION_DEPTH))"

# Inject cargo2nix_path into Cargo.toml if not present
@if ! grep -q "\[package\.metadata\.cargo2nix\]" Cargo.toml; then \
echo "Adding [package.metadata.cargo2nix] to Cargo.toml"; \
echo "" >> Cargo.toml; \
echo "[package.metadata.cargo2nix]" >> Cargo.toml; \
echo "cargo2nix_path = \"$(CARGO2NIX_BIN_PATH)\"" >> Cargo.toml; \
elif ! grep -q "cargo2nix_path" Cargo.toml; then \
echo "Adding cargo2nix_path to [package.metadata.cargo2nix] in Cargo.toml"; \
sed -i "/\[package\.metadata\.cargo2nix\]/a cargo2nix_path = \"$(CARGO2NIX_BIN_PATH)\"" Cargo.toml; \
else \
echo "Updating cargo2nix_path in Cargo.toml"; \
sed -i "s|cargo2nix_path = \".*\"|cargo2nix_path = \"$(CARGO2NIX_BIN_PATH)\"|" Cargo.toml; \
fi

PATH=$(CARGO2NIX_ROOT)/submodules/cargo/target/debug:$$PATH \
$(CARGO_GIT_MANAGE_BIN_PATH)
nix build
git add .
git commit -m "feat: Update, vendor, cargo2nix, and build for $(notdir $(CURDIR))"
git push origin feature/CRQ-016-nixify

clean:
@echo "Cleaning submodule $(notdir $(CURDIR))"
rm -f Cargo.nix
cargo clean
nix store gc --optimise
171 changes: 171 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
inputs = {
nixpkgs.url = "github:meta-introspector/nixpkgs?ref=feature/CRQ-016-nixify"; # Or your preferred nixpkgs branch/commit
flake-utils.url = "github:meta-introspector/flake-utils?ref=feature/CRQ-016-nixify"; # Or a stable flake-utils URL
cargo2nix.url = "github:cargo2nix/cargo2nix/release-0.12"; # Pin to a specific release for stability
};

outputs = inputs: with inputs;
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ cargo2nix.overlays.default ];
config = {
permittedInsecurePackages = [ "openssl-1.1.1w" ];
};
};

rustToolchain = pkgs.rust-bin.nightly."2025-09-16".default; # Example nightly

rustPkgs = pkgs.rustBuilder.makePackageSet {
packageFun = import ./Cargo.nix; # Links to your generated Cargo.nix
rustChannel = "nightly"; # Or "stable"
rustVersion = "latest"; # Or a specific version like "1.81.0"

rootFeatures = [
"base64/default"
"base64/alloc"
"base64/std"
];

packageOverrides = pkgs: [
# Add any necessary package overrides here
];
};

workspaceShell = pkgs.mkShell {
packages = [
pkgs.statix
pkgs.openssl_1_1.dev
];
shellHook = ''
export PKG_CONFIG_PATH=${pkgs.openssl_1_1.dev}/lib/pkgconfig:$PKG_CONFIG_PATH
export PATH=${rustToolchain}/bin:$PATH
'';
};

in
rec {
devShells = {
default = workspaceShell;
};

packages = rec {
base64 = rustPkgs.workspace.base64 {};
default = base64;
};

apps = {};
}
);
}
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ path = ".."
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"

# Prevent this from interfering with workspaces
[workspace]
#[workspace]
members = ["."]

[[bin]]
Expand Down
Loading