Skip to content

Commit 41521eb

Browse files
committed
nix: replace flake-utils with flake-parts
1 parent e2e2ed6 commit 41521eb

2 files changed

Lines changed: 71 additions & 122 deletions

File tree

flake.lock

Lines changed: 13 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 58 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,79 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4-
flake-utils.url = "github:numtide/flake-utils";
5-
rust-overlay.url = "github:oxalica/rust-overlay";
4+
flake-parts = {
5+
url = "github:hercules-ci/flake-parts";
6+
inputs.nixpkgs-lib.follows = "nixpkgs";
7+
};
68
};
79

810
outputs =
9-
{
10-
self,
11+
inputs@{
1112
nixpkgs,
12-
rust-overlay,
13-
flake-utils,
13+
flake-parts,
14+
...
1415
}:
15-
flake-utils.lib.eachDefaultSystem (
16-
system:
17-
let
18-
pkgs = import nixpkgs {
19-
inherit system;
20-
overlays = [ (import rust-overlay) ];
21-
};
22-
in
23-
{
24-
formatter = pkgs.treefmt.withConfig {
25-
runtimeInputs = [
26-
pkgs.nixfmt
27-
pkgs.rustfmt
28-
];
16+
flake-parts.lib.mkFlake { inherit inputs; } {
17+
systems = nixpkgs.lib.systems.flakeExposed;
18+
perSystem =
19+
{ system, pkgs, ... }:
20+
{
21+
formatter = pkgs.treefmt.withConfig {
22+
runtimeInputs = [
23+
pkgs.nixfmt
24+
pkgs.rustfmt
25+
];
2926

30-
settings = {
31-
on-unmatched = "info";
27+
settings = {
28+
on-unmatched = "info";
3229

33-
formatter.nixfmt = {
34-
command = "nixfmt";
35-
includes = [ "*.nix" ];
36-
};
30+
formatter.nixfmt = {
31+
command = "nixfmt";
32+
includes = [ "*.nix" ];
33+
};
3734

38-
formatter.rustfmt = {
39-
command = "rustfmt";
40-
includes = [ "*.rs" ];
35+
formatter.rustfmt = {
36+
command = "rustfmt";
37+
includes = [ "*.rs" ];
38+
};
4139
};
4240
};
43-
};
4441

45-
packages.default =
46-
let
47-
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
48-
in
49-
pkgs.rustPlatform.buildRustPackage {
50-
pname = "seabird-plugin-bundle";
51-
version = cargoToml.package.version;
52-
src = ./.;
53-
cargoLock.lockFile = ./Cargo.lock;
42+
packages.default =
43+
let
44+
version = builtins.fromTOML (builtins.readFile ./Cargo.toml).package.version;
45+
in
46+
pkgs.rustPlatform.buildRustPackage {
47+
inherit version;
5448

55-
nativeBuildInputs = [ pkgs.protobuf ];
49+
pname = "seabird-plugin-bundle";
50+
src = ./.;
51+
cargoLock.lockFile = ./Cargo.lock;
5652

57-
# sqlx uses the checked-in .sqlx cache instead of a live database.
58-
SQLX_OFFLINE = true;
53+
nativeBuildInputs = [ pkgs.protobuf ];
5954

60-
# Flake builds run against the git tree without a .git directory, so
61-
# git_version can't read the hash. Stamp a stable version string for
62-
# the introspection plugin to report instead.
63-
SEABIRD_GIT_VERSION = "v${cargoToml.package.version}-nix";
64-
};
55+
# sqlx uses the checked-in .sqlx cache instead of a live database.
56+
SQLX_OFFLINE = true;
6557

66-
devShells.default = pkgs.mkShell {
67-
nativeBuildInputs = [
68-
(pkgs.rust-bin.stable."1.93.0".default.override {
69-
extensions = [ "rust-src" ];
70-
})
71-
pkgs.rust-analyzer
72-
pkgs.sqlx-cli
73-
pkgs.protobuf
74-
pkgs.sqlite
75-
];
58+
# Flake builds run against the git tree without a .git directory, so
59+
# git_version can't read the hash. Stamp a stable version string for
60+
# the introspection plugin to report instead.
61+
SEABIRD_GIT_VERSION = "v${version}-nix";
62+
};
63+
64+
devShells.default = pkgs.mkShell {
65+
nativeBuildInputs = [
66+
pkgs.cargo
67+
pkgs.rustc
68+
pkgs.rust-analyzer
69+
pkgs.sqlx-cli
70+
pkgs.protobuf
71+
pkgs.sqlite
72+
];
7673

77-
RUST_BACKTRACE = 1;
78-
DATABASE_URL = "sqlite://seabird.db";
74+
RUST_BACKTRACE = 1;
75+
DATABASE_URL = "sqlite://seabird.db";
76+
};
7977
};
80-
}
81-
);
78+
};
8279
}

0 commit comments

Comments
 (0)