Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@
pkgs.flex
pkgs.gmp
pkgs.jemalloc
pkgs.zlib
];

makeFlags = [
# gsim defaults to /bin/bash, which is not guaranteed in NixOS
"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"
];

installPhase = ''
runHook preInstall
install -Dm755 build/gsim/gsim $out/bin/gsim
install -Dm644 include/gsimFst.h $out/include/gsimFst.h
runHook postInstall
'';

Expand Down
Loading