I want to use 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 myflake.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:rc2nix > old-config.nix
rc2nix > new-config.nix
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 = { # Specify the source of Home Manager and Nixpkgs home-manager.url = “github:nix-community/home-manager”; nixpkgs.url = “github:nixos/nixpkgs/nixpkgs-unstable”; home-manager.inputs.nixpkgs.follows = “nixpkgs”;
};
outputs = { home-manager , plasma-manager , nixpkgs , … }: let system = “x86_64-linux”; username = “naresh”; in { homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; # extraModules = [ # plasma-manager.homeManagerModules.plasma-manager # ];
} `
and home.nix looks like
{ config, pkgs, plasma-manager, ... }: { # Home Manager needs a bit of information about you and the paths it should # manage. home.username = "naresh"; home.homeDirectory = "/home/naresh"; # This value determines the Home Manager release that your configuration is # compatible with. This helps avoid breakage when a new Home Manager release # introduces backwards incompatible changes. # # You should not change this value, even if you update Home Manager. If you do # want to update the value, then make sure to first check the Home Manager # release notes. home.stateVersion = "23.05"; # Please read the comment before changing. imports = [ plasma-manager.homeManagerModules.plasma-manager ]; # The home.packages option allows you to install Nix packages into your # environment. home.packages = with pkgs; [ alacritty screenfetch konsole rnix-lsp # # Adds the 'hello' command to your environment. It prints a friendly # # "Hello, world!" when run. # pkgs.hello # # It is sometimes useful to fine-tune packages, for example, by applying # # overrides. You can do that directly here, just don't forget the # # parentheses. Maybe you want to install Nerd Fonts with a limited number of # # fonts? # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) # # You can also create simple shell scripts directly inside your # # configuration. For example, this adds a command 'my-hello' to your # # environment: # (pkgs.writeShellScriptBin "my-hello" '' # echo "Hello, ${config.home.username}!" # '') ]; #) ++ ([(builtins.getFlake "github:pjones/plasma-manager")]); # Home Manager is pretty good at managing dotfiles. The primary way to manage # plain files is through 'home.file'. home.file = { # # Building this configuration will create a copy of 'dotfiles/screenrc' in # # the Nix store. Activating the configuration will then make '~/.screenrc' a # # symlink to the Nix store copy. # ".screenrc".source = dotfiles/screenrc; # # You can also set the file content immediately. # ".gradle/gradle.properties".text = '' # org.gradle.console=verbose # org.gradle.daemon.idletimeout=3600000 # ''; }; # You can also manage environment variables but you will have to manually # source # # ~/.nix-profile/etc/profile.d/hm-session-vars.sh # # or # # /etc/profiles/per-user/naresh/etc/profile.d/hm-session-vars.sh # # if you don't want to manage your shell through Home Manager. home.sessionVariables = { # EDITOR = "emacs"; }; # Let Home Manager install and manage itself. programs.home-manager.enable = true; programs.plasma = { enable = true; # Some high-level settings: workspace.clickItemTo = "select"; hotkeys.commands."Launch Konsole" = { key = "Meta+Alt+K"; command = "konsole"; }; # Some mid-level settings: shortcuts = { ksmserver = { "Lock Session" = [ "Screensaver" "Meta+Ctrl+Alt+L" ]; }; kwin = { "Expose" = "Meta+,"; "Switch Window Down" = "Meta+J"; "Switch Window Left" = "Meta+H"; "Switch Window Right" = "Meta+L"; "Switch Window Up" = "Meta+K"; }; }; # A low-level setting: configFile."baloofilerc"."Basic Settings"."Indexing-Enabled" = false; }; }
and when I run
home-manager switch --flake ~/.config/home-manager/
It gives me`error: … while evaluating a branch condition
`
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 inflake.nix
as well as the line that importshome.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.