Sample Header Ad - 728x90

Can't enable home manager in WSL NixOS

0 votes
1 answer
247 views
I'm trying to setup home manager in NixOS running in WSL. However, it seems my import is not working correctly. I'm not sure what I'm missing. Google and ChatGPT were of no use here. My /etc/nixos/configuration.nix { config, lib, pkgs, ... }: let home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/master.tar.gz "; in { imports = [ # include NixOS-WSL modules ]; wsl.enable = true; wsl.defaultUser = "nixos"; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It's perfectly fine and recommended to leave # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html) . environment.systemPackages = with pkgs; [ vim oh-my-zsh zsh zsh-completions zsh-powerlevel10k zsh-syntax-highlighting zsh-history-substring-search # other packages ]; system.stateVersion = "24.05"; # Did you read the comment? users.users.nixos.isNormalUser = true; home-manager.users.nixos = { pkgs, ... }: { home.stateVersion = "24.05"; home.username = "nixos"; users.defaultUserShell = pkgs.zsh; programs.zsh = { enable = true; oh-my-zsh = { enable = true; theme = "avit"; # Set the desired theme here plugins = [ "git" "vim" "sudo" "z"]; }; }; }; } The error I get is: $ sudo nixos-rebuild switch building Nix... building the system configuration... error: … while calling the 'head' builtin at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1575:11: 1574| || pred here (elemAt values 1) (head values) then 1575| head values | ^ 1576| else … while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:809:9: 808| in warnDeprecation opt // 809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value; | ^ 810| inherit (res.defsFinal') highestPrio; (stack trace truncated; use '--show-trace' to show the full trace) error: The option `home-manager.users.nixos.users' does not exist. Definition values: - In `/etc/nixos/configuration.nix': { defaultUserShell = ; What am I missing?
Asked by CalumMcCall (101 rep)
Jul 20, 2024, 04:01 PM
Last activity: Jul 21, 2024, 05:13 PM