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

Possibility to put dotfiles someplace other than $HOME #45

Open
frontsideair opened this issue Aug 15, 2018 · 3 comments
Open

Possibility to put dotfiles someplace other than $HOME #45

frontsideair opened this issue Aug 15, 2018 · 3 comments

Comments

@frontsideair
Copy link

I just started using life-sync and it works like magic! I just keep all my git repos under ~/Code and seems like can't move dotfiles there.

I can work on this if you think it's not complicated. I have beginner to medium Haskell experience.

@frontsideair frontsideair changed the title Possibility to put dotfiles somplace other than $HOME Possibility to put dotfiles someplace other than $HOME Aug 15, 2018
@chshersh
Copy link
Contributor

I'm really happy you liked life-sync 😊

Yes, it uses hardcoded dotfiles location under ~/dotfiles. Making this directory configurable is a possible improvement for the package and I highly appreciate it! It requires to patch a lot of functions. But I think it worth it.

I guess best way to do this is to add lifeConfigurationRepoPath field to LifeConfiguration data type:

data LifeConfiguration = LifeConfiguration
{ lifeConfigurationFiles :: Set (Path Rel File)
, lifeConfigurationDirectories :: Set (Path Rel Dir)
} deriving (Show, Eq)

Commands like life init can ask interactively about default location for dotfiles repository.

I think it's not complicated. So I really appreciate if you're going to work on this 🙏 It's just usual type of refactoring: moving something from hardcoded constant to runtime configuration. Haskell shines in such use-cases! Also, feel free to ask any questions about codebase. I will help gladly 🙂

@frontsideair
Copy link
Author

frontsideair commented Aug 27, 2018

Hi, I've started this task and it looks more complicated than I imagined.

My original use case was that I'd keep my dotfiles in ~/Code/dotfiles on macOS and ~/dotfiles on Linux. But life executable must know this path and thus keep it in the config, which you suggested. But then pulling someone's dotfiles would dictate where it would be stored.

A solution could be keeping the repo path in a separate file (e.g. ~/.life.local). While I don't like increasing the number of files for such a simple utility, I can't think of any other way for user experience.

Also, I noticed that making repo path dynamic eliminates one of the LifeExistence cases, specifically OnlyRepo case as we can't know anything about the repo if we don't have a life file. On the other hand, keeping this path in another file will keep OnlyRepo case, but add another case where we have a repo path but it's not actually there.

@chshersh
Copy link
Contributor

@frontsideair I see, this issue indeed might be more complicated than it looks at first glance. @nixorn is currently working on supporting branch-based workflow (see PR #46). After this is implemented, it should become easier to make dotfiles path configurable in code. And also easier to maintain dotfiles repo on different machines. Basically, you should be able to store local path inside ~/.life file and then you can sync across multiple branches and multiple configurations. Though, the future interface is yet to be refined.

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

No branches or pull requests

2 participants