report/flake.nix

104 lines
2.2 KiB
Nix
Raw Normal View History

2021-04-23 14:47:26 +02:00
{
description = "Ambroisie's CV";
inputs = {
2021-07-20 20:23:54 +02:00
futils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "master";
};
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixpkgs-unstable";
};
2021-07-20 20:25:51 +02:00
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
};
};
2021-04-23 14:47:26 +02:00
};
2021-07-20 20:25:51 +02:00
outputs = { self, futils, nixpkgs, pre-commit-hooks } @ inputs:
futils.lib.eachDefaultSystem (system:
2021-04-23 14:47:26 +02:00
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
buildInputs = with pkgs; [
gnumake
pandoc
2021-08-05 15:11:04 +02:00
pandoc-plantuml-filter
plantuml
2021-04-23 14:47:26 +02:00
(texlive.combine {
inherit (texlive)
2021-07-20 20:28:35 +02:00
scheme-small
# Extra packages needed
changepage
enumitem
placeins
;
2021-04-23 14:47:26 +02:00
})
];
in
{
2021-07-20 20:25:51 +02:00
checks = {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt = {
enable = true;
};
markdown-lint = {
enable = true;
name = "Lint each post's markdown";
entry =
let
pkg = pkgs.nodePackages.markdownlint-cli;
in
"${pkg}/bin/markdownlint";
types = [ "markdown" ];
};
};
};
};
2021-04-23 14:47:26 +02:00
devShell = pkgs.mkShell {
name = "report";
inherit buildInputs;
2021-07-20 20:25:51 +02:00
inherit (self.checks.${system}.pre-commit) shellHook;
2021-04-23 14:47:26 +02:00
};
defaultPackage = pkgs.stdenvNoCC.mkDerivation {
pname = "report";
version = self.rev or "dirty";
src = ./.;
inherit buildInputs;
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out
cp report.pdf $out/
'';
};
}
);
}