initial commit
This commit is contained in:
61
client/default.nix
Normal file
61
client/default.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{ pkgs }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
|
||||
|
||||
yarnFilter = p: t: builtins.any (x: baseNameOf p == x) [
|
||||
"package.json"
|
||||
"yarn.lock"
|
||||
];
|
||||
|
||||
yarnSrc = lib.cleanSourceWith {
|
||||
filter = yarnFilter;
|
||||
src = ./.;
|
||||
};
|
||||
|
||||
in
|
||||
rec {
|
||||
shell = buildEnv { name = "homepage-devshell"; paths = homepage.buildInputs; };
|
||||
|
||||
nodeHeaders = fetchzip {
|
||||
name = "node-v${pkgs.nodejs.version}-headers";
|
||||
url = "https://nodejs.org/download/release/v${pkgs.nodejs.version}/node-v${pkgs.nodejs.version}-headers.tar.gz";
|
||||
sha256 = "sha256-wnw/eK+hqawpLbqC+sA65EF7FBz/Q8zvSJfb70dVo4o=";
|
||||
};
|
||||
|
||||
yarnPkgs = yarn2nix-moretea.mkYarnPackage {
|
||||
src = yarnSrc;
|
||||
publishBinsFor = [ "parcel" ];
|
||||
pkgConfig.lmdb-store = {
|
||||
buildInputs = [ nodePackages.node-gyp python3 pkgconfig ];
|
||||
postInstall = ''
|
||||
node-gyp --nodedir=${nodeHeaders} rebuild
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
homepage = stdenv.mkDerivation {
|
||||
name = "Homepage";
|
||||
src = ./.;
|
||||
buildInputs = with elmPackages; [
|
||||
elm
|
||||
elm-format
|
||||
elm2nix
|
||||
yarnPkgs
|
||||
];
|
||||
patchPhase = ''
|
||||
ln -sf ${yarnPkgs}/libexec/*/node_modules .
|
||||
'';
|
||||
configurePhase = elmPackages.fetchElmDeps {
|
||||
elmPackages = import ./elm-srcs.nix;
|
||||
registryDat = ./registry.dat;
|
||||
elmVersion = "0.19.1";
|
||||
};
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
parcel build --dist-dir $out index.html --no-source-maps --no-cache
|
||||
'';
|
||||
};
|
||||
}
|
||||
37
client/elm-srcs.nix
Normal file
37
client/elm-srcs.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
|
||||
"elm/html" = {
|
||||
sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k";
|
||||
version = "1.0.0";
|
||||
};
|
||||
|
||||
"elm/browser" = {
|
||||
sha256 = "0nagb9ajacxbbg985r4k9h0jadqpp0gp84nm94kcgbr5sf8i9x13";
|
||||
version = "1.0.2";
|
||||
};
|
||||
|
||||
"elm/core" = {
|
||||
sha256 = "19w0iisdd66ywjayyga4kv2p1v9rxzqjaxhckp8ni6n8i0fb2dvf";
|
||||
version = "1.0.5";
|
||||
};
|
||||
|
||||
"elm/json" = {
|
||||
sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh";
|
||||
version = "1.1.3";
|
||||
};
|
||||
|
||||
"elm/url" = {
|
||||
sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4";
|
||||
version = "1.0.0";
|
||||
};
|
||||
|
||||
"elm/time" = {
|
||||
sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1";
|
||||
version = "1.0.0";
|
||||
};
|
||||
|
||||
"elm/virtual-dom" = {
|
||||
sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg";
|
||||
version = "1.0.2";
|
||||
};
|
||||
}
|
||||
24
client/elm.json
Normal file
24
client/elm.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"type": "application",
|
||||
"source-directories": [
|
||||
"elm"
|
||||
],
|
||||
"elm-version": "0.19.1",
|
||||
"dependencies": {
|
||||
"direct": {
|
||||
"elm/browser": "1.0.2",
|
||||
"elm/core": "1.0.5",
|
||||
"elm/html": "1.0.0"
|
||||
},
|
||||
"indirect": {
|
||||
"elm/json": "1.1.3",
|
||||
"elm/time": "1.0.0",
|
||||
"elm/url": "1.0.0",
|
||||
"elm/virtual-dom": "1.0.2"
|
||||
}
|
||||
},
|
||||
"test-dependencies": {
|
||||
"direct": {},
|
||||
"indirect": {}
|
||||
}
|
||||
}
|
||||
36
client/elm/Loading.elm
Normal file
36
client/elm/Loading.elm
Normal file
@@ -0,0 +1,36 @@
|
||||
module Loading exposing (..)
|
||||
|
||||
import Html as H exposing (Html)
|
||||
import Html.Attributes as HA
|
||||
import Html.Events as HE
|
||||
|
||||
|
||||
type alias Model =
|
||||
Int
|
||||
|
||||
|
||||
type Msg
|
||||
= Dec
|
||||
| Inc
|
||||
|
||||
|
||||
init =
|
||||
0
|
||||
|
||||
|
||||
view mdl =
|
||||
H.div []
|
||||
[ H.button [ HE.onClick Dec ] [ H.text "-" ]
|
||||
, H.button [ HE.onClick Inc ] [ H.text "+" ]
|
||||
, H.text <| String.fromInt mdl
|
||||
]
|
||||
|
||||
|
||||
update : Msg -> Model -> Model
|
||||
update msg mdl =
|
||||
case msg of
|
||||
Dec ->
|
||||
mdl - 1
|
||||
|
||||
Inc ->
|
||||
mdl + 1
|
||||
39
client/elm/Main.elm
Normal file
39
client/elm/Main.elm
Normal file
@@ -0,0 +1,39 @@
|
||||
module Main exposing (main)
|
||||
|
||||
import Browser as B
|
||||
import Html as H exposing (Html)
|
||||
import Html.Attributes as HA
|
||||
import Html.Events as HE
|
||||
import Loading
|
||||
|
||||
|
||||
main =
|
||||
B.sandbox { init = init, update = update, view = view }
|
||||
|
||||
|
||||
type Model
|
||||
= LoadingMdl Loading.Model
|
||||
|
||||
|
||||
type Msg
|
||||
= LoadingMsg Loading.Msg
|
||||
|
||||
|
||||
init : Model
|
||||
init =
|
||||
LoadingMdl Loading.init
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view mdl =
|
||||
case mdl of
|
||||
LoadingMdl m ->
|
||||
H.map LoadingMsg <| Loading.view m
|
||||
|
||||
|
||||
update : Msg -> Model -> Model
|
||||
update msg_ mdl_ =
|
||||
case ( msg_, mdl_ ) of
|
||||
( LoadingMsg msg, LoadingMdl mdl ) ->
|
||||
LoadingMdl <| Loading.update msg mdl
|
||||
|
||||
8
client/index.html
Normal file
8
client/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root">Broken</div>
|
||||
<script type="module" src="./index.js"> </script>
|
||||
</body>
|
||||
5
client/index.js
Normal file
5
client/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Elm } from "./elm/Main.elm";
|
||||
|
||||
Elm.Main.init(
|
||||
{ node: document.getElementById("root") }
|
||||
);
|
||||
13
client/package.json
Normal file
13
client/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "FlakeTest",
|
||||
"version": "1.0.0",
|
||||
"browserslist": "since 2015 or > 0.05%",
|
||||
"repository": ".",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@parcel/transformer-elm": "2.0.0-rc.0",
|
||||
"parcel": "^2.0.0-rc.0"
|
||||
},
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
||||
BIN
client/registry.dat
Normal file
BIN
client/registry.dat
Normal file
Binary file not shown.
5055
client/yarn.lock
Normal file
5055
client/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user