-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
93 lines (83 loc) · 2 KB
/
flake.nix
File metadata and controls
93 lines (83 loc) · 2 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
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
{
description = "Lockfile updater";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt.url = "github:numtide/treefmt-nix";
treefmt.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
treefmt,
}: let
overlay = final: prev: {
update-lockfile = prev.python3.pkgs.callPackage ./pkg.nix {
src = self;
};
};
forEachSystem = nixpkgs.lib.genAttrs [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
importPkgs = system:
import nixpkgs {
inherit system;
overlays = [overlay];
};
treefmtSettings = {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
prettier.enable = true;
ruff-format.enable = true;
taplo.enable = true;
};
};
in {
overlays = {
default = overlay;
update-lockfile = overlay;
};
apps = forEachSystem (
system: let
pkgs = importPkgs system;
app = {
type = "app";
program = "${pkgs.update-lockfile}/bin/update-lockfile";
inherit (pkgs.update-lockfile) meta;
};
in {
default = app;
update-lockfile = app;
}
);
packages = forEachSystem (
system: let
pkgs = importPkgs system;
in {
default = pkgs.update-lockfile;
inherit (pkgs) update-lockfile;
}
);
formatter = forEachSystem (
system: (treefmt.lib.evalModule (importPkgs system) treefmtSettings).config.build.wrapper
);
checks = forEachSystem (
system: let
pkgs = importPkgs system;
in {
inherit (pkgs) update-lockfile;
inherit (pkgs.update-lockfile.passthru.tests) tests;
formatting = ((treefmt.lib.evalModule pkgs (nixpkgs.lib.recursiveUpdate treefmtSettings
{
programs.ruff-check.enable = true;
}))
.config
.build
.check)
self;
}
);
};
}