Skip to content

Commit

Permalink
elm-land: Rewrite and migrate from elmPackages to pkgs/by-name
Browse files Browse the repository at this point in the history
Signed-off-by: Ilan Joselevich <[email protected]>
  • Loading branch information
Kranzes committed Feb 15, 2025
1 parent e34669c commit 3195102
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
67 changes: 67 additions & 0 deletions pkgs/by-name/el/elm-land/elm-srcs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{

"elm/browser" = {
sha256 = "0nagb9ajacxbbg985r4k9h0jadqpp0gp84nm94kcgbr5sf8i9x13";
version = "1.0.2";
};

"elm/core" = {
sha256 = "19w0iisdd66ywjayyga4kv2p1v9rxzqjaxhckp8ni6n8i0fb2dvf";
version = "1.0.5";
};

"elm/html" = {
sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k";
version = "1.0.0";
};

"elm/json" = {
sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh";
version = "1.1.3";
};

"stil4m/elm-syntax" = {
sha256 = "1dlk7gslh9la6y7y3d56a37lsymmz32rlspbywcfmq40mq9hiify";
version = "7.2.9";
};

"elm-community/list-extra" = {
sha256 = "043iwpdwyrfb1jndxh7kf7xlkgq1v6pjczv1r1b19p2wky6nmy8z";
version = "8.5.2";
};

"elm/parser" = {
sha256 = "0a3cxrvbm7mwg9ykynhp7vjid58zsw03r63qxipxp3z09qks7512";
version = "1.1.0";
};

"elm/time" = {
sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1";
version = "1.0.0";
};

"elm/url" = {
sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4";
version = "1.0.0";
};

"elm/virtual-dom" = {
sha256 = "1yvb8px2z62xd578ag2q0r5hd1vkz9y7dfkx05355iiy1d7jwq4v";
version = "1.0.3";
};

"miniBill/elm-unicode" = {
sha256 = "18w246bvra93amvqq3r2kqdv5ad8iavnhvcsbfdxw6747pi6pg2f";
version = "1.0.2";
};

"rtfeldman/elm-hex" = {
sha256 = "1y0aa16asvwdqmgbskh5iba6psp43lkcjjw9mgzj3gsrg33lp00d";
version = "1.0.0";
};

"stil4m/structured-writer" = {
sha256 = "02k32yaw275bivab90wy8qkbys3gg4fw53f798dzf1j9wharhg12";
version = "1.0.3";
};
}
70 changes: 70 additions & 0 deletions pkgs/by-name/el/elm-land/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
lib,
buildNpmPackage,
fetchFromGitHub,
elmPackages,
versionCheckHook,
writeShellScript,
nix-update,
elm2nix,
}:

buildNpmPackage rec {
pname = "elm-land";
version = "0.20.1";

src = fetchFromGitHub {
owner = "elm-land";
repo = "elm-land";
rev = "v${version}";
hash = "sha256-PFyiVTH2Cek377YZwaCmvDToQCaxWQvJrQkRhyNI2Wg=";
};

sourceRoot = "${src.name}/projects/cli";

npmDepsHash = "sha256-Bg16s0tqEaUT+BbFMKuEtx32rmbZLIILp8Ra/dQGmUg=";

postConfigure = elmPackages.fetchElmDeps {
elmPackages = import ./elm-srcs.nix;
elmVersion = elmPackages.elm.version;
registryDat = ./registry.dat;
};

makeWrapperArgs = [
"--prefix"
"PATH"
":"
(lib.makeBinPath [ elmPackages.elm ])
];

nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = [ "--version" ];
doInstallCheck = true;

passthru.updateScript = writeShellScript "update-elm-land" ''
set -eu -o pipefail
# Update version, src and npm deps
${lib.getExe nix-update} "$UPDATE_NIX_ATTR_PATH"
# Update elm deps
cp "$(nix-build -A "$UPDATE_NIX_ATTR_PATH".src)/projects/cli/src/codegen/elm.json" elm.json
trap 'rm -rf elm.json registry.dat &> /dev/null' EXIT
${lib.getExe elm2nix} convert > pkgs/by-name/el/elm-land/elm-srcs.nix
${lib.getExe elm2nix} snapshot
cp registry.dat pkgs/by-name/el/elm-land/registry.dat
'';

meta = {
description = "A production-ready framework for building Elm applications";
homepage = "https://github.com/elm-land/elm-land";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [
domenkozar
zupo
];
mainProgram = "elm-land";
};
}
Binary file added pkgs/by-name/el/elm-land/registry.dat
Binary file not shown.

0 comments on commit 3195102

Please sign in to comment.