Open FirelightFlagboy opened 1 year ago
So you are saying the error is thrown by just importing the anyrun hm module?
Can you try inputs.anyrun.nixosModules."${system}".home-manager
?
Hello @Sntx626,
So you are saying the error is thrown by just importing the anyrun hm module?
Yes, just importing the module in nixosConfigurations
give me erros.
Can you try
inputs.anyrun.nixosModules."${system}".home-manager
?
I've tried your suggestion:
diff --git a/flake.nix b/flake.nix
index 61b4a1f..9b8ec6c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -58,7 +58,8 @@
./nixos/configuration.nix
home-manager.nixosModules.home-manager
# anyrun.nixosModules.home-manager
- anyrun.homeManagerModules.default
+ inputs.anyrun.nixosModules."${system}".home-manager
{
home-manager = {
useGlobalPkgs = true;
But it gave me the following error:
error: attribute 'x86_64-linux' missing
at /nix/store/cb46jgw2xy9m57s4g94rrjw4l9fbdj81-source/flake.nix:62:21:
61| # anyrun.homeManagerModules.default
62| inputs.anyrun.nixosModules."${system}".home-manager
| ^
63| {
Same issue here. @FirelightFlagboy do you have any progress with it?
Hello @pchabros, I've made no progress :(
Can you try
inputs.anyrun.nixosModules."${system}".home-manager
?
My bad, I forked anyrun and forgot I changed the flake that much. The following is a reference on how I circumvented the problem.
You can take a look at my anyrun fork - specifically the flake of that fork.
And how I import that flake into my system flake and the anyrun system module I use to config anyrun and set the plugins.
Though I do not recommend running or depending on these forks, a I just wait for #87 to complete. My forks will be out-of-date most of the time.
Home-manager modules should be imported only in the home-manager portions of your configuration. When you import the anyrun module in the nixosConfigurations.<name>
's modules
, the module tries to access home.*
which does not exist and is not expected to exist. That only exists in homeConfigurations.<name>
.
nixosConfigurations = {
thinkpad = lib.nixosSystem {
inherit system pkgs;
modules = [
./nixos/configuration.nix
home-manager.nixosModules.home-manager
- anyrun.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.redacted = import ./home-manager/home.nix;
};
}
];
};
};
@Lord-Valen would you be so kind and give a minimal working example of how this would look in a flake.nix without using flake-parts? I'm just digging into flakes and have been trying to get anyrun to work for quite a while now but somehow can't get my head around it.
My current flake.nix looks something like that:
This will build the minimal install-iso with home-manager and the anyrun module. You can run it in a vm with nix run .#nixosConfigurations.some-configuration.config.system.build.vm
(or the more easily remembered nixos-generators --run --flake .#some-configuration
).
# flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
anyrun.url = "github:Kirottu/anyrun"; # Don't override nixpkgs if you want the binary cache to work
};
outputs = {
nixpkgs,
home-manager,
anyrun,
...
}: {
nixosConfigurations.some-configuration = let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in
nixpkgs.lib.nixosSystem { # Configure the system environment
inherit system pkgs;
modules = [
({modulesPath, ...}: { # Base the MVE on the minimal install-iso
imports = [
(builtins.toString modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
];
})
home-manager.nixosModules.home-manager # Import the home-manager nixos module
({pkgs, ...}: {
users.users.nixos.isNormalUser = true; # Make sure the user exists
home-manager = {
# These two aren't necessary, but they sure are nice
useGlobalPkgs = true; # Use the system `pkgs`
useUserPackages = true; # Use `/etc/profile`
users.nixos = { # Configure the user's environment
imports = [
anyrun.homeManagerModules.anyrun # Import the anyrun home-manager module
];
programs.anyrun = {
# Configure anyrun using the module's options
enable = true;
config = {
plugins = with anyrun.packages.${system}; [];
};
};
home.stateVersion = "23.11";
};
};
system.stateVersion = "23.11";
})
];
};
};
}
I'm trying to use anyrun home-manager module with home-manager configured as a nixos module (in
nixosConfigurations
) but with the following command:I'm getting the following error:
I've to point out that by using
home-manager
in a standalone manner don't cause any error:I would like to help to configure my
flake.nix
to be able to use the anyrun home-manager module innixosConfiguration
to be able to use it duringnixos-rebuild
.I've opened an issue here because I was not able to find any example on google by searching for
"anyrun.nixosModules.home-manager"
or"anyrun.homeManagerModules.default"
Configurations
My current configuration look something like that:
```nix { description = "NixOS system configuration flake"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager/release-23.05"; inputs.nixpkgs.follows = "nixpkgs"; }; anyrun = { url = "github:Kirottu/anyrun"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { anyrun, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, ... }@inputs: let system = "x86_64-linux"; pkgs-unstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; }; overlay-unstable = final: prev: { unstable = pkgs-unstable; }; pkgs = import nixpkgs { inherit system; config = { allowUnfree = true; packageOverrides = pkgs: { xdg-desktop-portal-hyprland = pkgs-unstable.xdg-desktop-portal-hyprland; hyprland = pkgs-unstable.hyprland; }; }; overlays = [ overlay-unstable ]; }; lib = nixpkgs.lib; in { # NixOS configuration entrypoint # Available through `nixos-rebuild --flake '.#key' nixosConfigurations = { thinkpad = lib.nixosSystem { inherit system pkgs; modules = [ ./nixos/configuration.nix home-manager.nixosModules.home-manager anyrun.nixosModules.home-manager { home-manager = { useGlobalPkgs = true; useUserPackages = true; users.redacted = import ./home-manager/home.nix; }; } ]; }; }; # Standalone home-manager configuration entrypoint # Available through `home-manager --flake '.#key' homeConfigurations = { redacted = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ anyrun.nixosModules.home-manager ./home-manager/home.nix ]; }; }; }; } ``` > As you can see, I've added `anyrun.nixosModules.home-manager` to `nixosConfiguration.thinkpad.modules` and `homeConfigurations.redacted.modules`flake.nix
I don't include
home.nix
file because it don't contain configuration related to anyrun.