Triton,

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):


<span style="color:#323232;">homeManagerModule = {
</span><span style="color:#323232;">  imports = [home-manager.nixosModules.home-manager];
</span><span style="color:#323232;">  home-manager.users.myusername = import ./home.nix;
</span><span style="color:#323232;">  # This will give us access to the inputs in the home-manager config
</span><span style="color:#323232;">  home-manager.extraSpecialArgs = {inherit inputs};
</span><span style="color:#323232;">};
</span>

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


<span style="color:#323232;">{
</span><span style="color:#323232;">  inputs,
</span><span style="color:#323232;">  ...
</span><span style="color:#323232;">}: {
</span><span style="color:#323232;">  imports = [inputs.plasma-manager.homeManagerModules.plasma-manager];
</span><span style="color:#323232;">  programs.plasma = {
</span><span style="color:#323232;">    enable = true;
</span><span style="color:#323232;">    # ...
</span><span style="color:#323232;">}
</span>

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:

  1. Store the current config in a file, i.e. rc2nix > old-config.nix
  2. Make whatever changes I want in Plasma in the graphical settings app
  3. Store the updated config in a new file, i.e. rc2nix > new-config.nix
  4. 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.

43dc92z0, (edited )

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”;


<span style="color:#323232;">plasma-manager. url = "github:pjones/plasma-manager";
</span><span style="color:#323232;">plasma-manager. inputs. nixpkgs. follows = "nixpkgs";
</span><span style="color:#323232;">plasma-manager. inputs. home-manager. follows = "home-manager";
</span>

};

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 # ];


<span style="color:#323232;">    modules = [
</span><span style="color:#323232;">      # ./home.nix
</span><span style="color:#323232;">      # {
</span><span style="color:#323232;">      #   home = {
</span><span style="color:#323232;">      #     inherit username;
</span><span style="color:#323232;">      #     homeDirectory = "/home/${username}";
</span><span style="color:#323232;">      #     # Update the state version as needed.
</span><span style="color:#323232;">      #     stateVersion = "23.05";
</span><span style="color:#323232;">      #   };
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span><span style="color:#323232;">      # },
</span><span style="color:#323232;">      plasma-manager.homeManagerModules.plasma-manager
</span><span style="color:#323232;">
</span><span style="color:#323232;">    ];
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span><span style="color:#323232;">  };
</span><span style="color:#323232;">  devShells.${system}.default =
</span><span style="color:#323232;">    let pkgs = import nixpkgs { inherit system; }; in
</span><span style="color:#323232;">    pkgs.mkShell {
</span><span style="color:#323232;">      buildInputs = [
</span><span style="color:#323232;">        home-manager.packages.${system}.home-manager
</span><span style="color:#323232;">      ];
</span><span style="color:#323232;">    };
</span><span style="color:#323232;">};
</span>

} `

and home.nix looks like


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

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

`error: … while evaluating a branch condition


<span style="color:#323232;">     at /nix/store/1ryprai4bllkrna60cmcygxc4qyn79s1-source/lib/lists.nix:57:9:
</span><span style="color:#323232;">
</span><span style="color:#323232;">       56|       fold' = n:
</span><span style="color:#323232;">       57|         if n == len
</span><span style="color:#323232;">         |         ^
</span><span style="color:#323232;">       58|         then nul
</span><span style="color:#323232;">
</span><span style="color:#323232;">   … while calling the 'length' builtin
</span><span style="color:#323232;">
</span><span style="color:#323232;">     at /nix/store/1ryprai4bllkrna60cmcygxc4qyn79s1-source/lib/lists.nix:55:13:
</span><span style="color:#323232;">
</span><span style="color:#323232;">       54|     let
</span><span style="color:#323232;">       55|       len = length list;
</span><span style="color:#323232;">         |             ^
</span><span style="color:#323232;">       56|       fold' = n:
</span><span style="color:#323232;">
</span><span style="color:#323232;">   (stack trace truncated; use '--show-trace' to show the full trace)
</span><span style="color:#323232;">
</span><span style="color:#323232;">   error: The option `home.stateVersion' is used but not defined.
</span>

`

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)

___``___

Triton,

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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • nixos@infosec.pub
  • ngwrru68w68
  • DreamBathrooms
  • khanakhh
  • magazineikmin
  • InstantRegret
  • ethstaker
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • osvaldo12
  • everett
  • kavyap
  • Durango
  • megavids
  • cubers
  • tester
  • GTA5RPClips
  • modclub
  • mdbf
  • cisconetworking
  • tacticalgear
  • Leos
  • normalnudes
  • anitta
  • provamag3
  • JUstTest
  • lostlight
  • All magazines