vscode-utils/vscodeEnv: split to 2 functions vscodeWithConfiguration, vscodeExts2nix, vscodeEnv
change usage of toPath with toString
This commit is contained in:
parent
e2c8033df4
commit
6d31311eaa
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, lib, writeShellScriptBin, fetchurl, vscode, unzip }:
|
{ stdenv, lib, buildEnv, writeShellScriptBin, fetchurl, vscode, unzip }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
@ -72,21 +72,22 @@ let
|
|||||||
extensionsFromVscodeMarketplace = mktplcExtRefList:
|
extensionsFromVscodeMarketplace = mktplcExtRefList:
|
||||||
builtins.map extensionFromVscodeMarketplace mktplcExtRefList;
|
builtins.map extensionFromVscodeMarketplace mktplcExtRefList;
|
||||||
|
|
||||||
vscodeWithConfiguration = (userParams : import ./vscodeWithConfiguration.nix {
|
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||||
inherit lib vscode extensionsFromVscodeMarketplace writeShellScriptBin;
|
inherit lib extensionsFromVscodeMarketplace writeShellScriptBin;
|
||||||
} // userParams);
|
vscodeDefault = vscode;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
vscodeExts2nix = (userParams : import ./vscodeExts2nix.nix {
|
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
||||||
inherit lib vscode;
|
inherit lib writeShellScriptBin;
|
||||||
} // userParams);
|
vscodeDefault = vscode;
|
||||||
|
};
|
||||||
vscodeEnv = (userParams : import ./vscodeEnv.nix {
|
|
||||||
inherit lib writeShellScriptBin extensionsFromVscodeMarketplace vscode;
|
|
||||||
} // userParams );
|
|
||||||
|
|
||||||
|
vscodeEnv = import ./vscodeEnv.nix {
|
||||||
|
inherit lib buildEnv writeShellScriptBin extensionsFromVscodeMarketplace;
|
||||||
|
vscodeDefault = vscode;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
inherit fetchVsixFromVscodeMarketplace buildVscodeExtension
|
inherit fetchVsixFromVscodeMarketplace buildVscodeExtension
|
||||||
buildVscodeMarketplaceExtension extensionFromVscodeMarketplace
|
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.
|
#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
|
||||||
, lib ? pkgs.lib
|
, buildEnv
|
||||||
, writeShellScriptBin ? pkgs.writeShellScriptBin
|
, writeShellScriptBin
|
||||||
, extensionsFromVscodeMarketplace ? pkgs.vscode-utils.extensionsFromVscodeMarketplace
|
, extensionsFromVscodeMarketplace
|
||||||
|
, vscodeDefault
|
||||||
|
}:
|
||||||
##User input
|
##User input
|
||||||
|
{ vscode ? vscodeDefault
|
||||||
, nixExtensions ? []
|
, 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
|
# 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
|
# this file will be created/updated by vscodeExts2nix when vscode exists
|
||||||
, mutableExtensionsFile ? ./extensions.nix
|
, mutableExtensionsFile
|
||||||
, vscodeExtsFolderName ? ".vscode-exts"
|
|
||||||
, vscode ? pkgs.vscode
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
mutableExtensionsFilePath = builtins.toPath mutableExtensionsFile;
|
mutableExtensionsFilePath = toString mutableExtensionsFile;
|
||||||
mutableExtensions = if builtins.pathExists mutableExtensionsFile
|
mutableExtensions = if builtins.pathExists mutableExtensionsFile
|
||||||
then import mutableExtensionsFilePath else [];
|
then import mutableExtensionsFilePath else [];
|
||||||
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||||
inherit lib writeShellScriptBin vscode extensionsFromVscodeMarketplace
|
inherit lib writeShellScriptBin extensionsFromVscodeMarketplace;
|
||||||
nixExtensions mutableExtensions vscodeExtsFolderName;
|
vscodeDefault = vscode;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
inherit nixExtensions mutableExtensions vscodeExtsFolderName;
|
||||||
};
|
};
|
||||||
|
|
||||||
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
||||||
inherit lib writeShellScriptBin;
|
inherit lib writeShellScriptBin;
|
||||||
|
vscodeDefault = vscodeWithConfiguration;
|
||||||
|
}
|
||||||
|
{
|
||||||
extensionsToIgnore = nixExtensions;
|
extensionsToIgnore = nixExtensions;
|
||||||
extensions = mutableExtensions;
|
extensions = mutableExtensions;
|
||||||
vscode = vscodeWithConfiguration;
|
|
||||||
};
|
};
|
||||||
code = writeShellScriptBin "code" ''
|
code = writeShellScriptBin "code" ''
|
||||||
${vscodeWithConfiguration}/bin/code --wait "$@"
|
${vscodeWithConfiguration}/bin/code --wait "$@"
|
||||||
@ -34,7 +39,7 @@ let
|
|||||||
${vscodeExts2nix}/bin/vscodeExts2nix > ${mutableExtensionsFilePath}
|
${vscodeExts2nix}/bin/vscodeExts2nix > ${mutableExtensionsFilePath}
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
pkgs.buildEnv {
|
buildEnv {
|
||||||
name = "vscodeEnv";
|
name = "vscodeEnv";
|
||||||
paths = [ code vscodeExts2nix ];
|
paths = [ code vscodeExts2nix ];
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# based on the passed vscode will stdout a nix expression with the installed vscode extensions
|
# based on the passed vscode will stdout a nix expression with the installed vscode extensions
|
||||||
{ pkgs ? import <nixpkgs>{}
|
{ lib
|
||||||
, lib ? pkgs.lib
|
, vscodeDefault
|
||||||
, vscode ? pkgs.vscode
|
, writeShellScriptBin
|
||||||
, writeShellScriptBin ? pkgs.writeShellScriptBin
|
}:
|
||||||
|
|
||||||
##User input
|
##User input
|
||||||
|
{ vscode ? vscodeDefault
|
||||||
, extensionsToIgnore ? []
|
, extensionsToIgnore ? []
|
||||||
# will use those extensions to get sha256 if still exists when executed.
|
# will use those extensions to get sha256 if still exists when executed.
|
||||||
, extensions ? []
|
, extensions ? []
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
# wrapper over vscode to control extensions per project (extensions folder will be created in execution path)
|
# wrapper over vscode to control extensions per project (extensions folder will be created in execution path)
|
||||||
{ pkgs ? import <nixpkgs> {}
|
{ lib
|
||||||
, lib ? pkgs.lib
|
, writeShellScriptBin
|
||||||
, writeShellScriptBin ? pkgs.writeShellScriptBin
|
, extensionsFromVscodeMarketplace
|
||||||
, extensionsFromVscodeMarketplace ? pkgs.vscode-utils.extensionsFromVscodeMarketplace
|
, vscodeDefault
|
||||||
|
}:
|
||||||
## User input
|
## User input
|
||||||
|
{ vscode ? vscodeDefault
|
||||||
, vscode ? pkgs.vscode
|
|
||||||
# extensions to be symlinked into the project's extensions folder
|
# extensions to be symlinked into the project's extensions folder
|
||||||
, nixExtensions ? []
|
, nixExtensions ? []
|
||||||
# extensions to be copied into the project's extensions folder
|
# extensions to be copied into the project's extensions folder
|
||||||
|
Loading…
Reference in New Issue
Block a user