Skip to content

Commit

Permalink
update the code to the new r09-receiver name
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed May 19, 2024
1 parent 954b651 commit 36a32b3
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "radio-conf-aarch64"
name: "r09-receiver-aarch64"

on: [push, pull_request]

Expand All @@ -17,4 +17,4 @@ jobs:
with:
name: dump-dvb
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build --option system aarch64-linux --option sandbox false --extra-platforms aarch64-linux -vL .\#packages.aarch64-linux.gnuradio-decoder
- run: nix build --option system aarch64-linux --option sandbox false --extra-platforms aarch64-linux -vL .\#packages.aarch64-linux.r09-receiver
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: "radio-conf-x86_64"
name: "r09-receiver-x86_64"

on: [push, pull_request]

Expand All @@ -13,4 +13,4 @@ jobs:
with:
name: dump-dvb
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -vL .\#packages.x86_64-linux.gnuradio-decoder
- run: nix build -vL .\#packages.x86_64-linux.r09-receiver
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.22)

add_executable(gnuradio-decoder-cpp
add_executable(r09-receiver
src/main.cpp
src/correlate_access_code_bb_ts_fl_impl.cpp
src/rational_resampler_impl.cc)

target_compile_options(gnuradio-decoder-cpp PUBLIC -std=c++17 -Wall)
target_compile_options(r09-receiver PUBLIC -std=c++17 -Wall)

include_directories(src)

Expand All @@ -18,6 +18,6 @@ include(${OSMOSDR_DIR}/lib/cmake/osmosdr/gnuradio-osmosdrConfig.cmake)

include_directories(${GNURADIO_ALL_INCLUDE_DIRS})

target_link_libraries(gnuradio-decoder-cpp log4cpp gnuradio-digital gnuradio-analog gnuradio-filter gnuradio-blocks gnuradio-fft gnuradio-runtime gnuradio-pmt volk gnuradio-osmosdr libenvpp::libenvpp)
target_link_libraries(r09-receiver log4cpp gnuradio-digital gnuradio-analog gnuradio-filter gnuradio-blocks gnuradio-fft gnuradio-runtime gnuradio-pmt volk gnuradio-osmosdr libenvpp::libenvpp)

install(TARGETS gnuradio-decoder-cpp DESTINATION bin)
install(TARGETS r09-receiver DESTINATION bin)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ DECODER\_DEVICE\_STRING | device string for osmosdr
## building with nix flakes

```
$ nix build .\#packages.x86_64-linux.gnuradio-decoder
$ nix build .\#packages.x86_64-linux.r09-receiver
```
16 changes: 8 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
pkgs = nixpkgs.legacyPackages.${system};

libenvpp = pkgs.callPackage ./pkgs/libenvpp.nix { };
gnuradio-decoder = let
r09-receiver = let
gnuradio_unwrapped = pkgs.callPackage ./pkgs/gnuradio.nix {
gnuradio = pkgs.gnuradio3_8;
};
in pkgs.callPackage ./pkgs/gnuradio-decoder-cpp.nix {
in pkgs.callPackage ./pkgs/r09-receiver.nix {
inherit gnuradio_unwrapped libenvpp;
gnuradioPackages = pkgs.gnuradio3_8Packages;
};
in rec {
checks = packages;
packages = {
inherit gnuradio-decoder libenvpp;
default = gnuradio-decoder;
inherit r09-receiver libenvpp;
default = r09-receiver;
docs = (pkgs.nixosOptionsDoc {
options = (nixpkgs.lib.nixosSystem {
inherit system;
Expand All @@ -35,16 +35,16 @@
};
devShells.default = pkgs.mkShell {
nativeBuildInputs =
(with packages.gnuradio-decoder; buildInputs ++ nativeBuildInputs);
(with packages.r09-receiver; buildInputs ++ nativeBuildInputs);
};
}) // {
overlays.default = final: prev: {
inherit (self.packages.${prev.system}) gnuradio-decoder;
inherit (self.packages.${prev.system}) r09-receiver;
};

nixosModules = rec {
default = gnuradio-decoder;
gnuradio-decoder = import ./nixos-module;
default = r09-receiver;
r09-receiver = import ./nixos-module;
};

hydraJobs = let
Expand Down
28 changes: 14 additions & 14 deletions nixos-module/default.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{ pkgs, config, lib, ... }:
let
cfg = config.TLMS.gnuradio;
cfg = config.TLMS.r09-receiver;
in
{
options.TLMS.gnuradio = with lib; {
options.TLMS.r09-receiver = with lib; {
enable = mkOption {
type = types.bool;
default = false;
description = ''Wether to enable TLMS gnuradio reciever'';
description = ''Wether to enable TLMS r09-receiver'';
};
device = mkOption {
type = types.str;
default = "";
example = "hackrf=0";
description = ''Device string to pass to gnuradio'';
description = ''Device string to pass to r09-receiver'';
};
frequency = mkOption {
type = types.int;
Expand Down Expand Up @@ -42,13 +42,13 @@ in
};
user = mkOption {
type = types.str;
default = "gnuradio";
description = "as which user gnuradio should run";
default = "r09-receiver";
description = "as which user r09-receiver should run";
};
group = mkOption {
type = types.str;
default = "gnuradio";
description = "as which group gnuradio should run";
default = "r09-receiver";
description = "as which group r09-receiver should run";
};
};

Expand All @@ -59,13 +59,13 @@ in
rtl-sdr.enable = true;
};

environment.systemPackages = [ pkgs.gnuradio-decoder ];
environment.systemPackages = [ pkgs.r09-receiver ];

systemd.services."gnuradio" = {
systemd.services."r09-receiver" = {
enable = true;
wantedBy = [ "multi-user.target" ];

script = "exec ${pkgs.gnuradio-decoder}/bin/gnuradio-decoder-cpp &";
script = "exec ${pkgs.r09-receiver}/bin/r09-receiver &";

environment = with cfg; {
"DECODER_FREQUENCY" = toString frequency;
Expand All @@ -88,17 +88,17 @@ in
users.groups."${cfg.group}" = { };
users.users."${cfg.user}" = {
name = cfg.user;
description = "gnu radio service user";
description = "r09-receiver service user";
isNormalUser = true;
group = cfg.group;
extraGroups = [ "plugdev" ];
};

security.wrappers.gnuradio-decode = {
security.wrappers.r09-receiver = {
owner = cfg.user;
group = "users";
capabilities = "cap_sys_nice+eip";
source = "${pkgs.gnuradio-decoder}/bin/gnuradio-decoder-cpp";
source = "${pkgs.r09-receiver}/bin/r09-receiver";
};

};
Expand Down
20 changes: 10 additions & 10 deletions pkgs/gnuradio-decoder-cpp.nix → pkgs/r09-receiver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ let
'';
};

decoder = stdenv.mkDerivation {
name = "decoder";
r09-receiver = stdenv.mkDerivation {
name = "r09-receiver";
version = "0.1.0";

src = ./..;
Expand All @@ -88,24 +88,24 @@ let
};
in
stdenv.mkDerivation {
name = "decoder-shrinked";
name = "r09-receiver-striped";
version = "0.1.0";

src = decoder;
src = r09-receiver;

phases = [ "installPhase" ];

installPhase = ''
mkdir -p $out/bin
cp $src/bin/gnuradio-decoder-cpp gnuradio-decoder-cpp
chmod +w gnuradio-decoder-cpp
cp $src/bin/r09-receiver r09-receiver
chmod +w r09-receiver
RPATH=$(${patchelf}/bin/patchelf --print-rpath gnuradio-decoder-cpp)
RPATH=$(${patchelf}/bin/patchelf --print-rpath r09-receiver)
${patchelf}/bin/patchelf --set-rpath ${decoder-dependencies}/lib:${osmosdr-dependency}/lib:$RPATH gnuradio-decoder-cpp
${patchelf}/bin/patchelf --shrink-rpath gnuradio-decoder-cpp
${patchelf}/bin/patchelf --set-rpath ${decoder-dependencies}/lib:${osmosdr-dependency}/lib:$RPATH r09-receiver
${patchelf}/bin/patchelf --shrink-rpath r09-receiver
cp gnuradio-decoder-cpp $out/bin/gnuradio-decoder-cpp
cp r09-receiver $out/bin/r09-receiver
'';
}

0 comments on commit 36a32b3

Please sign in to comment.