diff --git a/home/scripts.nix b/home/scripts.nix index b199f2e..6723f71 100644 --- a/home/scripts.nix +++ b/home/scripts.nix @@ -27,40 +27,6 @@ in ''; executable = true; }; - "scripts/power_menu.sh" = { - executable = true; - text = '' - #!/bin/sh - - set -eu - - chpower() { - case "$1" in - "") - ;; - Shutdown) - exec systemctl poweroff - ;; - Reboot) - exec systemctl reboot - ;; - Hibernate) - exec systemctl hibernate - ;; - Logout) - swaymsg exit - ;; - *) - ${notify-send} -t 1500 -u low "Invalid Option" - ;; - esac - } - - OPTIONS="Shutdown\nReboot\nHibernate\nLogout" - - chpower "$(printf "%b" "$OPTIONS" | sort | ${dmenu} -p "Power Menu")" - ''; - }; "scripts/volume_up.sh" = let diff --git a/packages/default.nix b/packages/default.nix index 9db905f..85a3065 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -3,6 +3,8 @@ self: super: { catppuccin-wallpapers = super.callPackage ./catppuccin-wallpapers { }; dracula-gtk = super.callPackage ./dracula-gtk { }; newaita-icon-theme = super.callPackage ./newaita-icon-theme { }; + scripts = super.callPackage ./scripts { }; + waybar = super.waybar.overrideAttrs (oldAttrs: { mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; }); diff --git a/packages/scripts/default.nix b/packages/scripts/default.nix new file mode 100644 index 0000000..d43c396 --- /dev/null +++ b/packages/scripts/default.nix @@ -0,0 +1,16 @@ +{ lib, stdenvNoCC, makeWrapperm, libnotify }: +stdenvNoCC.mkDerivation { + pname = "scripts"; + version = "1.0"; + src = ./.; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ ]; + + installPhase = '' + mkdir -p $out/bin + cp power-menu.sh $out/bin/power-menu + chmod +x $out/bin/power-menu + wrapProgram $out/bin/power-menu --prefix PATH : ${lib.makeBinPath [ libnotify ]} + ''; +} diff --git a/packages/scripts/power-menu.sh b/packages/scripts/power-menu.sh new file mode 100644 index 0000000..113f1eb --- /dev/null +++ b/packages/scripts/power-menu.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +set -eu + +chpower() { + case "$1" in + "") + ;; + Shutdown) + exec systemctl poweroff + ;; + Reboot) + exec systemctl reboot + ;; + Hibernate) + exec systemctl hibernate + ;; + *) + notify-send -t 1500 -u low "Invalid Option" + ;; + esac +} + +OPTIONS="Shutdown\nReboot\nHibernate" + +chpower "$(printf "%b" "$OPTIONS" | sort | ${dmenu} -p "Power Menu")" +