mirror of
https://github.com/posquit0/Awesome-CV.git
synced 2025-12-30 10:55:04 +08:00
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.
This commit is contained in:
parent
b5931d723d
commit
2d46def90d
3 changed files with 83 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
|||
/.direnv
|
||||
/outputs
|
||||
/result
|
||||
|
||||
### TeX ###
|
||||
## Core latex/pdflatex auxiliary files:
|
||||
|
|
|
|||
52
Makefile
52
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"; \
|
||||
}
|
||||
|
|
|
|||
30
flake.nix
30
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 = [];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue