Skip to content

Commit

Permalink
Update to nixos 23.11
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Apr 7, 2024
1 parent 6ec0152 commit 3467eec
Show file tree
Hide file tree
Showing 11 changed files with 561 additions and 348 deletions.
1 change: 1 addition & 0 deletions .envrc
@@ -0,0 +1 @@
use flake
84 changes: 61 additions & 23 deletions .github/workflows/ci.yml
Expand Up @@ -5,8 +5,7 @@ on:
branches:
- master
- dev-1.x
- github-actions
- ci
- develop
pull_request:
branches:
- master
Expand All @@ -18,9 +17,9 @@ jobs:
fail-fast: false
matrix:
DISTRO:
- "ubuntu-18.04"
- "ubuntu-20.04"
- "ubuntu-22.04"
- "ubuntu-latest"
CC:
- "gcc"
- "clang"
Expand Down Expand Up @@ -55,9 +54,9 @@ jobs:
fail-fast: false
matrix:
DISTRO:
- "ubuntu-18.04"
- "ubuntu-20.04"
- "ubuntu-22.04"
- "ubuntu-latest"
CC:
- "gcc"
# - "clang"
Expand Down Expand Up @@ -153,26 +152,65 @@ jobs:
echo "-- END";
done
nix:
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-22.11
- run: nix-build
- run: nix-build nix/ci.nix
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v26
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
nix-flake:
runs-on: ubuntu-latest
nix:
name: "nix (${{ matrix.name }})"
runs-on: ${{ matrix.os }}
needs: nix-matrix
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-22.11
- run: nix build -L
- run: nix flake check -L
- uses: actions/checkout@v4

- name: Set Up Build Cache
uses: actions/cache@v4
id: nix-cache
with:
path: /tmp/nix-store.nar
key: nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.attr }}
restore-keys: |
nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-${{ matrix.attr }}
nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.lock') }}-
nix-store.nar-${{ runner.os }}-
- uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-23.11
extra_nix_config: "system-features = nixos-test benchmark big-parallel kvm"

- name: Import Nix Store Cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: |
nix-store --import < /tmp/nix-store.nar
- run: sudo sysctl -w kernel.perf_event_paranoid=1

- run: nix build -L ".#${{ matrix.attr }}"

# - run: nix flake check -L

# broken sigh
# - name: Export Nix Store Cache
# shell: bash
# # partially based on https://github.com/NixOS/nix/issues/1245#issuecomment-282586759
# run: |
# drv="$(nix-store -qd "$(readlink result)")"
# drvRefs="$( echo "$drv" | xargs nix-store -q --references )"
# ( echo "$drvRefs" | grep '[.]drv$' | xargs nix-store -q --outputs ;
# echo "$drvRefs" | grep -v '[.]drv$' ) | \
# xargs nix-store -r | \
# xargs nix-store -qR |
# xargs nix-store --export > /tmp/nix-store.nar
4 changes: 1 addition & 3 deletions .github/workflows/docker.yml
Expand Up @@ -4,9 +4,7 @@ on:
push:
branches:
- master
- ci
- github-actions
# - dev-1.x
- develop

jobs:
publish_alpine_docker_hub:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -77,3 +77,6 @@ stamp-h2

# valgrind?
vgcore.*

# nix
.direnv
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -88,7 +88,8 @@ docker pull docker.pkg.github.com/jbboehr/handlebars.c/handlebarsc:latest

## Usage

```
```console
$ handlebarsc --help
Usage: handlebarsc [OPTIONS]
Example: handlebarsc -t foo.hbs -D bar.json

Expand Down
84 changes: 42 additions & 42 deletions default.nix
@@ -1,47 +1,47 @@
{ pkgs ? (import <nixpkgs> { })
, stdenv ? pkgs.stdenv
, gitignoreSource ? (import
(pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore";
rev = "00b237fb1813c48e20ee2021deb6f3f03843e9e4";
sha256 = "sha256:186pvp1y5fid8mm8c7ycjzwzhv7i6s3hh33rbi05ggrs7r3as3yy";
})
{ inherit (pkgs) lib; }).gitignoreSource
, mustache_spec ? pkgs.callPackage
(import (
(fetchTarball {
url = "https://github.com/jbboehr/mustache-spec/archive/5b85c1b58309e241a6f7c09fa57bd1c7b16fa9be.tar.gz";
sha256 = "1h9zsnj4h8qdnzji5l9f9zmdy1nyxnf8by9869plyn7qlk71gdyv";
{
pkgs ? (import <nixpkgs> {}),
stdenv ? pkgs.stdenv,
gitignoreSource ?
(import
(pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore";
rev = "00b237fb1813c48e20ee2021deb6f3f03843e9e4";
sha256 = "sha256:186pvp1y5fid8mm8c7ycjzwzhv7i6s3hh33rbi05ggrs7r3as3yy";
})
))
{ }
, handlebars_spec ? pkgs.callPackage
(import (
(fetchTarball {
url = "https://github.com/jbboehr/handlebars-spec/archive/3eb919f19988f37a539779c08342d2ce50aa75d0.tar.gz";
sha256 = "088qzggkgl1v1a15l1plxdwiphh773q50k3w4pj0v45qc1cgyr7c";
})
))
{ }
, checkSupport ? true
, cmakeSupport ? false
, debugSupport ? false
, devSupport ? false
, doxygenSupport ? false
, hardeningSupport ? true
, jsonSupport ? true
, lmdbSupport ? true
, ltoSupport ? false
, noRefcountingSupport ? false
, pthreadSupport ? true
, sharedSupport ? true
, staticSupport ? true
, WerrorSupport ? false
, valgrindSupport ? false
, yamlSupport ? true
{inherit (pkgs) lib;})
.gitignoreSource,
mustache_spec ?
pkgs.callPackage
(import (fetchTarball {
url = "https://github.com/jbboehr/mustache-spec/archive/5b85c1b58309e241a6f7c09fa57bd1c7b16fa9be.tar.gz";
sha256 = "1h9zsnj4h8qdnzji5l9f9zmdy1nyxnf8by9869plyn7qlk71gdyv";
}))
{},
handlebars_spec ?
pkgs.callPackage
(import (fetchTarball {
url = "https://github.com/jbboehr/handlebars-spec/archive/3eb919f19988f37a539779c08342d2ce50aa75d0.tar.gz";
sha256 = "088qzggkgl1v1a15l1plxdwiphh773q50k3w4pj0v45qc1cgyr7c";
}))
{},
checkSupport ? true,
cmakeSupport ? false,
debugSupport ? false,
devSupport ? false,
doxygenSupport ? false,
hardeningSupport ? true,
jsonSupport ? true,
lmdbSupport ? true,
ltoSupport ? false,
noRefcountingSupport ? false,
pthreadSupport ? true,
sharedSupport ? true,
staticSupport ? true,
WerrorSupport ? false,
valgrindSupport ? false,
yamlSupport ? true,
}:

pkgs.callPackage ./nix/derivation.nix {
inherit stdenv gitignoreSource;
inherit mustache_spec handlebars_spec;
Expand Down

0 comments on commit 3467eec

Please sign in to comment.