commit a61bb3564415afa991ccd0fad32dbfccc0861dc6 Author: Ivan Dimitrov Date: Sun Nov 12 19:07:31 2023 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..a2a457d Binary files /dev/null and b/bun.lockb differ diff --git a/cv.tsx b/cv.tsx new file mode 100644 index 0000000..1d30565 --- /dev/null +++ b/cv.tsx @@ -0,0 +1,39 @@ +import React from 'react'; +import { Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer'; +import ReactPDF from '@react-pdf/renderer'; +import fs from "fs" + +const styles = StyleSheet.create({ + page: { + flexDirection: 'row', + backgroundColor: '#E4E4E4' + }, + section: { + margin: 10, + padding: 10, + flexGrow: 1 + } +}); + +const MyDocument = () => ( + + + + Section #1 + + + Section #2 + + + +); + +const outDir = process.env.out || "./" +const pname = process.env.pname || "cv" + +if (!fs.existsSync(outDir)) { + fs.mkdirSync(outDir, { recursive: true }) +} + +ReactPDF.render(, `${outDir}/${pname}.pdf`); + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bd82e59 --- /dev/null +++ b/flake.lock @@ -0,0 +1,63 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1699806023, + "narHash": "sha256-RqoU2yh61nzsfbtgjZwIrCMPwyxkUR7Eze+4hjEM6TY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54da2986be07ad2ffbade0b3cefaf7f0c2553c88", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1680978846, + "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", + "owner": "nix-systems", + "repo": "x86_64-linux", + "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "x86_64-linux", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d7d6455 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "CV template"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + systems.url = "github:nix-systems/x86_64-linux"; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, systems }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + pname = "cv"; + version = "0.0.1"; + src = ./.; + buildInputs = with pkgs; [ + ]; + nativeBuildInputs = with pkgs; [ + nodejs_20 + bun + ]; + in + { + devShells.default = pkgs.mkShell { + inherit pname buildInputs nativeBuildInputs; + }; + packages.default = pkgs.stdenv.mkDerivation { + inherit buildInputs nativeBuildInputs pname version src; + }; + + }); +} + + diff --git a/makefile b/makefile new file mode 100644 index 0000000..2751b04 --- /dev/null +++ b/makefile @@ -0,0 +1,13 @@ +main = $(pname).tsx + +default: all +all: + -bun $(main) + +clean: + rm -f $(pname) + +install: $(pname) + mkdir -p $(out)/bin + install $(pname).pdf $(out)/bin/$(pname) + diff --git a/package.json b/package.json new file mode 100644 index 0000000..a19f289 --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +{ "dependencies": { "@react-pdf/renderer": "^3.1.14", "@types/node": "^20.9.0", "@types/react": "^18.2.37", "react": "^18.2.0" } } \ No newline at end of file