mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-04-22 04:11:33 +02:00
Add rust template in flake
This commit is contained in:
parent
ae572deb85
commit
9b38722451
5 changed files with 54 additions and 0 deletions
|
|
@ -40,6 +40,12 @@
|
|||
nixpkgs,
|
||||
...
|
||||
} @ inputs: {
|
||||
templates = {
|
||||
rust = {
|
||||
path = ./templates/rust;
|
||||
description = "My rust template using rust-overlay and direnv";
|
||||
};
|
||||
};
|
||||
nixosConfigurations = {
|
||||
ZeNixLaptop = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
|
|
|
|||
4
templates/rust/.envrc
Normal file
4
templates/rust/.envrc
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0="
|
||||
fi
|
||||
use flake
|
||||
1
templates/rust/.gitignore
vendored
Normal file
1
templates/rust/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/target
|
||||
7
templates/rust/Cargo.toml
Normal file
7
templates/rust/Cargo.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "todo_change_name"
|
||||
version = "0.1.0"
|
||||
authors = ["traxys <quentin@familleboyer.net>"]
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
36
templates/rust/flake.nix
Normal file
36
templates/rust/flake.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
description = "A basic flake with a shell";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
inputs.naersk.url = "github:nix-community/naersk";
|
||||
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
naersk,
|
||||
rust-overlay,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [(import rust-overlay)];
|
||||
};
|
||||
rust = pkgs.rust-bin.stable.latest.default;
|
||||
naersk' = pkgs.callPackage naersk {
|
||||
cargo = rust;
|
||||
rustc = rust;
|
||||
};
|
||||
in {
|
||||
devShell = pkgs.mkShell {
|
||||
nativeBuildInputs = [rust];
|
||||
RUST_PATH = "${rust}";
|
||||
shellHook = ''
|
||||
alias rstddoc="firefox ${rust}/share/doc/rust/html/std/index.html"
|
||||
'';
|
||||
};
|
||||
|
||||
defaultPackage = nearsk'.buildPackage ./.;
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue