Skip to content

Commit

Permalink
update flake
Browse files Browse the repository at this point in the history
  • Loading branch information
foolnotion committed Jun 1, 2024
1 parent 716385b commit de193cd
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 92 deletions.
69 changes: 26 additions & 43 deletions flake.lock

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

111 changes: 62 additions & 49 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,59 +1,72 @@
{
description = "vstat dev";

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.foolnotion.url = "github:foolnotion/nur-pkg";
inputs.nixpkgs.url = "github:nixos/nixpkgs/master";

outputs = { self, flake-utils, nixpkgs, foolnotion }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ foolnotion.overlay ];
};
stdenv_ = pkgs.llvmPackages_18.stdenv;
pythonVersion = "${pkgs.python3.sourceVersion.major}.${pkgs.python3.sourceVersion.minor}";
nanobind = pkgs.python3Packages.nanobind;
in
rec {
devShells.default = stdenv_.mkDerivation {
name = "vstat-dev";
hardeningDisable = [ "all" ];
impureUseNativeOptimizations = true;
nativeBuildInputs = with pkgs; [
cmake
clang_18
clang-tools_18
cppcheck
gdb
doxygen
valgrind
nanobind
];
buildInputs = packages.default.buildInputs
++ (with pkgs; [ boost doctest gsl linasm pkg-config ]);
};
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
foolnotion.url = "github:foolnotion/nur-pkg";
nixpkgs.url = "github:nixos/nixpkgs/master";
foolnotion.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = inputs@{ self, flake-parts, nixpkgs, foolnotion }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-darwin" ];

perSystem = { pkgs, system, ... }:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ foolnotion.overlay ];
};
stdenv = pkgs.llvmPackages_18.stdenv;
pythonVersion = "${pkgs.python3.sourceVersion.major}.${pkgs.python3.sourceVersion.minor}";
nanobind = pkgs.python3Packages.nanobind.overridePythonAttrs(old: { doCheck = false; });
in
rec {
devShells.default = stdenv.mkDerivation {
name = "vstat-dev";
hardeningDisable = [ "all" ];
impureUseNativeOptimizations = true;
nativeBuildInputs = with pkgs; [
cmake
clang_18
clang-tools_18
cppcheck
gdb
doxygen
valgrind
nanobind
];
buildInputs = packages.default.buildInputs
++ (with pkgs; [ boost doctest gsl linasm pkg-config ]);
};

packages.default = stdenv_.mkDerivation {
name = "vstat";
packages.vstat = stdenv.mkDerivation {
name = "vstat";
src = self;
nativeBuildInputs = with pkgs; [ cmake ];
buildInputs = with pkgs; [ eve ];

src = self;
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=${
if pkgs.stdenv.hostPlatform.isx86_64 then "-march=x86-64" else ""
}"
];
};

nativeBuildInputs = with pkgs; [ cmake ];
packages.vstat-python = stdenv.mkDerivation {
name = "vstat";
src = self;
nativeBuildInputs = with pkgs; [ cmake ];
buildInputs = packages.vstat.buildInputs ++ [ nanobind ];

buildInputs = with pkgs; [
eve
nanobind
];
cmakeFlags = packages.vstat.cmakeFlags ++ [
"-Dvstat_BUILD_PYTHON=ON"
"-DCMAKE_PREFIX_PATH=${nanobind}/lib/python${pythonVersion}/site-packages"
];
};

cmakeFlags = [
"-Dvstat_BUILD_PYTHON=ON"
"-DCMAKE_CXX_FLAGS=${
if pkgs.stdenv.hostPlatform.isx86_64 then "-march=x86-64" else ""
}"
"-DCMAKE_PREFIX_PATH=${nanobind}/lib/python${pythonVersion}/site-packages"
];
packages.default = packages.vstat;
};
});
};
}

0 comments on commit de193cd

Please sign in to comment.