10 # To create Gemfile.lock and gemset.nix
11 # > nix-shell -p bundix bundler zlib
21 stdenv.mkDerivation rec {
24 # The package has no releases so let's use the latest commit
25 version = "unstable-2021-01-12";
27 src = fetchFromGitHub {
30 rev = "be15f5f897f8a919dd639009873147dca2a9cea0";
31 sha256 = "0gqkqfrqnrsy6avg372xwqj22yz8g6r2hnzbw6197b1rf7zr1il7";
37 substituteInPlace $script --replace "#{File.dirname(__FILE__)}/lib" "$out/lib/polar"
45 # See: https://wiki.nixos.org/wiki/Packaging/Ruby
47 # Put library content under lib/polar and the raw scripts under share/polar.
48 # Then, wrap the scripts so that they use the correct ruby environment and put
49 # these wrapped executables under bin.
51 install -Dm644 -t $out/etc/udev/rules.d ./pkg/99-polar.rules
52 mkdir -p $out/{bin,lib/polar,share/polar}
53 cp -r lib/* $out/lib/polar/
54 for script in ./polar_*
56 raw="$out/share/polar/$script"
57 bin="$out/bin/$script"
61 exec ${gems}/bin/bundle exec ${ruby}/bin/ruby "$raw" "\$@"
68 description = "Command-line tools to interact with Polar watches";
70 A set of command line tools written in Ruby to interact with Polar watches
71 and decode raw data files.
73 Udev rules can be added as:
75 services.udev.packages = [ pkgs.polar ]
77 homepage = "https://github.com/cmaion/polar";
78 license = licenses.gpl3Only;
79 maintainers = with maintainers; [ jluttine ];
80 platforms = platforms.linux;