From e48332a0008e9b2842769dffffeaf8ace4f17cab Mon Sep 17 00:00:00 2001 From: Benedikt Spies Date: Mon, 16 Sep 2024 11:21:48 +0200 Subject: [PATCH 1/3] add flake.nix --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0136f65 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1726243404, + "narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..257dc74 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + description = "nPerf"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { + inherit system; + }; + manifest = (pkgs.lib.importTOML ./Cargo.toml).package; + in + { + packages.nperf = pkgs.rustPlatform.buildRustPackage rec { + pname = manifest.name; + version = manifest.version; + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { # explicit hashes required for cargo git dependencies + "csv-1.1.5" = "sha256-IGfThZankbhI2LsQzJ0TdLhrw3fNlEB2P5pidvPUIxg="; + "io-uring-0.6.3" = "sha256-dAlKSPniUAJdme9HvTg/lr9Zqkl1yOC7xIGoAanl4z8="; + }; + }; + src = pkgs.lib.cleanSource ./.; + nativeBuildInputs = with pkgs; [ + pkg-config + ]; + buildInputs = with pkgs; [ + hwloc + ]; + doCheck = false; # do not run tests + }; + packages.default = self.packages.${system}.nperf; + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + cargo + pkg-config + hwloc + ]; + }; + } + ); +} \ No newline at end of file From 38049c4965b9f1650321567c8eff4d5b6a52b471 Mon Sep 17 00:00:00 2001 From: Benedikt Spies Date: Mon, 3 Nov 2025 15:08:57 +0100 Subject: [PATCH 2/3] update flake.nix --- .gitignore | 2 +- flake.nix | 94 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 56 insertions(+), 40 deletions(-) diff --git a/.gitignore b/.gitignore index 6180ff0..b67d6b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ +/result /target *.csv -*.png *.data *.old *.log \ No newline at end of file diff --git a/flake.nix b/flake.nix index 257dc74..ae811e3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,46 +1,62 @@ { - description = "nPerf"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem - (system: - let - pkgs = import nixpkgs { - inherit system; - }; - manifest = (pkgs.lib.importTOML ./Cargo.toml).package; - in - { - packages.nperf = pkgs.rustPlatform.buildRustPackage rec { - pname = manifest.name; - version = manifest.version; - cargoLock = { - lockFile = ./Cargo.lock; - outputHashes = { # explicit hashes required for cargo git dependencies - "csv-1.1.5" = "sha256-IGfThZankbhI2LsQzJ0TdLhrw3fNlEB2P5pidvPUIxg="; - "io-uring-0.6.3" = "sha256-dAlKSPniUAJdme9HvTg/lr9Zqkl1yOC7xIGoAanl4z8="; - }; + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + }; + manifest = (pkgs.lib.importTOML ./Cargo.toml).package; + rust-toolchain = pkgs.symlinkJoin { + name = "rust-toolchain"; + paths = with pkgs; [ + rustc + cargo + rustPlatform.rustcSrc + ]; + }; + in + { + packages.default = pkgs.rustPlatform.buildRustPackage rec { + pname = manifest.name; + version = manifest.version; + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + # explicit hashes required for cargo git dependencies + "csv-1.1.5" = "sha256-IGfThZankbhI2LsQzJ0TdLhrw3fNlEB2P5pidvPUIxg="; + "io-uring-0.6.3" = "sha256-dAlKSPniUAJdme9HvTg/lr9Zqkl1yOC7xIGoAanl4z8="; }; - src = pkgs.lib.cleanSource ./.; - nativeBuildInputs = with pkgs; [ - pkg-config - ]; - buildInputs = with pkgs; [ - hwloc - ]; - doCheck = false; # do not run tests - }; - packages.default = self.packages.${system}.nperf; - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - cargo - pkg-config - hwloc - ]; }; - } - ); -} \ No newline at end of file + src = pkgs.lib.cleanSource ./.; + nativeBuildInputs = with pkgs; [ + pkg-config + ]; + buildInputs = with pkgs; [ + hwloc + ]; + doCheck = false; # do not run tests + }; + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + clippy + rustfmt + rust-analyzer + rust-toolchain + pkg-config + hwloc + ]; + RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}"; + }; + } + ); +} From f68d4ceffc84e3a0243361acbde5cfb432e7f1fd Mon Sep 17 00:00:00 2001 From: Benedikt Spies Date: Mon, 3 Nov 2025 15:15:01 +0100 Subject: [PATCH 3/3] update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 64d07ce..a674184 100644 --- a/README.md +++ b/README.md @@ -205,4 +205,8 @@ The help message can be shown with `udperf --help`. ## System Design The most important components of udperf are shown in the following component diagram. -![udperf Component Diagram](doc/figures/udperf-component.svg) \ No newline at end of file +![udperf Component Diagram](doc/figures/udperf-component.svg) + +## Run with nix + +`nix run github:PickingUpPieces/udperf -- [OPTIONS] [MODE]`