Skip to content

Commit

Permalink
Enable easily citing RFCs
Browse files Browse the repository at this point in the history
Nix (with flakes) has an annoying behaviour where a Git subproject won't automatically be available, so a workaround is required.
See NixOS/nix#5284 and NixOS/nix#12421.
  • Loading branch information
Luflosi committed Feb 7, 2025
1 parent 80a8288 commit 94263eb
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "report/rfc.bib"]
path = report/rfc.bib
url = https://github.com/ichdasich/rfc.bib.git
19 changes: 18 additions & 1 deletion flake.lock

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

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";

rfc-bib = {
url = "git+file:report/rfc.bib";
flake = false;
};
};

outputs = { self, ... }@inputs: let
Expand Down Expand Up @@ -84,6 +89,7 @@
inherit measurements;
report = import ./report/build-document.nix {
inherit lib pkgs;
inherit (inputs) rfc-bib;
texlive = get-latex-packages pkgs;
shellEscape = true;
minted = true;
Expand Down
22 changes: 17 additions & 5 deletions report/build-document.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

{ lib
, pkgs
, rfc-bib

# Name of the final pdf file
, name ? "document.pdf"
Expand Down Expand Up @@ -52,17 +53,28 @@ let
extraFlags
(lib.optional shellEscape "-shell-escape")
];
report-src = fs.toSource {
root = ./.;
fileset = fs.unions [
./.latexmkrc
(fs.fileFilter (file: file.hasExt "tex" || file.hasExt "eps" || file.hasExt "sty" || file.hasExt "bib" || file.hasExt "dbx") ./.)
];
};
rfc-bib-src = pkgs.linkFarm "rfc.bib-src" [{
name = "rfc.bib";
path = rfc-bib;
}];
in

assert minted -> shellEscape;

pkgs.stdenvNoCC.mkDerivation rec {
inherit name;
src = fs.toSource {
root = ./.;
fileset = fs.unions [
./.latexmkrc
(fs.fileFilter (file: file.hasExt "tex" || file.hasExt "eps" || file.hasExt "sty" || file.hasExt "bib" || file.hasExt "dbx") ./.)
src = pkgs.symlinkJoin {
name = "combined-report-src";
paths = [
report-src
rfc-bib-src
];
};

Expand Down
1 change: 1 addition & 0 deletions report/header.tex
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
\input{Environments.tex}

\addbibresource{bibliography.bib}
\addbibresource{rfc.bib/rfc.bib}

%% Geometrie
\newdimen\lines
Expand Down
1 change: 1 addition & 0 deletions report/rfc.bib
Submodule rfc.bib added at fbf63f

0 comments on commit 94263eb

Please sign in to comment.