Questions Flake capabilities with Home-Manager as module

Hi,

Gotta few questions about Flakes capabilities and integrations with Home-Manager

Questions 01 - Is the “NixOS module” the ideal way to use it?

So AFAIK there are 3 ways to install home-manager. Based off the fact that I’m currently running NixOS installation and the tutorials I’ve seen it looks like the most “natural” flow both based on “code changes” and the fact we don’t need a second command to incorporate the changes.

Question 02 - Is “nixosConfigurations” output only consumed by nixos-rebuild command?
Where is located the documentation about what values can be placed on a Flake’s outputs and which ones are expected by which command itself?

Question 03 - Can Flake be used to only override certain aspects of /etc/nixos/configuration.nix
So on the majority of the tutorials mandates that we copy both configuration.nix and hardware-configuration.nix to the ~/folder/where/flake/file/lives and add the nixosConfigurations in the outputs scope to “consume” the copied files:

    nixosConfigurations = {
      workstation = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          ./configuration.nix
        ];
      };
    };

Cool. But I don’t think that’s much of a good idea (I can explain later if need for context) and instead what I would like the workflow to be is:

  1. Make Flake read the actual files from /etc/nixos/ folder
  2. Flake will read few values from whatever.nix module and override the equivalents from the /etc/nixos/configuration.nix
  3. Then the nixos-rebuild command would consume the “patched” version
    Again. Not sure if that’s possible that’s why I am asking.

Question 04 - consuming “homeConfigurations” output with home-manager as a module
I also read some tutorial recommending using home-manager in stand-alone mode. On these tutorials we have the homeConfigurations output being introduced on the flake.nix file. So the question remains why it’s not possible to use that output instead of the nixosConfigurations one when using the home-menager as a module? My point being that I don’t want to mess around the /etc/nixos/configuration.nix nor do I want a copied of it instead I would like Flake to be able to “inject” that (home-manager section) on the “payload” for the rebuild.

Sorry for the long post. thank you so much for reading it :smiley:

The ideal way is whatever you find more convenient.

yes.

Unless your flake lives in /etc/nixos, pointing to a path on the filesystem is impure. Don’t do this.
In general use relative paths within a flake, not absolute ones.

Not a thing.