mirror of
https://github.com/nix-community/home-manager
synced 2024-12-03 08:29:46 +01:00
c802fa310e
Signed-off-by: Reputable2722 <153411261+Reputable2772@users.noreply.github.com>
55 lines
1.2 KiB
Nix
55 lines
1.2 KiB
Nix
{ pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
tasksFilePath = name:
|
|
if pkgs.stdenv.hostPlatform.isDarwin then
|
|
"Library/Application Support/Code/User/${
|
|
lib.optionalString (name != "default") "profiles/${name}/"
|
|
}tasks.json"
|
|
else
|
|
".config/Code/User/${
|
|
lib.optionalString (name != "default") "profiles/${name}/"
|
|
}tasks.json";
|
|
|
|
tasks = {
|
|
version = "2.0.0";
|
|
tasks = [{
|
|
type = "shell";
|
|
label = "Hello task";
|
|
command = "hello";
|
|
}];
|
|
};
|
|
|
|
expectedTasks = pkgs.writeText "tasks-expected.json" ''
|
|
{
|
|
"tasks": [
|
|
{
|
|
"command": "hello",
|
|
"label": "Hello task",
|
|
"type": "shell"
|
|
}
|
|
],
|
|
"version": "2.0.0"
|
|
}
|
|
'';
|
|
|
|
in {
|
|
programs.vscode = {
|
|
enable = true;
|
|
package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; };
|
|
defaultProfile.userTasks = tasks;
|
|
profiles = [{
|
|
name = "test";
|
|
userTasks = tasks;
|
|
}];
|
|
};
|
|
|
|
nmt.script = ''
|
|
assertFileExists "home-files/${tasksFilePath "default"}"
|
|
assertFileContent "home-files/${tasksFilePath "default"}" "${expectedTasks}"
|
|
|
|
assertFileExists "home-files/${tasksFilePath "test"}"
|
|
assertFileContent "home-files/${tasksFilePath "test"}" "${expectedTasks}"
|
|
'';
|
|
}
|