[HN Gopher] Why and how to add Home Manager to NixOS
       ___________________________________________________________________
        
       Why and how to add Home Manager to NixOS
        
       Author : drakerossman
       Score  : 61 points
       Date   : 2023-06-24 14:04 UTC (8 hours ago)
        
 (HTM) web link (drakerossman.com)
 (TXT) w3m dump (drakerossman.com)
        
       | __MatrixMan__ wrote:
       | I've been meaning to switch home manager to flake mode. This will
       | be helpful, thanks.
        
         | tsuujin wrote:
         | I recently flipped my config over to a flake, and I'm glad I
         | did. Feels like flakes are just easier to understand with less
         | mystery.
        
           | return_to_monke wrote:
           | I don't think so. there is a lot of hidden complexitxy in
           | flakes.
           | 
           | If you have time, may I ask you to please provide more
           | opinion on what's easier to understand?
           | 
           | We are always looking for more input.
        
             | licebmi__at__ wrote:
             | In my experience, it's easier to understand everything as a
             | single project with the mind map of flakes. Although it is
             | as you mentioned that a lot of complexity is hidden and can
             | bit you in the ass, like home manager not (necessarily)
             | using the systemwide nixpkgs, yet as a beginners it feels
             | easier to grasp how everything is one big derivation and
             | your home manager config is only a dependency of this
             | derivation.
        
       | xpe wrote:
       | Suggestion for the author: the "why use it" discussion deserves
       | it own heading. As I write this, that content is situated in the
       | "What is Home Manager" section.
        
       | dundarious wrote:
       | From the linked "how to enable flakes" article:
       | 
       | > As you can see, it uses our ./configuration.nix as a module.
       | What are modules again? Per NixOS wiki:
       | 
       | > > Modules are files combined by NixOS to produce the full
       | system configuration. A module contains a Nix expression. It
       | declares options for other modules to define (give a value). It
       | processes them and defines options declared in other modules.
       | 
       | > Simple as.
       | 
       | If only.
       | 
       | Also, the article is very much a How not a Why.
        
         | drakerossman wrote:
         | >If only.
         | 
         | Could you please elaborate?
        
       | kaashif wrote:
       | > If you happen to have a necessity for such a thing, you're
       | better off using Home Manager, else you would end up implementing
       | parts of Home Manager by yourself.
       | 
       | So if I need to do X then I should use Y, but why do I need to do
       | X?
       | 
       | Maybe I'm missing it and it's really obvious.
        
         | tetris11 wrote:
         | User level dot files, instead of system wide
        
       | yakattak wrote:
       | I want to setup my configs using Nix and Home Manager but I just
       | find it so confusing and not very user friendly. Every guide I've
       | seen is either a really basic case of setting up a single package
       | and config or an extremely complicated setup using Flakes that I
       | can't wrap my head around.
       | 
       | This guide I feel like falls more into the former, it gives you a
       | really basic example but isn't enough to go off for me.
        
         | stuzenz wrote:
         | Drake's book looks great. I appreciate his efforts to create a
         | mental model and learning approach to NixOS.
         | 
         | I found a set of tutorials on YouTube by Will, to be incredibly
         | helpful at the beginning of my NixOS journey. Even though these
         | tutorials are a couple of years old, they should have aged
         | well.
         | 
         | Drake's book, should help confirm some assumptions I've made
         | about how NixOS works. Given NixOS's declarative nature, I find
         | it easy to copy configurations to do what I want - a handy
         | approach when pressed for time, but it does leave some gaps in
         | understanding that need to be filled.
         | 
         | You can find the tutorials I mentioned at the following link:
         | https://www.youtube.com/playlist?list=PL-saUBvIJzOkjAw_vOac7...
         | 
         | The tutorials are easy to understand and have good explanations
        
         | yeck wrote:
         | I think it is wise to use Nix for a bit before trying to manage
         | all your user configs with it. Using `nix-shell` for project
         | dependencies is a good starting point. You can't really make
         | any costly mistakes here since the scope of any given project
         | is likely much less than all your system and user
         | configurations.
         | 
         | Nix shell plus something like direnv using flakes or nix
         | expressions (non-flake approach) would give you a chance to
         | learn the language and ecosystem. Once you feel comfortable
         | with this, home-manager should be much more approachable.
        
         | woile wrote:
         | Take a look at https://github.com/srid/nixos-flake
        
       | heyoni wrote:
       | Drake, you misspelled your own book title on that page. Just
       | search for "partical".
        
         | drakerossman wrote:
         | Thank you for pointing that out!
        
           | heyoni wrote:
           | no problem :)
        
       ___________________________________________________________________
       (page generated 2023-06-24 23:02 UTC)