templates: rust: init
This commit is contained in:
parent
87f6792f12
commit
4834edd2d4
7 changed files with 60 additions and 0 deletions
6
templates/default.nix
Normal file
6
templates/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
rust = {
|
||||
path = ./rust;
|
||||
description = "Rust project template";
|
||||
};
|
||||
}
|
1
templates/rust/.envrc
Normal file
1
templates/rust/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake
|
5
templates/rust/Cargo.toml
Normal file
5
templates/rust/Cargo.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[package]
|
||||
name = "sample-rust"
|
||||
version = "0.0.1"
|
||||
license = "GPL-3.0-only"
|
||||
edition = "2024"
|
8
templates/rust/default.nix
Normal file
8
templates/rust/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{rustPlatform}:
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "some-rust-package";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
}
|
35
templates/rust/flake.nix
Normal file
35
templates/rust/flake.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
description = "Rust project template";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
};
|
||||
|
||||
outputs = inputs: let
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
inherit (lib.attrsets) genAttrs mapAttrs;
|
||||
|
||||
eachSystem = genAttrs (import inputs.systems);
|
||||
pkgsFor = inputs.nixpkgs.legacyPackages;
|
||||
in {
|
||||
packages = eachSystem (system: {
|
||||
default = inputs.self.packages.${system}.ralc;
|
||||
ralc = pkgsFor.${system}.callPackage ./nix/package.nix {};
|
||||
});
|
||||
|
||||
devShells =
|
||||
mapAttrs (system: pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
cargo
|
||||
rustc
|
||||
rustfmt
|
||||
bacon
|
||||
rust-analyzer
|
||||
rustPackages.clippy
|
||||
];
|
||||
};
|
||||
})
|
||||
pkgsFor;
|
||||
};
|
||||
}
|
3
templates/rust/src/main.rs
Normal file
3
templates/rust/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