-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
flake.nix
81 lines (74 loc) · 1.87 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
{
description = "Build Nix bootstraping packages for legacy distributions";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
treefmt-nix,
...
}:
(
let
inherit (nixpkgs) lib;
forSystems = lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
];
in
{
packages = forSystems (
system:
let
packages' = import self {
pkgs = nixpkgs.legacyPackages.${system};
inherit lib;
};
in
lib.listToAttrs (
lib.concatMap (
impl: lib.mapAttrsToList (format: v: lib.nameValuePair "${impl}-${format}" v) packages'.${impl}
) (lib.attrNames packages')
)
);
checks = forSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
treefmt =
pkgs.runCommand "treefmt-check"
{
nativeBuildInputs = [ self.formatter.${system} ];
}
''
cp -r ${self}/* .
env HOME=$(mktemp -d) treefmt --fail-on-change
touch $out
'';
}
);
formatter = forSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
(treefmt-nix.lib.evalModule pkgs ./treefmt.nix).config.build.wrapper
);
devShells = forSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.callPackage ./shell.nix { };
}
);
}
);
}