aboutsummaryrefslogtreecommitdiff
path: root/templates/rust/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'templates/rust/flake.nix')
-rw-r--r--templates/rust/flake.nix102
1 files changed, 0 insertions, 102 deletions
diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix
deleted file mode 100644
index fdce743..0000000
--- a/templates/rust/flake.nix
+++ /dev/null
@@ -1,102 +0,0 @@
-{
- description = "A CLI to manage public SSH keys for GitHub.";
-
- inputs = {
- flake-utils.url = "github:numtide/flake-utils";
- nixpkgs.url = "github:NixOS/nixpkgs";
- rust-overlay = {
- url = "github:oxalica/rust-overlay";
- inputs = {
- flake-utils.follows = "flake-utils";
- nixpkgs.follows = "nixpkgs";
- };
- };
- crane = {
- url = "github:ipetkov/crane";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- pre-commit-hooks = {
- url = "github:cachix/pre-commit-hooks.nix";
- inputs = {
- flake-utils.follows = "flake-utils";
- nixpkgs.follows = "nixpkgs";
- };
- };
- };
-
- outputs =
- { self
- , flake-utils
- , nixpkgs
- , rust-overlay
- , crane
- , pre-commit-hooks
- }:
-
- flake-utils.lib.eachDefaultSystem
- (system:
- let
- pkgs = import nixpkgs {
- inherit system;
- overlays = [ (import rust-overlay) ];
- };
- rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
-
- craneLib = (crane.mkLib pkgs).overrideScope' (_: _: {
- cargo = rust-toolchain;
- clippy = rust-toolchain;
- rustc = rust-toolchain;
- rustfmt = rust-toolchain;
- });
-
- src = ./.;
-
- cargoArtifacts = craneLib.buildDepsOnly {
- inherit src;
- };
-
- my-crate = craneLib.buildPackage {
- inherit cargoArtifacts src;
- };
- in
- {
- packages.default = my-crate;
- apps.default = flake-utils.lib.mkApp {
- drv = my-crate;
- };
-
- checks = {
- pre-commit = pre-commit-hooks.lib.${system}.run {
- inherit src;
- hooks = {
- clippy = {
- enable = true;
- entry = pkgs.lib.mkForce "cargo clippy -- -D warnings";
- };
- nixpkgs-fmt = {
- enable = true;
- };
- rustfmt = {
- enable = true;
- entry = pkgs.lib.mkForce "cargo fmt -- --check --color always";
- };
- };
- };
- };
-
- devShell = pkgs.mkShell {
- nativeBuildInputs = with pkgs; [
- rust-toolchain
- cargo-deny
- rust-analyzer
- ];
-
- inherit (self.checks.${system}.pre-commit) shellHook;
- };
- })
- // {
- overlay = final: prev: {
- XXX = self.defaultPackage.${prev.system};
- };
- };
-}