dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit 0a33ff3bd95a50e2986103751c53807f2545a4e0 parent 4176ade4d85b93e85330c323a7491db2eaf20ffc Author: maydayv7 <maydayv7@gmail.com> Date: Sat, 2 Mar 2024 10:14:03 +0530 refactor: `hyprutils` Script Also use `lib.getExe` and fix some shell and kernel stuff And update flake input 'chaotic': 'github:chaotic-cx/nyx/de5af0ecde1f26c008c01fc33775c42feccb9645' (2024-01-08) → 'github:chaotic-cx/nyx/39b0ccd13d13867e27cb6e27511c621b8e414ac8' (2024-02-29)
Diffstat:
| M | devices/vortex.nix | | | 2 | +- |
| M | flake.lock | | | 367 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ |
| M | modules/apps/default.nix | | | 4 | ++-- |
| M | modules/apps/git/default.nix | | | 4 | ++-- |
| M | modules/base/security.nix | | | 14 | ++++++++++---- |
| M | modules/gui/desktop/hyprland/apps/bar.nix | | | 5 | ++++- |
| M | modules/gui/desktop/hyprland/apps/default.nix | | | 97 | +++++++++++++++++++++++++++++++++++++++++++++---------------------------------- |
| M | modules/gui/desktop/hyprland/apps/security.nix | | | 13 | ++++++------- |
| M | modules/gui/desktop/hyprland/settings/default.nix | | | 3 | --- |
| M | modules/gui/desktop/hyprland/settings/keybindings.nix | | | 33 | ++++++++++----------------------- |
| M | modules/gui/launcher.nix | | | 4 | ++-- |
| M | modules/shell/bash.nix | | | 2 | +- |
| M | modules/shell/default.nix | | | 11 | +++++------ |
| M | scripts/audio.sh | | | 2 | +- |
| A | scripts/hyprutils.nix | | | 174 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | scripts/install.nix | | | 3 | ++- |
| M | scripts/nixos.nix | | | 3 | ++- |
| D | scripts/utils.sh | | | 116 | ------------------------------------------------------------------------------- |
18 files changed, 619 insertions(+), 238 deletions(-)
diff --git a/devices/vortex.nix b/devices/vortex.nix @@ -6,7 +6,7 @@ timezone = "Asia/Kolkata"; locale = "IN"; - kernel = "cachyos"; + kernel = "xanmod"; kernelModules = ["nvme" "thunderbolt"]; imports = [{services.fwupd.enable = true;}]; diff --git a/flake.lock b/flake.lock @@ -1,5 +1,38 @@ { "nodes": { + "attic": { + "inputs": { + "crane": [ + "chaotic", + "crane" + ], + "flake-compat": [ + "chaotic", + "flake-compat" + ], + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_2" + }, + "locked": { + "lastModified": 1707922053, + "narHash": "sha256-wSZjK+rOXn+UQiP1NbdNn5/UW6UcBxjvlqr2wh++MbM=", + "rev": "6eabc3f02fae3683bffab483e614bebfcd476b21", + "revCount": 193, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/zhaofengli/attic/0.1.193%2Brev-6eabc3f02fae3683bffab483e614bebfcd476b21/018da817-367d-75ac-bd41-470d92844bf2/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/zhaofengli/attic/0.1.%2A.tar.gz" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -181,11 +214,26 @@ }, "chaotic": { "inputs": { + "attic": "attic", "compare-to": "compare-to", + "conduit": "conduit", + "crane": "crane_2", + "fenix": "fenix", + "flake-compat": "flake-compat_2", "flake-schemas": "flake-schemas", + "flake-utils": [ + "utils", + "flake-utils" + ], "home-manager": [ "home-manager" ], + "jovian": "jovian", + "jujutsu": "jujutsu", + "niri": "niri", + "nix-filter": [ + "filters" + ], "nixpkgs": "nixpkgs", "systems": [ "systems" @@ -193,11 +241,11 @@ "yafas": "yafas" }, "locked": { - "lastModified": 1704755668, - "narHash": "sha256-rxDDY9X/UZ8DpmyqnILMDOL41gm520Po/N8bDojTt0k=", + "lastModified": 1709211633, + "narHash": "sha256-0O6sAGJqVlbL2oatQPOqoefM7IFBfzXkr61JcOmmsdI=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "de5af0ecde1f26c008c01fc33775c42feccb9645", + "rev": "39b0ccd13d13867e27cb6e27511c621b8e414ac8", "type": "github" }, "original": { @@ -218,7 +266,52 @@ }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/chaotic-cx/nix-empty-flake/0.1.2.tar.gz" + "url": "https://flakehub.com/f/chaotic-cx/nix-empty-flake/%3D0.1.2.tar.gz" + } + }, + "conduit": { + "inputs": { + "attic": [ + "chaotic", + "attic" + ], + "crane": [ + "chaotic", + "crane" + ], + "fenix": [ + "chaotic", + "fenix" + ], + "flake-compat": [ + "chaotic", + "flake-compat" + ], + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nix-filter": [ + "chaotic", + "nix-filter" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708926554, + "narHash": "sha256-NRfhf/+Scj23L6HysGoFT9+CQmegHCec91OxKFeSg+0=", + "owner": "girlbossceo", + "repo": "conduwuit", + "rev": "ca281b21db6640890828d2b6db743e9db33cc012", + "type": "gitlab" + }, + "original": { + "owner": "girlbossceo", + "repo": "conduwuit", + "type": "gitlab" } }, "crane": { @@ -254,6 +347,47 @@ "type": "github" } }, + "crane_2": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706473297, + "narHash": "sha256-FbxuYIrHaXpsYCLtI1gCNJhd+qvERjPibXL3ctmVaCs=", + "rev": "fe812ef0dad5bb93a56c599d318be176d080281d", + "revCount": 493, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.16.1/018d51be-1c17-765e-babc-c9e3bc8a5a14/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/ipetkov/crane/%2A.tar.gz" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1706768574, + "narHash": "sha256-4o6TMpzBHO659EiJTzd/EGQGUDdbgwKwhqf3u6b23U8=", + "rev": "668102037129923cd0fc239d864fce71eabdc6a3", + "revCount": 1762, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.1762%2Brev-668102037129923cd0fc239d864fce71eabdc6a3/018d63bb-6455-7a2f-98c6-74a36b8216a4/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A.tar.gz" + } + }, "filters": { "locked": { "lastModified": 1705332318, @@ -288,6 +422,21 @@ "flake-compat_2": { "flake": false, "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/%2A.tar.gz" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { "lastModified": 1673956053, "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", @@ -301,7 +450,7 @@ "type": "github" } }, - "flake-compat_3": { + "flake-compat_4": { "flake": false, "locked": { "lastModified": 1673956053, @@ -317,7 +466,7 @@ "type": "github" } }, - "flake-compat_4": { + "flake-compat_5": { "locked": { "lastModified": 1688025799, "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", @@ -332,7 +481,7 @@ "type": "github" } }, - "flake-compat_5": { + "flake-compat_6": { "flake": false, "locked": { "lastModified": 1673956053, @@ -372,16 +521,16 @@ }, "flake-schemas": { "locked": { - "lastModified": 1697467827, - "narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=", - "rev": "764932025c817d4e500a8d2a4d8c565563923d29", - "revCount": 29, + "lastModified": 1693491534, + "narHash": "sha256-ifw8Td8kD08J8DxFbYjeIx5naHcDLz7s2IFP3X42I/U=", + "rev": "c702cbb663d6d70bbb716584a2ee3aeb35017279", + "revCount": 21, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.1/018a4c59-80e1-708a-bb4d-854930c20f72/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.1.tar.gz" + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.1.tar.gz" } }, "flake-utils": { @@ -763,6 +912,54 @@ "type": "github" } }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709142038, + "narHash": "sha256-ZjP808isgLwuiqxSU1CYFyafm5GF80aYw1CXJbnVsgs=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "b83751a057acbb5f989193773841217ddc93d1f8", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "jujutsu": { + "inputs": { + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1709157367, + "narHash": "sha256-PK/2Q4f5xZvqCj2sETsfL1AdazMYnaowACn34f6GV58=", + "owner": "martinvonz", + "repo": "jj", + "rev": "e8f01ce19acd99c06ced9656eebfd0f8f5910a2a", + "type": "github" + }, + "original": { + "owner": "martinvonz", + "repo": "jj", + "type": "github" + } + }, "lib-aggregate": { "inputs": { "flake-utils": "flake-utils_2", @@ -782,10 +979,47 @@ "type": "github" } }, + "niri": { + "inputs": { + "crane": [ + "chaotic", + "crane" + ], + "fenix": [ + "chaotic", + "fenix" + ], + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nix-filter": [ + "chaotic", + "nix-filter" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709185909, + "narHash": "sha256-nmEqyuUisbdy/ZaWi/9lCwVtpU+lG2GXZWQYcKC7vl8=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "28977d1d3fd7883a7f757a1ba4e636bdacf9d0be", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-eval-jobs": { "inputs": { "flake-parts": "flake-parts", - "nix-github-actions": "nix-github-actions", + "nix-github-actions": "nix-github-actions_2", "nixpkgs": "nixpkgs_5", "treefmt-nix": "treefmt-nix" }, @@ -806,6 +1040,29 @@ "nix-github-actions": { "inputs": { "nixpkgs": [ + "chaotic", + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690328911, + "narHash": "sha256-fxtExYk+aGf2YbjeWQ8JY9/n9dwuEt+ma1eUFzF8Jeo=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "96df4a39c52f53cb7098b923224d8ce941b64747", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-github-actions_2": { + "inputs": { + "nixpkgs": [ "wayland", "nix-eval-jobs", "nixpkgs" @@ -827,16 +1084,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1704538339, - "narHash": "sha256-1734d3mQuux9ySvwf6axRWZRBhtcZA9Q8eftD6EZg6U=", - "rev": "46ae0210ce163b3cba6c7da08840c1d63de9c701", - "revCount": 567011, + "lastModified": 1709150264, + "narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", + "rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", + "revCount": 589696, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.567011%2Brev-46ae0210ce163b3cba6c7da08840c1d63de9c701/018ce71d-40cb-7594-bc00-f31ffedcdfa4/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.589696%2Brev-9099616b93301d5cf84274b184a3a5ec69e94e08/018df3e5-846d-74da-b6a7-4656c4e990d6/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz" + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" } }, "nixpkgs-lib": { @@ -870,6 +1127,22 @@ "type": "github" } }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1702780907, + "narHash": "sha256-blbrBBXjjZt6OKTcYX1jpe9SRof2P9ZYWPzq22tzXAA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e2e384c5b7c50dbf8e9c441a9e58d85f408b01f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1708751719, @@ -1050,6 +1323,23 @@ "windows": "windows" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1706735270, + "narHash": "sha256-IJk+UitcJsxzMQWm9pa1ZbJBriQ4ginXOlPyVq+Cu40=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "42cb1a2bd79af321b0cc503d2960b73f34e2f92b", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "rust-overlay": { "inputs": { "flake-utils": [ @@ -1075,6 +1365,33 @@ "type": "github" } }, + "rust-overlay_2": { + "inputs": { + "flake-utils": [ + "chaotic", + "jujutsu", + "flake-utils" + ], + "nixpkgs": [ + "chaotic", + "jujutsu", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1707444620, + "narHash": "sha256-P8kRkiJLFttN+hbAOlm11wPxUrQZqKle+QtVCqFiGXY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "78503e9199010a4df714f29a4f9c00eb2ccae071", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "sops": { "inputs": { "nixpkgs": [ @@ -1109,7 +1426,7 @@ "base16-kitty": "base16-kitty", "base16-tmux": "base16-tmux", "base16-vim": "base16-vim", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "home-manager": [ "home-manager" ], @@ -1269,7 +1586,7 @@ }, "vscode": { "inputs": { - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_4", "flake-utils": [ "utils", "flake-utils" @@ -1314,7 +1631,7 @@ }, "wayland": { "inputs": { - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_5", "lib-aggregate": "lib-aggregate", "nix-eval-jobs": "nix-eval-jobs", "nixpkgs": "nixpkgs_6" @@ -1355,7 +1672,7 @@ }, "windows": { "inputs": { - "flake-compat": "flake-compat_5", + "flake-compat": "flake-compat_6", "nixpkgs": [ "unstable" ] @@ -1447,7 +1764,7 @@ }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/UbiqueLambda/yafas/0.1.0.tar.gz" + "url": "https://flakehub.com/f/UbiqueLambda/yafas/0.1.%2A.tar.gz" } } }, diff --git a/modules/apps/default.nix b/modules/apps/default.nix @@ -5,7 +5,7 @@ ... }: let inherit (util.map) modules; - inherit (lib) mkOption types; + inherit (lib) getExe mkOption types; in { imports = modules.list ./.; @@ -18,7 +18,7 @@ in { # AppImage Support config.boot.binfmt.registrations.appimage = { wrapInterpreterInShell = false; - interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + interpreter = getExe pkgs.appimage-run; recognitionType = "magic"; offset = 0; mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; diff --git a/modules/apps/git/default.nix b/modules/apps/git/default.nix @@ -97,12 +97,12 @@ b = "branch"; bc = "${b} --show-current"; bd = "${b} -D"; - backup = '' - !sh -c 'CURRENT=$(git ${bc}) && git ${st} && git ${co} -B backup && git ${st} apply && git ${ad} && git ${cam} "backup" && git ${pf} $1 && git ${co} $CURRENT && git ${stp} && git ${bd} backup' -''; + backup = ''!sh -c 'CURRENT=$(git ${bc}) && git ${st} && git ${co} -B backup && git ${st} apply && git ${ad} && git ${cam} "backup" && git ${pf} $1 && git ${co} $CURRENT && git ${stp} && git ${bd} backup' -''; cfg = "config"; ci = "commit -v"; cam = "${ci} -am"; cia = "${ci} -a"; + cmx = ''!sh -c 'msg=$(cat ./.git/COMMIT_EDITMSG); echo "''${msg%%#*}"' -''; co = "checkout"; cp = "cherry-pick"; cpp = "!sh -c 'CURRENT=$(git ${bc}) && git ${st} && git ${co} -B $2 $3 && git ${cp} $1 && git ${pf} $4 && git ${co} $CURRENT && git ${stp}' -"; diff --git a/modules/base/security.nix b/modules/base/security.nix @@ -1,8 +1,11 @@ { + config, lib, pkgs, ... -}: { +}: let + inherit (lib) hasPrefix mkOverride; +in { ## Security & Hardening Settings ## config = { # Protocols @@ -24,12 +27,11 @@ kernel.sysctl = { # Kernel "kernel.ftrace_enabled" = false; - "kernel.kptr_restrict" = lib.mkOverride 500 2; + "kernel.kptr_restrict" = mkOverride 500 2; "kernel.sysrq" = 0; - "kernel.yama.ptrace_scope" = lib.mkOverride 500 1; + "kernel.yama.ptrace_scope" = mkOverride 500 1; # Network - "net.core.bpf_jit_enable" = false; "net.core.default_qdisc" = "cake"; "net.ipv4.conf.all.accept_redirects" = false; "net.ipv4.conf.all.accept_source_route" = 0; @@ -51,6 +53,10 @@ "net.ipv6.conf.all.accept_redirects" = false; "net.ipv6.conf.all.accept_source_route" = 0; "net.ipv6.conf.default.accept_redirects" = false; + "net.core.bpf_jit_enable" = + if (hasPrefix "cachyos" config.base.kernel) + then true + else false; }; # Secure Modules diff --git a/modules/gui/desktop/hyprland/apps/bar.nix b/modules/gui/desktop/hyprland/apps/bar.nix @@ -21,7 +21,7 @@ in rec { # nix-community/home-manager/4099 services.waybar.Service.ExecStart = lib.mkForce (pkgs.writeShellScript "waybar-wrapper.sh" '' ${files.path.systemd} - ${programs.waybar.package}/bin/waybar + ${lib.getExe programs.waybar.package} ''); # nix-community/home-manager/2064 @@ -280,6 +280,9 @@ in rec { idle_inhibitor = { format = "{icon}"; + on-click = "hyprutils toggle_idle"; + tooltip-format-activated = "Idle Inhibitor: On"; + tooltip-format-deactivated = "Idle Inhibitor: Off"; format-icons = { activated = ""; deactivated = ""; diff --git a/modules/gui/desktop/hyprland/apps/default.nix b/modules/gui/desktop/hyprland/apps/default.nix @@ -7,8 +7,9 @@ ... }: with files; let - inherit (config.gui) wallpaper; inherit (lib) getExe mkIf; + inherit (config.gui) wallpaper; + inherit (config.lib.stylix) colors; exists = app: builtins.elem app config.apps.list; theme = import ../theme.nix pkgs; in { @@ -52,6 +53,7 @@ in { transmission-gtk # Utilities + custom.hyprutils cliphist grim unstable.grimblast @@ -94,6 +96,16 @@ in { video = ["io.github.celluloid_player.Celluloid.desktop"]; }; + # App Environment + dconf.settings."org/gnome/desktop/wm/preferences".button-layout = "appmenu"; + wayland.windowManager.hyprland.settings.env = [ + # Screengrab + "SLURP_ARGS, -dc ${colors.base0D}" + + # QT Apps + "QT_WAYLAND_DISABLE_WINDOWDECORATION, 1" + ]; + # Shortcuts wayland.windowManager.hyprland.settings.bind = [ "$mod SHIFT, slash, exec, pkill -f -1 nwg-wrapper" # Binds List @@ -115,6 +127,8 @@ in { # Autostart wayland.windowManager.hyprland.settings.exec-once = [ + "dbus-update-activation-environment --systemd --all" + # Application Drawer "nwg-drawer -r" @@ -177,48 +191,47 @@ in { # Notifications stylix.targets.dunst.enable = true; - services.dunst = { + services.dunst = let + ignore = { + history_ignore = "yes"; + fullscreen = "show"; + highlight = "#${colors.base07}"; + }; + in { enable = true; iconTheme = theme.icons; - settings = - { - global = { - alignment = "center"; - corner_radius = 10; - follow = "mouse"; - format = "<b>%s</b>\\n%b"; - frame_width = 1; - horizontal_padding = 8; - icon_corner_radius = 10; - icon_position = "left"; - icon_theme = theme.icons.name; - indicate_hidden = "yes"; - markup = "yes"; - max_icon_size = 64; - mouse_left_click = "do_action"; - mouse_middle_click = "close_all"; - mouse_right_click = "close_current"; - offset = "5x5"; - padding = 8; - plain_text = "no"; - progress_bar_corner_radius = 10; - separator_height = 1; - show_indicators = false; - shrink = "no"; - transparency = 10; - word_wrap = "yes"; - }; - } - // (let - ignore = { - history_ignore = "yes"; - fullscreen = "show"; - }; - in { - fullscreen_delay = {fullscreen = "delay";}; - power = {appname = "poweralertd";} // ignore; - utility = {appname = "utility";} // ignore; - }); + settings = { + global = { + alignment = "center"; + corner_radius = 10; + follow = "mouse"; + format = "<b>%s</b>\\n%b"; + frame_width = 1; + horizontal_padding = 8; + icon_corner_radius = 10; + icon_position = "left"; + icon_theme = theme.icons.name; + indicate_hidden = "yes"; + markup = "yes"; + max_icon_size = 64; + mouse_left_click = "do_action"; + mouse_middle_click = "close_all"; + mouse_right_click = "close_current"; + offset = "5x5"; + padding = 8; + plain_text = "no"; + progress_bar_corner_radius = 10; + separator_height = 1; + show_indicators = false; + shrink = "no"; + transparency = 10; + word_wrap = "yes"; + }; + + fullscreen_delay.fullscreen = "delay"; + power = {appname = "poweralertd";} // ignore; + utility = {appname = "utility";} // ignore; + }; }; # Display Temperature @@ -245,7 +258,7 @@ in { # Screen Share xwaylandvideobridge = { - Unit.Description = "Stream Wayland windows to apps running under Xwayland"; + Unit.Description = "Stream Wayland windows to apps running under XWayland"; Install.wantedBy = ["graphical-session.target"]; Service = { ExecStart = getExe pkgs.xwaylandvideobridge; diff --git a/modules/gui/desktop/hyprland/apps/security.nix b/modules/gui/desktop/hyprland/apps/security.nix @@ -5,12 +5,14 @@ files, ... }: let + inherit (lib) concatMapStringsSep getExe; inherit (sys.stylix) fonts; + locker = pkgs.swaylock-effects; in { # Locker programs.swaylock = { enable = true; - package = pkgs.swaylock-effects; + package = locker; settings = { clock = true; indicator = true; @@ -38,7 +40,7 @@ in { } { event = "lock"; - command = "${pkgs.swaylock-effects}/bin/swaylock -f"; + command = "sh -c '${getExe pkgs.custom.hyprutils} toggle_media; ${getExe locker} -f'"; } ]; timeouts = [ @@ -49,10 +51,7 @@ in { runtimeInputs = with pkgs; [pipewire ripgrep systemd]; text = '' pw-cli i all | rg running - if [ $? == 1 ] - then - ${pkgs.systemd}/bin/systemctl suspend - fi + if [ $? == 1 ]; then ${pkgs.systemd}/bin/systemctl suspend; fi ''; }}/bin/suspend"; } @@ -65,7 +64,7 @@ in { style = files.hyprland.wlogout + '' - ${lib.concatMapStringsSep "\n" ( + ${concatMapStringsSep "\n" ( name: '' #${name} { background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/${name}.png")); diff --git a/modules/gui/desktop/hyprland/settings/default.nix b/modules/gui/desktop/hyprland/settings/default.nix @@ -7,7 +7,6 @@ ## Hyprland Settings imports = util.map.modules.list ./.; stylix.targets.hyprland.enable = true; - dconf.settings."org/gnome/desktop/wm/preferences".button-layout = "appmenu"; wayland.windowManager.hyprland = { inherit (sys.programs.hyprland) enable package; @@ -19,8 +18,6 @@ settings = { debug.disable_logs = false; - env = ["QT_WAYLAND_DISABLE_WINDOWDECORATION,1"]; - exec-once = ["dbus-update-activation-environment --systemd --all"]; # Display monitor = ",preferred,auto,1"; diff --git a/modules/gui/desktop/hyprland/settings/keybindings.nix b/modules/gui/desktop/hyprland/settings/keybindings.nix @@ -1,20 +1,7 @@ -{ - sys, - pkgs, - files, - ... -}: let - inherit (sys.lib.stylix.colors) base07 base0D; - utils = "${pkgs.writeShellApplication { - name = "utils"; - text = builtins.replaceStrings ["#ffffff"] ["#${base07}"] files.scripts.utils; - runtimeInputs = with pkgs; [coreutils alsa-utils brillo playerctl libnotify wget]; - }}/bin/utils"; -in { - ## Keybindings +_: { + ## Compositor Keybindings wayland.windowManager.hyprland.settings = { "$mod" = "SUPER"; - env = ["SLURP_ARGS, -dc ${base0D}"]; # Screengrab bind = [ # Compositor Commands @@ -111,23 +98,23 @@ in { # Ignore Locked State bindl = [ # Media Controls - ", XF86AudioPlay, exec, ${utils} play_pause" - ", XF86AudioPrev, exec, ${utils} prev_track" - ", XF86AudioNext, exec, ${utils} next_track" + ", XF86AudioPlay, exec, hyprutils play_pause" + ", XF86AudioPrev, exec, hyprutils prev_track" + ", XF86AudioNext, exec, hyprutils next_track" # Volume - ", XF86AudioMute, exec, ${utils} volume_mute" + ", XF86AudioMute, exec, hyprutils volume_mute" ]; # Repeat on Hold bindle = [ # Volume - ", XF86AudioRaiseVolume, exec, ${utils} volume_up" - ", XF86AudioLowerVolume, exec, ${utils} volume_down" + ", XF86AudioRaiseVolume, exec, hyprutils volume_up" + ", XF86AudioLowerVolume, exec, hyprutils volume_down" # Backlight - ", XF86MonBrightnessUp, exec, ${utils} brightness_up" - ", XF86MonBrightnessDown, exec, ${utils} brightness_down" + ", XF86MonBrightnessUp, exec, hyprutils brightness_up" + ", XF86MonBrightnessDown, exec, hyprutils brightness_down" ]; }; } diff --git a/modules/gui/launcher.nix b/modules/gui/launcher.nix @@ -5,7 +5,7 @@ pkgs, ... }: let - inherit (lib) mkEnableOption mkIf mkOption replaceStrings types; + inherit (lib) getExe mkEnableOption mkIf mkOption replaceStrings types; cfg = config.gui.launcher; in { options.gui.launcher = { @@ -79,7 +79,7 @@ in { ExecStart = pkgs.writeShellScript "ulauncher-wrapper.sh" '' ${files.path.systemd} export GDK_BACKEND=${cfg.server} - exec ${pkgs.ulauncher}/bin/ulauncher --hide-window ${ + exec ${getExe pkgs.ulauncher} --hide-window ${ if cfg.shadow then "" else "--no-window-shadow" diff --git a/modules/shell/bash.nix b/modules/shell/bash.nix @@ -41,7 +41,7 @@ in { initExtra = '' function _update_ps1() { local old_exit_status=$? - eval $(${pkgs.powerline-go}/bin/powerline-go -error $old_exit_status -shell bash -eval -modules "host,cwd,exit,jobs,git" -newline) + eval $(${lib.getExe pkgs.powerline-go} -error $old_exit_status -shell bash -eval -modules "host,cwd,exit,jobs,git" -newline) return $old_exit_status } diff --git a/modules/shell/default.nix b/modules/shell/default.nix @@ -9,7 +9,7 @@ with files; let inherit (util.map) modules; inherit (builtins) listToAttrs map; - inherit (lib) mkEnableOption mkBefore mkIf mkMerge nameValuePair; + inherit (lib) getExe mkEnableOption mkBefore mkIf mkMerge nameValuePair; in { imports = modules.list ./.; @@ -65,7 +65,7 @@ in { programs = listToAttrs (map (shell: nameValuePair shell - {initExtra = mkBefore ''eval $(${pkgs.thefuck}/bin/thefuck --alias "fix")'';}) + {initExtra = mkBefore ''eval $(${getExe pkgs.thefuck} --alias "fix")'';}) (modules.name ./.)) // { hstr.enable = true; # Command History Browser @@ -97,12 +97,11 @@ in { dotfiles = "cd ${path.system}"; # Programs - cat = "bat"; - colors = "${scripts.colors}"; + c = "bat"; + l = "eza -b -h -l -F --octal-permissions --icons --time-style iso"; grep = "grep --color"; + colors = "${scripts.colors}"; edit = "sudo $EDITOR"; - history = "hstr"; - l = "eza -b -h -l -F --octal-permissions --icons --time-style iso"; sike = "neofetch"; }; }; diff --git a/scripts/audio.sh b/scripts/audio.sh @@ -15,7 +15,7 @@ gdbus monitor -y -d org.freedesktop.login1 | grep LockedHint --line-buffered | else PLAY=false fi - playerctl pause + playerctl pause -a ;; *"<false>"*) if $PLAY diff --git a/scripts/hyprutils.nix b/scripts/hyprutils.nix @@ -0,0 +1,174 @@ +{ + lib, + pkgs, + files, + ... +}: let + inherit (lib) licenses recursiveUpdate; +in + recursiveUpdate { + meta = { + mainProgram = "hyprutils"; + description = "Hyprland Utility Script"; + homepage = files.path.repo; + license = licenses.gpl3Only; + maintainers = ["maydayv7"]; + }; + } (pkgs.writeShellApplication { + name = "hyprutils"; + runtimeInputs = with pkgs; [ + coreutils + alsa-utils + brillo + playerctl + libnotify + systemd + wget + ]; + + text = '' + set +eu + show_album_art=true + show_music_in_volume_indicator=true + + notify () { + notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:"$1" "''${@:2}" + } + + brightness_notification() { + brightness=$(brillo | grep -Po '[0-9]{1,3}' | head -n 1) + notify brightness -i "display" -h int:value:"$brightness" " $brightness%" + } + + get_media_icon() { + media_icon="audio-speakers" + if $show_album_art + then + url=$(playerctl -f "{{mpris:artUrl}}" metadata) + if [[ "$url" == "file://"* ]] + then + media_icon="''${url/file:\/\//}" + elif [[ "$url" == "http://"* ]] || [[ "$url" == "https://"* ]] + then + filename="$(echo "$url" | sed "s/.*\///")" + if [ ! -f "/tmp/$filename" ]; then wget -O "/tmp/$filename" "$url"; fi + media_icon="/tmp/$filename" + fi + fi + } + + volume_notification() { + volume=$(amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1) + mute=$(amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off | head -n1) + if [ "$volume" -eq 0 ] || [ "$mute" == "[off]" ] + then + volume_icon="" + else + volume_icon="" + fi + + song_title=$(playerctl -f "{{title}}" metadata) + get_media_icon + if $show_music_in_volume_indicator && [ -n "$song_title" ] + then + song_artist=$(playerctl -f "{{artist}}" metadata) + if [ -z "$song_artist" ] + then + notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" "$song_title" + else + notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" "$song_title\nBy $song_artist" + fi + else + notify volume -h int:value:"$volume" -i "$media_icon" "$volume_icon $volume%" + fi + } + + music_notification() { + song_title=$(playerctl -f "{{title}}" metadata) + song_artist=$(playerctl -f "{{artist}}" metadata) + song_album=$(playerctl -f "{{album}}" metadata) + get_media_icon + if [ -z "$song_album" ] + then + if [ -z "$song_artist" ] + then + notify music -i "$media_icon" "$song_title" + else + notify music -i "$media_icon" "$song_title" "By $song_artist" + fi + else + notify music -i "$media_icon" "$song_title" "By $song_artist from $song_album" + fi + } + + case "$1" in + volume_up) + amixer set Master on + amixer sset Master 5%+ + volume_notification + ;; + + volume_down) + amixer set Master on + amixer sset Master 5%- + volume_notification + ;; + + volume_mute) + amixer set Master 1+ toggle + volume_notification + ;; + + brightness_up) + brillo -u 300000 -A 5 + brightness_notification + ;; + + brightness_down) + brillo -u 300000 -U 5 + brightness_notification + ;; + + next_track) + playerctl next + sleep 0.5 && music_notification + ;; + + prev_track) + playerctl previous + sleep 0.5 && music_notification + ;; + + play_pause) + playerctl play-pause + music_notification + ;; + + toggle_media) + FILE="/tmp/playerctl_status" + if test -f "$FILE" + then + rm "$FILE" + playerctl play + exit 0 + fi + if playerctl status | grep Playing + then + touch "$FILE" + playerctl pause -a + fi + ;; + + toggle_idle) + if systemctl --user is-active swayidle + then + systemctl --user stop swayidle + notify idle -i "system-lock-screen" "Stopped Idle Daemon" + else + systemctl --user restart swayidle + notify idle -i "system-lock-screen" "Started Idle Daemon" + fi + ;; + esac + ''; + }) diff --git a/scripts/install.nix b/scripts/install.nix @@ -83,9 +83,10 @@ with files.path; let in recursiveUpdate { meta = { + mainProgram = "os-install"; description = "System Install Script"; homepage = repo; - license = licenses.mit; + license = licenses.gpl3Only; maintainers = ["maydayv7"]; }; } (pkgs.writeShellApplication { diff --git a/scripts/nixos.nix b/scripts/nixos.nix @@ -77,9 +77,10 @@ with files; let in recursiveUpdate { meta = { + mainProgram = "nixos"; description = "System Management Script"; homepage = files.path.repo; - license = licenses.mit; + license = licenses.gpl3Only; maintainers = ["maydayv7"]; }; } (pkgs.writeShellApplication { diff --git a/scripts/utils.sh b/scripts/utils.sh @@ -1,116 +0,0 @@ -#! /usr/bin/env nix -#! nix shell nixpkgs#bash nixpkgs#coreutils nixpkgs#alsa-utils nixpkgs#brillo nixpkgs#playerctl nixpkgs#libnotify nixpkgs#wget -c bash - -# Utility Script to control Volume, Brightness, Media # - -set +eu -show_album_art=true -show_music_in_volume_indicator=true - -function brightness_notification { - brightness=$(brillo | grep -Po '[0-9]{1,3}' | head -n 1) - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:brightness -h int:value:"$brightness" " $brightness%" -h string:hlcolor:#ffffff -} - -function get_album_art { - url=$(playerctl -f "{{mpris:artUrl}}" metadata) - if [[ "$url" == "file://"* ]] - then - album_art="${url/file:\/\//}" - elif [[ "$url" == "http://"* ]] || [[ "$url" == "https://"* ]] - then - filename="$(echo "$url" | sed "s/.*\///")" - if [ ! -f "/tmp/$filename" ]; then wget -O "/tmp/$filename" "$url"; fi - album_art="/tmp/$filename" - else - album_art="" - fi -} - -function volume_notification { - volume=$(amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1) - mute=$(amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off | head -n1) - if [ "$volume" -eq 0 ] || [ "$mute" == "[off]" ] - then - volume_icon="" - else - volume_icon="" - fi - - song_title=$(playerctl -f "{{title}}" metadata) - if $show_music_in_volume_indicator && [ -n "$song_title" ] - then - song_artist=$(playerctl -f "{{artist}}" metadata) - if $show_album_art; then get_album_art; fi - if [ -z "$song_artist" ] - then - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:volume -h int:value:"$volume" -i "$album_art" "$volume_icon $volume%" "$song_title" -h string:hlcolor:#ffffff - else - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:volume -h int:value:"$volume" -i "$album_art" "$volume_icon $volume%" "$song_title\nBy $song_artist" -h string:hlcolor:#ffffff - fi - else - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:volume -h int:value:"$volume" "$volume_icon $volume%" -h string:hlcolor:#ffffff - fi -} - -function music_notification { - song_title=$(playerctl -f "{{title}}" metadata) - song_artist=$(playerctl -f "{{artist}}" metadata) - if $show_album_art; then get_album_art; fi - song_album=$(playerctl -f "{{album}}" metadata) - if [ -z "$song_album" ] - then - if [ -z "$song_artist" ] - then - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:music -i "$album_art" "$song_title" - else - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:music -i "$album_art" "$song_title" "By $song_artist" - fi - else - notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:music -i "$album_art" "$song_title" "By $song_artist from $song_album" - fi -} - -case "$1" in - volume_up) - amixer set Master on - amixer sset Master 5%+ - volume_notification - ;; - - volume_down) - amixer set Master on - amixer sset Master 5%- - volume_notification - ;; - - volume_mute) - amixer set Master 1+ toggle - volume_notification - ;; - - brightness_up) - brillo -u 300000 -A 5 - brightness_notification - ;; - - brightness_down) - brillo -u 300000 -U 5 - brightness_notification - ;; - - next_track) - playerctl next - sleep 0.5 && music_notification - ;; - - prev_track) - playerctl previous - sleep 0.5 && music_notification - ;; - - play_pause) - playerctl play-pause - music_notification - ;; -esac