-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdevshell.nix
More file actions
62 lines (59 loc) · 1.58 KB
/
devshell.nix
File metadata and controls
62 lines (59 loc) · 1.58 KB
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
{ inputs }:
rec {
forAllSystems = inputs.nixpkgs.lib.genAttrs [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
devShells = forAllSystems (
system:
let
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
inputs.nur.overlays.default
];
};
fakeDotnetSdk = pkgs.runCommand "fake-dotnet-sdk" { } ''
mkdir -p "$out/share/dotnet"
'';
preCommitNoDotnet = pkgs.pre-commit.override {
# Keep nixpkgs' pre-commit package as-is, but replace the heavyweight
# .NET SDK test runtime with a tiny stub because this repo never uses
# the disabled dotnet hook tests.
dotnet-sdk = fakeDotnetSdk;
};
pre-commit-check = inputs.git-hooks-nix.lib.${system}.run {
src = ./.;
package = preCommitNoDotnet;
hooks = {
nixfmt = {
enable = true;
description = "Format nix files using nixfmt";
};
prettier = {
enable = true;
description = "Format various files using prettier";
};
};
};
in
{
default = pkgs.mkShell {
name = "dotfiles-shell-from-devshell";
buildInputs = [
pkgs.hello
pkgs.nixfmt # For nix formatting
pkgs.prettier # For general formatting
]
++ pre-commit-check.enabledPackages;
shellHook = ''
echo "flake.lock" > .prettierignore
${pre-commit-check.shellHook}
'';
};
}
);
}