nix test
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 34s Details
Nix Build / test (push) Failing after 45s Details

This commit is contained in:
Paul Zinselmeyer 2023-11-23 12:19:46 +01:00
parent 8c7c698601
commit 0c8b1045b4
4 changed files with 105 additions and 0 deletions

12
.gitea/workflows/nix.yaml Normal file
View File

@ -0,0 +1,12 @@
name: "Nix Build"
on:
pull_request:
push:
jobs:
test:
runs-on: debian-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- run: nix build
- run: nix flake check

5
01/abgabe.tex Normal file
View File

@ -0,0 +1,5 @@
\documentclass[ngerman]{article}
\begin{document}
Hello, World!
\end{document}

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1700501263,
"narHash": "sha256-M0U063Ba2DKL4lMYI7XW13Rsk5tfUXnIYiAVa39AV/0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f741f8a839912e272d7e87ccf4b9dbc6012cdaf9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

61
flake.nix Normal file
View File

@ -0,0 +1,61 @@
{
description = "LaTeX Documents";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
};
outputs = { self, nixpkgs }: let
assignments = [
"01"
];
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
] (system: function {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
});
forAllAssignments = function:
nixpkgs.lib.genAttrs assignments (assignment: function assignment);
texPackages = pkgs: pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-minimal latex-bin latexmk;
};
in rec {
packages = forAllSystems({system, pkgs}: forAllAssignments(assignment: let
tex = texPackages pkgs;
document = pkgs.stdenvNoCC.mkDerivation rec {
name = assignment;
src = self;
buildInputs = [ pkgs.coreutils tex ];
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
mkdir -p .cache/texmf-var
cd "./${assignment}"
env TEXMFHOME=.cache TEXMFVAR=.cache/texmf-var \
latexmk -interaction=nonstopmode -pdf -lualatex \
"./abgabe.tex"
'';
installPhase = ''
mkdir -p $out
cp abgabe.pdf $out/
'';
};
in document) // {
default = packages.${system}.${pkgs.lib.last assignments};
});
devShells = forAllSystems({pkgs, ...}: let
tex = texPackages pkgs;
in {
default = pkgs.mkShell {
packages = [ pkgs.coreutils tex ];
};
});
hydraJobs = packages;
};
}