nixd
nixd copied to clipboard
problems with home-manager.nixosModules.home-manager
nixd works for home-manager.nixosModules.home-manager somehow partially
Shows the versions of the programs
But let's try to get hints for programs from the home-manager
Not work helper message
my flake.nix
{
description = "Jenya NixOS Flake Configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }@inputs: {
nixosConfigurations = {
"pc-full" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
./nixos
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.jenya = import ./home;
extraSpecialArgs.inputs = inputs;
};
}
];
};
};
};
}
users.jenya = import ./home;
Looks like you are using HM attributes in an nested import
. It's generally hard to check this dataflow. (i.e. nixd cannot know import
ed file will be used as a part of NixOS modules, or HM modules, or nested in some attribute paths.
Maybe you could write standalone HM options and follow nixd examples in this repo.
My nix-darwin and home-manager configs are in separate files as well. They're both rather big, so having them in separate files makes it a bit easier to update etc.
It'd be cool if you could supply some sort of hint similar to JSDoc import types or Deno's @deno-types.
I have no idea if this makes any sense, but maybe it would look something like this in home.nix
.
{ pkgs, ... }:
# type = (import "github:nix-community/home-manager").home-manager.users.<name>
{
home = {
stateVersion = "23.11";
};
programs = {
bash.enable = true;
git = {
enable = true;
delta.enable = true;
lfs.enable = true;
};
};
}
My nix-darwin and home-manager configs are in separate files as well.
Type hints in comment is a planned feature.
users.jenya = import ./home;
Looks like you are using HM attributes in an nested
import
. It's generally hard to check this dataflow. (i.e. nixd cannot knowimport
ed file will be used as a part of NixOS modules, or HM modules, or nested in some attribute paths.Maybe you could write standalone HM options and follow nixd examples in this repo.
Excuse me. I forgot to answer. I did as you said and wrote standalone HM options.
This work:
{
description = "Jenya NixOS Flake Configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, home-manager, ... }@inputs:
let
system = "x86_64-linux";
username = "jenya";
in
{
nixosConfigurations."pc" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs username; };
modules = [ ./nixos ];
};
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [ ./home ];
extraSpecialArgs = {
inherit inputs system username;
};
};
};
}
Thank you!