open5gs/srsran

This commit is contained in:
Luke Granger-Brown 2024-08-11 02:25:04 +01:00
parent ec327dea3d
commit c01519ab07
4 changed files with 185 additions and 0 deletions

View file

@ -85,4 +85,6 @@
magicard-cups-driver = pkgs.callPackage ./magicard-cups-driver { }; magicard-cups-driver = pkgs.callPackage ./magicard-cups-driver { };
world-of-goo2 = pkgs.callPackage ./world-of-goo2.nix { }; world-of-goo2 = pkgs.callPackage ./world-of-goo2.nix { };
srsran5g = pkgs.callPackage ./srsran5g { };
open5gs = pkgs.callPackage ./open5gs { };
} // (import ./heptapod-runner args) } // (import ./heptapod-runner args)

View file

@ -0,0 +1,118 @@
{ stdenv
, lib
, fetchFromGitHub
, meson
, cmake
, ninja
, pkg-config
, flex
, bison
, lksctp-tools
, talloc
, mongoc
, libyaml
, libmicrohttpd_1_0
, libgcrypt
, libidn
, gnutls
, openssl
, nghttp2
, curl
# webui
, buildNpmPackage
, jq
}:
let
subprojects = {
prometheus-client-c = fetchFromGitHub {
owner = "open5gs";
repo = "prometheus-client-c";
rev = "a58ba25bf87a9b1b7c6be4e6f4c62047d620f402"; # open5gs branch
hash = "sha256-COZV4UeB7YRfpLwloIfc/WdlTP9huwVfXrJWH4jmvB8=";
};
freeDiameter = fetchFromGitHub {
owner = "open5gs";
repo = "freeDiameter";
rev = "20196a265aecb7b1573ceb526bb619e092c1fd3f"; # r1.5.0
hash = "sha256-0sxzQtKBx313+x3TRsmeswAq90Vk5jNA//rOJcEZJTQ=";
};
libtins = fetchFromGitHub {
owner = "open5gs";
repo = "libtins";
rev = "bf22438172d269e6db70e27246dffd8e1f0b96e3"; # r4.5
hash = "sha256-BxSBNKI+jwI33lN+vmYCYSDAxsVDXS190byAzq6lB/A=";
};
usrsctp = fetchFromGitHub {
owner = "sctplab";
repo = "usrsctp";
rev = "refs/tags/0.9.5.0";
hash = "sha256-Sengtkg4UoA03cPy5+dRSr5qKIttWHEKn48udOP8zYI=";
};
};
version = "2.7.2";
src = fetchFromGitHub {
owner = "open5gs";
repo = "open5gs";
rev = "v${version}";
hash = "sha256-XSDjVW+5l2trrilKMcSfX6QIfh/ijWxjoJg33Bn1DBU=";
};
webui = buildNpmPackage {
pname = "open5gs-webui";
inherit version src;
sourceRoot = "source/webui";
nativeBuildInputs = [ jq ];
postPatch = ''
jq '. * {"bin": {"open5gs-webui": "server/index.js"}}' package.json > package.json.new
mv package.json.new package.json
'';
postInstall = ''
wrapProgram "$out/bin/open5gs-webui" \
--chdir "$out/lib/node_modules/open5gs" \
--set NODE_ENV production
'';
npmDepsHash = "sha256-IpqineYa15GBqoPDJ7RpaDsq+MQIIDcdq7yhwmH4Lzo=";
};
in
stdenv.mkDerivation {
pname = "open5gs";
inherit version src;
postPatch = ''
${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: value: ''
ln -s "${value}" "subprojects/${name}"
'') subprojects)}
'';
nativeBuildInputs = [
meson
cmake
ninja
pkg-config
flex
bison
];
buildInputs = [
lksctp-tools
talloc
mongoc
libyaml
libmicrohttpd_1_0
libgcrypt
libidn
gnutls
openssl
nghttp2
curl
];
passthru = {
inherit subprojects webui;
};
}

View file

@ -0,0 +1,54 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, ninja
, pkg-config
, fftw
, lksctp-tools
, yaml-cpp
, mbedtls
, gtest
, elfutils
, libbfd
, libdwarf
}:
stdenv.mkDerivation {
pname = "srsran5g";
version = "24.04";
src = fetchFromGitHub {
owner = "srsran";
repo = "srsRAN_Project";
rev = "release_24_04";
hash = "sha256-ZgOeWpmcqQE7BYgiaVysnRkcJxD4fTCfKSQC5hIGTfk=";
};
env.CFLAGS = "-D_SCTP_H";
env.CXXFLAGS = lib.concatStringsSep " " [
"-D_SCTP_H" # lksctp and glibc do not agree
# /build/source/tests/unittests/phy/lower/processors/downlink/lower_phy_downlink_processor_test.cpp:796:75: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare]
# 796 | ASSERT_TRUE(md.tx_start.has_value() && (md.tx_start.value() == std::abs(t_offset)));
# | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
"-Wno-error=sign-compare"
];
nativeBuildInputs = [
cmake
ninja
pkg-config
];
buildInputs = [
fftw
lksctp-tools
yaml-cpp
mbedtls
gtest
elfutils # libdw
libbfd
libdwarf
];
}

View file

@ -16,6 +16,7 @@ in {
../lib/quadv-ca/default.nix ../lib/quadv-ca/default.nix
((import ../../../third_party/lanzaboote.nix { }).nixosModules.lanzaboote) ((import ../../../third_party/lanzaboote.nix { }).nixosModules.lanzaboote)
../lib/hackyplayer.nix ../lib/hackyplayer.nix
../lib/open5gs.nix
]; ];
boot = lib.mkMerge [{ boot = lib.mkMerge [{
@ -155,6 +156,12 @@ in {
efibootmgr -n 0003 efibootmgr -n 0003
systemctl reboot systemctl reboot
'') '')
limesuiteWithGui
srsran
];
services.udev.packages = with pkgs; [
limesuiteWithGui
]; ];
# Enable CUPS to print documents. # Enable CUPS to print documents.
@ -225,6 +232,8 @@ in {
iw iw
obs-studio obs-studio
vulkan-tools vulkan-tools
depot.nix.pkgs.world-of-goo2
yt-dlp
]); ]);
}; };
@ -315,6 +324,8 @@ in {
hostname = "hackyplayer.localhost"; hostname = "hackyplayer.localhost";
}; };
my.services.open5gs.enable = true;
# This value determines the NixOS release with which your system is to be # This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database # compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you # servers. You should change this only after NixOS release notes say you