-
-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No documentation on how to use the NUR with Home manager flakes #485
Comments
I ran into this myself. Tried a couple different approaches and the only one that worked for me was this example. Is that the canonical approach? If so I can take a stab at a PR updating the documentation with an example. |
This is what I use:
|
I tried that one and haven't been able to get it to work for me for some reason. |
@gBasil here's the configuration I landed on for comparison. |
I've tried shoving as many different configurations into the flake as possible. I don't know whether the (note, this is not a working setup, at least for me) flake.nix {
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Don't be fooled: The NUR doesn't work in this configuration for some reason
nur.url = "github:nix-community/NUR";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Asahi compatibility
nixos-m1-overlay = {
url = "github:tpwrules/nixos-apple-silicon";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, nur, home-manager, nixos-m1-overlay, ... }@inputs:
let
pkgs = import nixpkgs {
overlays = [
nixos-m1-overlay.overlays.default
nur.overlay
];
};
in
{
nixosConfigurations = {
mikubook = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./configuration.nix
nixos-m1-overlay.nixosModules.default
nur.nixosModules.nur
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
# home-manager.users.basil = import ./users/basil.nix;
home-manager.users.basil = {
imports = [ ./users/basil.nix ];
# import ./users/basil.nix;
_module.args.nur = { inherit nur; };
};
nixpkgs.overlays = [
nixos-m1-overlay.overlays.default
nur.overlay
];
_module.args.nur = { inherit nur; };
}
];
};
};
};
} users/basil.nix { config, lib, pkgs, ... }:
let
someVar = 0;
in {
imports = [ ../packages/vscodium.nix ../packages/firefox.nix ];
programs.firefox.profiles.basil.extensions = with pkgs.nur.repos.rycee.nur; [
ublock-origin
];
// other stuff is in here too
} When running (sorry for hijacking this issue!) EditWhile this doesn't solve the issue, my solution was to sidestep the NUR and just use the flake in the one repository I wanted, which meant adding |
Any updates? |
Well, I have a working config now, though I didn't try out the nur overlay. That might be a better solution. My config, with all the parts not needed for my home manager config taken out: {
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nur, home-manager, ... }:
let
stateVersion = "23.11";
in {
homeConfigurations = {
"annaaurora@LenOwO" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages."x86_64-linux";
modules = [
{ home = { inherit stateVersion; }; }
./users/common/home.nix
./users/annaaurora/home.nix
./users/annaaurora/hosts/LenOwO/home.nix
nur.hmModules.nur
];
};
};
};
} |
@gBasil Why are you doing the nixpkgs overlay twice? |
Using NUR with home manager in a flake is not that different from using NUR in a NixOS flake. You just put With The best option seems to be the overlay. Then you can use the NixOS modules from NUR too without infinite recursion according to https://nur.nix-community.org/documentation/#using-the-flake-in-nixos. But I'm not sure if newbies understand that it's kind of the same process, so it might be a good idea to explain this in the docs. |
Here's an example that worked for me, using Home Manager as a NixOS module and flakes. Adding {
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
home-manager = {
url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/NUR";
};
outputs = { self, nixpkgs, home-manager, nur, ... }@inputs: {
nixosConfigurations = {
"nixos" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nur.nixosModules.nur
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.ekisu = import ./home.nix;
home-manager.sharedModules = [ nur.hmModules.nur ];
}
];
};
};
};
} |
I agree with @auroraanna. Some more detailed explanation in the README would really help |
I FINALLY got it to work with my config, I did the following:
Then
Only error I am getting now is a conflicting file, so I guess I might have to reset my browser which kinda sucks |
For the life of me, I cannot work this out...#545 (comment) |
There's a section on how to do it with on Home manager without a flake and NixOS with a flake but now Home mananger with a flake.
The text was updated successfully, but these errors were encountered: