8000 build: Provide a reproducible env using nix flake by nosamad · Pull Request #563 · posquit0/Awesome-CV · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

build: Provide a reproducible env using nix flake #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
insert_final_newline = false

[*.nix]
indent_style = space
indent_size = 2

# Match diffs, avoid to trim trailing whitespace
[*.{diff,patch}]
trim_trailing_whitespace = false

[*.{vim,sh,bats}]
indent_style = space
indent_size = 4
max_line_length = 80

[*.{yml,json}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab

[*.{mk}]
indent_style = tab

[*.tex]
indent_style = space
indent_size = 2

5 changes: 5 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# shellcheck shell=bash
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
use flake
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/.direnv
/outputs
/result

### TeX ###
## Core latex/pdflatex auxiliary files:
*.aux
Expand Down
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"recommendations": [
"editorconfig.editorconfig",
"mhutchie.git-graph",
"donjayamanne.githistory",
"codezombiech.gitignore",
"waderyan.gitblame",
"gruntfuggly.todo-tree",
"bbenoist.nix",
"ms-vscode.makefile-tools",
"tomoki1207.pdf"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editorconfig.generateAuto": false
}
File renamed without changes.
180 changes: 166 additions & 14 deletions Makefile
39 changes: 27 additions & 12 deletions awesome-cv.cls
Original file line number Diff line number Diff line change
@@ -1,22 +1,174 @@
.DEFAULT_GOAL := all
.SHELLFLAGS := -e -c
SHELL := $(shell command -v sh)

## Enviroment overridable variables
out ?= $(CURDIR)/outputs
src ?= $(CURDIR)

CURDIR ?= {PWD}
VERBOSE ?= 1
FORCE ?= 0
LANG ?= C.UTF-8
XETEX ?= xelatex

### Installation paths
DOCDIR ?= share/doc/awesome-cv
EXAMPLEDIR ?= $(addsuffix /examples,$(DOCDIR))
DESTDIR ?= /usr/local

## Commandline overridable
SRC = $(src)
OUT = $(out)

### Internal variables
examples_dir = $(src)/examples

coverletter_dir = $(examples_dir)
coverletter_srcs =
coverletter_srcs += $(coverletter_dir)/coverletter.tex
coverletter_srcs += $(src)/awesome-cv.cls
coverletter_deps = $(patsubst $(src)/%,$(out)/%,$(coverletter_srcs))

resume_dir = $(examples_dir)/resume
resume_srcs =
resume_srcs += $(shell find "$(resume_dir)" -name "*.tex")
resume_srcs += $(src)/awesome-cv.cls
resume_deps = $(patsubst $(src)/%,$(out)/%,$(resume_srcs))

cv_dir = $(examples_dir)/cv
cv_srcs =
cv_srcs += $(shell find "$(cv_dir)" -name "*.tex")
cv_srcs += $(src)/awesome-cv.cls
cv_deps = $(patsubst $(src)/%,$(out)/%,$(cv_srcs))

out_dirs = $(sort $(dir \
$(coverletter_deps) \
$(resume_deps) \
$(cv_deps) \
))

install_dest_dir = $(addsuffix /,$(DESTDIR))
install_doc_dir = $(addprefix $(install_dest_dir),$(DOCDIR))
install_example_dir = $(addprefix $(install_dest_dir),$(EXAMPLEDIR))

force =
ifneq ($(strip $(filter-out 0,$(FORCE))),)
force = .force_non_existing
endif

silent =
ifeq ($(strip $(filter-out 0,$(VERBOSE))),)
silent = @
endif

## Resolve lazy variables
force := $(force)
silent := $(silent)
src := $(SRC)
out := $(OUT)
out_dirs := $(out_dirs)
install_dest_dir := $(install_dest_dir)
install_doc_dir := $(install_doc_dir)
install_example_dir := $(install_example_dir)

## Sentinel checks
ifeq ($(strip $(out)),)
$(error Output directory should be set to a value (OUT=))
endif
ifeq ($(strip $(src)),)
$(error Source directory should be set to a value (SRC=))
endif
ifeq ($(realpath $(out)),$(realpath $(src)))
$(error Output directory should not point to source tree (OUT <=> SRC='$(src)'))
endif

## (Re-)Exported variables
export LANG

.DELETE_ON_ERROR:

.ONE_SHELL:

.SUFFIXES:

.PHONY: examples
examples: \
$(out)/examples/coverletter.pdf \
$(out)/examples/cv.pdf \
$(out)/examples/resume.pdf

$(out)/%/resume.pdf: $(out)/%/resume.tex $(resume_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs)
$(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&-

$(out)/%/cv.pdf: $(out)/%/cv.tex $(cv_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs)
$(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&-

CC = xelatex
EXAMPLES_DIR = examples
RESUME_DIR = examples/resume
CV_DIR = examples/cv
RESUME_SRCS = $(shell find $(RESUME_DIR) -name '*.tex')
CV_SRCS = $(shell find $(CV_DIR) -name '*.tex')
$(out)/%/coverletter.pdf: $(out)/%/coverletter.tex $(coverletter_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs)
$(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&-

examples: $(foreach x, coverletter cv resume, $x.pdf)
$(out)/%.cls : $(src)/%.cls | $(out_dirs)
$(silent)ln -sf "$<" "$@"

resume.pdf: $(EXAMPLES_DIR)/resume.tex $(RESUME_SRCS)
$(CC) -output-directory=$(EXAMPLES_DIR) $<
$(out)/%.tex : $(src)/%.tex | $(out_dirs)
$(silent)ln -sf "$<" "$@"

cv.pdf: $(EXAMPLES_DIR)/cv.tex $(CV_SRCS)
$(CC) -output-directory=$(EXAMPLES_DIR) $<
$(out_dirs):
$(silent)mkdir -p "$@"

coverletter.pdf: $(EXAMPLES_DIR)/coverletter.tex
$(CC) -output-directory=$(EXAMPLES_DIR) $<
$(force): ;

.PHONY: pdf
pdf: examples

.PHONY: all
all: pdf

.PHONY: clean
clean:
rm -rf $(EXAMPLES_DIR)/*.pdf
$(silent)rm -rf "$(out)"

.PHONY: println-%
println-%:
@printf -- '%s\n' "$*" 1>&2
@printf -- '%s\n' $(foreach v,$($*),"$(v)")

.PHONY: install
install: all
$(silent)install -d "$(install_doc_dir)"
$(silent)install -d "$(install_example_dir)"
$(silent)install -m 644 $(out)/examples/*.pdf "$(install_example_dir)/"
$(silent)install -m 644 $(src)/README.md "$(install_doc_dir)/"
$(silent)install -m 644 $(src)/LICENSE "$(install_doc_dir)/"
$(silent)install -m 644 $(out)/awesome-cv.cls "$(install_doc_dir)/"

.PHONY: uninstall
uninstall:
$(silent)rm -rf "$(install_doc_dir)" "$(install_example_dir)"

.PHONY: help
help:
@{ \
echo "Usage: make [target] [VARIABLE=value]"; \
echo "Available targets:"; \
echo " all - Build all examples (default)"; \
echo " pdf - Build PDF files"; \
echo " examples - Build all example PDFs"; \
echo " clean - Clean output directory"; \
echo " install - Install the documentation and examples"; \
echo " uninstall - Uninstall the documentation and examples"; \
echo " help - Show this help message"; \
echo ""; \
echo "Overridable variables:"; \
echo " OUT - Output directory (default: outputs)"; \
echo " SRC - Source directory (default: current directory)"; \
echo " VERBOSE - Verbosity level (0 for silent, default: 1)"; \
echo " FORCE - Force rebuild (0 for no, default: 0)"; \
echo " LANG - Language setting for LaTeX (default: C.UTF-8)"; \
echo " XETEX - LaTeX engine to use (default: xelatex)"; \
echo ""; \
echo "Example usage:"; \
echo " make pdf OUT=outputs SRC=src VERBOSE=1 FORCE=1"; \
echo " make install DESTDIR=/usr/local"; \
echo " make uninstall DESTDIR=/usr/local"; \
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,19 @@
%-------------------------------------------------------------------------------
%% Page Layout
% Configure page margins with geometry
\geometry{left=2.0cm, top=1.5cm, right=2.0cm, bottom=2.0cm, footskip=.5cm}
\geometry{
paper=a4paper,
top=1.5cm,
bottom=2cm,
left=2cm,
right=2cm,
headheight=12pt,
footskip=.5cm,
includehead,
includefoot,
heightrounded,
nomarginpar
}

%% Header & Footer
% Set offset to each header and footer
Expand Down Expand Up @@ -422,8 +434,8 @@
\newcommand{\acvHeaderAfterQuoteSkip}{5mm}

% Others
\newcommand{\acvSectionTopSkip}{3mm}
\newcommand{\acvSectionContentTopSkip}{2.5mm}
\newcommand{\acvSectionTopSkip}{2.5mm}
\newcommand{\acvSectionContentTopSkip}{2.0mm}


%-------------------------------------------------------------------------------
Expand Down Expand Up @@ -640,7 +652,8 @@
\vspace{\acvSectionTopSkip}
\sectionstyle{#1}
\phantomsection
\color{sectiondivider}\vhrulefill{0.9pt}
\color{gray}\vhrulefill{0.9pt}
\vspace{\acvSectionContentTopSkip}
}

% Define a subsection for CV
Expand Down Expand Up @@ -669,10 +682,11 @@
}{%
\end{center}
}

% Define an entry of cv information
% Usage: \cventry{<position>}{<title>}{<location>}{<date>}{<description>}
\newcommand*{\cventry}[5]{%
\vspace{-2.0mm}
\vspace{-1.5mm}
\setlength\tabcolsep{0pt}
\setlength{\extrarowheight}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} L{\textwidth - 4.5cm} R{4.5cm}}
Expand All @@ -684,6 +698,7 @@
{}
{\multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}} \\}
\end{tabular*}%
\vspace{2mm} % Add space after each entry
}

% Define an environment for cvsubentry
Expand Down Expand Up @@ -735,10 +750,11 @@
\begin{center}
\setlength\tabcolsep{1ex}
\setlength{\extrarowheight}{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} r L{\textwidth * \real{0.9}}}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} r L{\textwidth * \real{0.85}}}
}{%
\end{tabular*}
\end{center}
\vspace{1mm}
}
% Define a line of cv information(skill)
% Usage: \cvskill{<type>}{<skillset>}
Expand All @@ -748,15 +764,15 @@

% Define an environment for cvitems(for cventry)
\newenvironment{cvitems}{%
\vspace{-4.0mm}
\vspace{-2mm}
\begin{justify}
\begin{itemize}[leftmargin=2ex, nosep, noitemsep]
\setlength{\parskip}{0pt}
\renewcommand{\labelitemi}{\bullet}
}{%
\end{itemize}
\end{justify}
\vspace{-4.0mm}
\vspace{1mm}
}


Expand All @@ -772,12 +788,11 @@
% Define a section for the cover letter
% Usage: \lettersection{<section-title>}
\newcommand{\lettersection}[1]{%
\par\addvspace{2.5ex}
\par\addvspace{2.0ex}
\phantomsection{}
\lettersectionstyle{#1}
\color{sectiondivider}\vhrulefill{0.9pt}
\par\nobreak\addvspace{0.4ex}
\lettertextstyle
\color{gray}\vhrulefill{0.9pt}
\par\nobreak\addvspace{0.5ex}
}

% Define a title of the cover letter
Expand Down
Loading
0