Accept a string or a list of strings

This commit is contained in:
Elsa
2025-03-08 10:21:11 +08:00
parent 40dc5fdcb5
commit 7943271335
3 changed files with 19 additions and 5 deletions
+14 -2
View File
@@ -140,14 +140,26 @@ This same list is also used to determine the `RPATH` when automatically patching
```
### `installPath`
The installation path for VS Code server is configurable and the default can differ for alternative builds (e.g. oss and insider), so this option allows you to configure which installation path should be monitered and automatically fixed. If you have multiple installations, you can specify them as an array.
The installation path for VS Code server is configurable. You can specify either a single path as a string or multiple paths as a list. If you have multiple installations (e.g., stable, OSS, and insider builds), you can specify all of them to be monitored and automatically fixed.
```nix
# Single path (string)
{
services.vscode-server.installPath = [ "$HOME/.vscode-server" "$HOME/.vscode-server-oss" ];
services.vscode-server.installPath = "$HOME/.vscode-server";
}
# Multiple paths (list)
{
services.vscode-server.installPath = [
"$HOME/.vscode-server"
"$HOME/.vscode-server-oss"
"$HOME/.vscode-server-insiders"
];
}
```
String values are automatically coerced to a single-element list for backwards compatibility.
### `postPatch`
The goal of this project is to make VS Code server work with NixOS, anything more is outside of the scope of the project, but if you want additional things to be done, you can use this hook to run a shell script after the patching is done.
+4 -2
View File
@@ -33,11 +33,13 @@ moduleConfig: {
};
installPath = mkOption {
type = listOf str;
type = lib.types.coercedTo str (x: [x]) (listOf str);
default = [ "$HOME/.vscode-server" ];
example = [ "$HOME/.vscode-server" "$HOME/.vscode-server-oss" "$HOME/.vscode-server-insiders" ];
description = ''
The install paths for VS Code Server.
Path(s) where VS Code Server will be installed.
Accepts either a single path string or a list of paths.
String values are automatically coerced to a single-element list for backwards compatibility.
'';
};
+1 -1
View File
@@ -21,7 +21,7 @@
enableFHS ? false,
nodejsPackage ? null,
extraRuntimeDependencies ? [ ],
installPath ? "$HOME/.vscode-server",
installPath ? [ "$HOME/.vscode-server" ],
postPatch ? "",
}: let
inherit (lib) makeBinPath makeLibraryPath optionalString;