Skip to content

Commit

Permalink
nix derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
siph committed May 12, 2023
1 parent ad1b5be commit 4b81793
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ jobs:
- uses: cachix/install-nix-action@v19
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Stage
run: mkdir out
- name: Generate HTML
run: |
nix develop --command \
pandoc resume.md -t html -f markdown -c style.css --self-contained -o out/${{ github.actor }}_resume.html
- name: Generate PDF
- name: Build Resumes
run: |
nix develop --command \
wkhtmltopdf --enable-local-file-access out/${{ github.actor }}_resume.html out/${{ github.actor }}_resume.pdf
mkdir out
nix build
cp result/resume/resume.html out/${{ github.actor}}_resume.html
cp result/resume/resume.pdf out/${{ github.actor}}_resume.pdf
cp result/resume/resume.md out/${{ github.actor}}_resume.md
- name: Store Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
35 changes: 28 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,35 @@
permittedInsecurePackages = [ "qtwebkit-5.212.0-alpha4" ];
};
};
in rec {
devShell = with pkgs;
mkShell {
buildInputs = [
pandoc
wkhtmltopdf-bin
];
buildInputs = with pkgs; [
pandoc
wkhtmltopdf-bin
];
in with pkgs; {
packages = {
default = stdenv.mkDerivation {
inherit buildInputs;
name = "resume_md";
src = ./.;
buildPhase = ''
pandoc resume.md \
-t html -f markdown \
-c style.css --self-contained \
-o resume.html
wkhtmltopdf --enable-local-file-access \
resume.html \
resume.pdf
'';
installPhase = ''
mkdir -p $out/resume
cp resume.* $out/resume/
'';
};
};
devShell = mkShell {
inherit buildInputs;
};
});
}

0 comments on commit 4b81793

Please sign in to comment.