gitpod icon indicating copy to clipboard operation
gitpod copied to clipboard

Feedback Issue: Dotfiles Support

Open mikenikles opened this issue 3 years ago • 25 comments

Objective

This issue is to track feedback related to Dotfiles Support.

See related roadmap item [21]

mikenikles avatar Jan 14 '22 04:01 mikenikles

https://github.com/trumbitta/dotfiles didn't 100% work for me

A README.md was indeed symlinked, but my customized .gitconfig wasn't

I understand this is due to the file already existing in the workspace. Here's my reply to a suggested workaround (merging via install script):

thanks but I'm hesitant to do that in an install script, because I need to use this same repo in my work machine and in my personal machine, where I have already an "inversion of control" situation with:

[include]
       path = ~/.gitconfig-local

I use .gitconfig-local to make git merge its own configurations when needed, without my intervention with a script

I'm going to try this updated install script snippet by @axonasif 🙏

#!/usr/bin/env bash

set -eu;

if test ! -e /ide/bin/gp-code || test ! -v GITPOD_REPO_ROOT; then {
    printf 'error: This script is meant to be run on Gitpod, quiting...\n' && exit 1;
} fi

_source_dir="$(readlink -f "$0")" && _source_dir="${_source_dir%/*}";
printf '%s\n' "$(< "$_source_dir/.gitconfig")" >> $HOME/.gitconfig

trumbitta avatar Jan 17 '22 14:01 trumbitta

A user wished to have a feature that would allow them set a default .gitpod.yml and Dockerfile(if specified in .gitpod.yml) https://github.com/gitpod-io/gitpod/issues/6275. Someone surely can script up something on install.sh from their dotfiles repo to automatically copy these files but that would require the user to create a new workspace to see the changes. I think it will be nice if somehow we could supply custom .gitpod.yml and Dockerfile on condition from our dotfiles repo and that Gitpod would pick them up before workspace initialization.

cc @csweichel

axonasif avatar Jan 23 '22 06:01 axonasif

Linking https://github.com/gitpod-io/gitpod/issues/7639 because it is related to dotfiles 🙂.

filiptronicek avatar Jan 25 '22 15:01 filiptronicek

Cross-linking https://github.com/gitpod-io/gitpod/issues/7592 here.

axonasif avatar Jan 30 '22 17:01 axonasif

Maybe it would be handy for setup scripts to clone submods if the .dotfiles dir is not owned by root

draxaris1010 avatar Apr 14 '22 15:04 draxaris1010

How does this work with VS Code User settings? My settings in ~/.config/Code/User/settings.json don't seem to be applied. The User settings that gitpod lets you edit appears to be some virtual file?

parched avatar Apr 23 '22 05:04 parched

How does this work with VS Code User settings? My settings in ~/.config/Code/User/settings.json don't seem to be applied. The User settings that gitpod lets you edit appears to be some virtual file?

Yes, it's stored on your browser.

axonasif avatar Apr 25 '22 17:04 axonasif

Ok, would it be possible to make gitpod use the file in .config instead if it's present? Or, as a workaround, is there a way to write to the in browser file, so I can sync it in the install script?

parched avatar Apr 25 '22 20:04 parched

FYI I wasnt getting my dotfiles repo but the logs gave a clue at ~/.dotfiles.log. I hadnt given Gitpod access to my private repos at Github. I fixed that and it now works as documented. Thanks for this feature.

weitzman avatar Apr 29 '22 14:04 weitzman

Another small feature request: automatic execution of .install.sh and other variants prepended with the .

