-
Notifications
You must be signed in to change notification settings - Fork 472
add nix flake #11781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sielicki
wants to merge
1
commit into
ofiwg:main
Choose a base branch
from
sielicki:add-nix-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+871
−0
Open
add nix flake #11781
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: Nix Build | ||
| on: [push, pull_request] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30 | ||
| with: | ||
| nix_path: nixpkgs=channel:nixos-unstable | ||
|
|
||
| - uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15 | ||
| with: | ||
| name: nix-community | ||
| authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | ||
| continue-on-error: true | ||
|
|
||
| - name: Build libfabric | ||
| run: nix build .#libfabric -L | ||
|
|
||
| - name: Build all packages | ||
| run: | | ||
| nix build .#cassini-headers -L | ||
| nix build .#libcxi -L | ||
| nix build .#accel-config -L | ||
|
|
||
| - name: Check flake | ||
| run: nix flake check | ||
|
|
||
| devshell: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30 | ||
| with: | ||
| nix_path: nixpkgs=channel:nixos-unstable | ||
|
|
||
| - name: Test devShell | ||
| run: | | ||
| nix develop .#ci --command bash -c ' | ||
| ./autogen.sh | ||
| ./configure --prefix=$PWD/install \ | ||
| --enable-tcp \ | ||
| --enable-udp \ | ||
| --enable-rxm \ | ||
| --enable-shm \ | ||
| --enable-verbs \ | ||
| --enable-efa \ | ||
| --enable-psm3 | ||
| make -j$(nproc) | ||
| make install | ||
| ./install/bin/fi_info -l | ||
| ' | ||
|
|
||
| - name: Upload build logs | ||
| if: failure() | ||
| uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | ||
| with: | ||
| name: nix-devshell-config.log | ||
| path: config.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # Reusable library functions for libfabric Nix packaging | ||
| { lib }: | ||
|
|
||
| { | ||
| # Combine CUDA header packages into a single derivation | ||
| # cuda_runtime.h needs headers from cuda_cccl, crt/ from cuda_nvcc, nvml.h from cuda_nvml_dev | ||
| mkCudaHeaders = pkgs: pkgs.symlinkJoin { | ||
| name = "cuda-headers-combined"; | ||
| paths = [ | ||
| pkgs.cudaPackages.cuda_cudart | ||
| pkgs.cudaPackages.cuda_cccl | ||
| pkgs.cudaPackages.cuda_nvcc | ||
| pkgs.cudaPackages.cuda_nvml_dev.include | ||
sielicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ]; | ||
| }; | ||
|
|
||
| # Get ROCm runtime if available on the platform (x86_64-linux only) | ||
| getRocmRuntime = pkgs: | ||
| if pkgs.stdenv.hostPlatform.isx86_64 | ||
| then pkgs.rocmPackages.clr | ||
| else null; | ||
|
|
||
| # Conditionally return a value only on Linux | ||
| linuxOnly = pkgs: value: | ||
| if pkgs.stdenv.hostPlatform.isLinux then value else null; | ||
|
|
||
| # Generate cross-compiled package attributes with a prefix | ||
| # packages: attrset of packages | ||
| # prefix: string prefix for attribute names (e.g., "cross-aarch64-linux") | ||
| # names: list of package names to include | ||
| mkCrossPackageAttrs = { packages, prefix, names }: | ||
| lib.listToAttrs (map (name: { | ||
| name = "${prefix}-${name}"; | ||
| value = packages.${name}; | ||
| }) names); | ||
|
|
||
| # Create a cross-compilation dev shell | ||
| # Note: Linux-only deps (numactl, libnl, rdma-core) come via inputsFrom | ||
| mkCrossShell = { crossPkgs, crossPackages, arch }: | ||
| crossPkgs.mkShell { | ||
| name = "libfabric-cross-${arch}"; | ||
| packages = with crossPkgs; [ | ||
| autoconf | ||
| automake | ||
| libtool | ||
| pkg-config | ||
| libuuid | ||
| curl | ||
| ]; | ||
| inputsFrom = [ crossPackages.libfabric ]; | ||
| shellHook = '' | ||
| echo "Cross-compilation shell: ${arch}" | ||
| echo "Target: ${crossPkgs.stdenv.hostPlatform.config}" | ||
| ''; | ||
| }; | ||
|
|
||
| # Dependencies that need native packages when cross-compiling | ||
| # Returns an attrset to merge with callPackage args | ||
| crossDepsForLibcxi = { nativePkgs, mkCudaHeaders }: | ||
| { | ||
| lm_sensors = nativePkgs.lm_sensors; | ||
| criterion = nativePkgs.criterion; | ||
| fuse = nativePkgs.fuse; | ||
| cuda_cudart = mkCudaHeaders nativePkgs; | ||
| level-zero = nativePkgs.level-zero; | ||
| rocm-runtime = | ||
| if nativePkgs.stdenv.hostPlatform.isx86_64 | ||
| then nativePkgs.rocmPackages.clr | ||
| else null; | ||
| }; | ||
|
|
||
| crossDepsForLibfabric = { nativePkgs, mkCudaHeaders }: | ||
| { | ||
| numactl = nativePkgs.numactl; | ||
| lttng-ust = nativePkgs.lttng-ust; | ||
| rdma-core = nativePkgs.rdma-core; | ||
| liburing = nativePkgs.liburing; | ||
| libnl = nativePkgs.libnl; | ||
| # DSA/idxd is x86-only (uses immintrin.h) | ||
| idxd-config = null; | ||
| cuda_cudart = mkCudaHeaders nativePkgs; | ||
| gdrcopy = nativePkgs.cudaPackages.gdrcopy or null; | ||
| rocm-runtime = | ||
| if nativePkgs.stdenv.hostPlatform.isx86_64 | ||
| then nativePkgs.rocmPackages.clr | ||
| else null; | ||
| level-zero = nativePkgs.level-zero; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| { | ||
| lib, | ||
| stdenv, | ||
| fetchFromGitHub, | ||
| autoreconfHook, | ||
| pkg-config, | ||
| libuuid, | ||
| json_c, | ||
| systemdLibs ? null, | ||
| kmod, | ||
| }: | ||
|
|
||
| stdenv.mkDerivation rec { | ||
| pname = "accel-config"; | ||
| version = "4.1.9"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "intel"; | ||
| repo = "idxd-config"; | ||
| rev = "accel-config-v${version}"; | ||
| hash = "sha256-uV6cOha+g5fZBq+ucrNmfUW+3gQzX9BKGYvYaeCYv40="; | ||
| }; | ||
|
|
||
| nativeBuildInputs = [ | ||
| autoreconfHook | ||
| pkg-config | ||
| ]; | ||
|
|
||
| buildInputs = [ | ||
| libuuid | ||
| json_c | ||
| kmod | ||
| ] ++ lib.optionals (systemdLibs != null) [ | ||
| systemdLibs | ||
| ]; | ||
|
|
||
| configureFlags = [ | ||
| "--disable-test" | ||
| "--disable-docs" | ||
| ] ++ lib.optionals (systemdLibs == null) [ | ||
| "--disable-systemd" | ||
| ]; | ||
|
|
||
| # Create version.m4 which is normally generated from git, and make | ||
| # git-version-gen a no-op so it doesn't overwrite during build | ||
| postPatch = '' | ||
| echo "m4_define([GIT_VERSION], [${version}])" > version.m4 | ||
| cat > git-version-gen <<'EOF' | ||
| #!/bin/sh | ||
| exit 0 | ||
| EOF | ||
| chmod +x git-version-gen | ||
| ''; | ||
|
|
||
| enableParallelBuilding = true; | ||
|
|
||
| meta = with lib; { | ||
| description = "Utility for controlling and configuring Intel DSA and IAA accelerators"; | ||
| homepage = "https://github.com/intel/idxd-config"; | ||
| license = licenses.lgpl21Plus; | ||
| platforms = platforms.linux; | ||
| maintainers = with maintainers; [ ]; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| lib, | ||
| stdenvNoCC, | ||
| fetchFromGitHub, | ||
| }: | ||
|
|
||
| stdenvNoCC.mkDerivation rec { | ||
| pname = "cassini-headers"; | ||
| version = "13.0.0"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "HewlettPackard"; | ||
| repo = "shs-cassini-headers"; | ||
| rev = "release/shs-${version}"; | ||
| hash = "sha256-Fh8RZFAcqbEcbHCmSFNoIcbHP7uC/CovVdkgAA7SpNQ="; | ||
| }; | ||
|
|
||
| dontBuild = true; | ||
|
|
||
| installPhase = '' | ||
| runHook preInstall | ||
| mkdir -p $out/include $out/share | ||
| cp -r include/* $out/include/ | ||
| # Copy share directory (contains csr_defs.json needed by libcxi build) | ||
| cp -r share/* $out/share/ | ||
| runHook postInstall | ||
| ''; | ||
|
|
||
| meta = with lib; { | ||
| description = "Hardware definitions and C headers for HPE Cassini/Slingshot network interconnect"; | ||
| homepage = "https://github.com/HewlettPackard/shs-cassini-headers"; | ||
| license = with licenses; [ gpl2 bsd2 ]; | ||
| platforms = platforms.linux; | ||
| maintainers = with maintainers; [ ]; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| lib, | ||
| stdenvNoCC, | ||
| fetchFromGitHub, | ||
| }: | ||
|
|
||
| stdenvNoCC.mkDerivation rec { | ||
| pname = "cxi-driver-headers"; | ||
| version = "13.0.0"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "HewlettPackard"; | ||
| repo = "shs-cxi-driver"; | ||
| rev = "release/shs-${version}"; | ||
| hash = "sha256-kJNKuvg0x6gGMPlz1y5EiRReSOqx65dmmdwfqGpVptU="; | ||
| }; | ||
|
|
||
| dontBuild = true; | ||
|
|
||
| installPhase = '' | ||
| runHook preInstall | ||
| mkdir -p $out/include | ||
| cp -r include/* $out/include/ | ||
| runHook postInstall | ||
| ''; | ||
|
|
||
| meta = with lib; { | ||
| description = "UAPI headers for HPE CXI driver (Slingshot)"; | ||
| homepage = "https://github.com/HewlettPackard/shs-cxi-driver"; | ||
| license = licenses.gpl2; | ||
| platforms = platforms.linux; | ||
| maintainers = with maintainers; [ ]; | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.