-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathflake.nix
More file actions
141 lines (138 loc) · 3.83 KB
/
Copy pathflake.nix
File metadata and controls
141 lines (138 loc) · 3.83 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
description = "Configurable jj subcommand for GitHub PR workflows";
inputs = {
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
crane,
flake-utils,
nixpkgs,
rust-overlay,
treefmt-nix,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
src =
let
root = ./.;
in
pkgs.lib.fileset.toSource {
inherit root;
fileset = pkgs.lib.fileset.unions [
(craneLib.fileset.commonCargoSources root)
(pkgs.lib.fileset.fileFilter (f: f.hasExt "gql") root)
(pkgs.lib.fileset.fileFilter (f: f.hasExt "graphql") root)
];
};
commonArgs = {
inherit src;
strictDeps = true;
buildInputs =
(pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.libiconv
])
++ (pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.openssl
]);
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.pkg-config ];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
treefmtEval = treefmt-nix.lib.evalModule pkgs (
import ./nix/treefmt.nix {
inherit pkgs;
inherit rustToolchain;
}
);
packageSet = import ./nix/pkgs {
inherit
pkgs
crane
craneLib
commonArgs
cargoArtifacts
rustToolchain
treefmtEval
;
};
inherit (packageSet)
fetch-schema-app
jj-gh
print-config-schema
release-app
release-plz-patched
update-docs
;
in
{
inherit (packageSet) packages;
apps = {
default = flake-utils.lib.mkApp { drv = jj-gh; };
docs = flake-utils.lib.mkApp {
drv = update-docs;
name = "update-docs";
};
release = flake-utils.lib.mkApp {
drv = release-app;
name = "release";
};
fetch-schema = flake-utils.lib.mkApp {
drv = fetch-schema-app;
name = "fetch-schema";
};
};
formatter = treefmtEval.config.build.wrapper;
devShells.default = craneLib.devShell {
inputsFrom = [ jj-gh ];
packages = [
pkgs.cargo-nextest
pkgs.cargo-semver-checks
pkgs.cargo-udeps
pkgs.ast-grep
pkgs.jujutsu
pkgs.rust-analyzer
treefmtEval.config.build.wrapper
];
};
checks = import ./nix/checks {
inherit
self
pkgs
craneLib
commonArgs
cargoArtifacts
treefmtEval
jj-gh
print-config-schema
release-plz-patched
update-docs
;
};
}
)
// {
overlays.default = final: _prev: {
jj-gh = self.packages.${final.stdenv.hostPlatform.system}.default;
};
homeManagerModules.default = import ./nix/hm-module.nix self;
homeManagerModules.jj-gh = import ./nix/hm-module.nix self;
};
}