Skip to content

Commit

Permalink
split out and expose package recipe (#125)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* add changelog entry

---------

Co-authored-by: Silvan Mosberger <[email protected]>
Co-authored-by: Silvan Mosberger <[email protected]>
  • Loading branch information
3 people committed May 26, 2024
1 parent fa9b800 commit 4da4347
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## Version 3.0.6

Exposes the package recipe under `recipes.default` so it can easily be re-used.
Example:

```
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.default {}
```

## Version 3.0.5

Fixes: incompatibility with nixpkgs in 3.0.3 and 3.0.4
Expand Down
29 changes: 18 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs, flake-utils, ... }:
let
recipe = { lib, rustPlatform }:
let
package = (lib.importTOML ./Cargo.toml).package;
in
rustPlatform.buildRustPackage {
pname = package.name;
version = package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
};
in
{
recipes.default = recipe;
}
//
flake-utils.lib.eachDefaultSystem (system:
let
nixpkgsDocs = import "${nixpkgs}/doc" {
Expand All @@ -21,21 +37,12 @@
};
};
pkgs = nixpkgs.legacyPackages.${system};
package = (pkgs.lib.importTOML ./Cargo.toml).package;
in
{
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = package.name;
version = package.version;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
};

packages.default = pkgs.callPackage recipe { };
apps.default = flake-utils.lib.mkApp {
drv = self.packages.${system}.default;
name = package.name;
name = self.packages.${system}.default.pname;
};

checks = {
Expand Down

0 comments on commit 4da4347

Please sign in to comment.