1
0
forked from quiK/hellorust

add flake, envrc

This commit is contained in:
2025-08-10 11:22:05 +02:00
parent 61a6086fea
commit 9a23cf2bb1
4 changed files with 62 additions and 58 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake .

34
flake.lock generated
View File

@@ -1,23 +1,5 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1754498491,
@@ -52,7 +34,6 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
@@ -74,21 +55,6 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@@ -1,36 +1,37 @@
{
description = "Rust Development Shell";
description = "Pinned Rust dev shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
outputs = { self, nixpkgs, rust-overlay, ... }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
inherit system;
overlays = [ (import rust-overlay) ];
};
in
with pkgs;
{
devShells.default = mkShell {
buildInputs = [
openssl
pkg-config
(
rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
})
)
];
rustToolchain = pkgs.rust-bin.stable."1.89.0".default.override {
extensions = [ "rust-src" "rust-analyzer" ];
};
}
in f pkgs rustToolchain
);
in {
devShells = forAllSystems (pkgs: rustToolchain: {
default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.pkg-config
rustToolchain
pkgs.lldb
];
buildInputs = [
pkgs.openssl
];
};
});
};
}

36
flake_old.nix Normal file
View File

@@ -0,0 +1,36 @@
{
description = "Rust Development Shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
with pkgs;
{
devShells.default = mkShell {
buildInputs = [
openssl
pkg-config
(
rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [
"rust-src"
"rust-analyzer"
];
})
)
];
};
}
);
}