From 9aa5eed3f67fe8113b7f5eebf48a6e45796e5676 Mon Sep 17 00:00:00 2001 From: estak Date: Tue, 16 Dec 2025 14:18:39 +0100 Subject: [PATCH 1/7] Simplifying the flake Signed-off-by: estak --- .envrc | 1 + .gitignore | 1 + flake.lock | 149 ++++++++++++++++- flake.nix | 466 ++++++----------------------------------------------- 4 files changed, 192 insertions(+), 425 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index c1aa91dc..14dc5640 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ __pycache__/ venv/ +.direnv .venv/ .idea/ .vscode/ diff --git a/flake.lock b/flake.lock index 681c095d..56f0611a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,24 +1,163 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1741048562, - "narHash": "sha256-W4YZ3fvWZiFYYyd900kh8P8wU6DHSiwaH0j4+fai1Sk=", + "lastModified": 1765762245, + "narHash": "sha256-3iXM/zTqEskWtmZs3gqNiVtRTsEjYAedIaLL0mSBsrk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c8cfcd6ccd422e41cc631a0b73ed4d5a925c393d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1766201043, + "narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b3aad468604d3e488d627c0b43984eb60e75e782", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1758690382, + "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6af28b834daca767a7ef99f8a7defa957d0ade6f", + "rev": "e643668fd71b949c53f8626614b21ff71a07379d", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, + "pyproject-nix": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1763716960, + "narHash": "sha256-PUlomle4klGbnZr0wOn8z61Mbt7tXh6Yp3hZ9/CQkq0=", + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "d6c61dbe0be75e2f4cf0efcdc62428175be4cfb5", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, + "pythainer": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2", + "pyproject-nix": "pyproject-nix" + }, + "locked": { + "lastModified": 1766420777, + "narHash": "sha256-WlUf5LgJoRfcm0cv4h7iXp8LRe2IPZsGM7ERtMSPbM0=", + "ref": "nixos", + "rev": "835fb3994aa6b2486f889126fabc9e1153c3b26a", + "revCount": 39, + "type": "git", + "url": "https://github.com/EstAK/pythainer.git" + }, + "original": { + "ref": "nixos", + "type": "git", + "url": "https://github.com/EstAK/pythainer.git" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "pythainer": "pythainer" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index c5814373..35b7c6cd 100644 --- a/flake.nix +++ b/flake.nix @@ -1,430 +1,56 @@ { - # The current NixPkgs release - inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + description = "Minimal flake for benchkit"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + flake-utils.url = "github:numtide/flake-utils"; + pythainer.url = "git+https://github.com/EstAK/pythainer.git?ref=nixos"; + }; - outputs = - { nixpkgs, ... }: - let - supportedSystems = [ - "x86_64-linux" - "x86_64-darwin" - "aarch64-linux" - "aarch64-darwin" - ]; - /** - Run the given function for all the systems in `supportedSystems`. + outputs = { self, nixpkgs, flake-utils, pythainer, ... }: - # Example - - ```nix - forAllSystems (system: pkgs: {packages.default = pkgs.coreutils;}) - => - { - packages = { - x86_64-linux.default = pkgs.coreutils; - x86_64-darwin.default = pkgs.coreutils; - aarch64-linux.default = pkgs.coreutils; - aarch64-darwin.default = pkgs.coreutils; - }; - }; - ``` - - # Type - - ``` - forAllSystems :: (String -> { ... } -> { ... }) -> { ... } - ``` - */ - forAllSystems = - f: - nixpkgs.lib.foldr nixpkgs.lib.recursiveUpdate { } ( - nixpkgs.lib.forEach supportedSystems ( - system: - builtins.mapAttrs (name: value: { ${system} = value; }) (f system nixpkgs.legacyPackages.${system}) - ) - ); - in - forAllSystems ( - system: pkgs: + flake-utils.lib.eachDefaultSystem (system : let - # The version of benchkit - version = "0.0.1"; - # The version of python to use - python = pkgs.python3; - # The Linux kernel to use, this is used for packages like `perf` - # Uses the latest LTS release (as of 2025-03-12) - # NOTE: This should be updated when a new LTS version is released - linuxKernel = pkgs.linuxKernel.packages.linux_6_12; - # From where to get the python packages, these are packages like `numpy`, `matplotlib`, ... - pythonPackages = pkgs.python3Packages; - # The main benchkit python package - benchkit = pythonPackages.buildPythonPackage { - inherit version; - pname = "pybenchkit"; - src = ./.; - propagatedBuildInputs = [ - pythonPackages.matplotlib - pythonPackages.pandas - pythonPackages.seaborn - pythonPackages.hatchling - ]; - # Use a `pyproject.toml` file - format = "pyproject"; - }; - /** - Make a derivation for a benchmark using the [benchkit](https://github.com/open-s4c/benchkit) - - # Type - - ```nix - buildBenchmark :: - name :: String; - src :: String | Path; - extraPythonPackages :: ({...} -> [{...}]) ? (_: [ ]); - benchmark :: String ? "benchmark.py"; - replaceBenchmarkSrcDir :: Bool ? false; - benchmarkSrcDirVariable :: String ? "_bench_src_path"; - benchmarkSrcDir :: String ? "."; - replaceBuildDir :: Bool ? false; - buildDirVariable :: String ? "_build_dir"; - buildDir :: String ? "./build/build_${name}"; - dirsFile :: String ? benchmark; - useSudo :: Bool ? false, - } // Derivation -> {...} - ``` - - # Arguments - - name - : The name of your benchmark. - - src - : The source directory of your benchmark, this should include both your Python benchmark file, - and the code that you want to benchmark. - - extraPythonPackages - : Extra Python packages that should be used when running the benchmark. - - benchmark - : The name of the benchmark Python file that, relative to the `src` directory, - this the entry file of your benchmark. - - replaceBenchmarkSrcDir - : Replace the value of the variable in `benchmarkSrcDirVariable` with the path - to your benchmarking code in the Nix store. - This means that, if `benchmarkSrcDirVariable` is `_bench_src_path` and `benchmarkSrcDir` - is `src/`, then `_bench_src_path = ` will be replaced with - `_bench_src_path = /src`, this substitution will be done in `dirsFile`. - - benchmarkSrcDirVariable - : The variable for which to replace the value in the Nix store, see `replaceBenchmarkSrcDir`. - - benchmarkSrcDir - : The directory in which your benchmarking code is, relative to the root directory given to by `src`, - see `replaceBenchmarkSrcDir`. - - replaceBuildDir - : Replace the value of the variable in `buildDirVariable` with the `buildDir`. - This means that, if `buildDirVariable` is `_build_dir` and `buildDir` - is `./build`, then `_build_dir = ` will be replaced with - `_build_dir = "./build"`, this substitution will be done in `dirsFile`. - - buildDirVariable - : The variable for which to replace the value to `buildDir`, see 'replaceBuildDir'. - - buildDir - : The directory in which your benchmark should be compiled, this is only used when `replaceBuildDir` is `true`, - see 'replaceBuildDir'. - - dirsFile - : The file in which the build directory and benchmark source directory should be replaced, - see `replaceBenchmarkSrcDir` and `replaceBuildDir`. - - useSudo - : Whether or not `sudo` should be added to the path. - */ - buildBenchmark = - { - name, - src, - extraPythonPackages ? (_: [ ]), - buildInputs ? [ ], - nativeBuildInputs ? [ ], - benchmark ? "benchmark.py", - replaceBenchmarkSrcDir ? false, - benchmarkSrcDirVariable ? "_bench_src_path", - benchmarkSrcDir ? ".", - replaceBuildDir ? false, - buildDirVariable ? "_build_dir", - buildDir ? "./build/build_${name}", - dirsFile ? benchmark, - useSudo ? false, - ... - }@attrs: - let - benchPython = python.withPackages (pks: [ benchkit ] ++ extraPythonPackages pks); - bin = pkgs.writeShellScript "benchmark_${name}" ''${pkgs.lib.getExe benchPython} "@out@/${benchmark}"''; - attrNames = [ - "name" - "src" - "extraPythonPackages" - "buildInputs" - "nativeBuildInputs" - "benchmark" - "replaceBenchmarkSrcDir" - "benchmarkSrcDirVariable" - "benchmarkSrcDir" - "replaceBuildDir" - "buildDirVariable" - "buildDir" - "dirsFile" - "useSudo" + pkgs = import nixpkgs {inherit system;}; + python = pkgs.python3; + pythonPackages = pkgs.python3Packages; + pythainerEnv = pythainer.packages.${system}.pythainerEnv; + pythonEnv = python.withPackages (ps: with ps; [ + pip + matplotlib + pandas + seaborn + docopt + libtmux # this is only required for the tmux extension : make it another lib ? + gitpython + wget + ]); + pythainerPackage = pythainer.packages.${system}.pythainer; + in + { + packages.benchkit = pythonPackages.buildPythonPackage { + pname = "pybenchkit"; + version = "0.0.1"; + + src = ./.; + propagatedBuildInputs = [ + pythonEnv + pythainerPackage ]; - in - pkgs.stdenv.mkDerivation - <| - builtins.removeAttrs attrs attrNames - // { - name = "benchmark_" + name; - src = src; - nativeBuildInputs = nativeBuildInputs ++ [ pkgs.makeWrapper ]; - postPatch = - # There are some paths that need to be changed, since the source code of the benchmark is in - # the Nix store, where to program wouldn't be able to find it normally, - # and the build folder should be done locally, since the Nix store is immutable. - pkgs.lib.optionalString (replaceBenchmarkSrcDir || replaceBuildDir) ( - "\nsubstituteInPlace '${dirsFile}'" - + pkgs.lib.optionalString replaceBenchmarkSrcDir " --replace-warn '${benchmarkSrcDirVariable} = ' \"${benchmarkSrcDirVariable} = pathlib.Path('$out/${benchmarkSrcDir}') #\"" - + pkgs.lib.optionalString replaceBuildDir " --replace-warn '${buildDirVariable} = ' '${buildDirVariable} = pathlib.Path(\"${buildDir}\") #'" - ); - installPhase = '' - runHook preInstall - - mkdir -p "$out/bin" - cp -r * "$out/" - substitute "${bin}" "$out/bin/benchmark_${name}" --replace-fail "@out@" "$out" - chmod +x "$out/bin/benchmark_${name}" - wrapProgram "$out/bin/benchmark_${name}" --set PATH ${ - pkgs.lib.makeBinPath - <| - buildInputs - ++ [ - pkgs.coreutils - pkgs.nettools - pkgs.git - pkgs.which - ] - ++ (pkgs.lib.optional useSudo "/run/wrappers/") - } - - runHook postInstall - ''; - meta.mainProgram = "benchmark_" + name; - dontBuild = true; - }; - # ======== TUTORIALS ======== - /** - This is a wrapper for `buildBenchmark` that makes it easier to build the tutorials included in `benchkit` - - # Type - - ```nix - buildTutorial :: { - deps :: { [ depName :: String ] :: String | Path } ? { }; - depsInTopLevelDir :: Bool ? false; - importKit :: { [ name :: String ] :: String } ? { }; - benchmarkSrcDir :: String; - } // buildBenchmark // Derivation -> {...} - ``` - - # Arguments - - deps - : The dependencies that are used for this tutorial, this should be an attribute set, - with as key the name of the dependency, and as value the path to the source code. - Any dependency, here will be symlinked into either `benchmarkSrcDir/deps/depName`, or `deps/depName` - depending on `depsInTopLevelDir`. - - depsInTopLevelDir - : If true, place `dep` folder, the dependencies from the `deps` argument in the top level directory, otherwise place it in `benchmarkSrcDir` directory - - importKit - : Most tutorials use a `kit` directory which is added to the python path at the top level, - because of this references to these files usually have to be prefixed with `.kit`, this is - done by this variable. - To do this, you give a attribute set that maps files, relative to the source directory, - to a list of imports in that file, every input in this list will then be prefixed with `.kit`. - This means that the following Nix code would replace `import vsyncmicrobench` in the file - `campaign_locks.py` with `import kit.vsyncmicrobench`. - ```nix - importKit = { "campaign_locks.py" = [ "vsyncmicrobench" ]; }; - ``` - - benchmarkSrcDir - : The directory in which your benchmarking source files are located - */ - buildTutorial = - { - deps ? { }, - depsInTopLevelDir ? false, - importKit ? { }, - benchmarkSrcDir, - postInstall ? "", - prePatch ? "", - buildInputs ? [ ], - ... - }@attrs: - buildBenchmark - <| - builtins.removeAttrs attrs [ - "deps" - "depsInTopLevelDir" - "importKit" - "buildInputs" - "postInstall" - ] - // { - replaceBuildDir = true; - buildInputs = [ - pkgs.cmake - pkgs.gnumake - pkgs.gcc - ] ++ buildInputs; - prePatch = - pkgs.lib.foldlAttrs ( - acc: file: importModules: - acc - + (pkgs.lib.foldr ( - importModule: acc: acc + " --replace-fail 'from ${importModule}' 'from kit.${importModule}'" - ) "\nsubstituteInPlace '${file}'" importModules) - ) "" importKit - + "\n" - + prePatch; - postInstall = - ''mkdir -p "$out/${pkgs.lib.optionalString (!depsInTopLevelDir) "${benchmarkSrcDir}/"}deps"'' - + pkgs.lib.foldlAttrs ( - acc: dep: src: - acc - + "\nln -s ${src} \"$out/${ - pkgs.lib.optionalString (!depsInTopLevelDir) "${benchmarkSrcDir}/" - }deps/${dep}\"" - ) "" deps - + "\n" - + postInstall; - dontConfigure = true; - }; - tutorials = { - # A library of synchronization primitives that is used in the benchmarks of some tutorials, - # only the source is here since `benchkit` expects source code so it can compile the program - # with differing options - libvsync-src = pkgs.fetchFromGitHub { - rev = "refs/tags/v4.1.0"; - owner = "open-s4c"; - repo = "libvsync"; - hash = "sha256-Sb1sbs5TnGyD2vxaDRUbCQjpYAHeu3zWo9ft3evXpV0="; - }; - leveldb-src = pkgs.stdenv.mkDerivation { - name = "leveldb-src"; - src = pkgs.fetchFromGitHub { - rev = "068d5ee1a3ac40dabd00d211d5013af44be55bea"; - owner = "google"; - repo = "leveldb"; - fetchSubmodules = true; - hash = "sha256-D12hjWT80YMwliVqNtryZkA1US0JUhtDFT9xBm9o8ng="; - }; - patches = [ ./tutorials/leveldb-bench/patch.diff ]; - buildPhase = '' - runHook preBuild - - mkdir -p "$out" - mv * "$out" - runHook postBuild - ''; - dontConfigure = true; - }; - # The [lybvsync locks](tutorials/libvsync-locks/README.md) tutorial - libvsync-locks = buildTutorial { - name = "tutorial_libvsync-locks"; - src = tutorials/libvsync-locks; - benchmarkSrcDir = "microbench/"; - benchmark = "campaign_locks.py"; - dirsFile = "kit/vsyncmicrobench.py"; - deps = { - "libvsync" = tutorials.libvsync-src; - }; - importKit = { - "campaign_locks.py" = [ "vsyncmicrobench" ]; - }; - }; - leveldb-opts = { - src = tutorials/leveldb-bench; - benchmarkSrcDir = "deps/leveldb"; - deps = { - "leveldb" = tutorials.leveldb-src; - }; - depsInTopLevelDir = true; - dirsFile = "leveldb.py"; - prePatch = "cp ${./examples/leveldb/kit/leveldb.py} 'leveldb.py'"; - }; - leveldb = - buildTutorial - <| - tutorials.leveldb-opts - // { - name = "tutorial_leveldb"; - benchmark = "campaign_leveldb.py"; - }; - leveldb_perf = - buildTutorial - <| - tutorials.leveldb-opts - // { - name = "tutorial_leveldb_perf"; - buildInputs = [ - pkgs.procps - # Use latest LTS release - linuxKernel.perf - ]; - useSudo = true; - benchmark = "campaign_leveldb_perf.py"; - }; - }; - in - { - packages = - let - buildableBenchkit = benchkit // { - inherit buildBenchmark; - }; - in - { - default = buildableBenchkit; - benchkit = buildableBenchkit; - }; - apps = rec { - default = libvsync-locks; - libvsync-locks = { - type = "app"; - program = "${pkgs.lib.getExe tutorials.libvsync-locks}"; - }; - leveldb = { - type = "app"; - program = "${pkgs.lib.getExe tutorials.leveldb}"; - }; - leveldb_perf = { - type = "app"; - program = "${pkgs.lib.getExe tutorials.leveldb_perf}"; + format = "pyproject"; + build-system = [ pythonPackages.hatchling ]; + }; + packages.default = self.packages.${system}.benchkit; + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + self.packages.${system}.benchkit + isort + black + pyright + qemu_full + ]; }; - }; - devShells.default = pkgs.mkShell { - packages = [ - pkgs.pyright - (python.withPackages (_: [ benchkit ])) - tutorials.libvsync-locks - ]; - }; - } + } ); } From edfdc9611d840527aef855c8decb00306247e1b0 Mon Sep 17 00:00:00 2001 From: estak Date: Sun, 28 Dec 2025 20:49:47 +0100 Subject: [PATCH 2/7] Dream2nix package Signed-off-by: estak --- default.nix | 82 +++++++++++++ flake.lock | 262 +++++++++++++++++++++++++++++++---------- flake.nix | 97 ++++++++------- lock.x86_64-linux.json | 108 +++++++++++++++++ requirements.txt | 3 + 5 files changed, 446 insertions(+), 106 deletions(-) create mode 100644 default.nix create mode 100644 lock.x86_64-linux.json create mode 100644 requirements.txt diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..b6ba745c --- /dev/null +++ b/default.nix @@ -0,0 +1,82 @@ +{ + config, + lib, + dream2nix, + pkgs, + pythainer, + ... +}: let + pyproject = lib.importTOML (config.mkDerivation.src + /pyproject.toml); +in { + + imports = [ + dream2nix.modules.dream2nix.pip + ]; + + + # package dependencies + deps = { nixpkgs, pythainer, ... } : { + + python = nixpkgs.python3; + pythainerPackage = pythainer.default; + inherit + (nixpkgs) + qemu_full + tmux + git + ; + }; + + inherit (pyproject.project) name version; + + mkDerivation = { + nativeBuildInputs = []; + + propagatedBuildInputs = [ + config.deps.qemu_full + config.deps.tmux + config.deps.git + config.deps.pythainerPackage + ]; + + src = lib.cleanSourceWith { + src = lib.cleanSource ./.; + filter = name : type: + !(builtins.any (x: x) [ + (lib.hasSuffix ".nix" name) # do not package nix files + (lib.hasPrefix "." (builtins.baseNameOf name)) # do not package hidden files + (lib.hasSuffix "flake.lock" name) # do not include the flake lock + ]); + }; + }; + + buildPythonPackage = { + pyproject = true; + pythonImportsCheck = [ # checks that python can import pythainer + "benchkit" + "pythainer" + ]; + }; + + pip = { + # concatenate both the build system (above) and the requirements.txt + requirementsList = + pyproject.build-system.requires or [] + ++ pyproject.project.dependencies or []; + requirementsFiles = ["requirements.txt"]; + flattenDependencies = true; + + # this is required as the pypi version of docopt makes the build fail + overrides.docopt = { + buildPythonPackage.pyproject = true; + mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools]; + }; + + overrides.wget = { + buildPythonPackage.pyproject = true; + mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools]; + }; + }; + + +} diff --git a/flake.lock b/flake.lock index 56f0611a..30d740ed 100644 --- a/flake.lock +++ b/flake.lock @@ -1,48 +1,100 @@ { "nodes": { - "flake-utils": { + "dream2nix": { "inputs": { - "systems": "systems" + "nixpkgs": "nixpkgs", + "purescript-overlay": "purescript-overlay", + "pyproject-nix": "pyproject-nix" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "lastModified": 1765953015, + "narHash": "sha256-5FBZbbWR1Csp3Y2icfRkxMJw/a/5FGg8hCXej2//bbI=", + "owner": "nix-community", + "repo": "dream2nix", + "rev": "69eb01fa0995e1e90add49d8ca5bcba213b0416f", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "nix-community", + "repo": "dream2nix", "type": "github" } }, - "flake-utils_2": { + "dream2nix_2": { "inputs": { - "systems": "systems_2" + "nixpkgs": "nixpkgs_3", + "purescript-overlay": "purescript-overlay_2", + "pyproject-nix": "pyproject-nix_2" + }, + "locked": { + "lastModified": 1765953015, + "narHash": "sha256-5FBZbbWR1Csp3Y2icfRkxMJw/a/5FGg8hCXej2//bbI=", + "owner": "nix-community", + "repo": "dream2nix", + "rev": "69eb01fa0995e1e90add49d8ca5bcba213b0416f", + "type": "github" }, + "original": { + "owner": "nix-community", + "repo": "dream2nix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1765762245, - "narHash": "sha256-3iXM/zTqEskWtmZs3gqNiVtRTsEjYAedIaLL0mSBsrk=", + "lastModified": 1750215678, + "narHash": "sha256-Rc/ytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M+ok=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5395fb3ab3f97b9b7abca147249fa2e8ed27b192", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1766736597, + "narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c8cfcd6ccd422e41cc631a0b73ed4d5a925c393d", + "rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852", "type": "github" }, "original": { @@ -52,48 +104,120 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { - "lastModified": 1766201043, - "narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=", + "lastModified": 1750215678, + "narHash": "sha256-Rc/ytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M+ok=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b3aad468604d3e488d627c0b43984eb60e75e782", + "rev": "5395fb3ab3f97b9b7abca147249fa2e8ed27b192", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-25.11", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { - "lastModified": 1758690382, - "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=", - "owner": "nixos", + "lastModified": 1766736597, + "narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "e643668fd71b949c53f8626614b21ff71a07379d", + "rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", + "owner": "NixOS", + "ref": "nixos-25.11", "repo": "nixpkgs", "type": "github" } }, + "purescript-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "dream2nix", + "nixpkgs" + ], + "slimlock": "slimlock" + }, + "locked": { + "lastModified": 1728546539, + "narHash": "sha256-Sws7w0tlnjD+Bjck1nv29NjC5DbL6nH5auL9Ex9Iz2A=", + "owner": "thomashoneyman", + "repo": "purescript-overlay", + "rev": "4ad4c15d07bd899d7346b331f377606631eb0ee4", + "type": "github" + }, + "original": { + "owner": "thomashoneyman", + "repo": "purescript-overlay", + "type": "github" + } + }, + "purescript-overlay_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": [ + "pythainer", + "dream2nix", + "nixpkgs" + ], + "slimlock": "slimlock_2" + }, + "locked": { + "lastModified": 1728546539, + "narHash": "sha256-Sws7w0tlnjD+Bjck1nv29NjC5DbL6nH5auL9Ex9Iz2A=", + "owner": "thomashoneyman", + "repo": "purescript-overlay", + "rev": "4ad4c15d07bd899d7346b331f377606631eb0ee4", + "type": "github" + }, + "original": { + "owner": "thomashoneyman", + "repo": "purescript-overlay", + "type": "github" + } + }, "pyproject-nix": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": [ + "dream2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763017646, + "narHash": "sha256-Z+R2lveIp6Skn1VPH3taQIuMhABg1IizJd8oVdmdHsQ=", + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "47bd6f296502842643078d66128f7b5e5370790c", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, + "pyproject-nix_2": { + "inputs": { + "nixpkgs": [ + "pythainer", + "dream2nix", + "nixpkgs" + ] }, "locked": { - "lastModified": 1763716960, - "narHash": "sha256-PUlomle4klGbnZr0wOn8z61Mbt7tXh6Yp3hZ9/CQkq0=", + "lastModified": 1763017646, + "narHash": "sha256-Z+R2lveIp6Skn1VPH3taQIuMhABg1IizJd8oVdmdHsQ=", "owner": "pyproject-nix", "repo": "pyproject.nix", - "rev": "d6c61dbe0be75e2f4cf0efcdc62428175be4cfb5", + "rev": "47bd6f296502842643078d66128f7b5e5370790c", "type": "github" }, "original": { @@ -104,16 +228,15 @@ }, "pythainer": { "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2", - "pyproject-nix": "pyproject-nix" + "dream2nix": "dream2nix_2", + "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1766420777, - "narHash": "sha256-WlUf5LgJoRfcm0cv4h7iXp8LRe2IPZsGM7ERtMSPbM0=", + "lastModified": 1766939132, + "narHash": "sha256-/DUq4WArPVQEpKm7/AZgu/iYwuls09vU3B2JMZqoIVw=", "ref": "nixos", - "rev": "835fb3994aa6b2486f889126fabc9e1153c3b26a", - "revCount": 39, + "rev": "98b0ade99c4f968f1be21156434708ee250f0295", + "revCount": 41, "type": "git", "url": "https://github.com/EstAK/pythainer.git" }, @@ -125,38 +248,53 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", + "dream2nix": "dream2nix", + "nixpkgs": "nixpkgs_2", "pythainer": "pythainer" } }, - "systems": { + "slimlock": { + "inputs": { + "nixpkgs": [ + "dream2nix", + "purescript-overlay", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1688756706, + "narHash": "sha256-xzkkMv3neJJJ89zo3o2ojp7nFeaZc2G0fYwNXNJRFlo=", + "owner": "thomashoneyman", + "repo": "slimlock", + "rev": "cf72723f59e2340d24881fd7bf61cb113b4c407c", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "thomashoneyman", + "repo": "slimlock", "type": "github" } }, - "systems_2": { + "slimlock_2": { + "inputs": { + "nixpkgs": [ + "pythainer", + "dream2nix", + "purescript-overlay", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1688756706, + "narHash": "sha256-xzkkMv3neJJJ89zo3o2ojp7nFeaZc2G0fYwNXNJRFlo=", + "owner": "thomashoneyman", + "repo": "slimlock", + "rev": "cf72723f59e2340d24881fd7bf61cb113b4c407c", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "thomashoneyman", + "repo": "slimlock", "type": "github" } } diff --git a/flake.nix b/flake.nix index 35b7c6cd..cf7db111 100644 --- a/flake.nix +++ b/flake.nix @@ -2,55 +2,64 @@ description = "Minimal flake for benchkit"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; - flake-utils.url = "github:numtide/flake-utils"; pythainer.url = "git+https://github.com/EstAK/pythainer.git?ref=nixos"; + dream2nix.url = "github:nix-community/dream2nix"; }; - outputs = { self, nixpkgs, flake-utils, pythainer, ... }: - - flake-utils.lib.eachDefaultSystem (system : - let - pkgs = import nixpkgs {inherit system;}; - python = pkgs.python3; - pythonPackages = pkgs.python3Packages; - pythainerEnv = pythainer.packages.${system}.pythainerEnv; - pythonEnv = python.withPackages (ps: with ps; [ - pip - matplotlib - pandas - seaborn - docopt - libtmux # this is only required for the tmux extension : make it another lib ? - gitpython - wget - ]); - pythainerPackage = pythainer.packages.${system}.pythainer; - in - { - packages.benchkit = pythonPackages.buildPythonPackage { - pname = "pybenchkit"; - version = "0.0.1"; - - src = ./.; - propagatedBuildInputs = [ - pythonEnv - pythainerPackage - ]; + outputs = { + self, + nixpkgs, + dream2nix, + pythainer + }: + let + eachSystem = nixpkgs.lib.genAttrs [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + in { + + packages = eachSystem (system : { + default = dream2nix.lib.evalModules { + packageSets.nixpkgs = nixpkgs.legacyPackages.${system}; + packageSets.pythainer = pythainer.packages.${system}; + modules = [ + ./default.nix + { + paths.projectRoot = ./.; + paths.projectRootFile = "flake.nix"; + paths.package = ./.; + + } + ]; + }; + }); + + + devShells = eachSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; # + benchkit = self.packages.${system}.default; + python = benchkit.config.deps.python; + in { + default = pkgs.mkShell { # + inputsFrom = [benchkit.devShell]; # + packages = [ + + benchkit.config.deps.pythainerPackage + benchkit.config.deps.qemu_full + benchkit.config.deps.tmux + + python.pkgs.python-lsp-ruff + python.pkgs.pip - format = "pyproject"; - build-system = [ pythonPackages.hatchling ]; - }; - packages.default = self.packages.${system}.benchkit; - devShells.default = pkgs.mkShell { - packages = with pkgs; [ - self.packages.${system}.benchkit - isort - black - pyright - qemu_full + pkgs.ruff + pkgs.black ]; }; + }); - } - ); + }; } diff --git a/lock.x86_64-linux.json b/lock.x86_64-linux.json new file mode 100644 index 00000000..1bb9cbd5 --- /dev/null +++ b/lock.x86_64-linux.json @@ -0,0 +1,108 @@ +{ + "fetchPipMetadata": { + "sources": { + "docopt": { + "is_direct": false, + "sha256": "49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491", + "type": "url", + "url": "https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz", + "version": "0.6.2" + }, + "gitdb": { + "is_direct": false, + "sha256": "67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf", + "type": "url", + "url": "https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl", + "version": "4.0.12" + }, + "gitpython": { + "is_direct": false, + "sha256": "8908cb2e02fb3b93b7eb0f2827125cb699869470432cc885f019b8fd0fccff77", + "type": "url", + "url": "https://files.pythonhosted.org/packages/01/61/d4b89fec821f72385526e1b9d9a3a0385dda4a72b206d28049e2c7cd39b8/gitpython-3.1.45-py3-none-any.whl", + "version": "3.1.45" + }, + "hatchling": { + "is_direct": false, + "sha256": "dc48722b68b3f4bbfa3ff618ca07cdea6750e7d03481289ffa8be1521d18a961", + "type": "url", + "url": "https://files.pythonhosted.org/packages/0d/a5/48cb7efb8b4718b1a4c0c331e3364a3a33f614ff0d6afd2b93ee883d3c47/hatchling-1.28.0-py3-none-any.whl", + "version": "1.28.0" + }, + "libtmux": { + "is_direct": false, + "sha256": "024b7ae6a12aae55358e8feb914c8632b3ab9bd61c0987c53559643c6a58ee4f", + "type": "url", + "url": "https://files.pythonhosted.org/packages/0e/d0/2e8bc5caa639ebb9f8801ba0be7070a28d48d8ed60e2a428d40f71fb88b8/libtmux-0.53.0-py3-none-any.whl", + "version": "0.53.0" + }, + "packaging": { + "is_direct": false, + "sha256": "29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", + "type": "url", + "url": "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", + "version": "25.0" + }, + "pathspec": { + "is_direct": false, + "sha256": "a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08", + "type": "url", + "url": "https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl", + "version": "0.12.1" + }, + "pluggy": { + "is_direct": false, + "sha256": "e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", + "type": "url", + "url": "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", + "version": "1.6.0" + }, + "smmap": { + "is_direct": false, + "sha256": "b30115f0def7d7531d22a0fb6502488d879e75b260a9db4d0819cfb25403af5e", + "type": "url", + "url": "https://files.pythonhosted.org/packages/04/be/d09147ad1ec7934636ad912901c5fd7667e1c858e19d355237db0d0cd5e4/smmap-5.0.2-py3-none-any.whl", + "version": "5.0.2" + }, + "trove-classifiers": { + "is_direct": false, + "sha256": "a8206978ede95937b9959c3aff3eb258bbf7b07dff391ddd4ea7e61f316635ab", + "type": "url", + "url": "https://files.pythonhosted.org/packages/4f/7e/bc19996fa86cad8801e8ffe6f1bba5836ca0160df76d0410d27432193712/trove_classifiers-2025.12.1.14-py3-none-any.whl", + "version": "2025.12.1.14" + }, + "wget": { + "is_direct": false, + "sha256": "35e630eca2aa50ce998b9b1a127bb26b30dfee573702782aa982f875e3f16061", + "type": "url", + "url": "https://files.pythonhosted.org/packages/47/6a/62e288da7bcda82b935ff0c6cfe542970f04e29c756b0e147251b2fb251f/wget-3.2.zip", + "version": "3.2" + } + }, + "targets": { + "default": { + "docopt": [], + "gitdb": [ + "smmap" + ], + "gitpython": [ + "gitdb" + ], + "hatchling": [ + "packaging", + "pathspec", + "pluggy", + "trove-classifiers" + ], + "libtmux": [], + "packaging": [], + "pathspec": [], + "pluggy": [], + "smmap": [], + "trove-classifiers": [], + "wget": [] + } + } + }, + "invalidationHash": "ba58f927a3f65ce3a4c35daefda89ffed9543c0455fa498a1415e78b9798abb7" +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..9eeaa8a1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +libtmux<=0.53.0 +GitPython<=3.1.45 +wget<=3.2 From 4aafde341c3eb0a5412c68aa2411424790f35ccf Mon Sep 17 00:00:00 2001 From: estak Date: Tue, 6 Jan 2026 16:42:17 +0100 Subject: [PATCH 3/7] part of the nix files to .nix Signed-off-by: estak --- default.nix => .nix/default.nix | 3 +-- lock.x86_64-linux.json => .nix/lock.x86_64-linux.json | 6 +++--- flake.nix | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) rename default.nix => .nix/default.nix (98%) rename lock.x86_64-linux.json => .nix/lock.x86_64-linux.json (93%) diff --git a/default.nix b/.nix/default.nix similarity index 98% rename from default.nix rename to .nix/default.nix index b6ba745c..682a2d53 100644 --- a/default.nix +++ b/.nix/default.nix @@ -13,7 +13,6 @@ in { dream2nix.modules.dream2nix.pip ]; - # package dependencies deps = { nixpkgs, pythainer, ... } : { @@ -40,7 +39,7 @@ in { ]; src = lib.cleanSourceWith { - src = lib.cleanSource ./.; + src = lib.cleanSource ./..; filter = name : type: !(builtins.any (x: x) [ (lib.hasSuffix ".nix" name) # do not package nix files diff --git a/lock.x86_64-linux.json b/.nix/lock.x86_64-linux.json similarity index 93% rename from lock.x86_64-linux.json rename to .nix/lock.x86_64-linux.json index 1bb9cbd5..42760df1 100644 --- a/lock.x86_64-linux.json +++ b/.nix/lock.x86_64-linux.json @@ -45,10 +45,10 @@ }, "pathspec": { "is_direct": false, - "sha256": "a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08", + "sha256": "8870061f22c58e6d83463cfce9a7dd6eca0512c772c1001fb09ac64091816721", "type": "url", - "url": "https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl", - "version": "0.12.1" + "url": "https://files.pythonhosted.org/packages/d2/fe/2257c71721aeab6a6e8aa1f00d01f2a20f58547d249a6c8fef5791f559fc/pathspec-1.0.1-py3-none-any.whl", + "version": "1.0.1" }, "pluggy": { "is_direct": false, diff --git a/flake.nix b/flake.nix index cf7db111..993e4fd6 100644 --- a/flake.nix +++ b/flake.nix @@ -24,14 +24,13 @@ packages = eachSystem (system : { default = dream2nix.lib.evalModules { packageSets.nixpkgs = nixpkgs.legacyPackages.${system}; - packageSets.pythainer = pythainer.packages.${system}; modules = [ - ./default.nix + .nix/default.nix { + paths.lockFile = ".nix/lock.${system}.json"; paths.projectRoot = ./.; paths.projectRootFile = "flake.nix"; paths.package = ./.; - } ]; }; From a9117bff065980c6c52f8efe9448a9c7088d49f9 Mon Sep 17 00:00:00 2001 From: estak Date: Tue, 13 Jan 2026 14:12:24 +0100 Subject: [PATCH 4/7] locking Signed-off-by: estak --- .nix/default.nix | 1 - .nix/lock.x86_64-linux.json | 56 ++++--------------------------------- flake.lock | 19 ++++++------- flake.nix | 17 +++++++++-- requirements.txt | 3 -- 5 files changed, 30 insertions(+), 66 deletions(-) delete mode 100644 requirements.txt diff --git a/.nix/default.nix b/.nix/default.nix index 682a2d53..6c5f7f35 100644 --- a/.nix/default.nix +++ b/.nix/default.nix @@ -62,7 +62,6 @@ in { requirementsList = pyproject.build-system.requires or [] ++ pyproject.project.dependencies or []; - requirementsFiles = ["requirements.txt"]; flattenDependencies = true; # this is required as the pypi version of docopt makes the build fail diff --git a/.nix/lock.x86_64-linux.json b/.nix/lock.x86_64-linux.json index 42760df1..24830c0a 100644 --- a/.nix/lock.x86_64-linux.json +++ b/.nix/lock.x86_64-linux.json @@ -8,20 +8,6 @@ "url": "https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz", "version": "0.6.2" }, - "gitdb": { - "is_direct": false, - "sha256": "67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf", - "type": "url", - "url": "https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl", - "version": "4.0.12" - }, - "gitpython": { - "is_direct": false, - "sha256": "8908cb2e02fb3b93b7eb0f2827125cb699869470432cc885f019b8fd0fccff77", - "type": "url", - "url": "https://files.pythonhosted.org/packages/01/61/d4b89fec821f72385526e1b9d9a3a0385dda4a72b206d28049e2c7cd39b8/gitpython-3.1.45-py3-none-any.whl", - "version": "3.1.45" - }, "hatchling": { "is_direct": false, "sha256": "dc48722b68b3f4bbfa3ff618ca07cdea6750e7d03481289ffa8be1521d18a961", @@ -29,13 +15,6 @@ "url": "https://files.pythonhosted.org/packages/0d/a5/48cb7efb8b4718b1a4c0c331e3364a3a33f614ff0d6afd2b93ee883d3c47/hatchling-1.28.0-py3-none-any.whl", "version": "1.28.0" }, - "libtmux": { - "is_direct": false, - "sha256": "024b7ae6a12aae55358e8feb914c8632b3ab9bd61c0987c53559643c6a58ee4f", - "type": "url", - "url": "https://files.pythonhosted.org/packages/0e/d0/2e8bc5caa639ebb9f8801ba0be7070a28d48d8ed60e2a428d40f71fb88b8/libtmux-0.53.0-py3-none-any.whl", - "version": "0.53.0" - }, "packaging": { "is_direct": false, "sha256": "29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", @@ -45,10 +24,10 @@ }, "pathspec": { "is_direct": false, - "sha256": "8870061f22c58e6d83463cfce9a7dd6eca0512c772c1001fb09ac64091816721", + "sha256": "1373719036e64a2b9de3b8ddd9e30afb082a915619f07265ed76d9ae507800ae", "type": "url", - "url": "https://files.pythonhosted.org/packages/d2/fe/2257c71721aeab6a6e8aa1f00d01f2a20f58547d249a6c8fef5791f559fc/pathspec-1.0.1-py3-none-any.whl", - "version": "1.0.1" + "url": "https://files.pythonhosted.org/packages/05/bb/39e6768529454cc2b57e1e2fa0a0a18ff64397a16303270e215a3e03285f/pathspec-1.0.0-py3-none-any.whl", + "version": "1.0.0" }, "pluggy": { "is_direct": false, @@ -57,52 +36,29 @@ "url": "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", "version": "1.6.0" }, - "smmap": { - "is_direct": false, - "sha256": "b30115f0def7d7531d22a0fb6502488d879e75b260a9db4d0819cfb25403af5e", - "type": "url", - "url": "https://files.pythonhosted.org/packages/04/be/d09147ad1ec7934636ad912901c5fd7667e1c858e19d355237db0d0cd5e4/smmap-5.0.2-py3-none-any.whl", - "version": "5.0.2" - }, "trove-classifiers": { "is_direct": false, "sha256": "a8206978ede95937b9959c3aff3eb258bbf7b07dff391ddd4ea7e61f316635ab", "type": "url", "url": "https://files.pythonhosted.org/packages/4f/7e/bc19996fa86cad8801e8ffe6f1bba5836ca0160df76d0410d27432193712/trove_classifiers-2025.12.1.14-py3-none-any.whl", "version": "2025.12.1.14" - }, - "wget": { - "is_direct": false, - "sha256": "35e630eca2aa50ce998b9b1a127bb26b30dfee573702782aa982f875e3f16061", - "type": "url", - "url": "https://files.pythonhosted.org/packages/47/6a/62e288da7bcda82b935ff0c6cfe542970f04e29c756b0e147251b2fb251f/wget-3.2.zip", - "version": "3.2" } }, "targets": { "default": { "docopt": [], - "gitdb": [ - "smmap" - ], - "gitpython": [ - "gitdb" - ], "hatchling": [ "packaging", "pathspec", "pluggy", "trove-classifiers" ], - "libtmux": [], "packaging": [], "pathspec": [], "pluggy": [], - "smmap": [], - "trove-classifiers": [], - "wget": [] + "trove-classifiers": [] } } }, - "invalidationHash": "ba58f927a3f65ce3a4c35daefda89ffed9543c0455fa498a1415e78b9798abb7" -} \ No newline at end of file + "invalidationHash": "d9ba953fb67f6a64d7d7c0fb36be292c3e84ee70bf54ebc1810bcd82c02c7146" +} diff --git a/flake.lock b/flake.lock index 30d740ed..8db42b51 100644 --- a/flake.lock +++ b/flake.lock @@ -232,18 +232,17 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1766939132, - "narHash": "sha256-/DUq4WArPVQEpKm7/AZgu/iYwuls09vU3B2JMZqoIVw=", - "ref": "nixos", - "rev": "98b0ade99c4f968f1be21156434708ee250f0295", - "revCount": 41, - "type": "git", - "url": "https://github.com/EstAK/pythainer.git" + "lastModified": 1767975120, + "narHash": "sha256-QU9dMACDn9nxbXfSa+rGPmi/xGXyae6PehI0BDX2jHQ=", + "owner": "apaolillo", + "repo": "pythainer", + "rev": "2c247cf419725e23a8c2386db7a4349028d563d0", + "type": "github" }, "original": { - "ref": "nixos", - "type": "git", - "url": "https://github.com/EstAK/pythainer.git" + "owner": "apaolillo", + "repo": "pythainer", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index 993e4fd6..2f732df6 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Minimal flake for benchkit"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; - pythainer.url = "git+https://github.com/EstAK/pythainer.git?ref=nixos"; + pythainer.url = "github:apaolillo/pythainer"; dream2nix.url = "github:nix-community/dream2nix"; }; @@ -24,6 +24,7 @@ packages = eachSystem (system : { default = dream2nix.lib.evalModules { packageSets.nixpkgs = nixpkgs.legacyPackages.${system}; + packageSets.pythainer = pythainer.packages.${system}; modules = [ .nix/default.nix { @@ -46,16 +47,28 @@ default = pkgs.mkShell { # inputsFrom = [benchkit.devShell]; # packages = [ - + benchkit.config.deps.pythainerPackage benchkit.config.deps.qemu_full benchkit.config.deps.tmux python.pkgs.python-lsp-ruff python.pkgs.pip + python.pkgs.numpy + python.pkgs.flake8 pkgs.ruff pkgs.black + pkgs.pylint + + # x264 requirements + pkgs.pkg-config + pkgs.yasm + pkgs.nasm + + pkgs.glibc + pkgs.glibc.dev + pkgs.glibc.static ]; }; }); diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9eeaa8a1..00000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -libtmux<=0.53.0 -GitPython<=3.1.45 -wget<=3.2 From eb0ffd54bf005a012701c66faab1bad5caa1b26c Mon Sep 17 00:00:00 2001 From: estak Date: Tue, 13 Jan 2026 14:33:07 +0100 Subject: [PATCH 5/7] new lock Signed-off-by: estak --- .nix/lock.x86_64-linux.json | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/.nix/lock.x86_64-linux.json b/.nix/lock.x86_64-linux.json index 24830c0a..88b15e44 100644 --- a/.nix/lock.x86_64-linux.json +++ b/.nix/lock.x86_64-linux.json @@ -15,6 +15,20 @@ "url": "https://files.pythonhosted.org/packages/0d/a5/48cb7efb8b4718b1a4c0c331e3364a3a33f614ff0d6afd2b93ee883d3c47/hatchling-1.28.0-py3-none-any.whl", "version": "1.28.0" }, + "markdown-it-py": { + "is_direct": false, + "sha256": "87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147", + "type": "url", + "url": "https://files.pythonhosted.org/packages/94/54/e7d793b573f298e1c9013b8c4dade17d481164aa517d1d7148619c2cedbf/markdown_it_py-4.0.0-py3-none-any.whl", + "version": "4.0.0" + }, + "mdurl": { + "is_direct": false, + "sha256": "84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", + "type": "url", + "url": "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", + "version": "0.1.2" + }, "packaging": { "is_direct": false, "sha256": "29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", @@ -36,6 +50,20 @@ "url": "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", "version": "1.6.0" }, + "pygments": { + "is_direct": false, + "sha256": "86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", + "type": "url", + "url": "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", + "version": "2.19.2" + }, + "rich": { + "is_direct": false, + "sha256": "76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd", + "type": "url", + "url": "https://files.pythonhosted.org/packages/25/7a/b0178788f8dc6cafce37a212c99565fa1fe7872c70c6c9c1e1a372d9d88f/rich-14.2.0-py3-none-any.whl", + "version": "14.2.0" + }, "trove-classifiers": { "is_direct": false, "sha256": "a8206978ede95937b9959c3aff3eb258bbf7b07dff391ddd4ea7e61f316635ab", @@ -53,12 +81,21 @@ "pluggy", "trove-classifiers" ], + "markdown-it-py": [ + "mdurl" + ], + "mdurl": [], "packaging": [], "pathspec": [], "pluggy": [], + "pygments": [], + "rich": [ + "markdown-it-py", + "pygments" + ], "trove-classifiers": [] } } }, - "invalidationHash": "d9ba953fb67f6a64d7d7c0fb36be292c3e84ee70bf54ebc1810bcd82c02c7146" + "invalidationHash": "156fe21e28238080e9b7e35e84dfb16761c3a17d21291acf0487ba850888dd18" } From 67690b97d10cb0e9021f60522443296f8e166e83 Mon Sep 17 00:00:00 2001 From: estak Date: Tue, 13 Jan 2026 14:34:46 +0100 Subject: [PATCH 6/7] ignore files Signed-off-by: estak --- .envrc | 1 - .gitignore | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .envrc diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30f..00000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/.gitignore b/.gitignore index 14dc5640..b67a86fe 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ venv/ .DS_Store results/ benchkit.egg-info/ +.envrc From c0aca68b344ed17d21ac96a3bd7493fa505cb3a8 Mon Sep 17 00:00:00 2001 From: estak Date: Thu, 15 Jan 2026 16:41:54 +0100 Subject: [PATCH 7/7] remove qemu, add stress-ng qemu starts becoming a dependency from a different pr, the other is a pure dep --- .nix/default.nix | 23 ++++++++------- flake.nix | 73 +++++++++++++++++++++++++++++------------------- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/.nix/default.nix b/.nix/default.nix index 6c5f7f35..244d6bea 100644 --- a/.nix/default.nix +++ b/.nix/default.nix @@ -20,7 +20,7 @@ in { pythainerPackage = pythainer.default; inherit (nixpkgs) - qemu_full + stress-ng tmux git ; @@ -32,10 +32,9 @@ in { nativeBuildInputs = []; propagatedBuildInputs = [ - config.deps.qemu_full - config.deps.tmux - config.deps.git config.deps.pythainerPackage + config.deps.stress-ng + config.deps.git ]; src = lib.cleanSourceWith { @@ -51,10 +50,10 @@ in { buildPythonPackage = { pyproject = true; - pythonImportsCheck = [ # checks that python can import pythainer - "benchkit" - "pythainer" - ]; + pythonImportsCheck = [ # checks that python can import pythainer + "benchkit" + "pythainer" + ]; }; pip = { @@ -66,13 +65,13 @@ in { # this is required as the pypi version of docopt makes the build fail overrides.docopt = { - buildPythonPackage.pyproject = true; - mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools]; + buildPythonPackage.pyproject = true; + mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools]; }; overrides.wget = { - buildPythonPackage.pyproject = true; - mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools]; + buildPythonPackage.pyproject = true; + mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools]; }; }; diff --git a/flake.nix b/flake.nix index 2f732df6..d8154a57 100644 --- a/flake.nix +++ b/flake.nix @@ -8,9 +8,9 @@ outputs = { self, - nixpkgs, - dream2nix, - pythainer + nixpkgs, + dream2nix, + pythainer }: let eachSystem = nixpkgs.lib.genAttrs [ @@ -40,38 +40,53 @@ devShells = eachSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; # + pkgs = import nixpkgs {inherit system;}; benchkit = self.packages.${system}.default; python = benchkit.config.deps.python; - in { - default = pkgs.mkShell { # - inputsFrom = [benchkit.devShell]; # - packages = [ - - benchkit.config.deps.pythainerPackage - benchkit.config.deps.qemu_full - benchkit.config.deps.tmux - - python.pkgs.python-lsp-ruff - python.pkgs.pip - python.pkgs.numpy - python.pkgs.flake8 - pkgs.ruff - pkgs.black - pkgs.pylint + benchkitCorePackages = [ + benchkit.config.deps.pythainerPackage + benchkit.config.deps.stress-ng + benchkit.config.deps.tmux + ]; - # x264 requirements - pkgs.pkg-config - pkgs.yasm - pkgs.nasm + pythonToolingPackages = [ + python.pkgs.python-lsp-ruff + python.pkgs.numpy + python.pkgs.pip + ]; - pkgs.glibc - pkgs.glibc.dev - pkgs.glibc.static - ]; + formattingPackages = [ + python.pkgs.flake8 + pkgs.pylint + pkgs.isort + pkgs.black + pkgs.ruff + ]; + in { + core = pkgs.mkShell { # + inputsFrom = [benchkit.devShell]; # + packages = benchkitCorePackages + ++ pythonToolingPackages + ++ formattingPackages + ++ []; }; - }); + # example of a devshell where non free software is required + # unfree = pkgs.mkShell { + # inputsFrom = [self.devShells.${system}.core]; + # packages = let + # pkgs = import nixpkgs { + # inherit system; + # config.allowUnfree = true; + # }; + # in benchkitCorePackages + # ++ pythonToolingPackages + # ++ formattingPackages + # ++ []; + # }; + + default = self.devShells.${system}.core; + }); }; }