Compare commits
2 Commits
ad392f8557
...
cfe166f68a
Author | SHA1 | Date |
---|---|---|
mat ess | cfe166f68a | |
mat ess | 83ae1044f3 |
|
@ -310,7 +310,11 @@
|
||||||
templates = {
|
templates = {
|
||||||
rust = {
|
rust = {
|
||||||
description = "A rust flake template based on flake.parts";
|
description = "A rust flake template based on flake.parts";
|
||||||
welcomeText = "Run `cargo init` to start a new project";
|
welcomeText = ''
|
||||||
|
welcome to a new rust project ミ(・・)ミ
|
||||||
|
|
||||||
|
run `direnv allow` and `cargo init` to start a new project
|
||||||
|
'';
|
||||||
path = ./templates/rust;
|
path = ./templates/rust;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
mkdcd = {
|
mkdcd = {
|
||||||
argumentNames = [ "target" ];
|
argumentNames = [ "target" ];
|
||||||
body = ''
|
body = ''
|
||||||
|
if test -z "$target"
|
||||||
|
echo "mkdcd requires an argument" 1>&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
mkdir -p $target
|
mkdir -p $target
|
||||||
cd $target
|
cd $target
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
/.direnv
|
||||||
|
/result
|
||||||
|
/target
|
||||||
|
/.pre-commit-config.yaml
|
|
@ -7,40 +7,39 @@
|
||||||
crane.url = "github:ipetkov/crane";
|
crane.url = "github:ipetkov/crane";
|
||||||
crane.inputs.nixpkgs.follows = "nixpkgs";
|
crane.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
|
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
|
||||||
|
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, flake-parts, ... }:
|
outputs = { self, flake-parts, crane, pre-commit, ... }:
|
||||||
flake-parts.lib.mkFlake { inherit self; } {
|
flake-parts.lib.mkFlake { inherit self; } {
|
||||||
|
imports = [ pre-commit.flakeModule ];
|
||||||
systems = [
|
systems = [
|
||||||
"aarch64-darwin"
|
"aarch64-darwin"
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
"x86_64-darwin"
|
"x86_64-darwin"
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
];
|
];
|
||||||
perSystem = { self', inputs', pkgs, ... }:
|
perSystem = { config, pkgs, system, ... }:
|
||||||
let
|
let
|
||||||
inherit (inputs') crane pre-commit;
|
crane-lib = crane.lib.${system};
|
||||||
crane-lib = crane.lib;
|
|
||||||
package = crane-lib.buildPackage {
|
package = crane-lib.buildPackage {
|
||||||
src = crane-lib.cleanCargoSource ./.;
|
src = crane-lib.cleanCargoSource ./.;
|
||||||
nativeBuildInputs = [ pkgs.libiconv ];
|
nativeBuildInputs = [ pkgs.libiconv ];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
checks = {
|
pre-commit.settings.hooks = {
|
||||||
inherit package;
|
rustfmt.enable = true;
|
||||||
pre-commit = pre-commit.lib.run {
|
clippy.enable = true;
|
||||||
src = ./.;
|
cargo-check.enable = true;
|
||||||
hooks = {
|
|
||||||
rustfmt.enable = true;
|
|
||||||
clippy.enable = true;
|
|
||||||
cargo-check.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
checks = { inherit package; };
|
||||||
packages.default = package;
|
packages.default = package;
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
inherit (self'.checks.pre-commit) shellHook;
|
shellHook = ''
|
||||||
|
${config.pre-commit.installationScript}
|
||||||
|
echo "welcome to your rust project ミ(・・)ミ" 1>&2
|
||||||
|
'';
|
||||||
inputsFrom = builtins.attrValues self.checks;
|
inputsFrom = builtins.attrValues self.checks;
|
||||||
|
|
||||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||||
|
|
Loading…
Reference in New Issue