-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
65 lines (58 loc) · 2.17 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
description = "Your personal jsonresume built with Nix";
inputs.jsonresume-nix.url = "github:TaserudConsulting/jsonresume-nix";
inputs.jsonresume-nix.inputs.flake-utils.follows = "flake-utils";
inputs.flake-utils.url = "flake-utils";
outputs =
{ jsonresume-nix
, self
, flake-utils
, nixpkgs
, ...
} @ inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
in
{
# Specify formatter package for "nix fmt ." and "nix fmt . -- --check"
formatter = pkgs.alejandra;
# Specify the builder package to use to build your resume, this
# will decide which theme to use.
#
# To show available packaged themes:
# nix flake show github:TaserudConsulting/jsonresume-nix
#
# If you miss a theme, consider opening a pull request :)
packages = {
builder = jsonresume-nix.packages.${system}.resumed-elegant;
inherit (jsonresume-nix.packages.${system}) fmt-as-json;
# Build production build
#
# This may need customizations, such as using the correct file
# format and copying other resources (such as images).
default = pkgs.runCommand "resume" { } ''
ln -s ${./resume.json} resume.json
HOME=$(mktemp -d) ${self.packages.${system}.builder}
mkdir $out
cp -v resume.html $out/index.html
# Copy other resources such as images here...
'';
};
# Allows to run a live preview server using "nix run .#live"
apps = {
live.type = "app";
live.program = builtins.toString (pkgs.writeShellScript "entr-reload" ''
${self.packages.${system}.builder}
${lib.getExe pkgs.nodePackages.live-server} \
--watch=resume.html --open=resume.html --wait=300 &
printf "\n%s" resume.{toml,nix,json} |
${lib.getExe pkgs.xe} -s 'test -f "$1" && echo "$1"' |
${lib.getExe pkgs.entr} -p ${self.packages.${system}.builder}
'');
};
})
// { inherit inputs; };
}