From c6e365bdb7d3fda4ddf899db7b98e0941ffad687 Mon Sep 17 00:00:00 2001 From: mat ess Date: Thu, 21 Apr 2022 22:33:07 -0400 Subject: [PATCH] Add vscodium for M1 --- flake.nix | 2 +- pkgs/vscodium-m1.nix | 47 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index 1ae5368..f8b52d0 100644 --- a/flake.nix +++ b/flake.nix @@ -161,7 +161,7 @@ system = "x86_64-darwin"; inherit (nixpkgsConfig) config; }; - vscodium-m1 = import ./pkgs/vscodium-m1.nix { }; + vscodium-m1 = final.callPackage ./pkgs/vscodium-m1.nix { }; }; }; diff --git a/pkgs/vscodium-m1.nix b/pkgs/vscodium-m1.nix index da13ab0..f42fa0f 100644 --- a/pkgs/vscodium-m1.nix +++ b/pkgs/vscodium-m1.nix @@ -1,4 +1,18 @@ -{ lib, stdenv }: +{ lib +, stdenv +, fetchurl +, # VSCodium build deps + git +, curl +, cacert +, jq +, nodejs +, nodePackages +, yarn +, python3 +, xcodebuild +, darwin +}: stdenv.mkDerivation rec { pname = "vscodium"; @@ -10,22 +24,43 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://github.com/VSCodium/vscodium/archive/refs/tags/${version}.tar.gz"; - sha256 = ""; + sha256 = "JtEMO9GVez5v7eE23DB2WVIZNMlC7O50gvP5p5l3jkU="; }; + nativeBuildInputs = with darwin.apple_sdk.frameworks; [ + git + curl + cacert + jq + nodejs + nodePackages.npm + yarn + python3 + xcodebuild + AppKit + CoreServices + Cocoa + ]; + buildPhase = '' - rm -rf VSCode* - rm -rf vscode + runHook preBuild + export HOME=$(mktemp -d) . get_repo.sh - SHOULD_BUILD=yes CI_BUILD=no OS_NAME=osx VSCODE_ARCH=arm64 . build.sh + + runHook postBuild ''; installPhase = '' runHook preInstall + mkdir -p "$out/Applications/${longName}.app" "$out/bin" - cp -r ./* "$out/Applications/${longName}.app" + cp -r ./VSCode-darwin-arm64/* "$out/Applications/${longName}.app" ln -s "$out/Applications/${longName}.app/Contents/Resources/app/bin/${executableName}" "$out/bin/${executableName}" + + runHook postInstall ''; + + meta.platforms = [ "aarch64-darwin" ]; }