Reason being: this being dotfiles, I try to keep everything in this repo.. a dotfile. (Feels cleaner for me, but that's subjective).

t8d7 avatar May 19 '22 06:05 t8d7

Another small feature request: automatic execution of .install.sh and other variants prepended with the .

Reason being: this being dotfiles, I try to keep everything in this repo.. a dotfile. (Feels cleaner for me, but that's subjective).

You can always call your other scripts from your main install.sh.

axonasif avatar May 19 '22 12:05 axonasif

Yes, it's stored on your browser.

@axonasif I don't understand the answer. I am trying to get my zsh4humans set up and need the default shell for the gitpod user to be $(which zsh) and not bash. Is there a way to define user custom vscode settings? (btw: I use the VSCode app not the browser).

christian-bromann avatar May 19 '22 15:05 christian-bromann

@christian-bromann IIRC in order to have zsh as my default shell I set up the $SHELL environment variable in my user settings in Gitpod.

image

trumbitta avatar May 19 '22 15:05 trumbitta

@trumbitta thanks, this works when I create a new terminal within VSCode but fails when executing tasks. I could workaround it by modifying them but the idea of dot files is to create custom settings. So I guess a suggestion would be to have a Gitpod user allow to set the default shell for all their tasks.

christian-bromann avatar May 19 '22 16:05 christian-bromann

Ok, I have to correct myself: it seems that zsh is now used everywhere but all tasks started by gitpod come with this terminal UI: Screenshot 2022-05-19 at 18 19 41 While a new shell correctly starts like this: Screenshot 2022-05-19 at 18 19 56

Even an exec zsh doesn't help.

christian-bromann avatar May 19 '22 16:05 christian-bromann

@christian-bromann @trumbitta you have to include the full path for your shell if you want to do it that way, also this is not recommended to do for non-posix shells like fish if anyone's wondering. Screenshot 2022-05-19 at 10 24 47 PM

axonasif avatar May 19 '22 16:05 axonasif

you have to include the full path for your shell if you want to do it that way

That is what I had

christian-bromann avatar May 19 '22 16:05 christian-bromann

fyi: behavior between using VSCode as application where

❯ echo $SHELL
/usr/bin/zsh

vs browser:

 $ echo $SHELL
/bin/bash

differs. Additionally it seems that running command through zsh fails due to this error:

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/home/gitpod/.vscode-server/data/User/workspaceStorage/27251866a452c4736ef63d0424ce389e/ms-vscode.js-debug/bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module._preloadModules (node:internal/modules/cjs/loader:1280:12)
    at loadPreloadModules (node:internal/bootstrap/pre_execution:476:5)
    at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:77:3)
    at node:internal/main/run_main_module:7:1 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}

christian-bromann avatar May 19 '22 20:05 christian-bromann

Idk what to say... my shell is zsh everywhere and it works via the SHELL env variable without /usr/bin 🤷

You can also find my dotfiles repo some comments above.

trumbitta avatar May 19 '22 22:05 trumbitta

Another small feature request: automatic execution of .install.sh and other variants prepended with the . Reason being: this being dotfiles, I try to keep everything in this repo.. a dotfile. (Feels cleaner for me, but that's subjective).

You can always call your other scripts from your main install.sh.

Yea, this would be a pretty obvious solution, but also defeats the purpose of why people like me have the install script include a prepending dot. The point of the setup is that the .install.sh is the main setup file, and is hidden by ls or ll, leaving only the data as listable, not configuration or installation scripts. And if someone were to say "just delete the installer afterwords".. then it creates a change to .git, leaving git conscious shells to be a bit annoying. Just deleting the .git as well.. just makes managing/updating the dotfiles itself more work.

(Not meaning to be condescending, just trying to explain the usecase and the other mitigation's problems.)

t8d7 avatar May 19 '22 22:05 t8d7

I was getting the error error: This script is meant to be run on Gitpod, quiting... tweaked the setup.sh by @axonasif, @trumbitta 🙏 to copy over .gitconfig as follows:

#!/usr/bin/env bash

set -eu;

if test ! -v GITPOD_REPO_ROOT; then {
    printf 'error: This script is meant to be run on Gitpod, quiting...\n' && exit 1;
} fi

_source_dir="$(readlink -f "$0")" && _source_dir="${_source_dir%/*}";
printf '%s\n' "$(< "$_source_dir/.gitconfig")" >> $HOME/.gitconfig

quangv avatar Jun 24 '22 15:06 quangv

Ok, I have to correct myself: it seems that zsh is now used everywhere but all tasks started by gitpod come with this terminal UI: Screenshot 2022-05-19 at 18 19 41 While a new shell correctly starts like this: Screenshot 2022-05-19 at 18 19 56

Even an exec zsh doesn't help.

Hey @christian-bromann, it should be fixed now, it was probably related with TERM variable having xterm-color.

axonasif avatar Jun 24 '22 18:06 axonasif

Idk what to say... my shell is zsh everywhere and it works via the SHELL env variable without /usr/bin 🤷

You can also find my dotfiles repo some comments above.

I forgot why I said that, but it was likely because something wasn't working for me 😅

axonasif avatar Jun 24 '22 18:06 axonasif

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 24 '22 16:09 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 22 '24 15:05 github-actions[bot]