Skip to content

Commit 832c71d

Browse files
authored
Use Nix flake for building the site (#2)
* Rework flake.nix to be more central to development * Update deploy action * Update deploy action * Update deploy action * Update deploy action I forgot the -r flag lol * Rework flake.nix to be more central to development * Update deploy action
1 parent 71066da commit 832c71d

234 files changed

Lines changed: 39 additions & 4879 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Deploy to neocities
22

3-
on: [workflow_dispatch, push]
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
48

59
concurrency: # prevent concurrent deploys doing strange things
610
group: deploy-to-neocities
@@ -10,7 +14,6 @@ jobs:
1014
# https://gist.github.com/AndrewLester/2d3e6257d932831756226ca9a281d9b5
1115
build_site:
1216
runs-on: ubuntu-latest
13-
if: ${{ contains(github.event.head_commit.message, '!UPD8') || github.event_name == 'workflow_dispatch' }}
1417

1518
steps:
1619
- name: Checkout
@@ -23,51 +26,29 @@ jobs:
2326
git pull --recurse-submodules
2427
git submodule update --remote --recursive
2528
29+
- name: Install Nix
30+
uses: cachix/install-nix-action@v31
31+
2632

2733
# If you're using pnpm, add this step then change the commands and cache key below to use `pnpm`
2834
# - name: Install pnpm
2935
# uses: pnpm/action-setup@v3
3036
# with:
3137
# version: 8
3238

33-
- name: Install Node.js
34-
uses: actions/setup-node@v4
35-
with:
36-
node-version: 20
37-
cache: npm
38-
39-
- name: Install dependencies
40-
run: npm install
41-
# - name: Install wasm-pack
42-
# uses: jetli/wasm-pack-action@v0.4.0
43-
# with:
44-
# version: 'latest'
45-
4639
- name: build
40+
uses: cachix/install-nix-action@v31
4741
env:
4842
BASE_PATH: '/${{ github.event.repository.name }}'
4943
run: |
50-
npm run build
51-
- name: Authenticate
52-
uses: oleksiyrudenko/gha-git-credentials@v2-latest
53-
with:
54-
token: '${{ secrets.GITHUB_TOKEN }}'
55-
- name: Commit changes
56-
run: |
57-
git add -A
58-
git commit -m "Automatically build site"
59-
git push
44+
nix build
45+
mkdir -p public/
46+
cp -r result/* public/
6047
61-
# deploy:
62-
# needs: build_site
63-
# runs-on: ubuntu-latest
64-
# if: ${{ contains(github.event.head_commit.message, '!UPD8') || github.event_name == 'workflow_dispatch' }}
65-
# steps:
66-
6748
- name: Deploy to neocities
6849
if: ${{ success() || failure() }}
6950
uses: bcomnes/deploy-to-neocities@v1.1.9
7051
with:
7152
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
7253
cleanup: false
73-
dist_dir: public
54+
dist_dir: result

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ node_modules
77
!.env.example
88
vite.config.js.timestamp-*
99
vite.config.ts.timestamp-*
10+
/result

flake.nix

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
3+
description = "";
4+
25
inputs = {
36
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
47
flake-utils.url = "github:numtide/flake-utils";
@@ -7,17 +10,31 @@
710
flake-utils.lib.eachDefaultSystem
811
(system:
912
let
10-
overlays = [ ];
11-
pkgs = import nixpkgs {
12-
inherit system overlays;
13-
};
13+
pkgs = import nixpkgs { inherit system; };
14+
nativeBuildInputs = with pkgs; [
15+
wasm-pack
16+
nodejs
17+
];
1418
in
1519
with pkgs;
1620
{
17-
devShells.default = mkShell {
18-
buildInputs = [
19-
wasm-pack
20-
];
21+
packages.default = buildNpmPackage {
22+
pname = "deep-freezer";
23+
version = "1.0.0";
24+
25+
nativeBuildInputs = nativeBuildInputs;
26+
27+
src = ./.;
28+
29+
npmDepsHash = "sha256-aX5sIAfW+9d7pPg9FBjiiSGNjbKE2KoE97tKtKMXDKA=";
30+
31+
npmBuild = ''
32+
npm run build
33+
'';
34+
installPhase = ''
35+
mkdir -p $out
36+
cp -r public/* $out
37+
'';
2138
};
2239
}
2340
);

public/ButtonToggle.png

-215 Bytes
Binary file not shown.

public/ButtonToggleSlider.png

-420 Bytes
Binary file not shown.

public/_app/env.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/_app/immutable/assets/12.DVoKC6fD.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/_app/immutable/assets/13.CaOLp-Yy.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/_app/immutable/assets/16.BzofsrWt.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/_app/immutable/assets/2.DenuX07o.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)