mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
vscode-utils/vscodeEnv: split to 2 functions vscodeWithConfiguration, vscodeExts2nix, vscodeEnv
change usage of toPath with toString
This commit is contained in:
parent
2d59425555
commit
7fc2b2ad7e
@ -1,4 +1,4 @@
|
||||
{ stdenv, lib, writeShellScriptBin, fetchurl, vscode, unzip }:
|
||||
{ stdenv, lib, buildEnv, writeShellScriptBin, fetchurl, vscode, unzip }:
|
||||
|
||||
let
|
||||
extendedPkgVersion = lib.getVersion vscode;
|
||||
@ -73,21 +73,22 @@ let
|
||||
extensionsFromVscodeMarketplace = mktplcExtRefList:
|
||||
builtins.map extensionFromVscodeMarketplace mktplcExtRefList;
|
||||
|
||||
vscodeWithConfiguration = (userParams : import ./vscodeWithConfiguration.nix {
|
||||
inherit lib vscode extensionsFromVscodeMarketplace writeShellScriptBin;
|
||||
} // userParams);
|
||||
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||
inherit lib extensionsFromVscodeMarketplace writeShellScriptBin;
|
||||
vscodeDefault = vscode;
|
||||
};
|
||||
|
||||
|
||||
vscodeExts2nix = (userParams : import ./vscodeExts2nix.nix {
|
||||
inherit lib vscode;
|
||||
} // userParams);
|
||||
|
||||
vscodeEnv = (userParams : import ./vscodeEnv.nix {
|
||||
inherit lib writeShellScriptBin extensionsFromVscodeMarketplace vscode;
|
||||
} // userParams );
|
||||
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
||||
inherit lib writeShellScriptBin;
|
||||
vscodeDefault = vscode;
|
||||
};
|
||||
|
||||
vscodeEnv = import ./vscodeEnv.nix {
|
||||
inherit lib buildEnv writeShellScriptBin extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
inherit fetchVsixFromVscodeMarketplace buildVscodeExtension
|
||||
buildVscodeMarketplaceExtension extensionFromVscodeMarketplace
|
||||
|
@ -1,32 +1,37 @@
|
||||
#use vscodeWithConfiguration and vscodeExts2nix to create vscode exetuable that when exits(vscode) will update the mutable extension file, which is imported when getting evaluated by nix.
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
, lib ? pkgs.lib
|
||||
, writeShellScriptBin ? pkgs.writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace ? pkgs.vscode-utils.extensionsFromVscodeMarketplace
|
||||
|
||||
{ lib
|
||||
, buildEnv
|
||||
, writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace
|
||||
, vscodeDefault
|
||||
}:
|
||||
##User input
|
||||
|
||||
, nixExtensions ? []
|
||||
{ vscode ? vscodeDefault
|
||||
, nixExtensions ? []
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
# if file exists will use it and import the extensions in it into this dervation else will use empty extensions list
|
||||
# this file will be created/updated by vscodeExts2nix when vscode exists
|
||||
, mutableExtensionsFile ? ./extensions.nix
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
, vscode ? pkgs.vscode
|
||||
, mutableExtensionsFile
|
||||
}:
|
||||
let
|
||||
mutableExtensionsFilePath = builtins.toPath mutableExtensionsFile;
|
||||
mutableExtensionsFilePath = toString mutableExtensionsFile;
|
||||
mutableExtensions = if builtins.pathExists mutableExtensionsFile
|
||||
then import mutableExtensionsFilePath else [];
|
||||
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||
inherit lib writeShellScriptBin vscode extensionsFromVscodeMarketplace
|
||||
nixExtensions mutableExtensions vscodeExtsFolderName;
|
||||
inherit lib writeShellScriptBin extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
}
|
||||
{
|
||||
inherit nixExtensions mutableExtensions vscodeExtsFolderName;
|
||||
};
|
||||
|
||||
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
||||
inherit lib writeShellScriptBin;
|
||||
vscodeDefault = vscodeWithConfiguration;
|
||||
}
|
||||
{
|
||||
extensionsToIgnore = nixExtensions;
|
||||
extensions = mutableExtensions;
|
||||
vscode = vscodeWithConfiguration;
|
||||
};
|
||||
code = writeShellScriptBin "code" ''
|
||||
${vscodeWithConfiguration}/bin/code --wait "$@"
|
||||
@ -34,7 +39,7 @@ let
|
||||
${vscodeExts2nix}/bin/vscodeExts2nix > ${mutableExtensionsFilePath}
|
||||
'';
|
||||
in
|
||||
pkgs.buildEnv {
|
||||
buildEnv {
|
||||
name = "vscodeEnv";
|
||||
paths = [ code vscodeExts2nix ];
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
# based on the passed vscode will stdout a nix expression with the installed vscode extensions
|
||||
{ pkgs ? import <nixpkgs>{}
|
||||
, lib ? pkgs.lib
|
||||
, vscode ? pkgs.vscode
|
||||
, writeShellScriptBin ? pkgs.writeShellScriptBin
|
||||
{ lib
|
||||
, vscodeDefault
|
||||
, writeShellScriptBin
|
||||
}:
|
||||
|
||||
##User input
|
||||
|
||||
, extensionsToIgnore ? []
|
||||
{ vscode ? vscodeDefault
|
||||
, extensionsToIgnore ? []
|
||||
# will use those extensions to get sha256 if still exists when executed.
|
||||
, extensions ? []
|
||||
, extensions ? []
|
||||
}:
|
||||
let
|
||||
mktplcExtRefToFetchArgs = import ./mktplcExtRefToFetchArgs.nix;
|
||||
|
@ -1,17 +1,16 @@
|
||||
# wrapper over vscode to control extensions per project (extensions folder will be created in execution path)
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
, lib ? pkgs.lib
|
||||
, writeShellScriptBin ? pkgs.writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace ? pkgs.vscode-utils.extensionsFromVscodeMarketplace
|
||||
|
||||
##User input
|
||||
|
||||
, vscode ? pkgs.vscode
|
||||
{ lib
|
||||
, writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace
|
||||
, vscodeDefault
|
||||
}:
|
||||
## User input
|
||||
{ vscode ? vscodeDefault
|
||||
# extensions to be symlinked into the project's extensions folder
|
||||
, nixExtensions ? []
|
||||
, nixExtensions ? []
|
||||
# extensions to be copied into the project's extensions folder
|
||||
, mutableExtensions ? []
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
, mutableExtensions ? []
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
}:
|
||||
let
|
||||
nixExtsDrvs = extensionsFromVscodeMarketplace nixExtensions;
|
||||
|
Loading…
Reference in New Issue
Block a user