From d10d9b5304b7ef40464241c949d34fbc2c61e1f5 Mon Sep 17 00:00:00 2001 From: Paul Roub Date: Thu, 2 Jan 2025 12:48:17 -0500 Subject: [PATCH 1/5] docs: document issue with direnv and nix-shell on macOS (#15990) workaround and a link to the direnv issue. --- docs/CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 15bb998be9bf1..3a1bde32700c1 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -46,6 +46,13 @@ direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +NIX_ 🎉 ``` +> **Note:** On macOS, a [direnv bug](https://github.com/direnv/direnv/issues/1345) can cause `nix-shell` to fail to build or run `coder`. If you see `error: creating directory` when attempting to run, build, or test, adding one line to your `.envrc` should fix the problem: + +```shell +use nix +mkdir -p "$TMPDIR" +``` + Alternatively if you do not want to use nix then you'll need to install the need the following tools by hand: From ef24953c896865e0fb93cd819fdf4ff9ee2912b5 Mon Sep 17 00:00:00 2001 From: EdwardAngert Date: Thu, 2 Jan 2025 17:51:51 +0000 Subject: [PATCH 2/5] make fmt --- docs/CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 3a1bde32700c1..38e012fae94ba 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -46,7 +46,11 @@ direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +NIX_ 🎉 ``` -> **Note:** On macOS, a [direnv bug](https://github.com/direnv/direnv/issues/1345) can cause `nix-shell` to fail to build or run `coder`. If you see `error: creating directory` when attempting to run, build, or test, adding one line to your `.envrc` should fix the problem: +> **Note:** On macOS, a +> [direnv bug](https://github.com/direnv/direnv/issues/1345) can cause +> `nix-shell` to fail to build or run `coder`. If you see +> `error: creating directory` when attempting to run, build, or test, adding one +> line to your `.envrc` should fix the problem: ```shell use nix From eeec289f900b8b7093d4c1a19a0cf7f575c38ebd Mon Sep 17 00:00:00 2001 From: EdwardAngert Date: Thu, 2 Jan 2025 19:30:23 +0000 Subject: [PATCH 3/5] adds nix/not nix tabs --- docs/CONTRIBUTING.md | 94 +++++++++---------- .../WorkspaceTiming/Chart/XAxis.tsx | 4 +- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 38e012fae94ba..6fd2323edb611 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -2,62 +2,61 @@ ## Requirements -We recommend using the [Nix](https://nix.dev/) package manager as it makes any -pain related to maintaining dependency versions -[disappear](https://nixos.org/guides/how-nix-works). Once nix -[has been installed](https://nixos.org/download.html) the development -environment can be _manually instantiated_ through the `nix-shell` command: +
-```shell -cd ~/code/coder +We recommend that you use [Nix](https://nix.dev/) package manager to +[maintain dependency versions](https://nixos.org/guides/how-nix-works). -# https://nix.dev/tutorials/declarative-and-reproducible-developer-environments -nix-shell +### Nix -... -copying path '/nix/store/3ms6cs5210n8vfb5a7jkdvzrzdagqzbp-iana-etc-20210225' from 'https://cache.nixos.org'... -copying path '/nix/store/dxg5aijpyy36clz05wjsyk90gqcdzbam-iana-etc-20220520' from 'https://cache.nixos.org'... -copying path '/nix/store/v2gvj8whv241nj4lzha3flq8pnllcmvv-ignore-5.2.0.tgz' from 'https://cache.nixos.org'... -... -``` +1. [Install Nix](https://nix.dev/install-nix#install-nix) -If [direnv](https://direnv.net/) is installed and the -[hooks are configured](https://direnv.net/docs/hook.html) then the development -environment can be _automatically instantiated_ by creating the following -`.envrc`, thus removing the need to run `nix-shell` by hand! +1. After you've installed Nix, instantiate the development with the `nix-shell` + command: -```shell -cd ~/code/coder -echo "use nix" >.envrc -direnv allow -``` + ```shell + cd ~/code/coder -Now, whenever you enter the project folder, -[`direnv`](https://direnv.net/docs/hook.html) will prepare the environment for -you: + # https://nix.dev/tutorials/declarative-and-reproducible-developer-environments + nix-shell -```shell -cd ~/code/coder + ... + copying path '/nix/store/3ms6cs5210n8vfb5a7jkdvzrzdagqzbp-iana-etc-20210225' from 'https:// cache.nixos.org'... + copying path '/nix/store/dxg5aijpyy36clz05wjsyk90gqcdzbam-iana-etc-20220520' from 'https:// cache.nixos.org'... + copying path '/nix/store/v2gvj8whv241nj4lzha3flq8pnllcmvv-ignore-5.2.0.tgz' from 'https://cache. nixos.org'... + ... + ``` -direnv: loading ~/code/coder/.envrc -direnv: using nix -direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +NODE_PATH +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +XDG_DATA_DIRS +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH +1. Optional: If you have [direnv](https://direnv.net/) installed with + [hooks configured](https://direnv.net/docs/hook.html), you can add `use nix` + to `.envrc` to automatically instantiate the development environment: -🎉 -``` + ```shell + cd ~/code/coder + echo "use nix" >.envrc + direnv allow + ``` -> **Note:** On macOS, a -> [direnv bug](https://github.com/direnv/direnv/issues/1345) can cause -> `nix-shell` to fail to build or run `coder`. If you see -> `error: creating directory` when attempting to run, build, or test, adding one -> line to your `.envrc` should fix the problem: + Now, whenever you enter the project folder, + [`direnv`](https://direnv.net/docs/hook.html) will prepare the environment + for you: -```shell -use nix -mkdir -p "$TMPDIR" -``` + ```shell + cd ~/code/coder + + direnv: loading ~/code/coder/.envrc + direnv: using nix + direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_STORE +NM +NODE_PATH +OBJCOPY +OBJDUMP +RANLIB +READELF +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +TMPDIR +XDG_DATA_DIRS +buildInputs +buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +mesonFlags +name +nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH + + 🎉 + ``` -Alternatively if you do not want to use nix then you'll need to install the need + - If you encounter a `creating directory` error on macOS, check the + [troubleshooting](#troubleshooting) section below. + +### Without Nix + +Alternatively if you do not want to use Nix then you'll need to install the need the following tools by hand: - Go 1.18+ @@ -84,7 +83,9 @@ the following tools by hand: - `pandoc` - on macOS, run `brew install pandocomatic` -### Development workflow +
+ +## Development workflow Use the following `make` commands and scripts in development: @@ -214,8 +215,7 @@ This helps in naming the dump (e.g. `000069` above). ### Documentation -Our style guide for authoring documentation can be found -[here](./contributing/documentation.md). +Visit our [documentation style guide](./contributing/documentation.md). ### Backend diff --git a/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx b/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx index 9ab5054957992..4863b08ec19bd 100644 --- a/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx +++ b/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx @@ -121,9 +121,7 @@ export const XGrid: FC = ({ columns, ...htmlProps }) => { // A dashed line is used as a background image to create the grid. // Using it as a background simplifies replication along the Y axis. -const dashedLine = ( - color: string, -) => ` +const dashedLine = (color: string) => ` `; From eacefb66b8089bcf372b20db8a2a3a4ef0176dea Mon Sep 17 00:00:00 2001 From: EdwardAngert Date: Thu, 2 Jan 2025 19:35:04 +0000 Subject: [PATCH 4/5] checkout origin/main -- **/XAxis.tsx --- site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx b/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx index 4863b08ec19bd..9ab5054957992 100644 --- a/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx +++ b/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx @@ -121,7 +121,9 @@ export const XGrid: FC = ({ columns, ...htmlProps }) => { // A dashed line is used as a background image to create the grid. // Using it as a background simplifies replication along the Y axis. -const dashedLine = (color: string) => ` +const dashedLine = ( + color: string, +) => ` `; From a7b2690b529d5f8882174b0c0db3e497af94fa6e Mon Sep 17 00:00:00 2001 From: EdwardAngert Date: Thu, 2 Jan 2025 19:37:23 +0000 Subject: [PATCH 5/5] add troubleshooting to bottom --- docs/CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 6fd2323edb611..4ec589f3356bb 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -345,3 +345,17 @@ The [`release/experimental`](https://github.com/coder/coder/issues?q=sort%3Aupdated-desc+label%3Arelease%2Fexperimental) label can be used to move the note to the bottom of the release notes under a separate title. + +## Troubleshooting + +### Nix on macOS: `error: creating directory` + +On macOS, a [direnv bug](https://github.com/direnv/direnv/issues/1345) can cause +`nix-shell` to fail to build or run `coder`. If you encounter +`error: creating directory` when you attempt to run, build, or test, add a +`mkdir` line to your `.envrc`: + +```shell +use nix +mkdir -p "$TMPDIR" +``` pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy