Closed Guz013 closed 9 months ago
You are importing the hm module in your nixos config.
Add it to your hm import array, not the nixos import array
I was wrong about the above.
Seems like you are declaring your hm config in two places. Please just put your imports in one place, import order is important.
Can you provide the code to fix or tell the line where this happens..? I just followed Vimjoyer's guide about configuring Nix, and I'm still trying to learn it, so it's kinda hard to understand where's the problem. Home-manager itself seems to be working fine at the moment, the problem just started when I tried to customize it with the module.
Try this:
Remove the import from here
homeConfiguration."guz" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
modules = [
flatpaks.homeManagerModules.default
];
};
And put it here (and restructure)
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
"guz".imports = [ flatpaks.homeManagerModules.default ./home.nix ];
};
};
I changed it so it looks like:
flake.nix
{
# ...
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flatpaks.url = "github:GermanBread/declarative-flatpak/stable";
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
inputs.home-manager.nixosModules.default
./hosts/default/configuration.nix
];
};
homeConfiguration."guz" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
};
};
}
configuration.nix
{ config, pkgs, inputs, lib, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
];
# ...
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
"guz".imports = [
inputs.flatpaks.homeManagerModules.default
./home.nix
];
};
};
}
And it gives me:
error: The option `home-manager.users.guz.services.flatpak.enable' does not exist. Definition values:
- In `/nix/store/8w63xz4vhzwlzdqqparkwl0if2zfnlw4-source/hosts/default/home.nix': true
Sorry if I did it wrong, I really am trying to understand.
Right.
I forgot that services.flatpak.enable
is not present in the hm version (because the nixos version uses the option I do not want to overwrite)
Use enableModule
instead
My bad, sorry!
Changing to services.flatpak.enable
to services.flatpak.enableModule
on home.nix
fixed the issue! Thank you very much for the help and quick replies, sorry for the inconvenience 😅
Many thanks for this module also! Really helps me create my NixOS exactly I want now!
sorry for the inconvenience
I like helping. Have fun messing with the module!
Hey! I was just thinking, wouldn't it be better if in the documentation there was a note warning/informing that in the home-manager module the service.flatpak.enableModule
needs to be used instead of the service.flatpak.enable
? I would be willing to open a small PR for it.
Uhh sure. I will add it, one sec
Hi! I'm new to NixOS, and I was trying to configure my home-manager config so flatpaks could be used in a declarative using this module, so installed it on
flake.nix
, using the home-manager module as it shows in the repo:And then on my
home.nix
added:And it gave me this error:
Could you help me with what I'm doing wrong? The documentation isn't so clear for where I should put the
services.flatpak
when it's related to home-manager. I was able to make it work with the NixOS module, and puttingservices.flatpak
onconfiguration.nix
, but it would be great to have all my user applications underhome.nix
.More details and attempts
I thought on changing from `services.flatpak` to `config.services.flatpak` and it gives me this error: ``` error: Module `:anon-6:anon-1' has an unsupported attribute `home'. This is caused by introducing a top-level `config' or `options' attribute. Add configuration attributes immediately on the top level instead, or move all of them (namely: home programs) into the explicit `config' attribute ``` On my `configuration.nix` is just (in summary for this issue): ```nix { config, pkgs, inputs, lib, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix inputs.home-manager.nixosModules.default ]; # ... home-manager = { extraSpecialArgs = { inherit inputs; }; users = { "guz" = import ./home.nix; }; }; } ``` The file structure is: ``` |- hosts \ - default |- configuration.nix |- hardware-configuration.nix \- home.nix |- flake.lock |- flake.nix ```Thanks in advance!