Files
dev/modules/optionnals/desktop/code.nix

95 lines
2.6 KiB
Nix

{
pkgs,
lib,
...
}:
let
open-remote-ssh = pkgs.stdenv.mkDerivation rec {
pname = "vscode-extension-open-remote-ssh";
version = "0.0.49";
vscodeExtUniqueId = "jeanp413.open-remote-ssh";
vscodeExtPublisher = "jeanp413";
src = pkgs.fetchurl {
url = "https://github.com/jeanp413/open-remote-ssh/releases/download/v${version}/open-remote-ssh-${version}.vsix";
# To obtain the correct hash, run:
# nix-prefetch-url --type sha256 https://github.com/jeanp413/open-remote-ssh/releases/download/v0.0.49/open-remote-ssh-0.0.49.vsix | xargs -I {} nix hash to-sri --type sha256 {}
# Temporarily use lib.fakeHash to have Nix give you the correct hash
# sha256 = lib.fakeHash;
# Then replace with the hash returned in the error
sha256 = "sha256-QfJnAAx+kO2iJ1EzWoO5HLogJKg3RiC3hg1/u2Jm6t4=";
};
nativeBuildInputs = [
pkgs.unzip
];
# No automatic unpacking for .vsix files
dontUnpack = true;
configurePhase = ''
runHook preConfigure
# Create a temporary directory to extract the .vsix
mkdir -p extract
cd extract
# A .vsix is a ZIP file, we decompress it
unzip -q "$src"
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
# Nothing to build, everything is precompiled in the .vsix
runHook postBuild
'';
installPhase = ''
runHook preInstall
# Create the directory structure expected by VS Code
mkdir -p "$out/share/vscode/extensions"
# The extension content is in the 'extension' folder of the .vsix
# Copy it to the directory with the name {publisher}.{name}-{version}
cp -r extension "$out/share/vscode/extensions/${vscodeExtUniqueId}"
runHook postInstall
'';
meta = {
description = "Open Remote - SSH";
homepage = "https://github.com/jeanp413/open-remote-ssh";
license = lib.licenses.mit;
platforms = lib.platforms.all;
};
};
in
{
environment.systemPackages = [
(pkgs.vscode-with-extensions.override {
vscode = pkgs.vscodium;
vscodeExtensions = [
pkgs.vscode-extensions.continue.continue
pkgs.vscode-extensions.catppuccin.catppuccin-vsc
pkgs.vscode-extensions.catppuccin.catppuccin-vsc-icons
pkgs.vscode-extensions.jnoortheen.nix-ide
pkgs.vscode-extensions.redhat.ansible
pkgs.vscode-extensions.ms-azuretools.vscode-docker
]
++ [ open-remote-ssh ];
})
pkgs.nodejs_24
pkgs.nodePackages.npm
pkgs.gcc
pkgs.gnumake
pkgs.nixd
pkgs.nixfmt-rfc-style
pkgs.ansible
];
}