64 lines
2.3 KiB
Nix
64 lines
2.3 KiB
Nix
{
|
|
description = "CLI tool to easily setup a new resume";
|
|
|
|
inputs = {
|
|
nix-extras = {
|
|
url = "github:colehaus/nix-extras/f33ab8f70982073b08c67e0d4f6144d029f0441d";
|
|
flake = false;
|
|
};
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
resume-cli = {
|
|
url = "github:jsonresume/resume-cli/7fb40dab8ca6aa519bd3c4ac2729b9fa4256cdcb";
|
|
flake = false;
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# be careful when updating nixpkgs, resume-cli depends on the chromium ABI
|
|
nixpkgs.url = "nixpkgs/20.09";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, resume-cli, nix-extras, flake-utils }:
|
|
let
|
|
forPkgs = pkgs:
|
|
let
|
|
dbg = pkgs.lib.traceVal;
|
|
callNode2nix = import "${nix-extras}/callNode2nix.nix";
|
|
node2nix = callNode2nix { inherit pkgs; name = "resume-cli"; package = "${resume-cli}/package.json"; packageLock = "${resume-cli}/package-lock.json"; };
|
|
nixifiedSrc =
|
|
with pkgs;
|
|
(runCommandLocal "node2nix-merge" { } ''
|
|
mkdir -p $out
|
|
cp -r ${resume-cli}/* $out
|
|
cp -rf ${node2nix}/* $out/
|
|
''
|
|
);
|
|
nodePackages = pkgs.callPackage "${nixifiedSrc}" { inherit pkgs; system = pkgs.system; };
|
|
override = nodePackages // {
|
|
package = nodePackages.package.override {
|
|
PUPPETEER_SKIP_DOWNLOAD = 1;
|
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = 1;
|
|
buildInputs = [ pkgs.chromium ];
|
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
|
postInstall = ''
|
|
wrapProgram $out/bin/resume \
|
|
--set PUPPETEER_EXECUTABLE_PATH ${pkgs.chromium.outPath}/bin/chromium
|
|
'';
|
|
};
|
|
};
|
|
in
|
|
rec {
|
|
packages.resume-cli = override.package;
|
|
defaultPackage = packages.resume-cli;
|
|
apps.resume-cli = flake-utils.lib.mkApp { drv = defaultPackage; exePath = "/bin/resume"; };
|
|
defaultApp = apps.resume-cli;
|
|
devShell = with pkgs; mkShell {
|
|
buildInputs = [ nodejs packages.resume-cli ];
|
|
};
|
|
};
|
|
forSystem = system: forPkgs (import nixpkgs { inherit system; });
|
|
in
|
|
(flake-utils.lib.eachSystem [ "x86_64-linux" ] forSystem) // {
|
|
overlay = final: prev: (forPkgs final).packages;
|
|
};
|
|
}
|