I am having the following error in my shared home manager config using both NixOS and Darwin in the same flake.
Here are the relevant parts.
# flake.nix
...
outputs = inputs @ { self, nix-darwin, nixpkgs, nixpkgs-stable, home-manager, hyprland, ... }:
let
vars = {
# Variables used in flake
user = "einherjar";
terminal = "alacritty";
editor = "hx"; # helium
};
in
{
# Linux (NixOS) machines Configurations
nixosConfigurations = (
import ./hosts {
inherit (nixpkgs) lib;
inherit inputs nixpkgs nixpkgs-stable home-manager hyprland vars;
}
);
# macOS machines Configurations
darwinConfigurations = (
import ./darwin {
inherit (nixpkgs) lib;
inherit inputs nixpkgs nixpkgs-stable home-manager nix-darwin vars;
}
);
};
Let’s focus on darwin now:
# darwin/default.nix
{ lib, inputs, nix-darwin, home-manager, vars, ... }:
let
system = "aarch64-darwin"; # System Architecture
in
{
macbook = nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit inputs vars; };
modules = [
./macbook.nix
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit vars; };
users.${vars.user} = {
imports = [ ../home-manager ../home-manager/darwin.nix ];
};
};
}
];
};
}
# home-manager/default.nix
{ config, pkgs, vars, ... }:
{
home = {
username = "${vars.user}";
stateVersion = "23.11";
};
programs = { home-manager.enable = true; };
imports = [
./helix.nix
./shell
./gpg.nix
./ssh.nix
./cli
];
}
and shell/default.nix
has:
# shell/default.nix
{ config, pkgs, vars, ... }:
{
imports = [ ./fish/fish.nix ./git.nix ./tmux.nix ];
}
Finally shell/fish/fish.nix
gives an error:
# shell/fish/fish.nix
{ lib, pkgs, vars, ... }:
{
programs.fish = {
enable = true;
};
home.file = {
".config/fish/functions/br.fish".text = import ./functions/br.nix;
".config/fish/functions/e.fish".text = import ./functions/e.nix;
".config/fish/functions/einherjar.fish".text = import ./functions/einherjar.nix;
".config/fish/functions/fzf.fish".text = import ./functions/fzf.nix;
".config/fish/functions/g.fish".text = import ./functions/g.nix;
".config/fish/functions/l.fish".text = import ./functions/l.nix;
".config/fish/functions/ls.fish".text = import ./functions/l.nix;
".config/fish/functions/nf.fish".text = import ./functions/nf.nix;
".config/fish/functions/r.fish".text = import ./functions/r.nix;
".config/fish/functions/rename_metadata.fish".text = import ./functions/rename_metadata.nix;
".config/fish/functions/testtor.fish".text = import ./functions/testtor.nix;
".config/fish/functions/top.fish".text = import ./functions/top.nix;
".config/fish/functions/vi.fish".text = import ./functions/vi.nix;
".config/fish/functions/yt.fish".text = import ./functions/yt.nix;
".config/fish/functions/yta.fish".text = import ./functions/yta.nix;
".config/fish/functions/ytp.fish".text = import ./functions/ytp.nix;
".config/fish/functions/fish_prompt.fish".source = ./functions/fish_prompt.fish;
};
}
This is the error:
error:
… while evaluating the attribute 'config.system.build.toplevel'
at /nix/store/i6hq63805y784dml4j8pgkrz3lryxzld-source/lib/modules.nix:320:9:
319| options = checked options;
320| config = checked (removeAttrs config [ "_module" ]);
| ^
321| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/store/i6hq63805y784dml4j8pgkrz3lryxzld-source/lib/modules.nix:320:18:
319| options = checked options;
320| config = checked (removeAttrs config [ "_module" ]);
| ^
321| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `home' does not exist. Definition values:
- In `/nix/store/imwyaz9vkdvznliqkcn78hggmhxc4jdi-source/home-manager/shell/fish/fish.nix':
{
file = {
".config/fish/functions/br.fish" = {
text = ''
# More information can be found in https://github.com/Canop/broot
...
Any help would be much appreciated.