Skip to content

Commit 86288b5

Browse files
committed
nix: get package version dynamically
see Gepetto/nix-lib#1
1 parent 980ece2 commit 86288b5

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

flake.nix

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
44

5+
utils = {
6+
url = "github:Gepetto/nix-lib";
7+
inputs.nixpkgs.follows = "nixpkgs";
8+
};
9+
510
odri-masterboard-sdk = {
611
# FIXME update after https://github.com/open-dynamic-robot-initiative/master-board/pull/173
712
url = "git+https://github.com/gwennlbh/master-board?ref=nix&rev=d5d6105f8db1770cd07fdde300c4c008e36de818";
@@ -10,32 +15,37 @@
1015
};
1116

1217
outputs =
13-
{ nixpkgs, odri-masterboard-sdk, ... }:
18+
{
19+
nixpkgs,
20+
utils,
21+
odri-masterboard-sdk,
22+
...
23+
}:
1424
let
1525
pkgs = nixpkgs.legacyPackages.x86_64-linux;
1626
sdk = odri-masterboard-sdk.packages.x86_64-linux.default;
27+
rosVersion = utils.lib.rosVersion pkgs;
1728
in
1829
{
19-
packages.x86_64-linux.default =
20-
pkgs.stdenv.mkDerivation rec {
21-
pname = "odri-control";
22-
version = "1.0.1";
23-
24-
src = builtins.path {
25-
name = pname;
26-
path = ./.;
27-
};
30+
packages.x86_64-linux.default = pkgs.stdenv.mkDerivation rec {
31+
pname = "odri-control";
32+
version = rosVersion ./package.xml;
2833

29-
nativeBuildInputs =
30-
[ sdk ]
31-
++ (with pkgs; [
32-
cmake
33-
yaml-cpp
34-
eigen
35-
python312Packages.eigenpy
36-
python312Packages.boost
37-
python312
38-
]);
34+
src = builtins.path {
35+
name = pname;
36+
path = ./.;
3937
};
38+
39+
nativeBuildInputs =
40+
[ sdk ]
41+
++ (with pkgs; [
42+
cmake
43+
yaml-cpp
44+
eigen
45+
python312Packages.eigenpy
46+
python312Packages.boost
47+
python312
48+
]);
49+
};
4050
};
4151
}

0 commit comments

Comments
 (0)