working devShell!
This commit is contained in:
parent
c58edc48e6
commit
10f4b7b134
11 changed files with 21 additions and 19 deletions
34
parts/fmt.nix
Normal file
34
parts/fmt.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
perSystem = {
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# https://github.com/numtide/treefmt-nix?tab=readme-ov-file#flake-parts
|
||||
formatter = config.treefmt.build.wrapper;
|
||||
treefmt = {
|
||||
projectRootFile = "flake.nix";
|
||||
enableDefaultExcludes = true;
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
|
||||
shellcheck.enable = true; # cannot be configured, errors on basic bash convention
|
||||
|
||||
prettier = {
|
||||
enable = true;
|
||||
package = pkgs.prettierd;
|
||||
excludes = ["*.age"];
|
||||
settings = {
|
||||
editorconfig = true;
|
||||
};
|
||||
};
|
||||
|
||||
shfmt = {
|
||||
enable = true;
|
||||
# https://flake.parts/options/treefmt-nix.html#opt-perSystem.treefmt.programs.shfmt.indent_size
|
||||
indent_size = 2; # set to 0 to use tabs
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
0
parts/lib/builders.nix
Normal file
0
parts/lib/builders.nix
Normal file
13
parts/pre-commit/default.nix
Normal file
13
parts/pre-commit/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
perSystem = _: {
|
||||
pre-commit = {
|
||||
settings = {
|
||||
excludes = ["flake.lock"];
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
prettier.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
36
parts/shell.nix
Normal file
36
parts/shell.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
perSystem = {
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
name = "nichts";
|
||||
|
||||
shellHook = ''
|
||||
${config.pre-commit.installationScript}
|
||||
'';
|
||||
|
||||
DIRENV_LOG_FORMAT = "";
|
||||
|
||||
inputsFrom = [config.treefmt.build.devShell];
|
||||
packages = [
|
||||
config.treefmt.build.wrapper # treewide formatter
|
||||
pkgs.git # take a guess
|
||||
|
||||
(pkgs.writeShellApplication {
|
||||
name = "update";
|
||||
text = ''
|
||||
nix flake update && git commit flake.lock -m "flake: bump inputs"
|
||||
'';
|
||||
})
|
||||
(pkgs.writeShellApplication {
|
||||
name = "rebuild";
|
||||
text = ''
|
||||
nh os switch
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue