-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathper-system.nix
120 lines (106 loc) · 4.14 KB
/
per-system.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
({ self, inputs, ... }:
{
perSystem = { config, system, pkgs, lib, self', ... }:
let
mkNixpkgs = nixpkgs:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config = { allowUnfree = true; };
};
in {
_module.args.pkgs = mkNixpkgs inputs.nixpkgs;
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
bash
# task execution from dodo.py
git
# Formatters & linters
pre-commit
watchexec
];
# Include pre-commit check shellHook so they can be ran with `pre-commit ...`
shellHook = config.pre-commit.installationScript;
};
};
packages = {
inherit (pkgs)
taskfzf pathnames backupper wiki-builder wsl-open-dynamic
pretty-task bootstrapSecretsScript rstcheck copier
pre-commit-hook-ensure-sops deploy-rs git-branch-clean
allas-cli-utils grokker poetry-with-c-tooling synonym-cli mosaic
sync-git-tag-with-poetry resolve-version poetry-run
python39-with-c-tooling python310-with-c-tooling
python311-with-c-tooling jupytext-nb-edit template-check nvim-nixvim
git-history-grep gdal update-flake fhs fhs-no-ld tracerepo;
inherit (pkgs.python3Packages)
doit-ext sphinxcontrib-mermaid sphinx-gallery item-synchronizer
gkeepapi powerlaw frackit python-ternary mplstereonet pyvtk fractopo
# TODO: Update pandera for numpy 2
# tracerepo pandera
;
inherit (pkgs.gptEngineerPackages) gpt-engineer;
inherit (pkgs.kibitzrPackages) kibitzr;
inherit (pkgs.stablerPackages)
tasklite-core lagrit dfnworks fehm pflotran petsc hdf5-full openmpi;
# TODO: Need to be updated upstream for numpy 2
# inherit (pkgs.previousPackages.python3Packages)
# ;
# fractopo-documentation =
# pkgs.python3Packages.fractopo.passthru.documentation.doc;
inherit (pkgs.stablerPackages.python3Packages) pydfnworks;
# inherit (pkgs.pandocPackages) pandoc-wrapped;
inherit (self'.devShells) poetry-devshell;
} //
# Adds all pre-commit hooks from pre-commit-hooks.nix to checks
# Should I exclude default ones and how?
(let
excludeOption =
# TODO: Make exclude smarter. E.g. make perSystem option where I define my own hooks
# Or mark them in the definition for testing
lib.filterAttrs (n: _:
builtins.elem n
# List of pre-commit hook entries that I want to check
# I.e. it tests the package build
[
"nbstripout"
"black-nb"
"cogapp"
"rstcheck"
"check-added-large-files"
"trim-trailing-whitespace"
"detect-secrets"
"sqlfluff-lint"
"sqlfluff-fix"
"ruff"
"no-pushes-to-branch"
]) (lib.mapAttrs' (name: value:
lib.nameValuePair name
(pkgs.writeText "${name}-entry" value.entry))
config.pre-commit.settings.hooks);
in excludeOption)
;
checks = self.packages."${system}";
pre-commit = {
check.enable = true;
settings = {
hooks = {
nixfmt.enable = true;
ruff.enable = true;
ruff-format = { enable = true; };
shellcheck.enable = true;
statix.enable = true;
deadnix.enable = true;
luacheck.enable = true;
stylua.enable = true;
yamllint = { enable = true; };
fish-lint = { enable = true; };
fish-format = { enable = true; };
shfmt = { enable = true; };
};
};
};
legacyPackages = pkgs;
};
})