Skip to content

Commit

Permalink
Merge pull request #22 from johnalotoski/nix-flake
Browse files Browse the repository at this point in the history
Add a nix flake with blockperf package and ci action
  • Loading branch information
oversize committed Feb 1, 2024
2 parents b37ec42 + 0e432c4 commit 1178239
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Nix
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v25
- name: Nix version
run: nix --version
- name: Nix build
run: nix build -L .#blockperf
64 changes: 64 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
description = "Cardano Blockperf";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs = inputs @ {flake-parts, ...}:
with builtins;
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "x86_64-darwin"];
perSystem = {
config,
pkgs,
lib,
...
}:
with pkgs.python3Packages; {
packages.blockperf = buildPythonApplication {
pname = "blockperf";

version = let
initFile = readFile ./src/blockperf/__init__.py;
initVersion = head (match ".*__version__ = \"([[:digit:]]\.[[:digit:]]\.[[:digit:]]).*" initFile);
in "${initVersion}-${inputs.self.shortRev or "dirty"}";

pyproject = true;
src = ./.;

propagatedBuildInputs = [
paho-mqtt
psutil
setuptools
];

meta = with lib; {
description = "Cardano BlockPerf";
homepage = "https://github.com/cardano-foundation/blockperf";
license = licenses.mit;
};
};
};
};
}

0 comments on commit 1178239

Please sign in to comment.