mirror of
https://github.com/davegallant/nix-config
synced 2025-08-07 00:58:16 +00:00
Remove vscode pin
This commit is contained in:
18
flake.lock
generated
18
flake.lock
generated
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1615014591,
|
"lastModified": 1615236417,
|
||||||
"narHash": "sha256-zKLLOn6gFbI1gmlqMdIPkMJBiOmkVPIwprtvzZa1mhw=",
|
"narHash": "sha256-ialggc4ff+coOaKIxreoynh+FPSs2cergePIQE1U8jE=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "abc9d96d19e2c8a7f3a32b74894dc16ba4c25df0",
|
"rev": "57a7e5e2c53de58215fdac1910470bef36dd30cd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
},
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1615019476,
|
"lastModified": 1615281383,
|
||||||
"narHash": "sha256-BYm1OOJYwPsd6nRT2EsiSWr2rCg3cI9HTlhyYPc8c+Q=",
|
"narHash": "sha256-23XBOcZapDtm7IzYYHub4tNpo4AsSz6qLXsHTCNuDAA=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "720d531b1cc0b4824d295bb38f3784aebf91a1a1",
|
"rev": "831de9cac9ff2ea8cf4c3742020ea92e82ac8ac3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -38,11 +38,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1614815769,
|
"lastModified": 1614989413,
|
||||||
"narHash": "sha256-Rdy37Ioof5FlMlc+YC9PniSIJW/EsdImG+wZPP5VWvo=",
|
"narHash": "sha256-g503bGSdVhLu2cKR5sHG8XetLFrVUzAL3+mrnQJpmdY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d496205cf22c3079461d868ea3198d42ded59287",
|
"rev": "102eb68ceecbbd32ab1906a53ef5a7269dc9794a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@@ -4,6 +4,5 @@ final: prev: {
|
|||||||
rfd = prev.callPackage ./rfd { };
|
rfd = prev.callPackage ./rfd { };
|
||||||
srv = prev.callPackage ./srv { };
|
srv = prev.callPackage ./srv { };
|
||||||
vpngate = prev.callPackage ./vpngate { };
|
vpngate = prev.callPackage ./vpngate { };
|
||||||
vscode = prev.callPackage ./vscode { };
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,47 +0,0 @@
|
|||||||
{ stdenv, lib, callPackage, fetchurl, isInsiders ? false }:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (stdenv.hostPlatform) system;
|
|
||||||
|
|
||||||
plat = { x86_64-linux = "linux-x64"; }.${system};
|
|
||||||
|
|
||||||
archive_fmt = "tar.gz";
|
|
||||||
|
|
||||||
sha256 = {
|
|
||||||
x86_64-linux = "sha256-jDD936sLQDtouBUeeaPCzLSj1Euo4GPA+Vf5ARZecs0=";
|
|
||||||
}.${system};
|
|
||||||
in callPackage ./generic.nix rec {
|
|
||||||
version = "1.52.1";
|
|
||||||
pname = "vscode";
|
|
||||||
|
|
||||||
executableName = "code" + lib.optionalString isInsiders "-insiders";
|
|
||||||
longName = "Visual Studio Code" + lib.optionalString isInsiders " - Insiders";
|
|
||||||
shortName = "Code" + lib.optionalString isInsiders " - Insiders";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
name = "VSCode_${version}_${plat}.${archive_fmt}";
|
|
||||||
url = "https://vscode-update.azurewebsites.net/${version}/${plat}/stable";
|
|
||||||
inherit sha256;
|
|
||||||
};
|
|
||||||
|
|
||||||
sourceRoot = "";
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = ''
|
|
||||||
Open source source code editor developed by Microsoft for Windows,
|
|
||||||
Linux and macOS
|
|
||||||
'';
|
|
||||||
longDescription = ''
|
|
||||||
Open source source code editor developed by Microsoft for Windows,
|
|
||||||
Linux and macOS. It includes support for debugging, embedded Git
|
|
||||||
control, syntax highlighting, intelligent code completion, snippets,
|
|
||||||
and code refactoring. It is also customizable, so users can change the
|
|
||||||
editor's theme, keyboard shortcuts, and preferences
|
|
||||||
'';
|
|
||||||
homepage = "https://code.visualstudio.com/";
|
|
||||||
downloadPage = "https://code.visualstudio.com/Updates";
|
|
||||||
license = licenses.unfree;
|
|
||||||
maintainers = with maintainers; [ davegallant ];
|
|
||||||
platforms = [ "x86_64-linux" ];
|
|
||||||
};
|
|
||||||
}
|
|
@@ -1,91 +0,0 @@
|
|||||||
{ stdenv, lib, makeDesktopItem, unzip, libsecret, libXScrnSaver, wrapGAppsHook
|
|
||||||
, gtk2, atomEnv, at-spi2-atk, autoPatchelfHook, systemd, fontconfig, libdbusmenu
|
|
||||||
|
|
||||||
# Populate passthru.tests
|
|
||||||
, tests
|
|
||||||
|
|
||||||
# Attributes inherit from specific versions
|
|
||||||
, version, src, meta, sourceRoot, executableName, longName, shortName, pname }:
|
|
||||||
|
|
||||||
let inherit (stdenv.hostPlatform) system;
|
|
||||||
in stdenv.mkDerivation {
|
|
||||||
|
|
||||||
inherit pname version src sourceRoot;
|
|
||||||
|
|
||||||
passthru = { inherit executableName tests; };
|
|
||||||
|
|
||||||
desktopItem = makeDesktopItem {
|
|
||||||
name = executableName;
|
|
||||||
desktopName = longName;
|
|
||||||
comment = "Code Editing. Redefined.";
|
|
||||||
genericName = "Text Editor";
|
|
||||||
exec = "${executableName} %F";
|
|
||||||
icon = "code";
|
|
||||||
startupNotify = "true";
|
|
||||||
categories = "Utility;TextEditor;Development;IDE;";
|
|
||||||
mimeType = "text/plain;inode/directory;";
|
|
||||||
extraEntries = ''
|
|
||||||
StartupWMClass=${shortName}
|
|
||||||
Actions=new-empty-window;
|
|
||||||
Keywords=vscode;
|
|
||||||
|
|
||||||
[Desktop Action new-empty-window]
|
|
||||||
Name=New Empty Window
|
|
||||||
Exec=${executableName} --new-window %F
|
|
||||||
Icon=code
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
urlHandlerDesktopItem = makeDesktopItem {
|
|
||||||
name = executableName + "-url-handler";
|
|
||||||
desktopName = longName + " - URL Handler";
|
|
||||||
comment = "Code Editing. Redefined.";
|
|
||||||
genericName = "Text Editor";
|
|
||||||
exec = executableName + " --open-url %U";
|
|
||||||
icon = "code";
|
|
||||||
startupNotify = "true";
|
|
||||||
categories = "Utility;TextEditor;Development;IDE;";
|
|
||||||
mimeType = "x-scheme-handler/vscode;";
|
|
||||||
extraEntries = ''
|
|
||||||
NoDisplay=true
|
|
||||||
Keywords=vscode;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
buildInputs = (if stdenv.isDarwin then
|
|
||||||
[ unzip ]
|
|
||||||
else
|
|
||||||
[ gtk2 at-spi2-atk wrapGAppsHook ] ++ atomEnv.packages)
|
|
||||||
++ [ libsecret libXScrnSaver ];
|
|
||||||
|
|
||||||
runtimeDependencies = lib.optional (stdenv.isLinux) [
|
|
||||||
(lib.getLib systemd)
|
|
||||||
fontconfig.lib
|
|
||||||
libdbusmenu
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = lib.optional (!stdenv.isDarwin) autoPatchelfHook;
|
|
||||||
|
|
||||||
dontBuild = true;
|
|
||||||
dontConfigure = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/lib/vscode $out/bin
|
|
||||||
cp -r ./* $out/lib/vscode
|
|
||||||
|
|
||||||
ln -s $out/lib/vscode/bin/${executableName} $out/bin
|
|
||||||
|
|
||||||
mkdir -p $out/share/applications
|
|
||||||
ln -s $desktopItem/share/applications/${executableName}.desktop $out/share/applications/${executableName}.desktop
|
|
||||||
ln -s $urlHandlerDesktopItem/share/applications/${executableName}-url-handler.desktop $out/share/applications/${executableName}-url-handler.desktop
|
|
||||||
|
|
||||||
mkdir -p $out/share/pixmaps
|
|
||||||
cp $out/lib/vscode/resources/app/resources/linux/code.png $out/share/pixmaps/code.png
|
|
||||||
|
|
||||||
# Override the previously determined VSCODE_PATH with the one we know to be correct
|
|
||||||
sed -i "/ELECTRON=/iVSCODE_PATH='$out/lib/vscode'" $out/bin/${executableName}
|
|
||||||
grep -q "VSCODE_PATH='$out/lib/vscode'" $out/bin/${executableName} # check if sed succeeded
|
|
||||||
'';
|
|
||||||
|
|
||||||
inherit meta;
|
|
||||||
}
|
|
@@ -1,73 +0,0 @@
|
|||||||
{ lib, runCommand, buildEnv, vscode, makeWrapper, vscodeExtensions ? [ ] }:
|
|
||||||
|
|
||||||
/* `vscodeExtensions`
|
|
||||||
: A set of vscode extensions to be installed alongside the editor. Here's a an
|
|
||||||
example:
|
|
||||||
|
|
||||||
~~~
|
|
||||||
vscode-with-extensions.override {
|
|
||||||
|
|
||||||
# When the extension is already available in the default extensions set.
|
|
||||||
vscodeExtensions = with vscode-extensions; [
|
|
||||||
bbenoist.Nix
|
|
||||||
]
|
|
||||||
|
|
||||||
# Concise version from the vscode market place when not available in the default set.
|
|
||||||
++ vscode-utils.extensionsFromVscodeMarketplace [
|
|
||||||
{
|
|
||||||
name = "code-runner";
|
|
||||||
publisher = "formulahendry";
|
|
||||||
version = "0.6.33";
|
|
||||||
sha256 = "166ia73vrcl5c9hm4q1a73qdn56m0jc7flfsk5p5q41na9f10lb0";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
~~~
|
|
||||||
|
|
||||||
This expression should fetch
|
|
||||||
- the *nix* vscode extension from whatever source defined in the
|
|
||||||
default nixpkgs extensions set `vscodeExtensions`.
|
|
||||||
|
|
||||||
- the *code-runner* vscode extension from the marketplace using the
|
|
||||||
following url:
|
|
||||||
|
|
||||||
~~~
|
|
||||||
https://bbenoist.gallery.vsassets.io/_apis/public/gallery/publisher/bbenoist/extension/nix/1.0.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
|
|
||||||
~~~
|
|
||||||
|
|
||||||
The original `code` executable will be wrapped so that it uses the set of pre-installed / unpacked
|
|
||||||
extensions as its `--extensions-dir`.
|
|
||||||
*/
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
inherit (vscode) executableName;
|
|
||||||
wrappedPkgVersion = lib.getVersion vscode;
|
|
||||||
wrappedPkgName = lib.removeSuffix "-${wrappedPkgVersion}" vscode.name;
|
|
||||||
|
|
||||||
combinedExtensionsDrv = buildEnv {
|
|
||||||
name = "vscode-extensions";
|
|
||||||
paths = vscodeExtensions;
|
|
||||||
};
|
|
||||||
|
|
||||||
# When no extensions are requested, we simply redirect to the original
|
|
||||||
# non-wrapped vscode executable.
|
|
||||||
in runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}" {
|
|
||||||
buildInputs = [ vscode makeWrapper ];
|
|
||||||
dontPatchELF = true;
|
|
||||||
dontStrip = true;
|
|
||||||
meta = vscode.meta;
|
|
||||||
} ''
|
|
||||||
mkdir -p "$out/bin"
|
|
||||||
mkdir -p "$out/share/applications"
|
|
||||||
mkdir -p "$out/share/pixmaps"
|
|
||||||
|
|
||||||
ln -sT "${vscode}/share/pixmaps/code.png" "$out/share/pixmaps/code.png"
|
|
||||||
ln -sT "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
|
|
||||||
ln -sT "${vscode}/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop"
|
|
||||||
makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${
|
|
||||||
lib.optionalString (vscodeExtensions != [ ]) ''
|
|
||||||
--add-flags "--extensions-dir ${combinedExtensionsDrv}/share/vscode/extensions"
|
|
||||||
''
|
|
||||||
}
|
|
||||||
''
|
|
Reference in New Issue
Block a user