gray/default.nix
Michele Guerini Rocco cd6966f1b4
default.nix: prevent nixpkgs tarball GC
When adding a GC root with `nix-build -A inputDerivation` the Nixpkgs
tarball wasn't being saved because it's technically not a build input.
2022-05-11 01:15:08 +02:00

73 lines
1.8 KiB
Nix

{ static ? false }:
let
# Pinned Nixpkgs for reproducibility
nixpkgs = builtins.fetchTarball
{ name = "nixpkgs-21.05-ee90403e147";
url = "https://github.com/nixos/nixpkgs/archive/ee90403e147.tar.gz";
sha256 = "1mk3s4ncfa8z8mr6vrgjh74s8dci12yam7plpc1bqgz12wld73ax";
};
# Needed for HTML manual
katex = builtins.fetchTarball {
url = "https://github.com/KaTeX/KaTeX/releases/download/v0.15.1/katex.tar.gz";
sha256 = "007nv11r0z9fz593iwzn55nc0p0wj5lpgf0k2brhs1ynmikq9gjr";
};
# Exclude this file and build artifacts
source = builtins.filterSource
(path: type:
!builtins.elem path [ "configure.mk" "default.nix" "result" ]
&& baseNameOf path != "build") ./.;
inherit (import nixpkgs {}) lib pkgs;
in
pkgs.stdenv.mkDerivation rec {
pname = "gray";
version = "0.1";
src = source;
nativeBuildInputs = with pkgs; [
# fortran
gfortran
# debugging
makefile2graph graphviz
# documentation
help2man pandoc
haskellPackages.pandoc-crossref
(texlive.combine {
inherit (texlive) scheme-small xetex fontspec;
})
# save nixpkgs tarball from gc
nixpkgs
];
buildInputs = lib.optional static pkgs.glibc.static;
# fonts needed for the PDF manual
FONTCONFIG_FILE = pkgs.makeFontsConf {
fontDirectories = with pkgs; [ fira-mono libertinus ];
};
enableParallelBuilding = true;
hardeningDisable = [ "format" ];
configureFlags = [
(lib.enableFeature static "static")
"--with-katex=${katex}"
"GIT_REV=${version}"
"GIT_DIRTY="
];
meta = {
homepage = "https://doi.org/10.13182/FST07-A1494";
description = "A quasi-optical beam-tracing code for EC waves in tokamaks";
platforms = lib.platforms.unix;
# license?
};
}