Skip to content

Commit

Permalink
build: setup nix flake and use it for gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jolars committed Jan 17, 2025
1 parent eb4bf54 commit 54c2e5c
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# shellcheck shell=bash
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
use flake
24 changes: 4 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: teatimeguest/setup-texlive-action@v3
- uses: cachix/install-nix-action@v27
with:
packages: >-
scheme-basic
beamer
biblatex
enumitem
fileinfo
hypdoc
hyperref
l3build
listings
metalogo
parskip
pgf
pgfopts
setspace
xurl
microtype
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: document
run: l3build doc
run: nix develop --command l3build doc
- name: build
run: l3build ctan -q -H --show-log-on-error
run: nix develop --command l3build ctan -q -H --show-log-on-error
release:
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,12 @@ build/
.oc
*.curlopt
*.zip

# nix -----------------------------------------------

# Ignore build outputs from performing a nix-build or `nix build` command
result
result-*

# Ignore direnv folder
.direnv/
64 changes: 64 additions & 0 deletions flake.lock

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

77 changes: 77 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
description = "A basic flake with a shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.systems.url = "github:nix-systems/default";
inputs.flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};

outputs =
{ nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
texlive = pkgs.texlive.combine {
inherit (pkgs.texlive)
scheme-basic
l3build
beamer
biblatex
enumitem
fileinfo
hypdoc
hyperref
listings
metalogo
parskip
pgf
pgfopts
setspace
xurl
microtype
;
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = [
texlive
];
shellHook = ''
export TEXMF="${texlive}/"
'';
};
}
);
}
# {
# inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# flake-utils.url = "github:numtide/flake-utils";
# };
#
# outputs = {
# self,
# nixpkgs,
# flake-utils,
# }:
# flake-utils.lib.eachDefaultSystem (
# system: let
# pkgs = nixpkgs.legacyPackages.${system};
# texlive = pkgs.texlive.combine {inherit (pkgs.texlive) scheme-basic l3build;};
# l3build-wrapped = pkgs.writeShellScriptBin "l3build-wrapped" ''
# # NOTE: the trailing slash in TEXMF is required
# TEXMF="${texlive}/" ${texlive}/bin/l3build "$@"
# '';
# in {
# devShells.default = pkgs.mkShell {
# buildInputs = [
# texlive
# l3build-wrapped
# ];
# };
# }
# );
# }

0 comments on commit 54c2e5c

Please sign in to comment.