works
Some checks are pending
CI Tests / dotnet (push) Waiting to run
CI Tests / dotnet-1 (push) Waiting to run
CI Tests / dotnet-2 (push) Waiting to run
Emacs End-to-End Tests / ert (push) Waiting to run
Vim End-to-End Tests / themis (push) Waiting to run

This commit is contained in:
fwastring 2026-02-18 13:29:52 +01:00
parent e1c0d950e0
commit 242fd47f93
3 changed files with 30 additions and 148 deletions

View file

@ -1,80 +1,37 @@
{ {
pkgs ? import <nixpkgs> { }, stdenvNoCC,
fetchzip,
lib,
powershell,
runtimeShell,
}: }:
let stdenvNoCC.mkDerivation rec {
psreadline = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/PSReadLine/2.4.5";
sha256 = "12pwy5b426lv7cmlasa7ajy202a0vjjs9drfyg2q5zwqxhj8g8cz";
stripRoot = false;
extension = "zip";
};
psscriptanalyzer = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/PSScriptAnalyzer/1.24.0";
sha256 = "03bz9f5rcx749758h6l9wsv86300s0a34qgd522v6166crbpvg2p";
stripRoot = false;
extension = "zip";
};
invokebuild = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/InvokeBuild/5.12.2";
sha256 = "0cry70c6ndlv4y0fmlg5iip0ix1r51p7i6dxx3y2zzczbkz2mn6m";
stripRoot = false;
extension = "zip";
};
platyps = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/platyPS/0.14.2";
sha256 = "13m11mf42blcn2327m9a4dqfg8sgjjg1vg9dmiwvnbq7wpam260q";
stripRoot = false;
extension = "zip";
};
in
pkgs.stdenv.mkDerivation {
pname = "powershell-editor-services"; pname = "powershell-editor-services";
version = "4.4.0"; version = "4.4.0";
src = ./.;
phases = [ src = fetchzip {
"unpackPhase" url = "https://github.com/PowerShell/PowerShellEditorServices/releases/download/v${version}/PowerShellEditorServices.zip";
"patchPhase" hash = "sha256-tmz6xkcF44xnG5VwSeHNWzjRQK6wxQ7Ii6mDNisCMb8=";
"buildPhase" stripRoot = false;
"installPhase" };
];
nativeBuildInputs = [
pkgs.dotnet-sdk_8
pkgs.git
pkgs.powershell
];
buildPhase = ''
export HOME=$TMPDIR
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export NUGET_PACKAGES=$TMPDIR/nuget
export NUGET_CONFIG_FILE=$PWD/nuget.config
git init -q
git config user.email "nix@local"
git config user.name "nix"
git add -A
git commit -qm "nix build"
mkdir -p module
cp -r ${psreadline} module/PSReadLine
cp -r ${psscriptanalyzer} module/PSScriptAnalyzer
mkdir -p $TMPDIR/psmodules
cp -r ${invokebuild} $TMPDIR/psmodules/InvokeBuild
cp -r ${platyps} $TMPDIR/psmodules/platyPS
export PSModulePath="$TMPDIR/psmodules${"PSModulePath:+:$PSModulePath"}"
pwsh -NoLogo -NoProfile -Command \
"Import-Module InvokeBuild; Invoke-Build -File PowerShellEditorServices.build.ps1 -Task Build,AssembleModule -Configuration Release"
'';
installPhase = '' installPhase = ''
mkdir -p $out/share/powershell/Modules mkdir -p $out/lib/powershell-editor-services/ $out/bin
cp -r module/* $out/share/powershell/Modules/ mv * $out/lib/powershell-editor-services/
cat > $out/bin/powershell-editor-services <<EOF
#! ${runtimeShell} -e
exec ${lib.getExe' powershell "pwsh"} -noprofile -nologo -c "& '$out/lib/powershell-editor-services/PowerShellEditorServices/Start-EditorServices.ps1' \$@"
EOF
chmod +x $out/bin/powershell-editor-services
''; '';
meta = {
description = "Common platform for PowerShell development support in any editor or application";
homepage = "https://github.com/PowerShell/PowerShellEditorServices";
changelog = "https://github.com/PowerShell/PowerShellEditorServices/releases/tag/v${version}";
platforms = lib.platforms.unix;
license = lib.licenses.mit;
mainProgram = "powershell-editor-services";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
};
} }

View file

@ -8,85 +8,10 @@
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
psreadline = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/PSReadLine/2.4.5";
sha256 = "12pwy5b426lv7cmlasa7ajy202a0vjjs9drfyg2q5zwqxhj8g8cz";
stripRoot = false;
extension = "zip";
};
psscriptanalyzer = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/PSScriptAnalyzer/1.24.0";
sha256 = "03bz9f5rcx749758h6l9wsv86300s0a34qgd522v6166crbpvg2p";
stripRoot = false;
extension = "zip";
};
invokebuild = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/InvokeBuild/5.12.2";
sha256 = "0cry70c6ndlv4y0fmlg5iip0ix1r51p7i6dxx3y2zzczbkz2mn6m";
stripRoot = false;
extension = "zip";
};
platyps = pkgs.fetchzip {
url = "https://www.powershellgallery.com/api/v2/package/platyPS/0.14.2";
sha256 = "13m11mf42blcn2327m9a4dqfg8sgjjg1vg9dmiwvnbq7wpam260q";
stripRoot = false;
extension = "zip";
};
in in
{ {
packages.${system} = rec { packages.${system} = rec {
pses = pkgs.stdenv.mkDerivation { pses = pkgs.callPackage ./default.nix { };
pname = "powershell-editor-services";
version = "4.4.0";
src = ./.;
phases = [
"unpackPhase"
"patchPhase"
"buildPhase"
"installPhase"
];
nativeBuildInputs = [
pkgs.dotnet-sdk_8
pkgs.git
pkgs.powershell
];
buildPhase = ''
export HOME=$TMPDIR
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export NUGET_PACKAGES=$TMPDIR/nuget
export NUGET_CONFIG_FILE=$PWD/nuget.config
git init -q
git config user.email "nix@local"
git config user.name "nix"
git add -A
git commit -qm "nix build"
mkdir -p module
cp -r ${psreadline} module/PSReadLine
cp -r ${psscriptanalyzer} module/PSScriptAnalyzer
mkdir -p $TMPDIR/psmodules
cp -r ${invokebuild} $TMPDIR/psmodules/InvokeBuild
cp -r ${platyps} $TMPDIR/psmodules/platyPS
export PSModulePath="$TMPDIR/psmodules''${PSModulePath:+:$PSModulePath}"
pwsh -NoLogo -NoProfile -Command \
"Import-Module InvokeBuild; Invoke-Build -File PowerShellEditorServices.build.ps1 -Task Build,AssembleModule -Configuration Release"
'';
installPhase = ''
mkdir -p $out/share/powershell/Modules
cp -r module/* $out/share/powershell/Modules/
'';
};
default = pses; default = pses;
}; };

View file

@ -2,6 +2,6 @@
<configuration> <configuration>
<packageSources> <packageSources>
<clear /> <clear />
<add key="PowerShellCore_PublicPackages" value="https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell/nuget/v3/index.json" /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>