-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
95 lines (89 loc) · 3.16 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
description = "Flake utils demo";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/master";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
inputs.treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
outputs = inputs @ { flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-darwin"
];
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem = { config, pkgs, lib, ... }: {
devShells.default = pkgs.callPackage ./shell.nix {
treefmt = config.treefmt.build.wrapper;
};
packages = {
harvest-exporter = pkgs.callPackage ./harvest-exporter.nix { };
harvest-report = pkgs.callPackage ./harvest-report.nix { };
wise-exporter = pkgs.callPackage ./wise-exporter.nix { };
sevdesk-invoicer = pkgs.callPackage ./sevdesk-invoicer.nix { };
sevdesk = pkgs.python3.pkgs.callPackage ./sevdesk.nix { };
quipu-invoicer = pkgs.python3.pkgs.callPackage ./quipu-invoicer.nix { };
working-days-calculator = pkgs.writers.writePython3Bin "working-days-calculator"
{
libraries = [ pkgs.python3Packages.pandas ];
flakeIgnore = [ "E501" ];
}
(builtins.readFile ./working-days-calculator.py);
default = config.packages.harvest-exporter;
};
treefmt = {
# Used to find the project root
projectRootFile = "flake.lock";
programs.mypy = {
enable = true;
directories = {
".".modules = [
"harvest"
"harvest_exporter"
"harvest_report"
"rest"
"kimai"
"kimai_exporter"
];
"sevdesk-invoicer" = { };
"wise-exporter" = {
extraPythonPackages = [ pkgs.python3.pkgs.rsa ];
};
"quipu-invoicer" = { };
};
};
settings.formatter = {
nix = {
command = "sh";
options = [
"-eucx"
''
export PATH=${lib.makeBinPath [ pkgs.coreutils pkgs.findutils pkgs.statix pkgs.deadnix pkgs.nixpkgs-fmt ]}
deadnix --edit "$@"
# statix breaks flake.nix's requirement for making outputs a function
echo "$@" | xargs -P$(nproc) -n1 statix fix -i flake.nix node-env.nix
nixpkgs-fmt "$@"
''
"--"
];
includes = [ "*.nix" ];
};
python = {
command = "sh";
options = [
"-eucx"
''
${pkgs.lib.getExe pkgs.ruff} --fix "$@"
${pkgs.lib.getExe pkgs.python3.pkgs.black} "$@"
''
"--" # this argument is ignored by bash
];
includes = [ "*.py" ];
};
};
};
};
};
}