Nix tweaks (#252)

* Pins nixpkgs

* Adds required texlive packages

* Factors texlive out of mkShell

* Sources Python packages from Nix
This commit is contained in:
Joe Kachmar 2020-08-03 01:31:16 -04:00 committed by GitHub
parent 1b53921358
commit f76e9d3ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 109 additions and 62 deletions

8
pinned.nix Normal file
View File

@ -0,0 +1,8 @@
# This commit corresponds to a recent (as of 2 August 2020) pin of the 20.03
# nixpkgs branch.
import (
builtins.fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/7dc4385dc7b5b2c0dbfecd774cebbc87ac05c061.tar.gz";
sha256 = "10xr87ilxypz8fya6q42vsk5rmavv1bjrxhkznr9fvn514am58xb";
}
)

163
shell.nix
View File

@ -1,67 +1,106 @@
{ pkgs ? import <nixpkgs> {} }: with pkgs;
{ pkgs ? import ./pinned.nix {} }:
mkShell {
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ inconsolata-lgc libertine libertinus]; };
buildInputs = [
(texlive.combine {
inherit (texlive)
bookcover
textpos
fgruler
tcolorbox
fvextra
framed
newtx
nowidow
emptypage
wrapfig
subfigure
adjustbox
collectbox
tikz-cd
imakeidx
idxlayout
titlesec
subfiles
lettrine
upquote
libertine
mweights
fontaxes
mdframed
needspace
xifthen
ifnextok
currfile
noindentafter
ifmtarg
scheme-medium
listings
minted
microtype
babel
todonotes
chngcntr
ifplatform
xstring
minifp
titlecaps
enumitem
environ
trimspaces
l3packages;
})
let
#############################################################################
# LaTeX Environment
texliveEnv = pkgs.texlive.combine {
inherit (pkgs.texlive)
bookcover
textpos
fgruler
tcolorbox
fvextra
framed
newtx
nowidow
emptypage
wrapfig
subfigure
adjustbox
collectbox
tikz-cd
imakeidx
idxlayout
titlesec
subfiles
lettrine
upquote
libertine
mweights
fontaxes
mdframed
needspace
xifthen
ifnextok
currfile
noindentafter
ifmtarg
scheme-medium
listings
minted
microtype
babel
todonotes
chngcntr
ifplatform
xstring
minifp
titlecaps
enumitem
environ
trimspaces
l3packages
zref
catchfile
import
;
};
#############################################################################
# Python Environment
# Pin the Python version and its associated package set in a single place.
python = pkgs.python38;
pythonPkgs = pkgs.python38Packages;
pygments-style-github = pythonPkgs.buildPythonPackage rec {
pname = "pygments-style-github";
version = "0.4";
doCheck = false; # Hopefully someone else has run the tests.
src = pythonPkgs.fetchPypi {
inherit pname version;
sha256 = "19zl8l5fyb8z3j8pdlm0zbgag669af66f8gn81ichm3x2hivvjhg";
};
# Anything depending on this derivation is probably also gonna want
# pygments to be available.
propagatedBuildInputs = with pythonPkgs; [ pygments ];
};
pythonEnv = python.withPackages (
pyPkgs: with pyPkgs; [
pygments
pygments-style-github
]
);
in
pkgs.mkShell {
FONTCONFIG_FILE = pkgs.makeFontsConf {
fontDirectories = with pkgs; [ inconsolata-lgc libertine libertinus ];
};
buildInputs = with pkgs; [
# Misc. build tooling.
gnumake
which
git
python3Packages.virtualenv
which
# LaTeX Environment (with all associated libraries and packages).
texliveEnv
# Python Environment (with all associated libraries and packages).
pythonEnv
];
shellHook = ''
# set SOURCE_DATE_EPOCH so that we can use python wheels
SOURCE_DATE_EPOCH=$(date +%s)
virtualenv venv
venv/bin/pip install -v pygments
venv/bin/pip install -v pygments-style-github
source venv/bin/activate
'';
}
}