[New] - Adding rustlings as submodule
This commit is contained in:
parent
d4772b1c0b
commit
2fc49e1a7c
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "hello"]
|
||||
path = hello
|
||||
url = https://gitea.adnangonzagaci.com/adnangonzaga/hello-rust.git
|
||||
[submodule "rustlings"]
|
||||
path = rustlings
|
||||
url = git@github.com:rust-lang/rustlings.git
|
||||
|
||||
88
flake.nix
Normal file
88
flake.nix
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
description = "Rust Dev environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
|
||||
rustVersion = pkgs.rust-bin.stable.latest.default;
|
||||
|
||||
# Packages required for rustlings
|
||||
rustPackages = with pkgs; [
|
||||
# Rust toolchain with extensions
|
||||
(rustVersion.override {
|
||||
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
|
||||
})
|
||||
|
||||
# Build essentials
|
||||
pkg-config
|
||||
openssl.dev
|
||||
|
||||
# Development tools
|
||||
rustlings
|
||||
cargo-edit
|
||||
cargo-watch
|
||||
cargo-expand
|
||||
cargo-audit
|
||||
|
||||
# IDE integration helpers
|
||||
rust-analyzer
|
||||
|
||||
# Windows compatibility (for cross-compilation)
|
||||
pkgsCross.mingwW64.buildPackages.gcc
|
||||
];
|
||||
|
||||
# Shell environment variables
|
||||
shellEnv = {
|
||||
RUST_SRC_PATH = "${rustVersion}/lib/rustlib/src/rust/library";
|
||||
RUSTFLAGS = "-C link-arg=-fuse-ld=gold";
|
||||
RUST_BACKTRACE = "1";
|
||||
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = rustPackages;
|
||||
|
||||
shellHook = ''
|
||||
echo "Rust development environment loaded!"
|
||||
echo "rustc version: $(rustc --version)"
|
||||
echo "cargo version: $(cargo --version)"
|
||||
echo "rustlings version: $(rustlings --version)"
|
||||
echo ""
|
||||
echo "You can start rustlings with: rustlings watch"
|
||||
|
||||
mkdir -p .cargo
|
||||
if [ ! -f .cargo/config.toml ]; then
|
||||
cat > .cargo/config.toml << EOF
|
||||
[build]
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=gold"]
|
||||
|
||||
[target.x86_64-pc-windows-gnu]
|
||||
linker = "x86_64-w64-mingw32-gcc"
|
||||
EOF
|
||||
fi
|
||||
'';
|
||||
|
||||
inherit (shellEnv) RUST_SRC_PATH RUSTFLAGS RUST_BACKTRACE PKG_CONFIG_PATH;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
1
rustlings
Submodule
1
rustlings
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 7c0d269279aaed64d6b8240ed5c1e9f6a981181e
|
||||
Loading…
Reference in New Issue
Block a user