Skip to content

Commit 4da4347

Browse files
split out and expose package recipe (#125)
* expose package recipe separately this allows building underlying derivations with other inputs: nix-repl> :l https://github.com/nixos/nixpkgs/tarball/nixpkgs-unstable nix-repl> :l https://github.com/nix-community/nixdoc/tarball/master nix-repl> pkgs.callPackage recipes.nixdoc {} * remove unnecessary output attribute Co-authored-by: Silvan Mosberger <github@infinisil.com> * add changelog entry --------- Co-authored-by: Silvan Mosberger <github@infinisil.com> Co-authored-by: Silvan Mosberger <contact@infinisil.com>
1 parent fa9b800 commit 4da4347

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## Version 3.0.6
4+
5+
Exposes the package recipe under `recipes.default` so it can easily be re-used.
6+
Example:
7+
8+
```
9+
nix-repl> :l https://github.com/nixos/nixpkgs/tarball/nixpkgs-unstable
10+
nix-repl> :l https://github.com/nix-community/nixdoc/tarball/master
11+
nix-repl> pkgs.callPackage recipes.default {}
12+
```
13+
314
## Version 3.0.5
415

516
Fixes: incompatibility with nixpkgs in 3.0.3 and 3.0.4

flake.nix

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
1111
};
1212
outputs = { self, nixpkgs, flake-utils, ... }:
13+
let
14+
recipe = { lib, rustPlatform }:
15+
let
16+
package = (lib.importTOML ./Cargo.toml).package;
17+
in
18+
rustPlatform.buildRustPackage {
19+
pname = package.name;
20+
version = package.version;
21+
src = ./.;
22+
cargoLock.lockFile = ./Cargo.lock;
23+
};
24+
in
25+
{
26+
recipes.default = recipe;
27+
}
28+
//
1329
flake-utils.lib.eachDefaultSystem (system:
1430
let
1531
nixpkgsDocs = import "${nixpkgs}/doc" {
@@ -21,21 +37,12 @@
2137
};
2238
};
2339
pkgs = nixpkgs.legacyPackages.${system};
24-
package = (pkgs.lib.importTOML ./Cargo.toml).package;
2540
in
2641
{
27-
packages.default = pkgs.rustPlatform.buildRustPackage {
28-
pname = package.name;
29-
version = package.version;
30-
src = ./.;
31-
cargoLock = {
32-
lockFile = ./Cargo.lock;
33-
};
34-
};
35-
42+
packages.default = pkgs.callPackage recipe { };
3643
apps.default = flake-utils.lib.mkApp {
3744
drv = self.packages.${system}.default;
38-
name = package.name;
45+
name = self.packages.${system}.default.pname;
3946
};
4047

4148
checks = {

0 commit comments

Comments
 (0)