gitpod-io / gitpod

The developer platform for on-demand cloud development environments to create software faster and more securely.
https://www.gitpod.io
GNU Affero General Public License v3.0
12.75k stars 1.22k forks source link

Feedback Issue: Dotfiles Support #7603

Closed mikenikles closed 3 months ago

mikenikles commented 2 years ago

Objective

This issue is to track feedback related to Dotfiles Support.

See related roadmap item [21]

trumbitta commented 2 years ago

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
axonasif commented 2 years ago

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

filiptronicek commented 2 years ago

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

axonasif commented 2 years ago

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

draxaris1010 commented 2 years ago

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

parched commented 2 years ago

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?

axonasif commented 2 years ago

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.

parched commented 2 years ago

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?

weitzman commented 2 years ago

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.

tommydrum commented 2 years ago

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).

axonasif commented 2 years ago

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.

christian-bromann commented 2 years ago

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).

trumbitta commented 2 years ago

@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
christian-bromann commented 2 years ago

@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 commented 2 years ago

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.

axonasif commented 2 years ago

@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
christian-bromann commented 2 years ago

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 commented 2 years ago

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' ]
}
trumbitta commented 2 years ago

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.

tommydrum commented 2 years ago

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.)

quangv commented 2 years ago

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
axonasif commented 2 years ago

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 commented 2 years ago

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 😅

stale[bot] commented 2 years ago

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] commented 4 months ago

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.