mirror of
https://github.com/0x5eal/luau-unzip.git
synced 2025-04-10 17:20:53 +01:00
chore(nix): structure refactor and install luau tooling
This commit is contained in:
parent
55f7851441
commit
16b35b4d30
1 changed files with 77 additions and 15 deletions
92
dev.nix
92
dev.nix
|
@ -33,40 +33,102 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
fromGithubRelease = { name, exeName, version, sha256, url ? null }:
|
fromGithubRelease = { name, exeName, version, sha256, url ? null, artifactName ? null }:
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
name = "${exeName}-${version}";
|
name = "${exeName}-${version}";
|
||||||
src = if url != null then
|
src =
|
||||||
pkgs.fetchzip {
|
if url != null then
|
||||||
url = url;
|
pkgs.fetchzip
|
||||||
sha256 = sha256;
|
{
|
||||||
}
|
url = url;
|
||||||
else
|
sha256 = sha256;
|
||||||
pkgs.fetchzip {
|
}
|
||||||
url = "https://github.com/${name}/releases/download/v${version}/${exeName}-${version}-linux-x86_64.zip";
|
else if artifactName != null then
|
||||||
sha256 = sha256;
|
pkgs.fetchzip
|
||||||
};
|
{
|
||||||
|
url = builtins.trace "https://github.com/${name}/releases/download/${version}/${artifactName}" "https://github.com/${name}/releases/download/${version}/${artifactName}";
|
||||||
|
sha256 = sha256;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw "Either artifactName or url must be supplied";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
ls -lah
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp ${exeName} $out/bin/
|
mv ${exeName} $out/bin/
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getVersion = { exeName, name, pesdePackage ? null }:
|
||||||
|
(
|
||||||
|
let package = if pesdePackage == null then "pesde/${exeName}" else pesdePackage; in pkgs.stdenv.mkDerivation {
|
||||||
|
name = "get-version";
|
||||||
|
src = ./pesde.lock;
|
||||||
|
buildInputs = [ pkgs.jq pkgs.toml2json ];
|
||||||
|
phases = [ "buildPhase" ];
|
||||||
|
buildPhase = ''
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
version=$(toml2json $src | jq -r '.graph."${package}" | to_entries[0].value.pkg_ref.version')
|
||||||
|
if [[ "${exeName}" = "stylua" ]]; then
|
||||||
|
# Special case for stylua which has versions that start with `v`
|
||||||
|
version="v$version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "$version" > $out
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fromPesdeManifest = { name, exeName, artifactName, pesdePackage ? null, sha256 }:
|
||||||
|
let
|
||||||
|
version = builtins.readFile (getVersion { exeName = exeName; name = name; pesdePackage = pesdePackage; });
|
||||||
|
in
|
||||||
|
fromGithubRelease {
|
||||||
|
name = name;
|
||||||
|
exeName = exeName;
|
||||||
|
version = version;
|
||||||
|
sha256 = sha256;
|
||||||
|
artifactName = artifactName;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
# General devtools and test requirements
|
||||||
pkgs.curl
|
pkgs.curl
|
||||||
pkgs.git
|
pkgs.git
|
||||||
pkgs.lune
|
|
||||||
(buildDerivation "unzip" "6.0-28" "s9lSnDQ4LMjS5syCmaGFNlBO28KEuRM/++UicEhlBo4=" pkgs.bzip2)
|
(buildDerivation "unzip" "6.0-28" "s9lSnDQ4LMjS5syCmaGFNlBO28KEuRM/++UicEhlBo4=" pkgs.bzip2)
|
||||||
(buildDerivation "zip" "3.0-14" "0vsh9c5wfbwsx1r1b5mkfxj5vy1xqv0wbj2i93jysyb7x1c3pq8n" pkgs.zlib)
|
(buildDerivation "zip" "3.0-14" "0vsh9c5wfbwsx1r1b5mkfxj5vy1xqv0wbj2i93jysyb7x1c3pq8n" pkgs.zlib)
|
||||||
|
|
||||||
|
# Luau tooling
|
||||||
|
pkgs.lune
|
||||||
(fromGithubRelease {
|
(fromGithubRelease {
|
||||||
name = "pesde-pkg/pesde";
|
name = "pesde-pkg/pesde";
|
||||||
exeName = "pesde";
|
exeName = "pesde";
|
||||||
version = "0.6.0-rc.4+registry.0.2.0-rc.1";
|
version = "v0.6.0-rc.4+registry.0.2.0-rc.1";
|
||||||
sha256 = "sha256-3aD2OGUUV4+ptWLTBHVDug9RDHicSM58YDcXCiYRSyY=";
|
artifactName = "pesde-0.6.0-rc.4-linux-x86_64.zip";
|
||||||
|
sha256 = "3aD2OGUUV4+ptWLTBHVDug9RDHicSM58YDcXCiYRSyY=";
|
||||||
|
})
|
||||||
|
(fromPesdeManifest {
|
||||||
|
name = "JohnnyMorganz/luau-lsp";
|
||||||
|
exeName = "luau-lsp";
|
||||||
|
pesdePackage = "pesde/luau_lsp";
|
||||||
|
artifactName = "luau-lsp-linux.zip";
|
||||||
|
sha256 = "mYALjfjY+UifOdX4AlYijweXDlMHUZo7m6hdOT577lw=";
|
||||||
|
})
|
||||||
|
(fromPesdeManifest {
|
||||||
|
name = "JohnnyMorganz/StyLua";
|
||||||
|
exeName = "stylua";
|
||||||
|
artifactName = "stylua-linux-x86_64.zip";
|
||||||
|
sha256 = "nzMJELcyczbCkbWPEAhIqESd90CseTYJs19+KA09OiI=";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
# Add pesde bins dir to path
|
||||||
|
export PATH="$PATH:$HOME/.pesde/bin"
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue