dotfiles/modules/programs/code.nix

66 lines
1.6 KiB
Nix
Raw Normal View History

2022-07-15 13:11:54 +02:00
{ config
, lib
, pkgs
, ...
}:
2022-03-23 12:41:04 +01:00
2022-03-30 10:55:57 +02:00
with lib;
2022-07-15 13:11:54 +02:00
let
cfg = config.my.programs.code;
in
{
2023-05-27 12:00:08 +02:00
options.my.programs.code = {
enable = mkEnableOption "code";
package = mkOption {
type = types.package;
default = pkgs.vscode;
};
extensions = mkOption {
type = types.listOf types.package;
default = with pkgs.vscode-extensions; [
bbenoist.nix
vscodevim.vim
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "copilot-nightly";
publisher = "GitHub";
version = "1.86.118";
sha256 = "04nspnmd5cfnv3m9igww6h6la6pvhdqzqmdnbm1znapxqiw2m927";
}
{
name = "copilot-chat";
publisher = "GitHub";
version = "0.1.2023052602";
sha256 = "0anlzzs4g7c9mmw7yxy5bgjcs0niwa3bswgvhwspf5fh8bbq5n44";
}
];
};
wayland = mkOption {
type = types.bool;
default = true;
};
};
2022-10-15 20:00:09 +02:00
2022-07-15 13:11:54 +02:00
config = mkIf cfg.enable {
2023-05-27 12:00:08 +02:00
environment.systemPackages =
let
withExtensions = pkgs.vscode-with-extensions.override {
vscode = cfg.package;
vscodeExtensions = cfg.extensions;
};
maybeExtensions = if cfg.extensions == [ ] then cfg.package else withExtensions;
withWayland = pkgs.symlinkJoin {
name = "${maybeExtensions.name}-wayland";
paths = [ maybeExtensions ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/code* \
--set NIXOS_OZONE_WL 1
'';
};
final = if cfg.wayland then withWayland else maybeExtensions;
in
[ final ];
2022-03-23 12:41:04 +01:00
};
}