initial commit

This commit is contained in:
Jonas Rabenstein 2025-09-30 12:07:41 +02:00
commit e3b0136650
9 changed files with 245 additions and 0 deletions

44
flake.lock generated Normal file
View file

@ -0,0 +1,44 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1759036355,
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-24.11": {
"locked": {
"lastModified": 1751274312,
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nixpkgs-24.11": "nixpkgs-24.11"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View file

@ -0,0 +1,31 @@
{
description = "Jetperch tools";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs."nixpkgs-24.11".url = "github:nixos/nixpkgs/nixos-24.11";
outputs = { self, nixpkgs, ... }@inputs: let
lib = nixpkgs.lib;
scan = root: pkg: let
path = ./. + "/${root}";
entries = lib.optionalAttrs (builtins.pathExists path) (builtins.readDir path);
in lib.attrsets.foldlAttrs (acc: name: value: acc // lib.optionalAttrs (builtins.pathExists ("${./.}/${root}/${name}/default.nix")) {
${name} = pkg name (import "${./.}/${root}/${name}/default.nix");
}) {} entries;
overlay = final: prev: let
all = packages final;
python3 = prev.python3.override {
self = python3;
packageOverrides = pself: psuper: {
watchdog = psuper.watchdog;
};
};
in { inherit python3; } // all;
packages = pkgs: scan "package" (name: pkg: (pkgs.extend overlay).callPackage pkg { jetperch = self; inherit name; });
in {
packages = builtins.mapAttrs (_: packages) nixpkgs.legacyPackages;
};
}

4
package/current.nix Normal file
View file

@ -0,0 +1,4 @@
{
lib,
versions,
}:

View file

@ -0,0 +1,29 @@
let
v."1.10.0" = "sha256-deMxbLHnD1jDvQaAzhGiCF1vt11IpF6Ao2OF6zJuJ9A=";
in {
callPackage,
jetperch,
name ? "joulescope-driver",
version ? "1.10.0",
hash ? v.${version} or "",
stdenv,
#dependencies
cmake,
udev,
}: stdenv.mkDerivation {
pname = name;
version = version;
src = callPackage ../source.nix {
repo = "joulescope_driver";
inherit version;
inherit hash;
};
postPatch = ''
echo 'install(TARGETS jsdrv DESTINATION lib)' >>CMakeLists.txt
'';
nativeBuildInputs = [ cmake ];
hardeningDisable = [ "format" ];
buildInputs = [ udev.dev ];
}

18
package/pyjls/default.nix Normal file
View file

@ -0,0 +1,18 @@
let
v."0.15.0" = "sha256-lr23f8YDF/7f/dAJIiZdy69lzcnO0HRkbYS/GkOYwfo=";
in {
callPackage,
jetperch,
name ? "pyjls",
version ? "0.15.0",
hash ? v.${version} or "",
}: callPackage ../python.nix {
inherit name;
inherit jetperch;
inherit version;
inherit hash;
repo = "jls";
pydeps = py: with py; [
numpy
];
}

View file

@ -0,0 +1,33 @@
let
v."1.10.0" = "sha256-deMxbLHnD1jDvQaAzhGiCF1vt11IpF6Ao2OF6zJuJ9A=";
in {
callPackage,
jetperch,
name ? "pyjoulescope-driver",
version ? "1.10.0",
hash ? v.${version} or "",
udev,
}: (callPackage ../python.nix {
inherit name;
inherit jetperch;
inherit version;
inherit hash;
repo = "joulescope_driver";
pydeps = py: with py; [
numpy
requests
psutil
];
}
).overrideAttrs (final: prev: {
nativeBuildInputs = (prev.nativeBuildInputs or []) ++ [
[ udev udev.dev ]
];
NIX_CFLAGS_COMPILE = (prev.NIX_CFLAGS_COMPILE or []) ++ [
"-I${udev.dev}/include"
];
NIX_LDFLAGS = (prev.NIX_LDFLAGS or []) ++ [
"-L${udev}/lib"
];
dontUseCmakeConfigure = true;
})

View file

@ -0,0 +1,38 @@
let
v."1.3.9" = "sha256-9UDZxeuSsaWreoFq6hhRub+72IvDavN5Y2tfgpBUwTE=";
in {
callPackage,
jetperch,
name ? "pyjoulescope-ui",
version ? "1.3.9",
hash ? v.${version} or "",
# dependencies
pyjoulescope-driver,
pyjls,
...
}: callPackage ../python.nix {
inherit name;
inherit jetperch;
inherit version;
inherit hash;
repo = "pyjoulescope_ui";
pydeps = py: with py; [
numpy
polib
pyside6
psutil
pyjls
pyopengl
pyqtgraph
pyside6-qtads
python-dateutil
qtpy
requests
appnope
fs
markdown
watchdog
pyjoulescope-driver
];
}

36
package/python.nix Normal file
View file

@ -0,0 +1,36 @@
{
callPackage,
python3Packages,
name,
repo ? name,
version,
hash,
pydeps ? (_: []),
...
}: let
source = callPackage ./source.nix {
inherit repo;
inherit version;
inherit hash;
};
in python3Packages.buildPythonPackage {
pname = name;
inherit version;
src = callPackage ./source.nix {
inherit repo;
inherit version;
inherit hash;
};
build-system = [ python3Packages.setuptools ];
pyproject = true;
dependencies = let
common = with python3Packages; [
cython
];
in common ++ pydeps python3Packages;
}

12
package/source.nix Normal file
View file

@ -0,0 +1,12 @@
{
fetchFromGitHub,
repo,
version,
hash ? "",
owner ? "jetperch",
}: fetchFromGitHub {
owner = owner;
repo = repo;
tag = "v${version}";
inherit hash;
}