Add rust template
parent
b34000fec1
commit
ad392f8557
81
flake.lock
81
flake.lock
|
@ -178,6 +178,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668681692,
|
||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
|
@ -224,6 +240,27 @@
|
|||
"url": "https://gitlab.haskell.org/bgamari/ghc-utils"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"helix": {
|
||||
"inputs": {
|
||||
"nci": "nci",
|
||||
|
@ -412,6 +449,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1669546925,
|
||||
"narHash": "sha256-Gvtk9agz88tBgqmCdHl5U7gYttTkiuEd8/Rq1Im0pTg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fecf05d4861f3985e8dee73f08bc82668ef75125",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-22.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1667610399,
|
||||
|
@ -430,36 +483,40 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1667292599,
|
||||
"narHash": "sha256-7ISOUI1aj6UKMPIL+wwthENL22L3+A9V+jS8Is3QsRo=",
|
||||
"lastModified": 1669542132,
|
||||
"narHash": "sha256-DRlg++NJAwPh8io3ExBJdNW7Djs3plVI5jgYQ+iXAZQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ef2f213d9659a274985778bff4ca322f3ef3ac68",
|
||||
"rev": "a115bb9bd56831941be3776c8a94005867f316a7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1668973924,
|
||||
"narHash": "sha256-17VnhpKJRoYdt23SJcUUCi/qEt9d3OyFsz9YRYStrew=",
|
||||
"owner": "cpcloud",
|
||||
"lastModified": 1669152228,
|
||||
"narHash": "sha256-FEDReoTLWJHXcNso7aaAlAUU7uOqIR6Hc/C/nqlfooE=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "7ee855668b78b9d7d1b504121c5b146c67a2abd8",
|
||||
"rev": "078b0dee35e2da01334af682ec347463b70a9986",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cpcloud",
|
||||
"ref": "dot-git-dir",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
15
flake.nix
15
flake.nix
|
@ -27,8 +27,7 @@
|
|||
home-manager-atemu.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
|
||||
# pre-commit and hooks
|
||||
# pre-commit.url = "github:cachix/pre-commit-hooks.nix";
|
||||
pre-commit.url = "github:cpcloud/pre-commit-hooks.nix/dot-git-dir";
|
||||
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
|
||||
pre-commit.inputs.flake-utils.follows = "flake-utils";
|
||||
|
||||
# Extra sources
|
||||
|
@ -308,6 +307,14 @@
|
|||
};
|
||||
};
|
||||
|
||||
templates = {
|
||||
rust = {
|
||||
description = "A rust flake template based on flake.parts";
|
||||
welcomeText = "Run `cargo init` to start a new project";
|
||||
path = ./templates/rust;
|
||||
};
|
||||
};
|
||||
|
||||
} // flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import inputs.nixpkgs-unstable {
|
||||
|
@ -335,6 +342,8 @@
|
|||
};
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell { inherit (self.checks.${system}.pre-commit) shellHook; };
|
||||
devShells.default = pkgs.mkShell {
|
||||
inherit (self.checks.${system}.pre-commit) shellHook;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
use flake
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
description = "FILL-ME-IN";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
crane.inputs.nixpkgs.follows = "nixpkgs";
|
||||
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
|
||||
};
|
||||
|
||||
outputs = { self, flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit self; } {
|
||||
systems = [
|
||||
"aarch64-darwin"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"x86_64-linux"
|
||||
];
|
||||
perSystem = { self', inputs', pkgs, ... }:
|
||||
let
|
||||
inherit (inputs') crane pre-commit;
|
||||
crane-lib = crane.lib;
|
||||
package = crane-lib.buildPackage {
|
||||
src = crane-lib.cleanCargoSource ./.;
|
||||
nativeBuildInputs = [ pkgs.libiconv ];
|
||||
};
|
||||
in
|
||||
{
|
||||
checks = {
|
||||
inherit package;
|
||||
pre-commit = pre-commit.lib.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
rustfmt.enable = true;
|
||||
clippy.enable = true;
|
||||
cargo-check.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
packages.default = package;
|
||||
devShells.default = pkgs.mkShell {
|
||||
inherit (self'.checks.pre-commit) shellHook;
|
||||
inputsFrom = builtins.attrValues self.checks;
|
||||
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cargo
|
||||
rustc
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
rustfmt
|
||||
clippy
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue