!lheuhImcToQZYTQTuI:nixos.org

Nix on macOS

1111 Members
“There are still many issues with the Darwin platform but most of it is quite usable.” — http://yves.gnu-darwin.org176 Servers

Load older messages


SenderMessageTime
14 Sep 2025
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeIf I don't add this, this will be a error error: builder for '/nix/store/zx1dn11h7apcz6ykph7pf7q8as0r6crh-code-oss-1.104.0.drv' failed with exit code 1; last 25 log lines: > npm error gid, gids, uid, umask, > npm error ^^^^^^^^^^^^^^^^^^^^^^ > npm error start_new_session, process_group) > npm error ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > npm error File "/nix/store/i8r431v9g2hwh9g0kkp2lrgd426szgnq-python3-3.13.7/lib/python3.13/subprocess.py", line 1972, in _execute_child > npm error raise child_exception_type(errno_num, err_msg, err_filename) > npm error FileNotFoundError: [Errno 2] No such file or directory: 'gcc'14:03:47
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeHere is my partial nix config file14:06:29
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoe
{
  lib,
  stdenv,
  stdenvNoCC,
  fetchFromGitHub,
  makeWrapper,
  nodejs_22,
  prefetch-npm-deps,
  mkElectron,
  writableTmpDirAsHomeHook,
  pkg-config,
  krb5,
  libtool,
  cctools,
  node-gyp,
  writeShellScriptBin,
  bash,
  ripgrep,
  gcc,
  clang_17,
  which,
  runCommand,
  apple-sdk_14,
  apple-sdk_15,
  srcOnly,
  llvmPackages_17,
}:
let
  llvmPackages = llvmPackages_17;
  clang = llvmPackages.clang;
  nodejs = nodejs_22;
  electronInfo =builtins.fromJSON ''
    {
      "hashes": {
          "aarch64-darwin": "7f390efeca2d2153e29c5ea13305915fb3f853b2a4e9a00be07183c6e09ac6de",
          "aarch64-linux": "c5c8ec46d9e291cd9dddb40c635d947d0f17873739f93b069e75b4bdadd75f5d",
          "armv7l-linux": "0871625623efb0edbb4d93ec9e036e01837f9d9ffaf4f1c05ae95f30ff823987",
          "headers": "1a5wfjjf68mcbsq2lxxsrhgni5ia4dcv1pfzmgw3wm10gbyb0wzi",
          "x86_64-darwin": "0a6a55de6c49d6eb929f01632701bd25f7e515d7b4042614dd5a1ec6c079f3f3",
          "x86_64-linux": "9c379b91f7ff65311f2b040299ee95c137fcb8e7e1bef87f9225d608cf579548"
      },
      "version": "37.3.1"
    }
  '';
  electron = mkElectron electronInfo.version electronInfo.hashes;
  ripgrep-zip = runCommand "ripgrep-zip" { } ''
    tar -czf $out -C ${ripgrep}/bin rg
  '';
  node-gyp-dir="Library/Caches/node-gyp/";
