Wrap your dotfiles with nix #10

Open
opened 2024-05-25 05:34:49 -04:00 by adrian-gierakowski · 9 comments
adrian-gierakowski commented 2024-05-25 05:34:49 -04:00 (Migrated from github.com)

so that people could reproducibly instantiate it on their system with a single command

so that people could reproducibly instantiate it on their system with a single command
omerxx commented 2024-05-28 10:56:00 -04:00 (Migrated from github.com)

@adrian-gierakowski that's a great idea, I still don't consider myself a Nix pro so don't want to break anything for others.
What you have in mind is a flake with the configuration and something like stow for symlinking?

@adrian-gierakowski that's a great idea, I *still* don't consider myself a Nix pro so don't want to break anything for others. What you have in mind is a flake with the configuration and something like `stow` for symlinking?
adrian-gierakowski commented 2024-05-28 13:34:35 -04:00 (Migrated from github.com)

What I had in mind was a home-manager configuration with all the programs and their configs.

I’ll be willing to pair on this as I’m fairly experienced with nix and I’m keen to learn about some of the tools you’ve got here.

What I had in mind was a [home-manager](https://github.com/nix-community/home-manager) configuration with all the programs and their configs. I’ll be willing to pair on this as I’m fairly experienced with nix and I’m keen to learn about some of the tools you’ve got here.
rafaeloledo commented 2024-08-05 21:03:52 -04:00 (Migrated from github.com)

@adrian-gierakowski Hello, i'm using nixos and home-manager for about 2 months. My current problem with the hm is that i want to replicate my dotfiles inside VMs. I've thought about backing up the config files from home-manager's output, but it has some nix-store paths. It seems that nix home-manager is a tool that makes me depend to use it on every distro, that is some that i don't want. It that the purpose? I've tested right now the stow solution and seems more easy to adapt between any kind of distros. Then, i just activated my i3 and hyprland setup with nixpkgs prefix inside nixos modules barebones.

It'll be nice if anyone can explain how can i use home-manager inside nixos without needing to re-use it on every place to avoid maintaing dotfiles twice.

@adrian-gierakowski Hello, i'm using nixos and home-manager for about 2 months. My current problem with the `hm` is that i want to replicate my `dotfiles` inside VMs. I've thought about backing up the config files from home-manager's output, but it has some nix-store paths. It seems that nix home-manager is a tool that makes me depend to use it on every distro, that is some that i don't want. It that the purpose? I've tested right now the `stow` solution and seems more easy to adapt between any kind of distros. Then, i just activated my i3 and hyprland setup with nixpkgs prefix inside nixos modules barebones. It'll be nice if anyone can explain how can i use home-manager inside nixos without needing to re-use it on every place to avoid maintaing dotfiles twice.
adrian-gierakowski commented 2024-08-06 02:54:57 -04:00 (Migrated from github.com)

You can use home-manager on any distro. But it only makes sense if IMHO if you are also using nix\HM on those distros to manage what software is installed. The benefit of this is that you not only ensure that the app configs are the same across those systems, but that the apps\binaries themselves are also the same.

You can obviously use stow on NixOS if you don’t want to use HM everywhere, but you are just making more work for yourself IMHO

You can use home-manager on any distro. But it only makes sense if IMHO if you are also using nix\HM on those distros to manage what software is installed. The benefit of this is that you not only ensure that the app configs are the same across those systems, but that the apps\binaries themselves are also the same. You can obviously use stow on NixOS if you don’t want to use HM everywhere, but you are just making more work for yourself IMHO
adrian-gierakowski commented 2024-08-06 02:59:25 -04:00 (Migrated from github.com)

@rafaeloledo may I ask what you’d want to avoid using nix\HM everywhere? IMHO it’s the only sane solution if you want to keep things in sync across multiple systems

@rafaeloledo may I ask what you’d want to avoid using nix\HM everywhere? IMHO it’s the only sane solution if you want to keep things in sync across multiple systems
rafaeloledo commented 2024-08-06 11:44:54 -04:00 (Migrated from github.com)

@adrian-gierakowski Since i don't want to depend strategically only on chace.nixos.org, i try to avoid keeping 100% of my workflow on it. It's a personal choice considering i'm not a source-and-compile user. I'm not saying the cache is not solid or anything, i just don't want to be in a state of awareness and keep concerns on my head on the current state of fundings. Just pick a strategy and forget it.

I saw that i can set a private cache in a local server on the wiki, i'm consindering doing this on future to resolve this dilemma. For now, stow's solution doesn't lock you on a binary provider.

Other solution that nix and hm ecossystem can adopt is making an api to backup the config files in their original form offline dereferencing the nix-store paths and symlinks (i don't know if it's possible). I think is a good option to people feel more secure on using nix in the long-term.

@adrian-gierakowski Since i don't want to depend strategically only on chace.nixos.org, i try to avoid keeping 100% of my workflow on it. It's a personal choice considering i'm not a source-and-compile user. I'm not saying the cache is not solid or anything, i just don't want to be in a state of awareness and keep concerns on my head on the current state of fundings. Just pick a strategy and forget it. I saw that i can set a private cache in a local server on the wiki, i'm consindering doing this on future to resolve this dilemma. For now, stow's solution doesn't lock you on a binary provider. Other solution that `nix` and `hm` ecossystem can adopt is making an api to backup the config files in their original form offline dereferencing the nix-store paths and symlinks (i don't know if it's possible). I think is a good option to people feel more secure on using nix in the `long-term`.
adrian-gierakowski commented 2024-08-06 14:49:17 -04:00 (Migrated from github.com)

You can use home.file for arbitrary files which can be sourced from current dir in a git repo and will be copied to nix store and then symlinked to chosen path in your home dir. If you use this exclusively you can manage your dotfiles without accidentally “polluting” them with nix store paths. Although you’d be foregoing all the best parts of home manager so maybe better to just use stow instead (note that I know nothing about stow)

You can use [home.file](https://nix-community.github.io/home-manager/options.xhtml#opt-home.file) for arbitrary files which can be sourced from current dir in a git repo and will be copied to nix store and then symlinked to chosen path in your home dir. If you use this exclusively you can manage your dotfiles without accidentally “polluting” them with nix store paths. Although you’d be foregoing all the best parts of home manager so maybe better to just use stow instead (note that I know nothing about stow)
rafaeloledo commented 2024-08-06 22:36:19 -04:00 (Migrated from github.com)

I think it's a good balance. Creating another abstraction layer inside home-manager API is not a good selling point for me. Using home.file, i can leverage the generations if i break something and not use stow (avoiding the extra work as you've mentioned). The only downside is creating additional copies in nix-store which i can garbage-collect afterwards.

Thanks.

Note:

@omerxx is using at commit fffac07 this kind of solution too

image

I think it's a good balance. Creating another abstraction layer inside home-manager API is not a good selling point for me. Using `home.file`, i can leverage the generations if i break something and not use stow (avoiding the extra work as you've mentioned). The only downside is creating additional copies in nix-store which i can garbage-collect afterwards. Thanks. Note: @omerxx is using at commit `fffac07` this kind of solution too ![image](https://github.com/user-attachments/assets/e60faea2-c41d-4951-9591-a9179512e2c7)
rafaeloledo commented 2024-08-07 16:13:17 -04:00 (Migrated from github.com)

@adrian-gierakowski
I had some problems setting my neovim like above. When i update the lazy-lock.json file it complains that's root permissions and read-only like this:

image

So, i've reached this discussion:
https://github.com/nix-community/home-manager/issues/676
Thanks to IgorGee.

It appears that hm has a way to create an exception and now i can link integrally outside of nix-store normal constraints and got this:

image

Simply, i've followed the example above and use this internal home-manager's function

image

@adrian-gierakowski I had some problems setting my neovim like above. When i update the `lazy-lock.json` file it complains that's root permissions and read-only like this: ![image](https://github.com/user-attachments/assets/d3c532ce-bc69-473d-b479-b3b7e4b7b81e) So, i've reached this discussion: https://github.com/nix-community/home-manager/issues/676 Thanks to IgorGee. It appears that `hm` has a way to create an exception and now i can link integrally outside of `nix-store` normal constraints and got this: ![image](https://github.com/user-attachments/assets/b3be29fa-5e23-4eb4-a0fb-8472287b1eea) Simply, i've followed the example above and use this internal home-manager's function ![image](https://github.com/user-attachments/assets/1a7d511b-46f5-4d7e-93d2-1e39c389db63)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
omerxx/dotfiles#10
No description provided.