Initial commit
This commit is contained in:
commit
3d7f813ffb
5 changed files with 56 additions and 0 deletions
11
flake.nix
Normal file
11
flake.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
description = "My collection of flake templates";
|
||||
|
||||
outputs = { self }: {
|
||||
templates = {
|
||||
rust = {
|
||||
path = ./rust;
|
||||
description = "Rust template, using oxalica/rust-overlay";
|
||||
};
|
||||
};
|
||||
};
|
||||
4
rust/.envrc
Normal file
4
rust/.envrc
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
|
||||
fi
|
||||
use flake
|
||||
8
rust/Cargo.toml
Normal file
8
rust/Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "rust"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
30
rust/flake.nix
Normal file
30
rust/flake.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
description = "Flake template for a rust project";
|
||||
|
||||
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 = [
|
||||
rust-bin.stable.latest.default
|
||||
];
|
||||
packages = [
|
||||
rust-analyzer
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
3
rust/src/main.rs
Normal file
3
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