Closed K-MeLeOn closed 1 week ago
because you are trying to import the home manager module as a nixos module
the last snippet works as expected, because you are defining a home-manager attr set, which is the home-manager config inside the nixos module
{
outputs = { nixpkgs, ags, ... }: {
nixosConfigurations.ey = nixpkgs.lib.nixosSystem {
specialArgs = { inherit ags; };
modules = [
# this is what you are trying to do, which doesn't work
# because this is "nixos land"
ags.homeManagerModules.default
# this works, because inside home-manager.users.username
# you are on "home-manager land"
({pkgs, ...}: {
home-manager.users.username = {
home.packages = [
ags.packages.${pkgs.system}.default
];
};
})
# and this also works
({pkgs, ...}: {
home-manager.users.username = {
imports = [ags.homeManagerModules.default];
programs.ags.enable = true;
};
})
];
};
};
}
because you are trying to import the home manager module as a nixos module
the last snippet works as expected, because you are defining a home-manager attr set, which is the home-manager config inside the nixos module
{ outputs = { nixpkgs, ags, ... }: { nixosConfigurations.ey = nixpkgs.lib.nixosSystem { specialArgs = { inherit ags; }; modules = [ # this is what you are trying to do, which doesn't work # because this is "nixos land" ags.homeManagerModules.default # this works, because inside home-manager.users.username # you are on "home-manager land" ({pkgs, ...}: { home-manager.users.username = { home.packages = [ ags.packages.${pkgs.system}.default ]; }; }) # and this also works ({pkgs, ...}: { home-manager.users.username = { imports = [ags.homeManagerModules.default]; programs.ags.enable = true; }; }) ]; }; }; }
Awwww, sooo much works to completly undestand nix :+1: Thank you for your explanation and sorry for wasting your time !
Hello,
I had a strange behavior (that's probably my fault ?) when trying to use AGS with Home-Manager & Flakes.
I didn't understand why I can install AGS using
home.packages
, not usingprograms.ags.enable = true
. I keep getting this error:cli error
``` error: The option `home' does not exist. Definition values: - In `/nix/store/rigj96fasvv4fxw9sad1zv8waisx2gwm-source/modules/system/ags': { _type = "if"; condition = false; content = { _type = "if"; ```Anyone had this problem ?
Thanks for your help ! :smile:
./flake.nix
```nix { description = "Machine specific configuration flake."; # Defining package channels inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; nixos-hardware.url = "https://github.com/NixOS/nixos-hardware/archive/master.tar.gz"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; hyprland = { type = "git"; url = "https://github.com/hyprwm/Hyprland"; submodules = true; }; # Add AGS ags.url = "github:Aylur/ags"; }; # Defining flake import structure for packages outputs = { self, nixpkgs, nixpkgs-stable, nixos-hardware, ags, ... } @ attrs: let system = "x86_64-linux"; nixpkgs-overlays = import nixpkgs { inherit system; overlays = [ (import ./modules/overlays) ]; config.allowUnfree = true; }; in { nixosConfigurations.ey = nixpkgs.lib.nixosSystem { system = system; specialArgs = { inherit nixpkgs-stable; inherit nixpkgs-overlays; inherit nixos-hardware; inherit ags; username = "myUsername"; hostname = "myHostname"; displayConfig = "laptop"; nvidia_bool = "disabled"; } // attrs; modules = [ nixos-hardware.nixosModules.framework-12th-gen-intel ./. ]; }; } ```./default.nix
```nix { home-manager, ... }: { imports = [ home-manager.nixosModules.home-manager # Some imports ./modules ]; home-manager.backupFileExtension = ".bak"; } ```./modules/default.nix
```nix { imports = [ # Some imports ./system ]; } ```./modules/system/default.nix
```nix { hyprland, ags, pkgs, nvidia_bool, username, ... }: { imports = [ # Some imports ./ags ]; # Some config } ```./modules/system/ags/default.nix **NOT WORKING**
```nix { pkgs, ags, home-manager, username, ... }: { imports = [ ags.homeManagerModules.default ]; home-manager.users.${username} = { ... }: { programs.ags = { enable = true; configDir = null; #../ags; # additional packages to add to gjs's runtime extraPackages = with pkgs; [ gtksourceview webkitgtk accountsservice ]; }; }; } ```./modules/system/ags/default.nix **WORKING**
```nix { pkgs, ags, home-manager, username, ... }: { home-manager.users.${username} = { ... }: { home.packages = [ ags.packages.${pkgs.system}.default ]; }; } ```