google-handwriting-api-elm/flake.nix

59 lines
1.4 KiB
Nix

{
description = "Proof of concept API usage and canvas in Elm";
inputs = {
nixpkgs.url = "nixpkgs/nixos-21.11";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachSystem [
"aarch64-linux"
"aarch64-darwin"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
]
(system: let
pkgs = import nixpkgs { inherit system; };
in rec {
defaultApp = apps.host-with-webserver;
apps.host-with-webserver = {
type = "app";
program = "${pkgs.devd}/bin/devd -l ${packages.google-handwriting-api-elm}/";
};
defaultPackage = packages.google-handwriting-api-elm;
packages.google-handwriting-api-elm = pkgs.stdenv.mkDerivation {
name = "google-handwriting-api-elm";
version = "1.0.0";
src = ./.;
buildInputs = [ pkgs.elmPackages.elm ];
buildPhase = pkgs.elmPackages.fetchElmDeps {
elmPackages = import ./nix/elm-srcs.nix;
elmVersion = "0.19.1";
registryDat = ./nix/versions.dat;
};
installPhase = ''
ls
mkdir $out
cp -r dist/index.html dist/style.css $out
echo "compiling ./src/Main.elm"
elm make ./src/Main.elm --output $out/app.js --docs $out/share/doc/Main.json
'';
};
devShell = pkgs.mkShell {
buildInputs = [
pkgs.elm2nix
];
};
});
}