From 6c720bdac671bacf747016046bcb26720b1d9388 Mon Sep 17 00:00:00 2001 From: m3tam3re Date: Thu, 10 Oct 2024 14:52:28 +0200 Subject: [PATCH] video13 --- flake.nix | 1 + home/common/default.nix | 11 ++++++-- home/m3tam3re/home.nix | 24 +++++++++++++++- modules/home-manager/default.nix | 3 ++ modules/home-manager/zellij-ps.nix | 44 ++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 modules/home-manager/default.nix create mode 100644 modules/home-manager/zellij-ps.nix diff --git a/flake.nix b/flake.nix index dd602fe..3c667cf 100644 --- a/flake.nix +++ b/flake.nix @@ -53,6 +53,7 @@ packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); overlays = import ./overlays {inherit inputs;}; + homeManagerModules = import ./modules/home-manager; nixosConfigurations = { m3-kratos-vm = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; diff --git a/home/common/default.nix b/home/common/default.nix index 8b31055..75338b7 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -1,4 +1,11 @@ -{ config, lib, outputs, pkgs, ... }: { +{ + config, + lib, + outputs, + pkgs, + ... +}: { + imports = builtins.attrValues outputs.homeManagerModules; nixpkgs = { # You can add overlays here overlays = [ @@ -29,7 +36,7 @@ nix = { package = lib.mkDefault pkgs.nix; settings = { - experimental-features = [ "nix-command" "flakes" "repl-flake" ]; + experimental-features = ["nix-command" "flakes" "repl-flake"]; warn-dirty = false; }; }; diff --git a/home/m3tam3re/home.nix b/home/m3tam3re/home.nix index bd6402c..7fb0053 100644 --- a/home/m3tam3re/home.nix +++ b/home/m3tam3re/home.nix @@ -26,7 +26,6 @@ home.packages = with pkgs; [ kitty wofi - zellij-ps # # Adds the 'hello' command to your environment. It prints a friendly # # "Hello, world!" when run. # pkgs.hello @@ -81,4 +80,27 @@ # Let Home Manager install and manage itself. programs.home-manager.enable = true; + + programs.zellij-ps = { + enable = true; + projectFolders = [ + "${config.home.homeDirectory}/.config" + "${config.home.homeDirectory}" + ]; + layout = '' + layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane size="70%" command="nvim" + pane split_direction="vertical" { + pane + pane command="unimatrix" + } + pane size=1 borderless=true { + plugin location="zellij:status-bar" + } + } + ''; + }; } diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..cee0ec6 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,3 @@ +{ + zellij-ps = import ./zellij-ps.nix; +} diff --git a/modules/home-manager/zellij-ps.nix b/modules/home-manager/zellij-ps.nix new file mode 100644 index 0000000..39b9e60 --- /dev/null +++ b/modules/home-manager/zellij-ps.nix @@ -0,0 +1,44 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.programs.zellij-ps; +in { + options = { + programs.zellij-ps = { + enable = mkEnableOption "Zellij Project Selector"; + projectFolders = lib.mkOption { + type = lib.types.listOf lib.types.path; + description = "List of project folders for zellij-ps."; + default = ["${config.home.homeDirectory}/projects"]; + }; + layout = lib.mkOption { + type = lib.types.str; + description = "Layout for zellij"; + default = '' + layout { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane split_direction="vertical" { + pane + pane command="htop" + } + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } + } + ''; + }; + }; + }; + config = mkIf cfg.enable { + home.packages = [pkgs.zellij-ps]; + home.sessionVariables.PROJECT_FOLDERS = lib.concatStringsSep ":" cfg.projectFolders; + home.file.".config/zellij/layouts/zellij-ps.kdl".text = cfg.layout; + }; +}