From 314ecacaa4fa684ecdfeb18a56d121f3a93646e4 Mon Sep 17 00:00:00 2001 From: Lin Yinfeng Date: Sat, 21 Sep 2024 15:35:01 +0800 Subject: [PATCH] hm/vscode-server: init --- flake.lock | 24 +++++++++++++++++++ flake.nix | 4 ++++ flake/hosts.nix | 2 ++ .../profiles/vscode-server/default.nix | 8 +++++++ home-manager/profiles/vscode/default.nix | 8 +------ 5 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 home-manager/profiles/vscode-server/default.nix diff --git a/flake.lock b/flake.lock index 0040b521f..7c35c0205 100644 --- a/flake.lock +++ b/flake.lock @@ -1104,6 +1104,29 @@ "type": "github" } }, + "nixos-vscode-server": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1713958148, + "narHash": "sha256-8PDNi/dgoI2kyM7uSiU4eoLBqUKoA+3TXuz+VWmuCOc=", + "owner": "nix-community", + "repo": "nixos-vscode-server", + "rev": "fc900c16efc6a5ed972fb6be87df018bcf3035bc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-vscode-server", + "type": "github" + } + }, "nixos-wsl": { "inputs": { "flake-compat": [ @@ -1400,6 +1423,7 @@ "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", "nixos-riscv": "nixos-riscv", + "nixos-vscode-server": "nixos-vscode-server", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_2", "nixpkgs-latest": "nixpkgs-latest", diff --git a/flake.nix b/flake.nix index 0bcbc2fa5..42a602b96 100644 --- a/flake.nix +++ b/flake.nix @@ -90,6 +90,10 @@ emacs-overlay.inputs.flake-utils.follows = "flake-utils"; emacs-overlay.inputs.nixpkgs-stable.follows = "blank"; + nixos-vscode-server.url = "github:nix-community/nixos-vscode-server"; + nixos-vscode-server.inputs.flake-utils.follows = "flake-utils"; + nixos-vscode-server.inputs.nixpkgs.follows = "nixpkgs"; + # programs nix-gc-s3.url = "github:linyinfeng/nix-gc-s3"; diff --git a/flake/hosts.nix b/flake/hosts.nix index b16c8f3f0..3e0b40969 100644 --- a/flake/hosts.nix +++ b/flake/hosts.nix @@ -191,6 +191,7 @@ let terraform shells ok + vscode-server ]; virtualization = [ ]; multimediaDev = @@ -262,6 +263,7 @@ let ]; commonHmModules = hmModules ++ [ + inputs.nixos-vscode-server.homeModules.default { lib.self = self.lib; } ]; diff --git a/home-manager/profiles/vscode-server/default.nix b/home-manager/profiles/vscode-server/default.nix new file mode 100644 index 000000000..b0db020ae --- /dev/null +++ b/home-manager/profiles/vscode-server/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + services.vscode-server.enable = true; + + home.global-persistence.directories = [ + ".vscode-server" + ]; +} diff --git a/home-manager/profiles/vscode/default.nix b/home-manager/profiles/vscode/default.nix index c4083b69b..e535cf8df 100644 --- a/home-manager/profiles/vscode/default.nix +++ b/home-manager/profiles/vscode/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ pkgs, ... }: { programs.vscode = { enable = true; @@ -14,14 +14,8 @@ extensions = with pkgs.vscode-extensions; [ ]; }; - home.activation.patchVSCodeServer = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - mkdir -p "$HOME/.vscode-server" - ${pkgs.findutils}/bin/find "$HOME/.vscode-server" -maxdepth 3 -name node -exec $DRY_RUN_CMD ln -sf $VERBOSE_ARG ${pkgs.nodejs}/bin/node {} \; - ''; - home.global-persistence.directories = [ ".vscode" - ".vscode-server" ".config/Code" ];