diff options
| author | seth <[email protected]> | 2024-05-22 22:00:02 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-05-22 20:45:24 -0600 |
| commit | 8fd8b7e53d59a034706dd7eaad6b608721ce3cdb (patch) | |
| tree | 2ce7e4a8b7eafc9d8550a54aa6d4f34d678d76f5 /nix | |
| parent | 329bf8a3384474cfe45ecae142dfb7d97b699aa2 (diff) | |
move to zola
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/checks.nix | 46 | ||||
| -rw-r--r-- | nix/default.nix | 106 | ||||
| -rw-r--r-- | nix/package.nix | 56 |
3 files changed, 56 insertions, 152 deletions
diff --git a/nix/checks.nix b/nix/checks.nix deleted file mode 100644 index c7f6547..0000000 --- a/nix/checks.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - lib, - runCommand, - actionlint, - biome, - deadnix, - formatter, - eclint, - statix, - ... -}: { - actionlint = runCommand "check-actionlint" {} '' - ${lib.getExe actionlint} ${../.github/workflows}/* - touch $out - ''; - - biome-fmt = runCommand "check-biome-fmt" {} '' - ${lib.getExe biome} format ${../.}/**/* - touch $out - ''; - - biome-lint = runCommand "check-biome-lint" {} '' - ${lib.getExe biome} lint ${../.}/**/* - touch $out - ''; - - deadnix = runCommand "check-deadnix" {} '' - ${lib.getExe deadnix} ${../.} - touch $out - ''; - - "${formatter.pname}" = runCommand "check-${formatter.pname}" {} '' - ${lib.getExe formatter} --check ${../.} - touch $out - ''; - - eclint = runCommand "check-eclint" {} '' - ${lib.getExe eclint} ${../.}/**/* - touch $out - ''; - - statix = runCommand "check-statix" {} '' - ${lib.getExe statix} check ${../.} - touch $out - ''; -} diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index d340b77..0000000 --- a/nix/default.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ - lib, - stdenvNoCC, - cacert, - jq, - moreutils, - nodejs, -}: -stdenvNoCC.mkDerivation (finalAttrs: { - name = "getchoo-website"; - - src = lib.fileset.toSource { - root = ../.; - fileset = lib.fileset.gitTracked ../.; - }; - - __structuredAttrs = true; - - nativeBuildInputs = [ - nodejs - nodejs.pkgs.pnpm - ]; - - env = { - pnpmDeps = stdenvNoCC.mkDerivation (finalAttrs': { - name = "${finalAttrs.name}-pnpm-deps"; - inherit (finalAttrs) src; - - __structuredAttrs = true; - - nativeBuildInputs = [ - cacert - jq - moreutils - nodejs.pkgs.pnpm - ]; - - dontConfigure = true; - dontBuild = true; - doCheck = false; - - installPhase = '' - runHook preInstall - - export HOME="$(mktemp -d)" - pnpm config set store-dir "$out" - pnpm install --force --frozen-lockfile --ignore-script - - runHook postInstall - ''; - - fixupPhase = '' - runHook preFixup - - rm -rf "$out"/v3/tmp - for f in $(find "$out" -name "*.json"); do - sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f - jq --sort-keys . $f | sponge $f - done - - runHook postFixup - ''; - - outputHashMode = "recursive"; - outputHash = "sha256-Rd5fdB/pMxHRwy6gRTjQQWX4OlKHUJIqh2KX+9jiBQY="; - }); - }; - - postConfigure = '' - export HOME="$(mktemp -d)" - export STORE_PATH="$(mktemp -d)" - - cp -rT "$pnpmDeps" "$STORE_PATH" - chmod -R +w "$STORE_PATH" - - pnpm config set store-dir "$STORE_PATH" - - pnpm install --force --frozen-lockfile --ignore-script --offline - - patchShebangs node_modules/{*,.*} - ''; - - buildPhase = '' - runHook preBuild - pnpm run build - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - mv dist "$out" - runHook postInstall - ''; - - checkPhase = '' - runHook preCheck - pnpm run check - runHook postCheck - ''; - - meta = with lib; { - homepage = "https://github.com/getchoo/website"; - license = licenses.mit; - maintainers = with maintainers; [getchoo]; - }; -}) diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..997bff3 --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,56 @@ +{ + lib, + stdenvNoCC, + writeShellApplication, + zola, +}: +stdenvNoCC.mkDerivation { + name = "getchoo-website"; + + src = lib.fileset.toSource { + root = ../.; + fileset = lib.fileset.unions [ + ../config.toml + ../content + ../highlight_themes + ../static + ../templates + ]; + }; + + nativeBuildInputs = [ + zola + ]; + + dontConfigure = true; + doCheck = false; + + buildPhase = '' + runHook preBuild + zola build + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mv public $out + runHook postInstall + ''; + + passthru = { + serve = writeShellApplication { + name = "serve"; + runtimeInputs = [zola]; + + text = '' + zola serve + ''; + }; + }; + + meta = { + homepage = "https://github.com/getchoo/website"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [getchoo]; + }; +} |
