Hi everyone!
I was used to set up my nixos distro on wsl2 with configuration.nix until I recently discovered a flake the community tutorial suggested. That solved a problem I had previously with an impure flake I had to bypassed with --impure flag in nix-rebuild --flake.
Right now I don’t have any idea about how to set group users and set either isSystemUser or isNormalUser as this error wants me to:
error:
Failed assertions:
- Exactly one of users.users.wavesinaroom.isSystemUser and users.users.wavesinaroom.isNormalUser must be set.
- users.users.wavesinaroom.group is unset. This used to default to
nogroup, but this is unsafe. For example you can create a group
for this user with:
users.users.wavesinaroom.group = "wavesinaroom";
users.groups.wavesinaroom = {};
Command 'nix --extra-experimental-features 'nix-command flakes' build --print-out-paths '/home/wavesinaroom/waves_nixconfig#nixosConfigurations."nixos".config.system.build.toplevel' --no-link' returned non-zero exit status 1.
This is my flake:
{
description = "Waves in a room set up";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, nixos-wsl, ... }: {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nixos-wsl.nixosModules.default
{
system.stateVersion = "25.05";
wsl.enable = true;
}
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.wavesinaroom = import ./home.nix;
backupFileExtension = "backup";
};
}
];
};
};
};
}
This is my home manager:
{ lib, config, pkgs, ... }:
let
dotfiles = "${config.home.homeDirectory}/waves-dotfiles/config";
create_symlink = path: config.lib.file.mkOutOfStoreSymlink path;
configs = { };
in {
imports = [
./modules/nvim/nvim.nix
./modules/bash.nix
./modules/git.nix
./modules/direnv.nix
./modules/tmux/tmux.nix
];
xdg.configFile = builtins.mapAttrs (name: subpath: {
source = create_symlink "${dotfiles}/${subpath}";
recursive = true;
}) configs;
home.username = "wavesinaroom";
home.homeDirectory = lib.mkDefault "/home/wavesinaroom";
home.packages = with pkgs; [ glab w3m ];
home.stateVersion = "25.05";
}
I did a couple of tries in my homemanager.nix but I didn’t know how to do that. The problem with my flake is that I’m importing homemanager.nix so I can’t add more attributes. Sorry, I’m not sure what to do
Can anyone lend me a hand with this please?
Edit
I just realized I didn’t add configuration.nix, here you go:
{ config, lib, pkgs, ... }:
{
imports = [
# include NixOS-WSL modules
<nixos-wsl/modules>
];
wsl.enable = true;
wsl.defaultUser = "wavesinaroom";
users.users.wavesinaroom.isSystemUser = true;
programs.git = {
enable = true;
prompt.enable = true;
};
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
defaultEditor = true;
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
system.stateVersion = "25.05"; # Did you read the comment?
}
users.users.wavesinaroom.isSystemUser = true; is in this file and still I get the error. Now I remember that’s the reason what I’m asking here what’s going on here.