feat: Rust templates
This commit is contained in:
parent
50a0f0abc2
commit
e5faf58ba8
33 changed files with 630 additions and 1 deletions
2
rust/cargo-stable/nixpkgs/.envrc
Normal file
2
rust/cargo-stable/nixpkgs/.envrc
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
use flake
|
||||
7
rust/cargo-stable/nixpkgs/Cargo.lock
generated
Normal file
7
rust/cargo-stable/nixpkgs/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "hello"
|
||||
version = "0.1.0"
|
||||
6
rust/cargo-stable/nixpkgs/Cargo.toml
Normal file
6
rust/cargo-stable/nixpkgs/Cargo.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "hello"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
43
rust/cargo-stable/nixpkgs/flake.lock
generated
Normal file
43
rust/cargo-stable/nixpkgs/flake.lock
generated
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764138170,
|
||||
"narHash": "sha256-2bCmfCUZyi2yj9FFXYKwsDiaZmizN75cLhI/eWmf3tk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "bb813de6d2241bcb1b5af2d3059f560c66329967",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"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",
|
||||
"version": 7
|
||||
}
|
||||
23
rust/cargo-stable/nixpkgs/flake.nix
Normal file
23
rust/cargo-stable/nixpkgs/flake.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, systems, ... }:
|
||||
let eachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
in {
|
||||
packages = eachSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
hello = pkgs.callPackage ./package.nix {};
|
||||
default = self.packages.${system}.hello;
|
||||
});
|
||||
|
||||
devShells = eachSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
default = import ./shell.nix { inherit pkgs; };
|
||||
});
|
||||
};
|
||||
}
|
||||
12
rust/cargo-stable/nixpkgs/package.nix
Normal file
12
rust/cargo-stable/nixpkgs/package.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "hello";
|
||||
version = "0.1";
|
||||
src = ./.;
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
}
|
||||
10
rust/cargo-stable/nixpkgs/shell.nix
Normal file
10
rust/cargo-stable/nixpkgs/shell.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let inherit (pkgs)
|
||||
mkShellNoCC
|
||||
rustc
|
||||
cargo
|
||||
rust-analyzer
|
||||
;
|
||||
in mkShellNoCC {
|
||||
packages = [ rustc cargo rust-analyzer ];
|
||||
}
|
||||
3
rust/cargo-stable/nixpkgs/src/main.rs
Normal file
3
rust/cargo-stable/nixpkgs/src/main.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, World!");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue