Skip to content

Commit c5a4185

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

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

flake.nix

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4+
utils.url = "github:Gepetto/nix-lib";
45

56
odri-masterboard-sdk = {
67
# FIXME update after https://github.com/open-dynamic-robot-initiative/master-board/pull/173
@@ -10,32 +11,37 @@
1011
};
1112

1213
outputs =
13-
{ nixpkgs, odri-masterboard-sdk, ... }:
14+
{
15+
nixpkgs,
16+
utils,
17+
odri-masterboard-sdk,
18+
...
19+
}:
1420
let
1521
pkgs = nixpkgs.legacyPackages.x86_64-linux;
1622
sdk = odri-masterboard-sdk.packages.x86_64-linux.default;
23+
rosVersion = utils.lib.rosVersion pkgs;
1724
in
1825
{
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-
};
26+
packages.x86_64-linux.default = pkgs.stdenv.mkDerivation rec {
27+
pname = "odri-control";
28+
version = rosVersion ./package.xml;
2829

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

0 commit comments

Comments
 (0)