From b144c4501f1c6c2cf89e416a3025bc198da2847d Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Thu, 7 Mar 2024 21:58:24 +0100 Subject: [PATCH] feat(vscodium remote): attempt to match versions on client and server environments --- flake.lock | 35 +++++++++++++++++++ flake.nix | 4 +++ nix/devShells.nix | 4 ++- .../configuration/graphical-fullblown.nix | 1 + nix/home-manager/programs/vscode/default.nix | 13 +++++-- .../devices/sj-bm-hostkey0/configuration.nix | 15 +++++++- 6 files changed, 67 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 08892be..8c5d48e 100644 --- a/flake.lock +++ b/flake.lock @@ -631,6 +631,22 @@ "type": "github" } }, + "nixpkgs-vscodium": { + "locked": { + "lastModified": 1709558755, + "narHash": "sha256-hx4FIbk4X4ve1oiHLOj+VE6dzO4CtXBR5RSU6kaq34M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "207107bbc7d6d19a8b2c36a088d3756d03490243", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-wayland": { "inputs": { "flake-compat": "flake-compat_2", @@ -684,6 +700,23 @@ "type": "github" } }, + "openvscode-server": { + "flake": false, + "locked": { + "lastModified": 1708067838, + "narHash": "sha256-GNqDYqi40X7/og3TacvKyPj6c5amkxTYr/1DsnGV2AI=", + "owner": "gitpod-io", + "repo": "openvscode-server", + "rev": "fa212cab64faaac10741979e96a0662d14f61c81", + "type": "github" + }, + "original": { + "owner": "gitpod-io", + "ref": "openvscode-server-v1.86.2", + "repo": "openvscode-server", + "type": "github" + } + }, "prs": { "flake": false, "locked": { @@ -730,8 +763,10 @@ "nixpkgs-unstable-small" ], "nixpkgs-unstable-small": "nixpkgs-unstable-small", + "nixpkgs-vscodium": "nixpkgs-vscodium", "nixpkgs-wayland": "nixpkgs-wayland", "ofi-pass": "ofi-pass", + "openvscode-server": "openvscode-server", "prs": "prs", "radicalePkgs": [ "nixpkgs-2211" diff --git a/flake.nix b/flake.nix index 2538a15..1bdf23c 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,10 @@ nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; + nixpkgs-vscodium.url = "github:nixos/nixpkgs/nixos-unstable-small"; + openvscode-server.url = "github:gitpod-io/openvscode-server/openvscode-server-v1.86.2"; + openvscode-server.flake = false; + colmena = { url = "github:zhaofengli/colmena"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/nix/devShells.nix b/nix/devShells.nix index 01d318b..f90fbb1 100644 --- a/nix/devShells.nix +++ b/nix/devShells.nix @@ -2,7 +2,9 @@ self', inputs', pkgs, -}: { +}: let + pkgsUnstable = inputs'.nixpkgs-unstable.legacyPackages; +in { install = pkgs.mkShell { name = "infra-install"; packages = with pkgs; [ diff --git a/nix/home-manager/configuration/graphical-fullblown.nix b/nix/home-manager/configuration/graphical-fullblown.nix index 8060725..4359cc6 100644 --- a/nix/home-manager/configuration/graphical-fullblown.nix +++ b/nix/home-manager/configuration/graphical-fullblown.nix @@ -4,6 +4,7 @@ config, # these come in via home-manager.extraSpecialArgs and are specific to each node nodeFlake, + repoFlake, packages', ... }: let diff --git a/nix/home-manager/programs/vscode/default.nix b/nix/home-manager/programs/vscode/default.nix index a0c0d76..dfc421f 100644 --- a/nix/home-manager/programs/vscode/default.nix +++ b/nix/home-manager/programs/vscode/default.nix @@ -1,11 +1,14 @@ { pkgs, nodeFlake, + repoFlake, ... -}: { +}: let + pkgsVscodium = import repoFlake.inputs.nixpkgs-vscodium {inherit (pkgs) system config;}; +in { programs.vscode = { enable = true; - package = pkgs.vscodium; + package = pkgsVscodium.vscodium; extensions = [ # TODO: how can i install (this) vsix(s) directly? @@ -38,7 +41,11 @@ mutableExtensionsDir = true; }; - home.packages = [pkgs.nixpkgs-fmt pkgs.alejandra]; + home.packages = [ + pkgs.nixpkgs-fmt + pkgs.alejandra + pkgs.nil + ]; } # TODO: automate ### original list: diff --git a/nix/os/devices/sj-bm-hostkey0/configuration.nix b/nix/os/devices/sj-bm-hostkey0/configuration.nix index 5c32ea3..9210b46 100644 --- a/nix/os/devices/sj-bm-hostkey0/configuration.nix +++ b/nix/os/devices/sj-bm-hostkey0/configuration.nix @@ -9,7 +9,10 @@ nodeName, system, ... -}: { +}: let + pkgsUnstableSmall = import nodeFlake.inputs.nixpkgs-unstable-small {inherit (pkgs) system config;}; + pkgsVscodium = import repoFlake.inputs.nixpkgs-vscodium {inherit (pkgs) system config;}; +in { disabledModules = [ ]; @@ -47,6 +50,16 @@ pkgs.nixpkgs-fmt pkgs.alejandra pkgs.nixfmt + + # TODO: automate linking this + # 1. get the commit with: `codium --version` + # 2. create the binary directory: `mkdir -p /home/steveej/.vscodium-server/bin/c8ce3ba4bc6b30b3b10edc61481cb85b1d2396bc/bin/` + # 3. link the binary. this relies on the client-side setting `"remote.SSH.experimental.serverBinaryName": "openvscode-server"` : ln -s $(which openvscode-server) /home/steveej/.vscodium-server/bin/c8ce3ba4bc6b30b3b10edc61481cb85b1d2396bc/bin/ + (pkgsVscodium.openvscode-server.overrideAttrs(attrs: { + src = repoFlake.inputs.openvscode-server; + version = "1.86.2"; + yarnCache = attrs.yarnCache.overrideAttrs (_: {outputHash = "sha256-mB7Fw/5pCBJNGtH3PvGhZOAIP/C2MoSvBvZy17TPN9U=";}); + })) ]; };