From 789d6e79164d617ebdcab3de53fc79457025edcc Mon Sep 17 00:00:00 2001 From: jolheiser Date: Sun, 24 Sep 2023 01:15:12 -0500 Subject: [PATCH] feat: drv Signed-off-by: jolheiser --- flake.nix | 26 ++++++++++++++++++++++++++ justfile | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 justfile diff --git a/flake.nix b/flake.nix index c8bcca1..e2412af 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,32 @@ system: let pkgs = nixpkgs.legacyPackages.${system}; in { + packages.default = pkgs.stdenv.mkDerivation rec { + pname = "jolheiser.com"; + version = "site"; + src = ./.; + offlineCache = pkgs.fetchYarnDeps { + yarnLock = "${src}/yarn.lock"; + sha256 = "sha256-IF30H3ZXlKoyap7xJOD6tnZjCZ/U/VgWrCjj4fh6zyM="; + }; + + nativeBuildInputs = with pkgs; [yarn fixup_yarn_lock nodejs-slim]; + postPatch = '' + export HOME=$NIX_BUILD_TOP/fake_home + yarn config --offline set yarn-offline-mirror $offlineCache + fixup_yarn_lock yarn.lock + yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive + patchShebangs node_modules/ + ''; + buildPhase = '' + runHook preBuild + + yarn --offline build + mv dist $out + + runHook postBuild + ''; + }; devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ yarn diff --git a/justfile b/justfile new file mode 100644 index 0000000..8f92f5e --- /dev/null +++ b/justfile @@ -0,0 +1,3 @@ +build: + @git add . + @nix build