Flakes use in home manager help required

https://lemmy.world/post/8261812

Flakes use in home manager help required - Lemmy.World

I want to use Plasma-manager [https://github.com/pjones/plasma-manager] in my system. I have enabled flakes in configurations. Now what to do to use it. The output generated by tool rc2nix can be copied through terminal but when i put that in home.nix , it says that plasma is not available which is true but then how do I use this tool. flake file.

First, you need to pass the plasma-manager input to your home-manager config in some way. I use the NixOS module for home-manager which I declare like this in my flake.nix (if you have a different setup, this might not be necessary or you have to do it in a slightly different way):

homeManagerModule = { imports = [home-manager.nixosModules.home-manager]; home-manager.users.myusername = import ./home.nix; # This will give us access to the inputs in the home-manager config home-manager.extraSpecialArgs = {inherit inputs}; };

Now the home-manager config (in my case home.nix) can look like this:

{ inputs, ... }: { imports = [inputs.plasma-manager.homeManagerModules.plasma-manager]; programs.plasma = { enable = true; # ... }

You probably forgot to import the plasma-manager module into home-manager. If you want to have a cleaner setup, I’d also recommend against just copying the complete output of rc2nix into your config since it tends to contain a lot of unnecessary stuff. What I usually do is:

  • Store the current config in a file, i.e. rc2nix > old-config.nix
  • Make whatever changes I want in Plasma in the graphical settings app
  • Store the updated config in a new file, i.e. rc2nix > new-config.nix
  • Get the difference, i.e. diff old-config.nix new-config.nix and add what I want to my actual plasma-manager config.
  • This of course only works if you’re starting from a relatively unmodified installation of KDE, but in that case it’s worth the effort imo.

    Thank you for help. so now I have flake.nix and home.nix in ~/.config/home-manager. flake.nix looks like

    `{ description = “Plasma Manager Example”;

    inputs = { home-manager.url = “github:nix-community/home-manager”; nixpkgs.url = “github:nixos/nixpkgs/nixpkgs-unstable”; home-manager.inputs.nixpkgs.follows = “nixpkgs”;

    plasma-manager. url = "github:pjones/plasma-manager"; plasma-manager. inputs. nixpkgs. follows = "nixpkgs"; plasma-manager. inputs. home-manager. follows = "home-manager";

    };

    outputs = inputs: let system = “x86_64-linux”; username = “naresh”; in { # Standalone Home Manager Setup: homeConfigurations.${username} = inputs.home-manager.lib.homeManagerConfiguration { pkgs = inputs.nixpkgs.legacyPackages.${system}; # Ensure Plasma Manager is available: extraModules = [ inputs.plasma-manager.homeManagerModules.plasma-manager ];

    # Specify the path to your home configuration here: configuration = import ./home.nix; inherit system username; homeDirectory = "/home/${username}"; }; # A shell where Home Manager can be used: devShells.${system}.default = let pkgs = import inputs.nixpkgs { inherit system; }; in pkgs.mkShell { buildInputs = [ inputs.home-manager.packages.${system}.home-manager ]; }; };

    }`

    and when I run home-manager switch --flake ~/.config/home-manager/ It gives me

    `error: … while calling the ‘throw’ builtin

    at /nix/store/1ryprai4bllkrna60cmcygxc4qyn79s1-source/lib/trivial.nix:393:37: 392| */ 393| throwIf = cond: msg: if cond then throw msg else x: x; | ^ 394| error: The 'homeManagerConfiguration' arguments - 'configuration', - 'username', - 'homeDirectory' - 'stateVersion', - 'extraModules', and - 'system' have been removed. Instead use the arguments 'pkgs' and 'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.html#sec-release-22.11-highlights Deprecated args passed: configuration username homeDirectory extraModules system

    `

    Now don’t know what to do. I got your latter advice regarding diff but first I need to make this work. I am on unstable nixos version. and

    home-manager --version gives 23.11-pre

    nixos-version gives 23.11pre546599.e44462d6021b (Tapir)

    The problem seems to be that home.stateVersion is not set because you commented out both the declaration in flake.nix as well as the line that imports home.nix. It’s a bit difficult to see whether the config is otherwise fine since there is a lot of visual clutter due to all the commented-out lines.