Skip to content

Commit

Permalink
Use elm-pages from nix packages
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoDaniels committed Sep 13, 2023
1 parent 6495f77 commit 60b71a4
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 2,178 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
COCKPIT_API_URL: ${{secrets.COCKPIT_API_URL}}
COCKPIT_API_TOKEN: ${{secrets.COCKPIT_API_TOKEN}}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -23,17 +25,17 @@ jobs:
key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json', '**/elm.json') }}
- uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/30daa988f10.tar.gz
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/fc541b860a28.tar.gz
- uses: cachix/cachix-action@v12
with:
name: marco-daniels
authToken: ${{secrets.CACHIX_AUTH_TOKEN}}
- name: Build Website
run: nix-build default.nix --argstr url ${{secrets.COCKPIT_API_URL}} --argstr token ${{secrets.COCKPIT_API_TOKEN}}
run: nix-shell buildWebsite.nix --run "buildWebsite"
- name: Sync Website
run: aws s3 sync ./dist s3://${{secrets.AWS_S3_BUCKET}}
- name: Build Preview
run: nix-build default-preview.nix
run: nix-build buildPreview.nix
- name: Sync Preview
uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
key: ${{ runner.os }}-modules-${{ hashFiles('**/package.json', '**/elm.json') }}
- uses: cachix/install-nix-action@v21
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/30daa988f10.tar.gz
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/fc541b860a28.tar.gz
- uses: cachix/cachix-action@v12
with:
name: marco-daniels
authToken: ${{secrets.CACHIX_AUTH_TOKEN}}
- name: Build Website
run: nix-build default.nix --argstr url $COCKPIT_API_URL --argstr token ${{secrets.COCKPIT_API_TOKEN}}
run: nix-shell buildWebsite.nix --run "buildWebsite"
File renamed without changes.
12 changes: 12 additions & 0 deletions buildWebsite.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let
pkgs = (import ./nix/shared.nix).pkgs;

buildWebsite = pkgs.writeScriptBin "buildWebsite" ''
${pkgs.elmPackages.elm-pages}/bin/elm-pages build --debug
'';

in pkgs.mkShell {
buildInputs = [
buildWebsite
];
}
41 changes: 0 additions & 41 deletions default.nix

This file was deleted.

6 changes: 3 additions & 3 deletions nix/shared.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let
pkgs = import (fetchTarball {
name = "NixOS-unstable-23-01-2022";
url = "https://github.com/NixOS/nixpkgs/archive/30daa988f10.tar.gz";
sha256 = "0zh3rbmzyv8d57fn22vfzi8b1di5daqwdrd6j1ayd5p1rh2vk59m";
name = "nixpkgs-23.05-darwin";
url = "https://github.com/NixOS/nixpkgs/archive/fc541b860a28.tar.gz";
sha256 = "0929i9d331zgv86imvsdzyfsrnr7zwhb7sdh8sw5zzsp7qsxycja";
}) { };

jsHandler = pkgs.writeShellScriptBin "jsHandler" ''
Expand Down
18 changes: 0 additions & 18 deletions package.json

This file was deleted.

6 changes: 3 additions & 3 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let

# concurrently Pages with Proxy & Preview
start = pkgs.writeShellScriptBin "start" ''
${pkgs.concurrently}/bin/concurrently "yarn start" "${cockpitProxy}/bin/cockpit-proxy"
${pkgs.concurrently}/bin/concurrently "${pkgs.elmPackages.elm-pages}/bin/elm-pages dev" "${cockpitProxy}/bin/cockpit-proxy"
'';

# to include flags: buildLambda AssetRequest "{flags:{token:'123',domain:'abc'}}"
Expand Down Expand Up @@ -92,12 +92,12 @@ in pkgs.mkShell {
buildInputs = [
pkgs.nixfmt
pkgs.terraform
pkgs.nodejs-16_x
pkgs.nodejs_18
pkgs.concurrently
pkgs.yarn
pkgs.elmPackages.elm
pkgs.elmPackages.elm-format
pkgs.elmPackages.elm-test
pkgs.elmPackages.elm-pages
pkgs.elm2nix

dot2Env
Expand Down
Loading

0 comments on commit 60b71a4

Please sign in to comment.