summary refs log tree commit diff
path: root/pkgs/applications/editors
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-10-08 02:35:12 +0300
committerArtturin <Artturin@artturin.com>2023-10-08 02:44:43 +0300
commit2afc2443076783e147b9e8c923ee5135cec8390d (patch)
tree711ce6548eefd035bac1b8db73e99635d78e981e /pkgs/applications/editors
parent021da9bf6297124b3a2c61f4ae005b5db002a8a3 (diff)
downloadnixpkgs-2afc2443076783e147b9e8c923ee5135cec8390d.tar
nixpkgs-2afc2443076783e147b9e8c923ee5135cec8390d.tar.gz
nixpkgs-2afc2443076783e147b9e8c923ee5135cec8390d.tar.bz2
nixpkgs-2afc2443076783e147b9e8c923ee5135cec8390d.tar.lz
nixpkgs-2afc2443076783e147b9e8c923ee5135cec8390d.tar.xz
nixpkgs-2afc2443076783e147b9e8c923ee5135cec8390d.tar.zst
nixpkgs-2afc2443076783e147b9e8c923ee5135cec8390d.zip
vscode: fix using the fhs with overrideAttrs
fixes
```nix
((pkgs.vscode.override { isInsiders = true; }).overrideAttrs (previousAttrs: {
  version = "latest";
  src = (pkgs.fetchurl {
    name = "VSCODE_insiders.tar.gz";
    url = "https://code.visualstudio.com/sha/download?build=insider&os=linux-x64";
    sha256 = "sha256-XcDSCuEMnTq2D75X9sNmGkD+CfPoLRJki9cSDDOeUtc=";
  });
})).fhs
```

NOTE: sha256 isn't stable
Diffstat (limited to 'pkgs/applications/editors')
-rw-r--r--pkgs/applications/editors/vscode/generic.nix128
1 files changed, 64 insertions, 64 deletions
diff --git a/pkgs/applications/editors/vscode/generic.nix b/pkgs/applications/editors/vscode/generic.nix
index e8ae861bf2f..1bbeafd2d15 100644
--- a/pkgs/applications/editors/vscode/generic.nix
+++ b/pkgs/applications/editors/vscode/generic.nix
@@ -20,8 +20,69 @@
 , ripgrep
 }:
 
-let
-  unwrapped = stdenv.mkDerivation {
+  stdenv.mkDerivation (finalAttrs:
+  let
+
+  # Vscode and variants allow for users to download and use extensions
+  # which often include the usage of pre-built binaries.
+  # This has been an on-going painpoint for many users, as
+  # a full extension update cycle has to be done through nixpkgs
+  # in order to create or update extensions.
+  # See: #83288 #91179 #73810 #41189
+  #
+  # buildFHSEnv allows for users to use the existing vscode
+  # extension tooling without significant pain.
+  fhs = { additionalPkgs ? pkgs: [] }: buildFHSEnv {
+    # also determines the name of the wrapped command
+    name = executableName;
+
+    # additional libraries which are commonly needed for extensions
+    targetPkgs = pkgs: (with pkgs; [
+      # ld-linux-x86-64-linux.so.2 and others
+      glibc
+
+      # dotnet
+      curl
+      icu
+      libunwind
+      libuuid
+      lttng-ust
+      openssl
+      zlib
+
+      # mono
+      krb5
+    ]) ++ additionalPkgs pkgs;
+
+    extraBwrapArgs = [
+      "--bind-try /etc/nixos/ /etc/nixos/"
+    ];
+
+    # symlink shared assets, including icons and desktop entries
+    extraInstallCommands = ''
+      ln -s "${finalAttrs.finalPackage}/share" "$out/"
+    '';
+
+    runScript = "${finalAttrs.finalPackage}/bin/${executableName}";
+
+    # vscode likes to kill the parent so that the
+    # gui application isn't attached to the terminal session
+    dieWithParent = false;
+
+    passthru = {
+      inherit executableName;
+      inherit (finalAttrs.finalPackage) pname version; # for home-manager module
+    };
+
+    meta = meta // {
+      description = ''
+        Wrapped variant of ${pname} which launches in a FHS compatible environment.
+        Should allow for easy usage of extensions without nix-specific modifications.
+      '';
+    };
+  };
+  in
+  {
 
     inherit pname version src sourceRoot dontFixup;
 
@@ -158,65 +219,4 @@ let
     '';
 
     inherit meta;
-  };
-
-  # Vscode and variants allow for users to download and use extensions
-  # which often include the usage of pre-built binaries.
-  # This has been an on-going painpoint for many users, as
-  # a full extension update cycle has to be done through nixpkgs
-  # in order to create or update extensions.
-  # See: #83288 #91179 #73810 #41189
-  #
-  # buildFHSEnv allows for users to use the existing vscode
-  # extension tooling without significant pain.
-  fhs = { additionalPkgs ? pkgs: [] }: buildFHSEnv {
-    # also determines the name of the wrapped command
-    name = executableName;
-
-    # additional libraries which are commonly needed for extensions
-    targetPkgs = pkgs: (with pkgs; [
-      # ld-linux-x86-64-linux.so.2 and others
-      glibc
-
-      # dotnet
-      curl
-      icu
-      libunwind
-      libuuid
-      lttng-ust
-      openssl
-      zlib
-
-      # mono
-      krb5
-    ]) ++ additionalPkgs pkgs;
-
-    extraBwrapArgs = [
-      "--bind-try /etc/nixos/ /etc/nixos/"
-    ];
-
-    # symlink shared assets, including icons and desktop entries
-    extraInstallCommands = ''
-      ln -s "${unwrapped}/share" "$out/"
-    '';
-
-    runScript = "${unwrapped}/bin/${executableName}";
-
-    # vscode likes to kill the parent so that the
-    # gui application isn't attached to the terminal session
-    dieWithParent = false;
-
-    passthru = {
-      inherit executableName;
-      inherit (unwrapped) pname version; # for home-manager module
-    };
-
-    meta = meta // {
-      description = ''
-        Wrapped variant of ${pname} which launches in a FHS compatible environment.
-        Should allow for easy usage of extensions without nix-specific modifications.
-      '';
-    };
-  };
-in
-  unwrapped
+  })