in
stdenv.mkDerivation (finalAttrs: {
  pname = "code-oss";
  version = "1.104.0";

  src = fetchFromGitHub {
    owner = "microsoft";
    repo = "vscode";
    tag = finalAttrs.version;
    hash = "sha256-ojx1VladX3c3jqIIdVtxmotlysJg6a0rbTuHdP8957I=";
  };
  patches = [
    ./node-gyp.patch
  ];
  npmDeps = stdenvNoCC.mkDerivation {
    name = "code-oss-${finalAttrs.version}-npm-deps";
    inherit (finalAttrs) src patches;

    nativeBuildInputs = [ prefetch-npm-deps ];

    buildPhase = ''
      FORCE_EMPTY_CACHE=true FORCE_GIT_DEPS=true find . -name package-lock.json -exec sh -c 'echo prefetch-npm-deps {} \$out && prefetch-npm-deps {} $out' \;
      rm $out/package-lock.json
    '';

    outputHashMode = "recursive";
    outputHash = "sha256-9e75w2BgLEuV4uvevJSEyPrjoT3V9UwjUkhsGP+mu+o=";
  };
  nativeBuildInputs = [
    writableTmpDirAsHomeHook
    nodejs
    nodejs.python
    krb5
    node-gyp
    pkg-config
    which
  ]
  ++ lib.optionals stdenv.isDarwin [
    llvmPackages.clang
    llvmPackages.libcxx
    llvmPackages.libclang
    cctools
    cctools.libtool
  ];
  postPatch = ''
    cp -r "$npmDeps" "$TMPDIR/cache"
    chmod -R 700 "$TMPDIR/cache"
    cachePath="$TMPDIR/cache"
    export npm_config_cache="$cachePath"
    export npm_config_offline="true"
    export npm_config_progress="false"
    # export npm_config_loglevel=verbose
    # export npm_config_verbose=true

    mkdir -p "$HOME/${node-gyp-dir}/${electron.version}"
    echo 11 > "$HOME/${node-gyp-dir}/${electron.version}/installVersion"
    ln -s "${electron.headers}/include" "$HOME/${node-gyp-dir}/${electron.version}/include"
    mkdir -p "$HOME/${node-gyp-dir}/${nodejs.version}"
    echo 11 > "$HOME/${node-gyp-dir}/${nodejs.version}/installVersion"
    ln -s "${nodejs}/include" "$HOME/${node-gyp-dir}/${nodejs.version}/include"

    export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
    export ELECTRON_SKIP_BINARY_DOWNLOAD=1
    cat .npmrc
  '';

  configurePhase = ''
    runHook preConfigure

    export NPX_NO_INSTALL=1
    npm ci --offline --ignore-scripts
    mkdir node_modules/@vscode/ripgrep/bin
    mkdir $TMPDIR/vscode-ripgrep-cache-1.15.14
    ln -s ${ripgrep-zip} $TMPDIR/vscode-ripgrep-cache-1.15.14/ripgrep-v13.0.0-13-aarch64-apple-darwin.tar.gz

    npm ci

    runHook postConfigure
  '';
})
14:06:41
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeWeird that node-gyp didn't go into the macos specific branch14:10:53
@emilazy:matrix.orgemilywe cannot use LLVM 17 for new packages14:58:31
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeWhich version should I use?15:00:11
@emilazy:matrix.orgemilyyou shouldn't need to specify any version, the default should work unless you know an older version is required15:02:03
@reckenrode:matrix.orgRandy Eckenrode Also don’t use llvmPackages.libcxx. Use the top-level one if you must. 15:36:00
@zxfsee:matrix.orgzxfsee changed their profile picture.15:42:52
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeOh, I found it15:48:03
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoe
	if (process.env['CC']) { opts.env['CC'] = 'gcc'; }
	if (process.env['CXX']) { opts.env['CXX'] = 'g++'; }
	if (process.env['CXXFLAGS']) { opts.env['CXXFLAGS'] = ''; }
	if (process.env['LDFLAGS']) { opts.env['LDFLAGS'] = ''; }
15:48:05
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoehttps://github.com/microsoft/vscode/blob/main/build/npm/postinstall.js#L137-L14015:48:50
@reckenrode:matrix.orgRandy Eckenrode It’s hardcodes gcc if CC is set? 😵‍💫 15:49:00
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeMicrosoft love gcc too much! 😭15:49:28
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeI hate this hard codes15:49:47
@saiko:knifepoint.netKatalin 🔪that’s awful15:51:19
@saiko:knifepoint.netKatalin 🔪it was added here… of course no reasoning as to why https://github.com/microsoft/vscode/pull/192513/files#diff-a40188ca009d7f9636573a981287496f622d66c41c3cabfa591b15eafaa3d955R9415:54:05
@reckenrode:matrix.orgRandy EckenrodeDoes VS Code merge and squash? The blame is useless.15:55:11
@saiko:knifepoint.netKatalin 🔪this is directly from the PR, I guess this is the commit https://github.com/microsoft/vscode/pull/192513/commits/45702f806168cda61e94f6a16a3bef868e27196b#diff-a40188ca009d7f9636573a981287496f622d66c41c3cabfa591b15eafaa3d955R9415:56:18
@saiko:knifepoint.netKatalin 🔪it’s just one awful mega-commit15:56:25
@emilazy:matrix.orgemilywe should probably look at how VSCodium does their build16:53:30
@emilazy:matrix.orgemilyor other distros16:53:49
@qyliss:fairydust.spaceAlyssa Rosssadly it also has an ill-considered platform-specific event loop16:55:16
@qyliss:fairydust.spaceAlyssa Rossthat is now hard to get rid of16:55:24
@reckenrode:matrix.orgRandy EckenrodeI’m pretty sure it didn’t have any binaries on Darwin when I last looked. Is there actually a Darwin event loop now?16:57:50
@qyliss:fairydust.spaceAlyssa Rossit's in the library16:58:05
@qyliss:fairydust.spaceAlyssa Rossbut yes until it broke recently with an update we built libwayland for Darwin16:58:19
@qyliss:fairydust.spaceAlyssa Rosswith a non-upstream patch16:58:22
@reckenrode:matrix.orgRandy Eckenrode My impression was that Wayland was portable in the sense that it worked on different Linux distros. 16:59:04
@reckenrode:matrix.orgRandy EckenrodeMaking it work on BSD requires a non-trivial amount of effort.16:59:09

Show newer messages


Back to Room ListRoom Version: 6