Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazygit fails to open on first launch due to the assumption that config.yml exists #455

Open
DrymarchonShaun opened this issue Jan 11, 2025 · 6 comments

Comments

@DrymarchonShaun
Copy link

DrymarchonShaun commented Jan 11, 2025

Currently, the lazygit module assumes config.yml exists in its default location when it sets $LG_CONFIG_FILE, but that file doesn't get created until first launch, and if the aforementioned variable contains a file that doesn't exist, it fails to launch.

$ lazygit             
2025/01/10 20:31:53 stat /home/shaun/.config/lazygit/config.yml: no such file or directory
@DrymarchonShaun DrymarchonShaun changed the title Lazygit Fails to Start if config.yml doesn't exist Lazygit fails to start if config.yml doesn't exist Jan 11, 2025
@DrymarchonShaun DrymarchonShaun changed the title Lazygit fails to start if config.yml doesn't exist lazygit module assumes ~/.config/lazygit/config.yml exists Jan 11, 2025
@DrymarchonShaun DrymarchonShaun changed the title lazygit module assumes ~/.config/lazygit/config.yml exists lazygit module assumes ~/.config/lazygit/config.yml exists, causing failure to launch Jan 11, 2025
@DrymarchonShaun DrymarchonShaun changed the title lazygit module assumes ~/.config/lazygit/config.yml exists, causing failure to launch lazygit fails to open on first launch due to the assumption that config.yml exists Jan 11, 2025
@DrymarchonShaun
Copy link
Author

DrymarchonShaun commented Jan 11, 2025

I would have just submitted a PR, but I'm not entirely sure how to mitigate the issue.

EDIT - I suppose the ideal way would be to feed it into home-manager's programs.lazygit.settings but that would require parsing YAML to Nix, which doesn't seem to be officially supported yet?

@natecox
Copy link
Contributor

natecox commented Jan 15, 2025

I was about to say that I couldn't replicate this, but then I realized that the config file is always being created for me via home-manager's install before a run can be tried. Out of curiosity, how are you installing lazygit?

@uncenter
Copy link
Member

I was about to say that I couldn't replicate this, but then I realized that the config file is always being created for me via home-manager's install before a run can be tried.

I experienced this issue a few months ago (https://discord.com/channels/907385605422448742/1089733914328838294/1318055416684482590) because I deleted my (empty) lazygit config file for some forgotten reason, and home-manager actually wasn't recreating it...

@getchoo
Copy link
Member

getchoo commented Jan 15, 2025

I suppose the ideal way would be to feed it into home-manager's programs.lazygit.settings but that would require parsing YAML to Nix, which doesn't seem to be officially supported yet?

We support this here via importYAML

It uses IFD which isn't great, but if there are no other alternative to applying the configuration in a mergeable (with other user settings) way, I'd say it's fine

@DrymarchonShaun
Copy link
Author

I was about to say that I couldn't replicate this, but then I realized that the config file is always being created for me via home-manager's install before a run can be tried. Out of curiosity, how are you installing lazygit?

Like this. programs.lazygit.settings doesn't contain anything, so home-manager isn't creating the file, it seems.

@DrymarchonShaun
Copy link
Author

It uses IFD which isn't great, but if there are no other alternative to applying the configuration in a mergeable (with other user settings) way, I'd say it's fine

Actually, looking at the commit history, it looks like this is how it was being done prior to #304.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants