From 052c3e297aa84bfde51cf36d22b84e12c3422ae0 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Sun, 4 May 2025 14:28:18 +0200 Subject: [PATCH 01/10] build: Provide a reproducible env using nix flake --- .editorconfig | 39 +++++++++++++++++++++++++++++++ .envrc | 5 ++++ .gitignore | 3 +++ flake.lock | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 .editorconfig create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..9a7fb34ae --- /dev/null +++ b/.editorconfig @@ -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 + diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..a6ee435c9 --- /dev/null +++ b/.envrc @@ -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 diff --git a/.gitignore b/.gitignore index 38e66a836..21b2fedbb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +/.direnv +/outputs + ### TeX ### ## Core latex/pdflatex auxiliary files: *.aux diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..496816bd2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1746061036, + "narHash": "sha256-OxYwCGJf9VJ2KnUO+w/hVJVTjOgscdDg/lPv8Eus07Y=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3afd19146cac33ed242fc0fc87481c67c758a59e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..722b1b2a4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + description = "A basic flake with a shell, make and latex support"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + }; + + outputs = + { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + tex = (pkgs.texlive.combine { + inherit (pkgs.texlive) + scheme-basic + xetex + xetexref + enumitem + ragged2e + geometry + fancyhdr + xcolor + ifmtarg + xkeyval + tikzfill + xifthen + xstring + etoolbox + setspace + fontspec + unicode-math + fontawesome5 + roboto + sourcesanspro + tcolorbox + parskip + hyperref + bookmark + ; + }); + src = ./.; + nativeBuildInputs = with pkgs; [ + coreutils + bashInteractive + gnumake + tex + ]; + buildInputs = with pkgs; [ + + ]; + in + { + devShells.default = pkgs.mkShellNoCC { + inherit buildInputs nativeBuildInputs; + }; + } + ); +} From ea768cc4613ff367d0ccb5de7bde6d6d62224dd8 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Sun, 4 May 2025 14:29:14 +0200 Subject: [PATCH 02/10] chore: Add vscode support files --- .vscode/extensions.json | 13 +++++++++++++ .vscode/settings.json | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..a0f69f87a --- /dev/null +++ b/.vscode/extensions.json @@ -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" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..e26d2d441 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editorconfig.generateAuto": false +} From 4e7e9a290f5874d85782d6381065294b56634420 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Sun, 4 May 2025 16:39:50 +0200 Subject: [PATCH 03/10] build: Add support for out-of-source builds --- Makefile | 126 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 112 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index ae1a12a45..7a472aaae 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,120 @@ +.DEFAULT_GOAL := all +.SHELLFLAGS := -e -c +SHELL := $(shell command -v sh) + +## Enviroment overridable variables +CURDIR ?= {PWD} +OUT ?= $(CURDIR)/outputs +out ?= $(OUT) +SRC ?= $(CURDIR) +VERBOSE ?= 1 +FORCE ?= 0 +LANG ?= C.UTF-8 +XETEX ?= xelatex + +## Commandline overridable (internal) variables +src = $(SRC) + +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) \ +)) + +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) + +## 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 -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)/%/resume.pdf: $(out)/%/resume.tex $(resume_deps) $(force) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(dir $@)" "$<" -examples: $(foreach x, coverletter cv resume, $x.pdf) +$(out)/%/cv.pdf: $(out)/%/cv.tex $(cv_deps) $(force) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(dir $@)" "$<" -resume.pdf: $(EXAMPLES_DIR)/resume.tex $(RESUME_SRCS) - $(CC) -output-directory=$(EXAMPLES_DIR) $< +$(out)/%/coverletter.pdf: $(out)/%/coverletter.tex $(coverletter_deps) $(force) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(dir $@)" "$<" -cv.pdf: $(EXAMPLES_DIR)/cv.tex $(CV_SRCS) - $(CC) -output-directory=$(EXAMPLES_DIR) $< +$(out)/%.cls : $(src)/%.cls | $(out_dirs) + $(silent)ln -sf "$<" "$@" -coverletter.pdf: $(EXAMPLES_DIR)/coverletter.tex - $(CC) -output-directory=$(EXAMPLES_DIR) $< +$(out)/%.tex : $(src)/%.tex | $(out_dirs) + $(silent)ln -sf "$<" "$@" +$(out_dirs): + $(silent)mkdir -p "$@" + +$(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)") From fbedc10159ee99557a3f8e324fde06bc0096dde0 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Sun, 4 May 2025 16:47:57 +0200 Subject: [PATCH 04/10] build: Add makefile dep --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7a472aaae..cce13dd3c 100644 --- a/Makefile +++ b/Makefile @@ -84,14 +84,14 @@ $(out)/examples/coverletter.pdf \ $(out)/examples/cv.pdf \ $(out)/examples/resume.pdf -$(out)/%/resume.pdf: $(out)/%/resume.tex $(resume_deps) $(force) | $(out_dirs) - $(silent)"$(XETEX)" -output-directory="$(dir $@)" "$<" +$(out)/%/resume.pdf: $(out)/%/resume.tex $(resume_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" -$(out)/%/cv.pdf: $(out)/%/cv.tex $(cv_deps) $(force) | $(out_dirs) - $(silent)"$(XETEX)" -output-directory="$(dir $@)" "$<" +$(out)/%/cv.pdf: $(out)/%/cv.tex $(cv_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" -$(out)/%/coverletter.pdf: $(out)/%/coverletter.tex $(coverletter_deps) $(force) | $(out_dirs) - $(silent)"$(XETEX)" -output-directory="$(dir $@)" "$<" +$(out)/%/coverletter.pdf: $(out)/%/coverletter.tex $(coverletter_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs) + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" $(out)/%.cls : $(src)/%.cls | $(out_dirs) $(silent)ln -sf "$<" "$@" From 450a9b30f18d6217d3d14468562b676d516ea691 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Thu, 29 May 2025 01:08:33 +0200 Subject: [PATCH 05/10] build: close stdin to avoid user input requests --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cce13dd3c..e5066e622 100644 --- a/Makefile +++ b/Makefile @@ -85,13 +85,13 @@ $(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 $@))" "$<" + $(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 $@))" "$<" + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&- $(out)/%/coverletter.pdf: $(out)/%/coverletter.tex $(coverletter_deps) $(force) $(MAKEFILE_LIST) | $(out_dirs) - $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" + $(silent)"$(XETEX)" -output-directory="$(patsubst %/,%,$(dir $@))" "$<" 0<&- $(out)/%.cls : $(src)/%.cls | $(out_dirs) $(silent)ln -sf "$<" "$@" From 0732d1a763a9f3b2dde37ee8d0396cd133ab9185 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Thu, 29 May 2025 01:09:43 +0200 Subject: [PATCH 06/10] build: Experiment with fontconfig --- flake.nix | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 722b1b2a4..f1c38ea68 100644 --- a/flake.nix +++ b/flake.nix @@ -10,17 +10,17 @@ }; }; - outputs = - { nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem ( - system: + outputs = { self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - tex = (pkgs.texlive.combine { - inherit (pkgs.texlive) - scheme-basic + pkgs = import nixpkgs { inherit system; }; + + tex = pkgs.texlive.combine { + inherit (pkgs.texlive.pkgs) xetex xetexref + scheme-minimal + mathtools enumitem ragged2e geometry @@ -43,21 +43,50 @@ hyperref bookmark ; - }); + }; + src = ./.; nativeBuildInputs = with pkgs; [ coreutils bashInteractive gnumake tex + line-awesome + fontconfig + poppler-utils # for pdffonts ]; - buildInputs = with pkgs; [ + buildInputs = with pkgs; [ ]; + systemfontdirs = with pkgs; map toString [ + line-awesome ]; + + # used by xetex and mtx-fonts (context) + generatedFontsConf = pkgs.makeFontsConf { + fontDirectories = systemfontdirs ++ [ tex.fonts ]; + }; + + customFontConf = pkgs.writeText "custom-fonts.conf" '' + + + + ''; + + fontsConf = pkgs.writeText "fonts.conf" '' + + + + ${customFontConf} + ${generatedFontsConf} + /etc/fonts/fonts.conf + + ''; + + FONTCONFIG_FILE = fontsConf; in { devShells.default = pkgs.mkShellNoCC { - inherit buildInputs nativeBuildInputs; + inherit buildInputs nativeBuildInputs FONTCONFIG_FILE; }; } ); From b5931d723d1ae863d32e47d23428ca222f492e3b Mon Sep 17 00:00:00 2001 From: "O. El Hosami" Date: Thu, 29 May 2025 01:12:43 +0200 Subject: [PATCH 07/10] fix: Adjust spacing and layout in awesome-cv class - Fix section spacing to prevent overlapping content - Adjust vertical spacing between entries (2mm) - Balance page breaks for better content distribution - Update cventry spacing to improve readability - Fine-tune cvskills environment spacing - Maintain consistent spacing across all sections The changes improve overall document layout while maintaining compatibility with existing CV and resume templates. --- awesome-cv.cls | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/awesome-cv.cls b/awesome-cv.cls index a4270c10a..633176855 100644 --- a/awesome-cv.cls +++ b/awesome-cv.cls @@ -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 @@ -422,8 +434,8 @@ \newcommand{\acvHeaderAfterQuoteSkip}{5mm} % Others -\newcommand{\acvSectionTopSkip}{3mm} -\newcommand{\acvSectionContentTopSkip}{2.5mm} +\newcommand{\acvSectionTopSkip}{2.5mm} +\newcommand{\acvSectionContentTopSkip}{2.0mm} %------------------------------------------------------------------------------- @@ -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 @@ -669,10 +682,11 @@ }{% \end{center} } + % Define an entry of cv information % Usage: \cventry{}{}{<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}} @@ -684,6 +698,7 @@ {} {\multicolumn{2}{L{\textwidth}}{\descriptionstyle{#5}} \\} \end{tabular*}% + \vspace{2mm} % Add space after each entry } % Define an environment for cvsubentry @@ -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>} @@ -748,7 +764,7 @@ % 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} @@ -756,7 +772,7 @@ }{% \end{itemize} \end{justify} - \vspace{-4.0mm} + \vspace{1mm} } @@ -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 From 2d46def90dfcece08700bbbfac3f282eaf185aa5 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" <nosamad@users.noreply.github.com> Date: Thu, 29 May 2025 16:20:01 +0200 Subject: [PATCH 08/10] feat: Add make install support and nix build - Add install/uninstall targets to Makefile with configurable paths - Update flake.nix to use make install in derivation - Configure proper installation directories in nix build - Use stdenvNoCC for LaTeX-only package - Add meta information for nix package The changes allow installing the package both via make and nix build, while maintaining consistent paths and permissions. --- .gitignore | 1 + Makefile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 30 ++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/.gitignore b/.gitignore index 21b2fedbb..8e3aae1a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /.direnv /outputs +/result ### TeX ### ## Core latex/pdflatex auxiliary files: diff --git a/Makefile b/Makefile index e5066e622..7745a3b67 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,12 @@ FORCE ?= 0 LANG ?= C.UTF-8 XETEX ?= xelatex +### Installation paths +PREFIX ?= usr/local +DOCDIR ?= share/doc/awesome-cv +EXAMPLEDIR ?= $(addsuffix /examples,$(DOCDIR)) +DESTDIR ?= $(PREFIX)/ + ## Commandline overridable (internal) variables src = $(SRC) @@ -41,6 +47,10 @@ $(resume_deps) \ $(cv_deps) \ )) +install_dest_dir = $(DESTDIR) +install_doc_dir = $(install_dest_dir)$(DOCDIR) +install_example_dir = $(install_dest_dir)$(EXAMPLEDIR) + force = ifneq ($(strip $(filter-out 0,$(FORCE))),) force = .force_non_existing @@ -54,6 +64,9 @@ endif ## Resolve lazy variables force := $(force) silent := $(silent) +install_dest_dir := $(install_dest_dir) +install_doc_dir := $(install_doc_dir) +install_example_dir := $(install_example_dir) src := $(src) out := $(out) out_dirs := $(out_dirs) @@ -118,3 +131,42 @@ clean: 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 README.md "$(install_doc_dir)/" + $(silent)install -m 644 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"; \ + } diff --git a/flake.nix b/flake.nix index f1c38ea68..b6c0b81b8 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; + pname = "awesome-cv"; tex = pkgs.texlive.combine { inherit (pkgs.texlive.pkgs) @@ -88,6 +89,35 @@ devShells.default = pkgs.mkShellNoCC { inherit buildInputs nativeBuildInputs FONTCONFIG_FILE; }; + + packages.default = pkgs.stdenvNoCC.mkDerivation { + inherit pname; + version = "1.0.0"; + inherit src nativeBuildInputs buildInputs FONTCONFIG_FILE; + + buildPhase = '' + make all OUT=$out/build SRC=$src VERBOSE=1 + ''; + + installPhase = '' + make install \ + DESTDIR=$out \ + PREFIX="" \ + DOCDIR="share/doc/${pname}" \ + EXAMPLEDIR="share/doc/${pname}/examples" \ + OUT=$out/build \ + SRC=$src \ + VERBOSE=1 + ''; + + meta = with pkgs.lib; { + description = "Awesome LaTeX CV and resume class"; + homepage = "https://github.com/posquit0/Awesome-CV"; + license = licenses.lppl13c; + platforms = platforms.all; + maintainers = []; + }; + }; } ); } From ac17ffa424a1b878dc83763589d6c4507333d3f7 Mon Sep 17 00:00:00 2001 From: "O. El Hosami" <nosamad@users.noreply.github.com> Date: Sat, 31 May 2025 17:50:35 +0200 Subject: [PATCH 09/10] fix: Install target --- Makefile | 27 ++++++++++++++------------- flake.nix | 6 ++---- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 7745a3b67..fd17c7c85 100644 --- a/Makefile +++ b/Makefile @@ -3,24 +3,25 @@ SHELL := $(shell command -v sh) ## Enviroment overridable variables +out ?= $(CURDIR)/outputs +src ?= $(CURDIR) + CURDIR ?= {PWD} -OUT ?= $(CURDIR)/outputs -out ?= $(OUT) -SRC ?= $(CURDIR) VERBOSE ?= 1 FORCE ?= 0 LANG ?= C.UTF-8 XETEX ?= xelatex ### Installation paths -PREFIX ?= usr/local DOCDIR ?= share/doc/awesome-cv EXAMPLEDIR ?= $(addsuffix /examples,$(DOCDIR)) -DESTDIR ?= $(PREFIX)/ +DESTDIR ?= /usr/local -## Commandline overridable (internal) variables -src = $(SRC) +## Commandline overridable +SRC = $(src) +OUT = $(out) +### Internal variables examples_dir = $(src)/examples coverletter_dir = $(examples_dir) @@ -47,9 +48,9 @@ $(resume_deps) \ $(cv_deps) \ )) -install_dest_dir = $(DESTDIR) -install_doc_dir = $(install_dest_dir)$(DOCDIR) -install_example_dir = $(install_dest_dir)$(EXAMPLEDIR) +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))),) @@ -64,12 +65,12 @@ 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) -src := $(src) -out := $(out) -out_dirs := $(out_dirs) ## Sentinel checks ifeq ($(strip $(out)),) diff --git a/flake.nix b/flake.nix index b6c0b81b8..7714d5385 100644 --- a/flake.nix +++ b/flake.nix @@ -96,17 +96,15 @@ inherit src nativeBuildInputs buildInputs FONTCONFIG_FILE; buildPhase = '' - make all OUT=$out/build SRC=$src VERBOSE=1 + make all OUT=. VERBOSE=1 ''; installPhase = '' make install \ DESTDIR=$out \ - PREFIX="" \ DOCDIR="share/doc/${pname}" \ EXAMPLEDIR="share/doc/${pname}/examples" \ - OUT=$out/build \ - SRC=$src \ + OUT=. \ VERBOSE=1 ''; From 683506e2d3b35ddec0700668c770917233854fdb Mon Sep 17 00:00:00 2001 From: "O. El Hosami" <nosamad@users.noreply.github.com> Date: Sat, 31 May 2025 17:59:10 +0200 Subject: [PATCH 10/10] fix: install target - Rename license file (fix typo) --- LICENCE => LICENSE | 0 Makefile | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) rename LICENCE => LICENSE (100%) diff --git a/LICENCE b/LICENSE similarity index 100% rename from LICENCE rename to LICENSE diff --git a/Makefile b/Makefile index fd17c7c85..71f232ba5 100644 --- a/Makefile +++ b/Makefile @@ -138,8 +138,9 @@ 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 README.md "$(install_doc_dir)/" - $(silent)install -m 644 awesome-cv.cls "$(install_doc_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: