vscode: apply nixfmt
This commit is contained in:
parent
aecd4acfb4
commit
e7d5531cfa
1
format
1
format
|
@ -38,7 +38,6 @@ find . -name '*.nix' \
|
||||||
! -path ./modules/programs/lesspipe.nix \
|
! -path ./modules/programs/lesspipe.nix \
|
||||||
! -path ./modules/programs/ssh.nix \
|
! -path ./modules/programs/ssh.nix \
|
||||||
! -path ./modules/programs/tmux.nix \
|
! -path ./modules/programs/tmux.nix \
|
||||||
! -path ./modules/programs/vscode.nix \
|
|
||||||
! -path ./modules/programs/zsh.nix \
|
! -path ./modules/programs/zsh.nix \
|
||||||
! -path ./modules/services/gpg-agent.nix \
|
! -path ./modules/services/gpg-agent.nix \
|
||||||
! -path ./modules/services/kbfs.nix \
|
! -path ./modules/services/kbfs.nix \
|
||||||
|
|
|
@ -20,8 +20,7 @@ let
|
||||||
"vscodium" = "vscode-oss";
|
"vscodium" = "vscode-oss";
|
||||||
}.${vscodePname};
|
}.${vscodePname};
|
||||||
|
|
||||||
userDir =
|
userDir = if pkgs.stdenv.hostPlatform.isDarwin then
|
||||||
if pkgs.stdenv.hostPlatform.isDarwin then
|
|
||||||
"Library/Application Support/${configDir}/User"
|
"Library/Application Support/${configDir}/User"
|
||||||
else
|
else
|
||||||
"${config.xdg.configHome}/${configDir}/User";
|
"${config.xdg.configHome}/${configDir}/User";
|
||||||
|
@ -31,9 +30,8 @@ let
|
||||||
|
|
||||||
# TODO: On Darwin where are the extensions?
|
# TODO: On Darwin where are the extensions?
|
||||||
extensionPath = ".${extensionDir}/extensions";
|
extensionPath = ".${extensionDir}/extensions";
|
||||||
in
|
|
||||||
|
|
||||||
{
|
in {
|
||||||
options = {
|
options = {
|
||||||
programs.vscode = {
|
programs.vscode = {
|
||||||
enable = mkEnableOption "Visual Studio Code";
|
enable = mkEnableOption "Visual Studio Code";
|
||||||
|
@ -49,7 +47,7 @@ in
|
||||||
|
|
||||||
userSettings = mkOption {
|
userSettings = mkOption {
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
default = {};
|
default = { };
|
||||||
example = literalExample ''
|
example = literalExample ''
|
||||||
{
|
{
|
||||||
"update.channel" = "none";
|
"update.channel" = "none";
|
||||||
|
@ -85,7 +83,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
default = [];
|
default = [ ];
|
||||||
example = literalExample ''
|
example = literalExample ''
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -103,7 +101,7 @@ in
|
||||||
|
|
||||||
extensions = mkOption {
|
extensions = mkOption {
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
default = [];
|
default = [ ];
|
||||||
example = literalExample "[ pkgs.vscode-extensions.bbenoist.Nix ]";
|
example = literalExample "[ pkgs.vscode-extensions.bbenoist.Nix ]";
|
||||||
description = ''
|
description = ''
|
||||||
The extensions Visual Studio Code should be started with.
|
The extensions Visual Studio Code should be started with.
|
||||||
|
@ -117,29 +115,21 @@ in
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
|
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
|
||||||
home.file =
|
home.file = let
|
||||||
let
|
|
||||||
subDir = "share/vscode/extensions";
|
subDir = "share/vscode/extensions";
|
||||||
toPaths = path:
|
toPaths = path:
|
||||||
# Links every dir in path to the extension path.
|
# Links every dir in path to the extension path.
|
||||||
mapAttrsToList (k: _:
|
mapAttrsToList
|
||||||
{
|
(k: _: { "${extensionPath}/${k}".source = "${path}/${subDir}/${k}"; })
|
||||||
"${extensionPath}/${k}".source = "${path}/${subDir}/${k}";
|
(builtins.readDir (path + "/${subDir}"));
|
||||||
}) (builtins.readDir (path + "/${subDir}"));
|
|
||||||
toSymlink = concatMap toPaths cfg.extensions;
|
toSymlink = concatMap toPaths cfg.extensions;
|
||||||
in
|
in foldr (a: b: a // b) {
|
||||||
foldr
|
"${configFilePath}" = mkIf (cfg.userSettings != { }) {
|
||||||
(a: b: a // b)
|
|
||||||
{
|
|
||||||
"${configFilePath}" =
|
|
||||||
mkIf (cfg.userSettings != {}) {
|
|
||||||
text = builtins.toJSON cfg.userSettings;
|
text = builtins.toJSON cfg.userSettings;
|
||||||
};
|
};
|
||||||
"${keybindingsFilePath}" =
|
"${keybindingsFilePath}" = mkIf (cfg.keybindings != [ ]) {
|
||||||
mkIf (cfg.keybindings != []) {
|
|
||||||
text = builtins.toJSON cfg.keybindings;
|
text = builtins.toJSON cfg.keybindings;
|
||||||
};
|
};
|
||||||
}
|
} toSymlink;
|
||||||
toSymlink;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue