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.

  • Triton
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 months ago

    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:

    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.

    • Insaan@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      7 months ago

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

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

      };

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

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

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

      `

      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
        link
        fedilink
        English
        arrow-up
        1
        ·
        7 months ago

        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.