diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01ffa392..2c9d12c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,3 +111,15 @@ jobs: run: | sed -i -e "s/--threads [^ ]*/--threads `nproc`/" Makefile make -j `nproc` bolt dutName=ysyx3 + + nix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: cachix/install-nix-action@v31 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Check if nix builds + run: | + nix build .#gsim + nix build .#gsim-static diff --git a/Makefile b/Makefile index ecac6ec5..f59673c8 100644 --- a/Makefile +++ b/Makefile @@ -157,8 +157,9 @@ CXXFLAGS += -ggdb -O3 -MMD $(addprefix -I,$(GSIM_INC_DIR)) -Wall -Werror --std=c GSIM_VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo UNKNOWN) GSIM_BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo UNKNOWN) GSIM_CXX_VERSION ?= $(shell $(CXX) --version 2>/dev/null | head -n 1 || echo UNKNOWN) +GSIM_INCLUDE_DIR ?= $(abspath include) CXXFLAGS += '-DGSIM_VERSION="$(GSIM_VERSION)"' '-DGSIM_BUILD_DATE="$(GSIM_BUILD_DATE)"' '-DGSIM_CXX_VERSION="$(GSIM_CXX_VERSION)"' -CXXFLAGS += '-DGSIM_INCLUDE_DIR="$(abspath include)"' +CXXFLAGS += '-DGSIM_INCLUDE_DIR="$(GSIM_INCLUDE_DIR)"' ifeq ($(DWARF4),1) CXXFLAGS += -gdwarf-4 diff --git a/flake.nix b/flake.nix index 72e824fb..bd148fc3 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,7 @@ pkgs.flex pkgs.gmp pkgs.jemalloc + pkgs.zlib ]; makeFlags = [ @@ -37,6 +38,8 @@ "SHELL=${llvm.stdenv.shell}" # nix builder does not have access to .git, so 'git describe' will fail, we need pass this explicitly "GSIM_VERSION=${version}" + # override GSIM_INCLUDE_DIR to real output path + "GSIM_INCLUDE_DIR=${builtins.placeholder "out"}/include" # override default build target to avoid running tests "build-gsim" ]; @@ -44,6 +47,7 @@ installPhase = '' runHook preInstall install -Dm755 build/gsim/gsim $out/bin/gsim + install -Dm644 include/gsimFst.h $out/include/gsimFst.h runHook postInstall '';