aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2025-09-06 15:26:03 -0700
committerFranck Cuny <franck@fcuny.net>2025-09-06 15:26:03 -0700
commit25fa2237ba8a96a86bf5db30baa597a5b25168d7 (patch)
treed1c6fe71973d532bed4d05b29f995abcc3d4623d /flake.nix
parentconvert index from markdown to org (diff)
downloadfcuny.net-25fa2237ba8a96a86bf5db30baa597a5b25168d7.tar.gz
generate the site and the resume using pandoc
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix90
1 files changed, 34 insertions, 56 deletions
diff --git a/flake.nix b/flake.nix
index c1ca52c..fb3b89f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -5,7 +5,6 @@
nixpkgs.url = "https://channels.nixos.org/nixos-25.05-small/nixexprs.tar.xz";
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
- devshell.url = "github:numtide/devshell";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
@@ -15,7 +14,6 @@
nixpkgs,
flake-utils,
pre-commit-hooks,
- devshell,
treefmt-nix,
}:
flake-utils.lib.eachDefaultSystem (
@@ -23,32 +21,37 @@
let
pkgs = import nixpkgs {
inherit system;
- overlays = [
- devshell.overlays.default
- ];
};
-
- treefmt = (
- treefmt-nix.lib.mkWrapper pkgs {
- projectRootFile = "flake.nix";
- programs = {
- actionlint.enable = true;
- deadnix.enable = true;
- jsonfmt.enable = true;
- just.enable = true;
- nixfmt.enable = true;
- prettier.enable = true;
- taplo.enable = true;
- typos.enable = true;
- };
- settings.formatter.typos.excludes = [
- "*.jpeg"
- "*.jpg"
- ];
- }
- );
+ treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
+ texlive = pkgs.texlive.combine { inherit (pkgs.texlive) scheme-context; };
in
{
+ # for `nix fmt`
+ formatter = treefmtEval.config.build.wrapper;
+
+ # for `nix flake check`
+ checks = {
+ # Throws an error if any of the source files are not correctly formatted
+ # when you run `nix flake check --print-build-logs`. Useful for CI
+ treefmt = treefmtEval.config.build.check self;
+ pre-commit-check = pre-commit-hooks.lib.${system}.run {
+ src = ./.;
+ hooks = {
+ format = {
+ enable = true;
+ name = "Format with treefmt";
+ pass_filenames = true;
+ entry = "${treefmtEval.config.build.wrapper}/bin/treefmt";
+ stages = [
+ "pre-commit"
+ "pre-push"
+ ];
+ };
+ };
+ };
+ };
+
+ # for `nix build`
packages = {
default =
with pkgs;
@@ -57,48 +60,23 @@
version = self.lastModifiedDate;
src = ./.;
buildInputs = [
- zola
- git
+ pandoc
+ texlive
];
buildPhase = ''
mkdir -p $out
- ${pkgs.zola}/bin/zola build -o $out -f
+ pandoc --embed-resources -s src/index.org --css=src/css/main.css -t html -o $out/index.html
+ pandoc --pdf-engine=context src/resume.org -o $out/resume.pdf
'';
dontInstall = true;
};
};
- formatter = treefmt;
-
- checks = {
- pre-commit-check = pre-commit-hooks.lib.${system}.run {
- src = ./.;
- hooks = {
- treefmt = {
- enable = true;
- excludes = [ ".*" ];
- };
- check-merge-conflicts.enable = true;
- end-of-file-fixer.enable = true;
- };
- };
- };
-
- devShells.default = pkgs.devshell.mkShell {
- name = "zola";
+ devShells.default = pkgs.mkShell {
+ inherit (self.checks.${system}.pre-commit-check) shellHook;
packages = with pkgs; [
- zola
git
treefmt
- lychee
- just
- ];
- devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-check.shellHook;
- env = [
- {
- name = "DEVSHELL_NO_MOTD";
- value = "1";
- }
];
};
}