lets package a bunch of useless shit whaddya say
This commit is contained in:
@@ -126,6 +126,7 @@
|
||||
|
||||
nixosModules.common = import ./common/module.nix;
|
||||
packages.x86_64-linux.snmpb = nixpkgs.legacyPackages.x86_64-linux.libsForQt5.callPackage ./packages/snmpb/package.nix {};
|
||||
packages.x86_64-linux.snmp-mibs-downloader = nixpkgs.legacyPackages.x86_64-linux.callPackage ./packages/snmp-mibs-downloader.nix {};
|
||||
packages.x86_64-linux.digitalOceanImage = import ./generic-digitalocean-nixos.nix { inherit inputs; };
|
||||
packages.x86_64-linux.authorizedKeys = let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
|
104
packages/snmp-mibs-downloader.nix
Normal file
104
packages/snmp-mibs-downloader.nix
Normal file
@@ -0,0 +1,104 @@
|
||||
{
|
||||
bash,
|
||||
coreutils,
|
||||
gzip,
|
||||
gnutar,
|
||||
unzip,
|
||||
wget,
|
||||
gnupatch,
|
||||
|
||||
fetchFromGitLab,
|
||||
fetchurl,
|
||||
#libsmi,
|
||||
#resholve,
|
||||
stdenv,
|
||||
writeText,
|
||||
lib,
|
||||
}@args:
|
||||
stdenv.mkDerivation (self: let
|
||||
# this script depends on an old version of libsmi's smistrip
|
||||
libsmi = stdenv.mkDerivation rec {
|
||||
pname = "libsmi";
|
||||
version = "0.4.8";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.ibr.cs.tu-bs.de/projects/libsmi/download/${pname}-${version}.tar.gz";
|
||||
hash = "sha256-8EilJw9BvIiww7Co/nDKTXFqRrUxoOyqqHxGL0nXSEk=";
|
||||
};
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = "-std=gnu90";
|
||||
#env.CFLAGS="-Wno-error";
|
||||
#env.NIX_DEBUG="7";
|
||||
|
||||
hardeningDisable = [ "format" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Library to Access SMI MIB Information";
|
||||
homepage = "https://www.ibr.cs.tu-bs.de/projects/libsmi/index.html";
|
||||
license = licenses.free;
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
};
|
||||
in rec {
|
||||
pname = "snmp-mibs-downloader";
|
||||
version = "1.6";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
domain = "salsa.debian.org";
|
||||
owner = "debian";
|
||||
repo = "${pname}";
|
||||
rev = "debian/${version}";
|
||||
hash = "sha256-W2VW3EJWmHwlqMoL12dFcfkYmAADLOtUWCydcL5qUKc=";
|
||||
};
|
||||
|
||||
# installPhase = ''
|
||||
# install -Dm755 download-mibs $out/bin
|
||||
# install -Dm644 *.conf *list $out/etc/snmp-mips-downloader
|
||||
# cp mibrfcs/* $out/share/snmp/mibs-downloader/mibrfcs
|
||||
# cp mibiana/* $out/share/snmp/mibs-downloader/mibiana
|
||||
# gzip -9 $out/share/snmp/mibs-downloader/*/*
|
||||
|
||||
# '';
|
||||
postPatch = ''
|
||||
substituteInPlace download-mibs \
|
||||
--replace-fail SMISTRIP=/usr/bin/smistrip "" \
|
||||
--replace-fail CONFDIR=/etc/snmp-mibs-downloader "BASEDIR=/var/lib/mibs; AUTOLOAD='rfc ianarfc iana'" \
|
||||
--replace-fail '. $CONFDIR/snmp-mibs-downloader.conf' ""
|
||||
'';
|
||||
preInstall = ''
|
||||
mkdir -p $out/usr/bin $out/etc/snmp-mibs-downloader $out/usr/share/snmp/mibs-downloader/mib{rfcs,iana} $out/usr/share/snmp/mibs
|
||||
'';
|
||||
installFlags = [ "INSTALL=install" "DESTDIR=$(out)" ];
|
||||
postInstall = ''
|
||||
mv $out/usr/* $out
|
||||
rmdir $out/usr
|
||||
substituteInPlace $out/etc/snmp-mibs-downloader/* \
|
||||
--replace-quiet 'DIR=/usr/share/snmp/mibs-downloader' 'DIR='$out'/share/snmp/mibs-downloader'
|
||||
mv $out/bin/download-mibs $out/bin/.download-mibs-unwrapped
|
||||
cat <<EOF > $out/bin/download-mibs
|
||||
#!${bash}/bin/bash
|
||||
PATH=${lib.escapeShellArg (lib.concatStringsSep ":" (lib.flip map [ coreutils gzip gnutar unzip wget gnupatch ] (p: "${p}/bin")))}
|
||||
SMISTRIP=${libsmi}/bin/smistrip
|
||||
CONFDIR=$out/etc/snmp-mibs-downloader
|
||||
source $out/bin/.download-mibs-unwrapped
|
||||
EOF
|
||||
chmod u+x $out/bin/download-mibs
|
||||
'';
|
||||
|
||||
env.NIX_DEBUG="7";
|
||||
# solutions.default = {
|
||||
# scripts = [ "bin/download-mibs" ];
|
||||
# interpreter = "${bash}/bin/bash";
|
||||
# inputs = [ coreutils gzip gnutar unzip wget gnupatch ];
|
||||
# keep = {
|
||||
# "$archive_fetcher" = true;
|
||||
# source = [ "$CONFDIR/$i.conf" ];
|
||||
# "${wget}/bin/wget" = true;
|
||||
# };
|
||||
# fix = { "$SMISTRIP" = [ "${libsmi}/bin/smistrip" ]; };
|
||||
# };
|
||||
|
||||
meta = {
|
||||
mainProgram = "download-mibs";
|
||||
};
|
||||
})
|
@@ -10,11 +10,17 @@
|
||||
wrapQtAppsHook,
|
||||
|
||||
breakpointHook,
|
||||
}:
|
||||
}@args:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: let
|
||||
mibtypes = [ "ieft" "iana" "irtf" "tubs" ];
|
||||
DEFAULT_SMIPATH = lib.concatStringsSep ";" (map (m: "${libsmi}/share/mibs/${m}") mibtypes);
|
||||
# ./configure --disable-shared --disable-yang --with-pathseparator=';' --with-dirseparator='/' --with-smipath=${INSTALL_PREFIX}'/${SHARE}/snmpb/mibs;'${INSTALL_PREFIX}'/${SHARE}/snmpb/pibs'
|
||||
libsmi = finalAttrs.passthru.libsmi;
|
||||
# $(INSTALL) -m 444 ${ROOT_OWNER} libsmi/mibs/iana/* ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs
|
||||
# $(INSTALL) -m 444 ${ROOT_OWNER} libsmi/mibs/ietf/* ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs
|
||||
# $(INSTALL) -m 444 ${ROOT_OWNER} libsmi/mibs/tubs/* ${INSTALL_PREFIX}/${SHARE}/snmpb/mibs
|
||||
# $(INSTALL) -m 444 ${ROOT_OWNER} libsmi/pibs/ietf/* ${INSTALL_PREFIX}/${SHARE}/snmpb/pibs
|
||||
# $(INSTALL) -m 444 ${ROOT_OWNER} libsmi/pibs/tubs/* ${INSTALL_PREFIX}/${SHARE}/snmpb/pibs
|
||||
|
||||
in {
|
||||
pname = "snmpb";
|
||||
version = "0.9pre1";
|
||||
@@ -24,6 +30,30 @@ in {
|
||||
passthru = {
|
||||
proFile = "${finalAttrs.pname}.pro";
|
||||
makeFile = "makefile.${finalAttrs.pname}";
|
||||
smipath = "${finalAttrs.passthru.libsmi-data}/share/snmpb/mibs;${finalAttrs.passthru.libsmi-data}/share/snmpb/pibs";
|
||||
libsmi = args.libsmi.overrideAttrs (final: prev: {
|
||||
#preConfigure = (prev.preConfigure or "") + "\n" + ''
|
||||
# appendToVar configureFlags --prefix=$out/ --disable-yang --with-pathseparator=';' --with-dirseparator='/'
|
||||
#'';
|
||||
configureFlags = (prev.configureFlags or []) ++ ["--with-pathseparator=;" "--with-smipath=${finalAttrs.passthru.smipath}"];
|
||||
env.NIX_DEBUG="2";
|
||||
pname = prev.pname + "-for-snmpb";
|
||||
});
|
||||
libsmi-data = stdenv.mkDerivation {
|
||||
name = "libsmi-snmpb-data";
|
||||
phases = "unpackPhase installPhase";
|
||||
src = libsmi.src;
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/snmpb/{mibs,pibs}
|
||||
shopt -s globstar
|
||||
for foo in mibs pibs; do
|
||||
for node in $foo/**/*; do
|
||||
[[ -f $node ]] && install -m444 $node $out/share/snmpb/$foo/
|
||||
done
|
||||
done
|
||||
rm $out/share/snmpb/*/Makefile*
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
src = fetchgit {
|
||||
@@ -54,6 +84,12 @@ in {
|
||||
installPhase = ''
|
||||
popd
|
||||
install -Dm 555 -s app/snmpb $out/bin/snmpb
|
||||
#mkdir -p $out/share/snmpb/{mibs,pibs}
|
||||
#for foo in mibs pibs; do
|
||||
# for file in ${libsmi}/share/$foo/*; do
|
||||
# ln -s $file $out/share/snmpb/$foo/
|
||||
# done
|
||||
#done
|
||||
install -Dm 444 app/snmpb.desktop $out/share/applications
|
||||
install -Dm 444 app/snmpb.xml $out/share/mime/packages
|
||||
install -Dm 444 app/images/snmpb.png $out/share/icons/hicolor/128x128/apps
|
||||
@@ -62,16 +98,18 @@ in {
|
||||
'';
|
||||
postPatch = ''
|
||||
rm -rf libsmi libtomcrypt qwt #ensures un-vendoring worked correctly
|
||||
substituteInPlace app/preferences.cpp --subst-var DEFAULT_SMIPATH
|
||||
#smipath_parts=(${libsmi}/share/{mibs,pibs}/*)
|
||||
#smipath=$(IFS=";" ; echo "''${smipath_parts[*]}")
|
||||
substituteInPlace app/preferences.cpp --subst-var smipath
|
||||
substituteInPlace app/*.pro \
|
||||
--subst-var libs \
|
||||
--subst-var include
|
||||
pushd app
|
||||
'';
|
||||
env = {
|
||||
inherit DEFAULT_SMIPATH;
|
||||
include = "${qwt.dev}/include ${libsmi}/include ${libtomcrypt}/include";
|
||||
libs = "${qwt}/lib/libqwt.so ${libsmi}/lib/libsmi.so ${libtomcrypt}/lib/libtomcrypt.so -lqwt -lsmi -ltomcrypt";
|
||||
inherit (finalAttrs.passthru) smipath;
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git a/app/preferences.cpp b/app/preferences.cpp
|
||||
index 29fa8c8..01c86db 100644
|
||||
index 29fa8c8..98e842f 100644
|
||||
--- a/app/preferences.cpp
|
||||
+++ b/app/preferences.cpp
|
||||
@@ -22,13 +22,6 @@
|
||||
@@ -21,7 +21,7 @@ index 29fa8c8..01c86db 100644
|
||||
{
|
||||
// "Reset to default" for MIB paths
|
||||
- QStringList defaultpaths = QString(DEFAULT_SMIPATH).split(SMI_PATH_SEPARATOR);
|
||||
+ QStringList defaultpaths = QString("@DEFAULT_SMIPATH@").split(SMI_PATH_SEPARATOR);
|
||||
+ QStringList defaultpaths = QString("@smipath@").split(SMI_PATH_SEPARATOR);
|
||||
|
||||
QSettings settings;
|
||||
settings.beginWriteArray("mibpaths");
|
||||
|
Reference in New Issue
Block a user