generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{ stdenv, lib, fetchurl, dpkg, makeWrapper , mono, gtk-sharp-3_0 | ||
, glib, libusb1 , zlib, gtk3-x11, callPackage | ||
, scopes ? [ | ||
"picocv" | ||
"ps2000" | ||
"ps2000a" | ||
"ps3000" | ||
"ps3000a" | ||
"ps4000" | ||
"ps4000a" | ||
"ps5000" | ||
"ps5000a" | ||
"ps6000" | ||
"ps6000a" | ||
] }: | ||
|
||
let | ||
shared_meta = lib: | ||
with lib; { | ||
homepage = "https://www.picotech.com/downloads/linux"; | ||
maintainers = with maintainers; [ expipiplus1 yorickvp wirew0rm ]; | ||
platforms = [ "x86_64-linux" ]; | ||
license = licenses.unfree; | ||
}; | ||
|
||
libpicoipp = callPackage ({ stdenv, lib, fetchurl, autoPatchelfHook, dpkg }: | ||
stdenv.mkDerivation rec { | ||
pname = "libpicoipp"; | ||
inherit (sources.libpicoipp) version; | ||
src = fetchurl { inherit (sources.libpicoipp) url sha256; }; | ||
nativeBuildInputs = [ dpkg autoPatchelfHook ]; | ||
buildInputs = [ stdenv.cc.cc.lib ]; | ||
sourceRoot = "."; | ||
unpackCmd = "dpkg-deb -x $src ."; | ||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/lib | ||
cp -d opt/picoscope/lib/* $out/lib | ||
install -Dt $out/usr/share/doc/libpicoipp usr/share/doc/libpicoipp/copyright | ||
runHook postInstall | ||
''; | ||
meta = with lib; | ||
shared_meta lib // { | ||
description = "library for picotech oscilloscope software"; | ||
}; | ||
}) { }; | ||
|
||
# If we don't have a platform available, put a dummy version here, so at | ||
# least evaluation succeeds. | ||
sources = | ||
(lib.importJSON ./sources.json).${stdenv.system} or { picoscope.version = "unknown"; }; | ||
|
||
scopePkg = name: | ||
{ url, version, sha256 }: | ||
stdenv.mkDerivation rec { | ||
pname = "lib${name}"; | ||
inherit version; | ||
src = fetchurl { inherit url sha256; }; | ||
# picoscope does a signature check, so we can't patchelf these | ||
nativeBuildInputs = [ dpkg ]; | ||
sourceRoot = "."; | ||
unpackCmd = "dpkg-deb -x $src ."; | ||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/lib | ||
cp -d opt/picoscope/lib/* $out/lib | ||
runHook postInstall | ||
''; | ||
meta = with lib; | ||
shared_meta lib // { | ||
description = "library for picotech oscilloscope ${name} series"; | ||
}; | ||
}; | ||
|
||
scopePkgs = lib.mapAttrs scopePkg sources; | ||
|
||
in stdenv.mkDerivation rec { | ||
pname = "picoscope"; | ||
inherit (sources.picoscope) version; | ||
|
||
src = fetchurl { inherit (sources.picoscope) url sha256; }; | ||
|
||
nativeBuildInputs = [ dpkg makeWrapper ]; | ||
buildInputs = [ gtk-sharp-3_0 mono glib libusb1 zlib ]; | ||
|
||
unpackCmd = "dpkg-deb -x $src ."; | ||
sourceRoot = "."; | ||
scopeLibs = lib.attrVals (map (x: "lib${x}") scopes) scopePkgs; | ||
MONO_PATH = "${gtk-sharp-3_0}/lib/mono/gtk-sharp-3.0:" + (lib.makeLibraryPath | ||
([ | ||
glib | ||
gtk3-x11 | ||
gtk-sharp-3_0 | ||
libusb1 | ||
zlib | ||
libpicoipp | ||
] ++ scopeLibs)); | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/ | ||
cp -dr usr/share $out/share | ||
cp -dr opt/picoscope/* $out/ | ||
makeWrapper "$(command -v mono)" $out/bin/picoscope \ | ||
--add-flags $out/lib/PicoScope.GTK.exe \ | ||
--prefix MONO_PATH : "$MONO_PATH" \ | ||
--prefix LD_LIBRARY_PATH : "$MONO_PATH" \ | ||
--set LANG C | ||
runHook postInstall | ||
''; | ||
|
||
# usage: | ||
# services.udev.packages = [ pkgs.picoscope.rules ]; | ||
# users.groups.pico = {}; | ||
# users.users.you.extraGroups = [ "pico" ]; | ||
passthru.rules = lib.writeTextDir "lib/udev/rules.d/95-pico.rules" '' | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ce9", MODE="664",GROUP="pico" | ||
''; | ||
|
||
meta = with lib; | ||
shared_meta lib // { | ||
description = | ||
"Oscilloscope application that works with all PicoScope models"; | ||
longDescription = '' | ||
PicoScope for Linux is a powerful oscilloscope application that works | ||
with all PicoScope models. The most important features from PicoScope | ||
for Windows are included—scope, spectrum analyzer, advanced triggers, | ||
automated measurements, interactive zoom, persistence modes and signal | ||
generator control. More features are being added all the time. | ||
Waveform captures can be saved for off-line analysis, and shared with | ||
PicoScope for Linux, PicoScope for macOS and PicoScope for Windows | ||
users, or exported in text, CSV and MathWorks MATLAB 4 formats. | ||
''; | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"x86_64-linux": { | ||
"libpicocv": { | ||
"sha256": "c2e74c2b0679df0226993d063b38d0eda5b05ff59f29bbfa12ded5226df37024", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libpicocv/libpicocv_1.1.27-1r153_amd64.deb", | ||
"version": "1.1.27-1r153" | ||
}, | ||
"libpicoipp": { | ||
"sha256": "0e414ad547f506a39ff11a64772baec923e54f8ca98b81fc9b9cbd19ed573b22", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libpicoipp/libpicoipp_1.3.0-4r130_amd64.deb", | ||
"version": "1.3.0-4r130" | ||
}, | ||
"libps2000": { | ||
"sha256": "3ac230a95e434019a77a745719eafcbb099b7155f3886daff3f776eb86dd2ff1", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps2000/libps2000_3.0.77-3r2996_amd64.deb", | ||
"version": "3.0.77-3r2996" | ||
}, | ||
"libps2000a": { | ||
"sha256": "1dca8f10e2c442f7888c53545acec38e7d898a2a0150f86d4204fb0e197bca69", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps2000a/libps2000a_2.1.77-5r2996_amd64.deb", | ||
"version": "2.1.77-5r2996" | ||
}, | ||
"libps3000": { | ||
"sha256": "fc06341f02ea9cac72a1c8fc9edfe30e0f74ab47a8bfdd9f560ccc9961c08e10", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps3000/libps3000_4.0.77-3r2996_amd64.deb", | ||
"version": "4.0.77-3r2996" | ||
}, | ||
"libps3000a": { | ||
"sha256": "79eb72ecd8f927e7c57bf0cafe15180163240390a37e901138241fa383cd2166", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps3000a/libps3000a_2.1.77-6r2996_amd64.deb", | ||
"version": "2.1.77-6r2996" | ||
}, | ||
"libps4000": { | ||
"sha256": "52eeb69d2dce6be794eee53acae05843d346fd18b1235628246cac428bd90404", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps4000/libps4000_2.1.77-2r2996_amd64.deb", | ||
"version": "2.1.77-2r2996" | ||
}, | ||
"libps4000a": { | ||
"sha256": "c3158b31492f74ddc5cf7425f8b7363e09de5ae746e2d89522d015c1709e88de", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps4000a/libps4000a_2.1.77-2r2996_amd64.deb", | ||
"version": "2.1.77-2r2996" | ||
}, | ||
"libps5000": { | ||
"sha256": "38b3f38b8430e41cada3724a2d1e638d2c6a1438cc6e3c16c5b4f69bd4e552e8", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps5000/libps5000_2.1.77-3r2996_amd64.deb", | ||
"version": "2.1.77-3r2996" | ||
}, | ||
"libps5000a": { | ||
"sha256": "d9a7c2c1854199b00ef5df8c52ae282175d240b604dedd6166b2be8332ad1c0d", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps5000a/libps5000a_2.1.77-5r2996_amd64.deb", | ||
"version": "2.1.77-5r2996" | ||
}, | ||
"libps6000": { | ||
"sha256": "a7676ffc48eb70833867a2c4cbb2f4a236d7007adbcc02ea75211054a07eadb6", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps6000/libps6000_2.1.77-6r2996_amd64.deb", | ||
"version": "2.1.77-6r2996" | ||
}, | ||
"libps6000a": { | ||
"sha256": "31ce0d27b5377e1ae964d792cfd9e9eea67367625915989d8e56cf0def736370", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/libp/libps6000a/libps6000a_1.0.77-0r2996_amd64.deb", | ||
"version": "1.0.77-0r2996" | ||
}, | ||
"picoscope": { | ||
"sha256": "2d1fa5d7854281a46665dfb9db7759ac5e376f0cce312c81648cfb4f8fc9d28c", | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/pool/main/p/picoscope/picoscope_7.0.87-1r9773_amd64.deb", | ||
"version": "7.0.87-1r9773" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell --pure -i python3 -p "python3.withPackages (ps: with ps; [ requests ])" | ||
import json | ||
import os | ||
import requests | ||
import sys | ||
|
||
def parse_packages(text): | ||
res = [] | ||
for package in resp.text.split("\n\n"): | ||
if not package: continue | ||
pkg = {} | ||
for field in package.split("\n"): | ||
if field.startswith(" "): # multiline string | ||
pkg[k] += "\n" + field[1:] | ||
else: | ||
[k, v] = field.split(": ", 1) | ||
pkg[k] = v | ||
res.append(pkg) | ||
return res | ||
|
||
def generate_sources(packages): | ||
sources_spec = {} | ||
for pkg in pkgs: | ||
sources_spec[pkg['Package']] = { | ||
"url": "https://labs.picotech.com/rc/picoscope7/debian/" + pkg["Filename"], | ||
"sha256": pkg["SHA256"], | ||
"version": pkg["Version"] | ||
} | ||
return sources_spec | ||
|
||
out = {} | ||
for nix_system, release in {"x86_64-linux": "amd64"}.items(): | ||
resp = requests.get("https://labs.picotech.com/rc/picoscope7/debian//dists/picoscope/main/binary-"+release+"/Packages") | ||
if resp.status_code != 200: | ||
print("error: could not fetch data for release {} (code {})".format(release, resp.code), file=sys.stderr) | ||
sys.exit(1) | ||
pkgs = parse_packages(resp.text) | ||
out[nix_system] = generate_sources(pkgs) | ||
|
||
with open(os.path.dirname(__file__) + "/sources.json", "w") as f: | ||
json.dump(out, f, indent=2, sort_keys=True) | ||
f.write('\n') | ||
|