add rust-flake template
This commit is contained in:
parent
03ede4536c
commit
2db5ad16cd
3 changed files with 36 additions and 0 deletions
|
@ -7,6 +7,10 @@
|
||||||
path = ./base-flake;
|
path = ./base-flake;
|
||||||
description = "An empty flake for each default system";
|
description = "An empty flake for each default system";
|
||||||
};
|
};
|
||||||
|
rust-flake = {
|
||||||
|
path = ./rust-flake;
|
||||||
|
description = "Flake to develop, build and run a rust application";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
defaultTemplate = self.templates.base-flake;
|
defaultTemplate = self.templates.base-flake;
|
||||||
};
|
};
|
||||||
|
|
1
rust-flake/.envrc
Normal file
1
rust-flake/.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
31
rust-flake/flake.nix
Normal file
31
rust-flake/flake.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
|
||||||
|
utils.url = github:numtide/flake-utils;
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, utils }:
|
||||||
|
utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
cargoToml = with builtins; (fromTOML (readFile ./dexios/Cargo.toml));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages.default = pkgs.rustPlatform.buildRustPackage {
|
||||||
|
inherit (cargoToml.package) name version;
|
||||||
|
src = nixpkgs.lib.cleanSource ./.;
|
||||||
|
doCheck = true;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
};
|
||||||
|
|
||||||
|
apps.default = utils.lib.mkApp {
|
||||||
|
inherit (cargoToml.package) name;
|
||||||
|
drv = packages.default;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShell = with pkgs; mkShell {
|
||||||
|
packages = [ cargo rustc rustfmt clippy rust-analyzer ];
|
||||||
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue