Hello,
I packaged my CV and my blog using Nix Flakes and I want to use the result of my CV package (PDF file) in my blog. How can I do that?
Here’s the flake for my CV:
{
description = "Nix Flake package for my CV";
inputs.nixpkgs.url = "nixpkgs/nixos-23.11";
outputs = { self, nixpkgs }:
let
pkgName = "matejascv";
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
drv = {stdenv, texliveFull, ...}: stdenv.mkDerivation {
name = pkgName;
src = ./.;
nativeBuildInputs = [ texliveFull ];
buildPhase = ''
pdflatex cv.tex
'';
installPhase = ''
cp cv.pdf $out
'';
};
in
{
overlays.default = (final: prev: {
${pkgName} = prev.callPackage drv {};
});
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
${pkgName} = drv pkgs;
default = drv pkgs;
}
);
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [ git rsync texliveFull ];
};
}
);
};
}
Here’s the flake for my blog:
{
description = "Nix Flake package for my blog";
inputs.nixpkgs.url = "nixpkgs/nixos-23.11";
outputs = { self, nixpkgs }:
let
pkgName = "matejasblog";
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
drv = {stdenv, hugo, ...}: stdenv.mkDerivation {
name = pkgName;
src = ./.;
nativeBuildInputs = [ hugo ];
buildPhase = ''
hugo
'';
installPhase = ''
mkdir -p $out/var/www
cp -r public $out/var/www/matejamaric.com
'';
};
in
{
overlays.default = (final: prev: {
${pkgName} = prev.callPackage drv {};
});
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
${pkgName} = drv pkgs;
default = drv pkgs;
}
);
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [ git rsync hugo ];
};
}
);
};
}
I would like to install the result of CV derivation (PDF file) to $out/var/www/matejamaric.com/cv.pdf
Thanks a lot for any help!