-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
75 lines (70 loc) · 2.15 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
description = "A tool that allows you to keep blocks in sync across different files in your codebase.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-pre-commit = {
url = "github:jmgilman/nix-pre-commit";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nix-pre-commit, ... }: let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pname = "onchg";
owner = "aksiksi";
version = "0.1.6";
in {
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.rustPlatform.buildRustPackage {
inherit pname;
inherit version;
src = ./.;
cargoSha256 = "sha256-t34KF87WPSDUBynLRZbmexEWvqYrddD9+YlhgpyWxWo=";
meta = {
description = "A tool that allows you to keep blocks in sync across different files in your codebase.";
homepage = "https://github.com/aksiksi/onchg-rs";
license = nixpkgs.lib.licenses.mit;
maintainers = [];
};
# Do not run tests; they rely on the filesystem.
doCheck = false;
};
}
);
shellHook = forAllSystems (system:
(nix-pre-commit.lib.${system}.mkConfig {
pkgs = nixpkgs.legacyPackages.${system};
config = {
repos = [
{
repo = "local";
hooks = [
{
id = "onchg";
language = "system";
entry = "${self.packages.${system}.default}/bin/onchg repo";
types = [ "text" ];
pass_filenames = false;
}
];
}
];
};
}).shellHook
);
# Development shell
# nix develop
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
buildInputs = [ pkgs.cargo pkgs.libgit2 pkgs.rust-analyzer pkgs.rustc pkgs.rustfmt ];
};
}
);
};
}