Skip to content

Commit 9f35de6

Browse files
committed
Improve flake.nix
1 parent 3e77684 commit 9f35de6

2 files changed

Lines changed: 62 additions & 69 deletions

File tree

flake.lock

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

flake.nix

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
11
{
22
inputs = {
3-
naersk.url = "github:nix-community/naersk/master";
43
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5-
utils.url = "github:numtide/flake-utils";
4+
flake-utils.url = "github:numtide/flake-utils";
5+
naersk = {
6+
url = "github:nix-community/naersk";
7+
inputs.nixpkgs.follows = "nixpkgs";
8+
};
69
};
710

8-
outputs = { nixpkgs, utils, naersk, ... }:
9-
utils.lib.eachDefaultSystem (system:
11+
outputs =
12+
{
13+
flake-utils,
14+
naersk,
15+
nixpkgs,
16+
...
17+
}:
18+
flake-utils.lib.eachDefaultSystem (
19+
system:
1020
let
11-
pkgs = import nixpkgs { inherit system; };
12-
naersk-lib = pkgs.callPackage naersk { };
13-
in {
14-
defaultPackage = naersk-lib.buildPackage {
15-
src = ./.;
16-
# The binary is called `maconomy`, not `maconomy-cli`
17-
pname = "maconomy";
21+
pkgs = (import nixpkgs) { inherit system; };
22+
naersk' = pkgs.callPackage naersk { };
23+
in
24+
{
25+
devShell = pkgs.mkShell {
26+
# For `nix develop`
27+
nativeBuildInputs = with pkgs; [
28+
# Rust stuff - use unwrapped to avoid -Z flags
29+
rustfmt
30+
pre-commit
31+
rustPackages.clippy
32+
cargo-insta
33+
34+
# Other
35+
openssl
36+
pkg-config
37+
chromium
38+
];
1839
};
19-
devShell = with pkgs;
20-
mkShell {
21-
buildInputs = [
22-
# Rust stuff
23-
cargo
24-
rustc
25-
rustfmt
26-
pre-commit
27-
rustPackages.clippy
2840

29-
# Other
30-
openssl
31-
pkg-config
32-
chromium
33-
];
34-
RUST_SRC_PATH = rustPlatform.rustLibSrc;
35-
};
36-
});
41+
# For `nix build`/`nix run`
42+
packages.default = naersk'.buildPackage { src = ./.; };
43+
}
44+
);
3745
}

0 commit comments

Comments
 (0)