My flake.nix used by nix profile is ignoring my home-manager section

Hi,

It seems that nix profile is ignore my home-manager section without any errors.
Any suggestions to what can be the reason?

# Flake.nix

{
  description = "e9n Flake";
  inputs = {
    # Packages
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin";
    # Controls Mac settings
    nix-darwin.url = "github:LnL7/nix-darwin/master";
    nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
    # Unstable packafges
    unstable.url = "nixpkgs/nixos-unstable";
    # Devenv
    devenv.url = "github:cachix/devenv/latest";
    # Links and syncs my dotfiles
    home-manager.url = "github:nix-community/home-manager/master";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = inputs: {
    
    darwinConfigurations."e9n-MacBook" = inputs.darwin.lib.darwinSystem {
      system = "aarch64-darwin";
      pkgs = import inputs.nixpkgs { system = "aarch64-darwin"; };

      modules = [
        ({ pkgs, ...}: {
          # Darwin preferences and configuration
          program.zsh.enable = true;
          environment.shells = [ pkgs.zsh ];
          environment.loginShell = pkgs.zsh;
          nix.extraOptions = ''
            experimental-features = nix-command flakes
	        '';
          fonts.fontDir.enable = true; # Nix now owns the font directory. 
          fonts.fonts = [ (pkgs.nerdfonts.override  { fonts = [ "Meslo" ]; }) ];
          services.nix-daemon.enable = true;
          system.defaults.finder.AppleShowAllExtensions = true;
          # Backwards compat: Don`t change
          system.stateVersion = 4;
        })

        inputs.home-manager.darwinModules.home-manager {
          home-manager = {
            useGlobalPkgs = true;
            useUserPkgs = true;
            users.espen.imports = [
              ({pkgs, ...}: {
                home.stateVersion = "22.11"; #Don't touch!
                # My Home-Manager configs
                home.sessionVariables = {
                  PAGER = "less";
                  EDITOR = "nvim";
                };
                program.git = {
                  enable = true;
                  userName = "Espen Nilsen";
                  userEmail = "hi@e9n.dev";
                };
                program.neovim.enable = true;
                program.bat.enable = true;
                program.bat.config.theme = "TwoDark";
                program.zsh.enable = true;
                program.zsh.enableCompletion = true;
                program.zsh.enableAutosuggestion = true;
                program.zsh.enableSyntaxHighlighting = true;
                program.zsh.shellAliases = { ls = "ls --color=auto -F"; };
                program.starship.enable = true;
                program.starship.enableZshIntegration = true;
              })
            ];
          };
        }
      ];
    };
    packages."aarch64-darwin".default = let
    pkgs = inputs.nixpkgs.legacyPackages."aarch64-darwin";
    in pkgs.buildEnv {
      name = "home-packages";
      paths = with pkgs; [
        tmux
        curl
        wget
      ];
    };  
  };
}

What command do you run exactly? I don’t think nix profile touches darwinConfigurations, you need to use the nix-darwin script.

The darwin module is not a function by the way, and even if it was you’d need parentheses around it and that attrset so that nix doesn’t treat its argument as another list entry.

In this case, it should not immediately throw an error (assuming no other issues) because there are no parentheses, but the way you wrote your modules is misleading.

Thanks for the feedback.

Will try to move it to another nix command and see how that works.

Specifically, you probably need these instructions: https://daiderd.com/nix-darwin/#flakes-experimental

1 Like