From 791d65a78d20e41ee3be7808659319002625e3f6 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Tue, 25 Jun 2024 12:11:51 +0200 Subject: [PATCH] plasma manager --- flake.lock | 1 + flake.nix | 9 ++- home-manager/all.nix | 2 + home-manager/files.nix | 21 +++++++ home-manager/plasma.nix | 103 +++++++++++++++++++++++++++++++++++ nixos/shared/graphical.nix | 2 +- nixos/shared/user-system.nix | 2 +- pkgs/cpypsk.nix | 13 +++++ pkgs/pash.nix | 14 +++++ 9 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 home-manager/files.nix create mode 100644 home-manager/plasma.nix create mode 100644 pkgs/cpypsk.nix create mode 100644 pkgs/pash.nix diff --git a/flake.lock b/flake.lock index 5e6c0c3..7ce65a1 100644 --- a/flake.lock +++ b/flake.lock @@ -183,6 +183,7 @@ }, "original": { "owner": "nix-community", + "ref": "trunk", "repo": "plasma-manager", "type": "github" } diff --git a/flake.nix b/flake.nix index 2e6e173..0809531 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,7 @@ inputs.nixpkgs.follows = "nixpkgs-unstable"; }; plasma-manager = { - url = "github:nix-community/plasma-manager"; + url = "github:nix-community/plasma-manager/trunk"; inputs.nixpkgs.follows = "nixpkgs"; inputs.home-manager.follows = "home-manager"; }; @@ -56,10 +56,13 @@ cornelis = cornelis.packages.${system}.cornelis; cornelis-vim = cornelis.packages.${system}.cornelis-vim; slippi-netplay = ssbm-nix.packages.${system}.slippi-netplay; + rc2nix = plasma-manager.packages.${system}.rc2nix; sax2nf = self.packages.${system}.sax2nf; bqn-vim = self.packages.${system}.bqn-vim; bqn-nvim = self.packages.${system}.bqn-nvim; shell-menu = self.packages.${system}.shell-menu; + pash = self.packages.${system}.pash; + cpypsk = self.packages.${system}.cpypsk; }; }; }; @@ -97,11 +100,13 @@ } // flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; in { - packages = { + packages = rec { bqn-vim = import ./pkgs/bqn-vim.nix { inherit pkgs; }; bqn-nvim = import ./pkgs/bqn-nvim.nix { inherit pkgs; }; sax2nf = import ./pkgs/sax2nf.nix { inherit pkgs; }; shell-menu = import ./pkgs/shell-menu.nix { inherit pkgs; }; + pash = import ./pkgs/pash.nix { inherit pkgs; }; + cpypsk = import ./pkgs/cpypsk.nix { inherit pkgs pash; }; }; }); } diff --git a/home-manager/all.nix b/home-manager/all.nix index 352c693..22316c9 100644 --- a/home-manager/all.nix +++ b/home-manager/all.nix @@ -7,12 +7,14 @@ in { imports = builtins.map (x: import x { inherit pkgs unstable extra common; }) [ ./applications.nix ./fetch.nix + ./files.nix ./git.nix ./gpg.nix ./hm-settings.nix ./launcher.nix ./media.nix ./neovim.nix + ./plasma.nix ./shell.nix ./ssh.nix ./terminal.nix diff --git a/home-manager/files.nix b/home-manager/files.nix new file mode 100644 index 0000000..e685f30 --- /dev/null +++ b/home-manager/files.nix @@ -0,0 +1,21 @@ +{ ... }: +{ + home.file."bin/xinitrc" = { + executable = true; + text = '' + #!/bin/sh -e + cd "$HOME" + + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) + fi + systemctl --user import-environment DISPLAY XAUTHORITY + + if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY + fi + + exec startplasma-x11 + ''; + }; +} diff --git a/home-manager/plasma.nix b/home-manager/plasma.nix new file mode 100644 index 0000000..f26bd2b --- /dev/null +++ b/home-manager/plasma.nix @@ -0,0 +1,103 @@ +{ pkgs, extra, ... }: +{ + programs.plasma = { + enable = true; + overrideConfig = true; + + workspace = { + lookAndFeel = "org.kde.breezedark.desktop"; + wallpaperPictureOfTheDay.provider = "simonstalenhag"; + }; + + kscreenlocker = { + wallpaperPictureOfTheDay.provider = "simonstalenhag"; + }; + + hotkeys.commands."launch-alacritty" = { + name = "Launch alacritty"; + key = "Meta+Return"; + command = "alacritty"; + }; + + hotkeys.commands."cpypsk" = { + name = "Launch cpypsk"; + key = "Meta+p"; + command = "${extra.cpypsk}"; + }; + + fonts = { + general = { + family = "SAX2 Nerd Font"; + pointSize = 10; + }; + }; + + panels = [ + { + location = "bottom"; + floating = true; + height = 44; + widgets = [ + { + name = "org.kde.plasma.kickoff"; + config = { + General.icon = "nix-snowflake-white"; + }; + } + { + name = "org.kde.plasma.icontasks"; + config = { + General.launchers = [ + "applications:thunderbird.desktop" + "applications:Alacritty.desktop" + "applications:firefox.desktop" + "applications:discord.desktop" + ]; + }; + } + { + systemTray.items = { + shown = [ + "org.kde.plasma.battery" + "org.kde.plasma.bluetooth" + "org.kde.plasma.networkmanagement" + "org.kde.plasma.volume" + ]; + }; + } + { + digitalClock = { + calendar.firstDayOfWeek = "monday"; + time.format = "24h"; + }; + } + ]; + } + ]; + + window-rules = [ + { + description = "alacritty"; + match = { + window-class = { + value = "Alacritty"; + type = "substring"; + }; + window-types = [ "normal" ]; + }; + apply = { + noborder = { + value = true; + apply = "force"; + }; + maximizehoriz = true; + maximizevert = true; + }; + } + ]; + }; + + home.packages = [ + extra.rc2nix + ]; +} diff --git a/nixos/shared/graphical.nix b/nixos/shared/graphical.nix index c138c75..adf1642 100644 --- a/nixos/shared/graphical.nix +++ b/nixos/shared/graphical.nix @@ -11,9 +11,9 @@ }; services.xserver = { enable = true; - desktopManager.plasma5.enable = true; displayManager.startx.enable = true; }; + services.desktopManager.plasma6.enable = true; # [SOUND] sound.enable = false; diff --git a/nixos/shared/user-system.nix b/nixos/shared/user-system.nix index a972788..309fee4 100644 --- a/nixos/shared/user-system.nix +++ b/nixos/shared/user-system.nix @@ -49,7 +49,7 @@ services.xserver = { xkb = { layout = "fox,sus"; - options = "ctrl:nocaps,grp:alt_shift_toggle"; + options = "ctrl:nocaps"; extraLayouts.sus = { description = "Swedish US"; languages = [ "se" ]; diff --git a/pkgs/cpypsk.nix b/pkgs/cpypsk.nix new file mode 100644 index 0000000..fbc4ffd --- /dev/null +++ b/pkgs/cpypsk.nix @@ -0,0 +1,13 @@ +{ pkgs, pash, ... }: +pkgs.writeScript "cpypsk" '' + #!/bin/sh + + D="''${PASH_DIR:-$HOME/.local/share/pash}" + D="''${D%/}" + + for f in "$D"/*.gpg; do + n="''${f#$D/}" + n="''${n%.gpg}" + printf '%s\n' "$n" + done | ${pkgs.rofi}/bin/rofi -dmenu | xargs ${pash} copy +'' diff --git a/pkgs/pash.nix b/pkgs/pash.nix new file mode 100644 index 0000000..aff3a45 --- /dev/null +++ b/pkgs/pash.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: +pkgs.stdenv.mkDerivation { + name = "pash"; + src = pkgs.fetchFromGitHub { + owner = "rachelambda"; + repo = "pash"; + rev = "5fa05003ec63256dce2d6071a33f254439096e94"; + hash = "sha256-AFAvtLWMWRSdRxZB3Mo9U9TD/x0s4m8tZMt7M3tRVlM="; + }; + phases = [ "installPhase" ]; + installPhase = '' + install -Dm755 $src/pash $out + ''; +}