diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..a6ee435c --- /dev/null +++ b/.envrc @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cd9146f..030e6af1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.gitignore b/.gitignore index 9d25d3fe..f754ad7c 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..f8b21860 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1737003892, + "narHash": "sha256-RCzJE9wKByLCXmRBp+z8LK9EgdW+K+W/DXnJS4S/NVo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ae06b9c2d83cb5c8b12d7d0e32692e93d1379713", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..39d15d80 --- /dev/null +++ b/flake.nix @@ -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 +# ]; +# }; +# } +# ); +# }