ehllie / ez-configs

A flake-parts module for simple nixos, darwin and home-manager configurations using project directory structure
Mozilla Public License 2.0
59 stars 13 forks source link

Cannot get template to work #6

Closed jmgilman closed 7 months ago

jmgilman commented 7 months ago

Cloned the template into a new folder, initialized with git, added all the files, and then added home-configurations/josh.nix:

{ pkgs, ... }:
let
  inherit (pkgs.stdenv) isDarwin;
in
{
  home = {
    username = "josh";
    stateVersion = "23.11";
    homeDirectory = if isDarwin then "/Users/josh" else "/home/josh";
  };
}

However, when inspecting the flake outputs, homeConfigurations is empty:

nix-repl> homeConfigurations
{ }

What am I missing?

ehllie commented 7 months ago

By default, the module creates homeConfiguration user@hostname pairs, for each defined user and host. That's to share the package set between the host system and the user. It's how you can do conditional settings on your pkgs.stdenv in your home manager modules.

If you define at least one darwinConfiguration or nixosConfiguration, then you will get your outputs in homeConfigurations. Alternatively, you can set the flake module option standalone to true, and provide a package set to use for that user. See the example on the flake-parts website.

jmgilman commented 7 months ago

Thank you for the explanation. Based on your response, I'm assuming using this setup for a non-Nixos Linux system is not well supported? I have a few Darwin machines as well as a Linux machine (with Nix installed) that I manage. It seems the only way to use the user@hostname method is if I tricked the system into thinking the Linux machine was a NixOS machine. I imagine it wouldn't go to well, though.

ehllie commented 7 months ago

That's what standalone home manager modules are meant to solve to some degree. Alternatively you can just create a dummy nixosConfiguration that will provide the system for the non-NixOs home configurations. It shouldn't cause any issues, as it will only provide the packages.