diff --git a/flake.lock b/flake.lock index 211d185..48ee087 100644 --- a/flake.lock +++ b/flake.lock @@ -1,25 +1,23 @@ { "nodes": { - "beautysh": { + "devshell": { "inputs": { "nixpkgs": [ "nixvim", "nixpkgs" - ], - "poetry2nix": "poetry2nix", - "utils": "utils" + ] }, "locked": { - "lastModified": 1680308980, - "narHash": "sha256-aUEHV0jk2qIFP3jlsWYWhBbm+w/N9gzH3e4I5DcdB5s=", - "owner": "lovesegfault", - "repo": "beautysh", - "rev": "9845efc3ea3e86cc0d41465d720a47f521b2799c", + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "owner": "numtide", + "repo": "devshell", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", "type": "github" }, "original": { - "owner": "lovesegfault", - "repo": "beautysh", + "owner": "numtide", + "repo": "devshell", "type": "github" } }, @@ -40,13 +38,27 @@ } }, "flake-compat_2": { + "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/1.tar.gz" + } + }, + "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -55,6 +67,27 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems_2" @@ -77,42 +110,6 @@ "inputs": { "systems": "systems_3" }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "inputs": { - "systems": "systems_4" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_5" - }, "locked": { "lastModified": 1681202837, "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", @@ -127,20 +124,47 @@ "type": "github" } }, - "gitignore": { + "git-hooks": { "inputs": { + "flake-compat": "flake-compat_3", + "gitignore": "gitignore", "nixpkgs": [ "nixvim", - "pre-commit-hooks", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1724440431, + "narHash": "sha256-9etXEOUtzeMgqg1u0wp+EdwG7RpmrAZ2yX516bMj2aE=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "c8a54057aae480c56e28ef3e14e4960628ac495b", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -156,16 +180,38 @@ ] }, "locked": { - "lastModified": 1712386041, - "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", + "lastModified": 1720042825, + "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "owner": "nix-community", "repo": "home-manager", - "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", + "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.11", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720042825, + "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", "repo": "home-manager", "type": "github" } @@ -273,6 +319,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724469941, + "narHash": "sha256-+U5152FwmDD9EUOiFi5CFxCK6/yFESyDei9jEIlmUtI=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "ea319a737939094b48fda9063fa3201ef2479aac", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixos-wsl": { "inputs": { "flake-compat": "flake-compat", @@ -311,111 +378,63 @@ "type": "github" } }, - "nixpkgs-stable": { + "nixpkgs-unstable": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", - "owner": "NixOS", + "lastModified": 1724224976, + "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-23.05", + "owner": "nixos", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1712588820, - "narHash": "sha256-y31s5idk3jMJMAVE4Ud9AdI7HT3CgTAeMTJ0StqKN7Y=", + "lastModified": 1724316499, + "narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d272ca50d1f7424fbfcd1e6f1c9e01d92f6da167", + "rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixvim": { "inputs": { - "beautysh": "beautysh", - "flake-utils": "flake-utils_2", - "nixpkgs": [ - "nixpkgs" - ], - "pre-commit-hooks": "pre-commit-hooks" - }, - "locked": { - "lastModified": 1704297403, - "narHash": "sha256-g7+4SiXDGzIlWIfANyH1J5CeEaY+Alah6KOm6IO4nIk=", - "owner": "nix-community", - "repo": "nixvim", - "rev": "b3ea5256e07ee9105060cffa075028402946bd63", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "nixos-23.11", - "repo": "nixvim", - "type": "github" - } - }, - "poetry2nix": { - "inputs": { - "flake-utils": [ - "nixvim", - "beautysh", - "utils" - ], - "nixpkgs": [ - "nixvim", - "beautysh", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1658665240, - "narHash": "sha256-/wkx7D7enyBPRjIkK0w7QxLQhzEkb3UxNQnjyc3FTUI=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "8b8edc85d24661d5a6d0d71d6a7011f3e699780f", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { + "devshell": "devshell", "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_3", - "gitignore": "gitignore", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", "nixpkgs": [ - "nixvim", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable" + "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1703939133, - "narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38", + "lastModified": 1724502615, + "narHash": "sha256-g206hhNghyxMO9Sdv9fD22MRgWQppws10x+oDHKDVdU=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "764b89aa14543da7266719757cfcf0cce8c1679f", "type": "github" }, "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", + "owner": "nix-community", + "ref": "nixos-24.05", + "repo": "nixvim", "type": "github" } }, @@ -425,6 +444,7 @@ "hyprland": "hyprland", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_2", + "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim", "vscode-server": "vscode-server" } @@ -474,54 +494,30 @@ "type": "github" } }, - "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_5": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "utils": { - "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1724338379, + "narHash": "sha256-kKJtaiU5Ou+e/0Qs7SICXF22DLx4V/WhG1P6+k4yeOE=", "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "repo": "treefmt-nix", + "rev": "070f834771efa715f3e74cd8ab93ecc96fabc951", "type": "github" }, "original": { "owner": "numtide", - "repo": "flake-utils", + "repo": "treefmt-nix", "type": "github" } }, "vscode-server": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ] diff --git a/flake.nix b/flake.nix index 9ad88b5..2ad3c46 100644 --- a/flake.nix +++ b/flake.nix @@ -2,10 +2,10 @@ description = "Your new nix config"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; - + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager/release-23.11"; + url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -20,16 +20,17 @@ }; nixvim = { - url = "github:nix-community/nixvim/nixos-23.11"; + url = "github:nix-community/nixvim/nixos-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; - hyprland.url = "github:hyprwm/Hyprland"; + hyprland.url = "github:hyprwm/Hyprland"; }; outputs = { self, nixpkgs, + nixpkgs-unstable, home-manager, nixos-wsl, vscode-server, diff --git a/home-manager/modules/eww/config/eww.scss b/home-manager/modules/eww/config/eww.scss new file mode 100644 index 0000000..284b520 --- /dev/null +++ b/home-manager/modules/eww/config/eww.scss @@ -0,0 +1,112 @@ +$anim: .2s cubic-bezier(0.4, 0.0, 0.2, 1); +$anim-slow: .4s cubic-bezier(0.4, 0.0, 0.2, 1); + +$background: #1C1C1C; +$background-alt: #2b2b2b; +$foreground: #C5C5C5; +$accent: #CF6A4C; + + +* { + all: unset; //Unsets everything so you can style everything from scratch + font-family: Hack Nerd Regular; + color: $foreground; + font-size: 16px +} + +.bar { + background-color: $background; + border-bottom: 2px solid $accent; + padding: 0 12px; +} + +.workspace-entry { + border: 2px solid $foreground; + border-radius: 50%; + min-width: 10px; + min-height: 10px; + margin: 5px 5px; + transition: background-color $anim, opacity $anim, border $anim; + opacity: .2; + + &.has-windows { + opacity: 1; + } + + &.active { + opacity: 1; + background-color: $foreground; + border-color: $foreground + } +} + +.datetime { + .time { + font-weight: bold; + margin-right: 15px; + } +} + +.side-bar { + padding: 0 5px; + opacity: .4; + background-color: transparent; + transition: background-color $anim-slow, opacity $anim-slow, border $anim-slow; + border-bottom: 2px solid transparent; + + &.active { + opacity: 1; + background-color: $background; + border-bottom: 2px solid $accent; + } + + .workspace-entry { + margin: 5px 2px; + } + + &.left-bar { + &.active { + border-left: 2px solid $accent; + } + border-left: 2px solid transparent; + border-bottom-left-radius: 12px; + } + + &.right-bar { + &.active { + border-right: 2px solid $accent; + } + border-right: 2px solid transparent; + border-bottom-right-radius: 12px; + } +} + +.scale { + trough { + background-color: $background-alt; + border-radius: 10px; + min-height: 5px; + min-width: 80px; + + highlight { + background-color: $accent; + border-radius: 10px; + } + } +} + +.music { + .music-control { + font-size: 10px; + } + .music-timer { + font-size: 12px; + } + .scale { + margin: 0 10px; + } + padding: 0 15px; + margin: 0 15px; + border-right: 2px solid #CF6A4C; + border-left: 2px solid #CF6A4C; +} diff --git a/home-manager/modules/eww/config/eww.yuck b/home-manager/modules/eww/config/eww.yuck new file mode 100644 index 0000000..0fe841d --- /dev/null +++ b/home-manager/modules/eww/config/eww.yuck @@ -0,0 +1,98 @@ +; WINDOWS + +(defwindow primary + :monitor 0 + :stacking "fg" + :exclusive true + :geometry (geometry :x "0%" + :y "0%" + :width "100%" + :height "20px" + :anchor "top center") + (primary_bar)) + +(defwindow left + :monitor 1 + :stacking "fg" + :exclusive false + :geometry (geometry :x "0%" + :y "0%" + :width "100%" + :height "20px" + :anchor "top center") + (left_bar)) + +(defwindow right + :monitor 2 + :stacking "fg" + :exclusive false + :geometry (geometry :x "0%" + :y "0%" + :width "100%" + :height "20px" + :anchor "top center") + (right_bar)) + +; VARIABLES + +(defpoll battery :interval "1s" "scripts/battery-level") +(deflisten workspaces :initial "{}" "bash ~/.config/eww/scripts/get-workspaces") +(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace") +(deflisten current_monitor :initial "DP-1" "bash ~/.config/eww/scripts/get-active-monitor") +(deflisten window :initial "..." "sh ~/.config/eww/scripts/get-window-title") +(deflisten volume :initial "{}" "sh ~/.config/eww/scripts/volume") +(defpoll time :interval "10s" "date '+%H:%M'") +(defpoll date :interval "10s" "date '+%Y-%m-%d'") + +; BARS + +(defwidget primary_bar [] + (box :class "bar primary-bar ${current_monitor == 'DP-1' ? 'active' : ''}" + (box :class "primary-left" :space-evenly false :halign "start" + (datetime) + (workspaces :ids "[\"1\",\"2\",\"3\",\"4\",\"5\"]")) + (label :halign "center" :text "${window}") + (controls :halign "end"))) + +(defwidget left_bar [] + (box :class "bar side-bar left-bar ${current_monitor == 'HDMI-A-1' ? 'active' : ''}" :halign "end" + (workspaces :ids "[\"6\",\"7\"]"))) + +(defwidget right_bar [] + (box :class "bar side-bar right-bar ${current_monitor == 'DP-3' ? 'active' : ''}" :halign "start" + (workspaces :ids "[\"8\",\"9\"]"))) + +; WIDGETS + +(defwidget workspaces [ids] + (box :space-evenly false :spacing 10 :class "workspaces" + (for id in ids + (eventbox :onclick "hyprctl dispatch workspace ${id}" + (box :class "workspace-entry ${current_workspace == id ? 'active' : 'inactive'} ${(workspaces?.[id]?.windows?:0) >= 1 ? 'has-windows' : 'no-windows'}"))))) + +(defwidget datetime [] + (box :space-evenly false :class "datetime" :spacing 10 + (label :class "date" :text "${date}") + (label :class "time" :text "${time}"))) + +(defwidget controls [] + (box :space-evenly false :class "controls" :halign "end" + (metric :icon {volume?.["icon"]?:""} + :value {volume?.["audio"] != "1" ? 0 : volume?.["percent"]} + :onchange "~/.config/eww/scripts/volume setvol SINK {}" + :onclick "~/.config/eww/scripts/volume mute SINK"))) + +(defwidget metric [value ?icon ?onchange ?onclick] + (box :space-evenly false :class "metric" :spacing 10 :halign "end" :visible {(value?:-1) != -1} + (scale :class "scale" + :min 0 + :max 101 + :flipped true + :orientation 'h' + :active {(onchange?:"") != ""} + :onchange {onchange} + :value {value?:0}) + (eventbox :active {(onclick?:"") != ""} :onclick {onclick} + (box + (label :width 1 :visible {icon != ""} :class "icon" :text {icon}) + (label :width 35 :class "label" :text "${value}%"))))) diff --git a/home-manager/modules/eww/config/scripts/battery-level b/home-manager/modules/eww/config/scripts/battery-level new file mode 100644 index 0000000..fb9a53d --- /dev/null +++ b/home-manager/modules/eww/config/scripts/battery-level @@ -0,0 +1,2 @@ +#!/bin/sh +cat /sys/class/power_supply/BAT0/capacity \ No newline at end of file diff --git a/home-manager/modules/eww/config/scripts/battery-status b/home-manager/modules/eww/config/scripts/battery-status new file mode 100644 index 0000000..3d51bbd --- /dev/null +++ b/home-manager/modules/eww/config/scripts/battery-status @@ -0,0 +1,2 @@ +#!/bin/sh +cat /sys/class/power_supply/BAT0/status \ No newline at end of file diff --git a/home-manager/modules/eww/config/scripts/change-active-workspace b/home-manager/modules/eww/config/scripts/change-active-workspace new file mode 100755 index 0000000..ad6470f --- /dev/null +++ b/home-manager/modules/eww/config/scripts/change-active-workspace @@ -0,0 +1,21 @@ +#! /bin/bash +function clamp { + min=$1 + max=$2 + val=$3 + python -c "print(max($min, min($val, $max)))" +} + +direction=$1 +current=$2 +if test "$direction" = "down" +then + target=$(clamp 1 10 $(($current+1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +elif test "$direction" = "up" +then + target=$(clamp 1 10 $(($current-1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +fi \ No newline at end of file diff --git a/home-manager/modules/eww/config/scripts/get-active-monitor b/home-manager/modules/eww/config/scripts/get-active-monitor new file mode 100755 index 0000000..1fc8034 --- /dev/null +++ b/home-manager/modules/eww/config/scripts/get-active-monitor @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +hyprctl monitors -j | jq '.[] | select(.focused) | .name' + +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | + stdbuf -o0 awk -F '>>|,' -e '/^focusedmon>>/ {print $2}' \ No newline at end of file diff --git a/home-manager/modules/eww/config/scripts/get-active-workspace b/home-manager/modules/eww/config/scripts/get-active-workspace new file mode 100755 index 0000000..0ebac7b --- /dev/null +++ b/home-manager/modules/eww/config/scripts/get-active-workspace @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' + +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | + stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}' \ No newline at end of file diff --git a/home-manager/modules/eww/config/scripts/get-window-title b/home-manager/modules/eww/config/scripts/get-window-title new file mode 100755 index 0000000..cb08116 --- /dev/null +++ b/home-manager/modules/eww/config/scripts/get-window-title @@ -0,0 +1,3 @@ +#!/bin/sh +hyprctl activewindow -j | jq --raw-output .title | sed 's/\(.\{120\}\).*/\1.../' +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}' | sed 's/\(.\{120\}\).*/\1.../' diff --git a/home-manager/modules/eww/config/scripts/get-workspaces b/home-manager/modules/eww/config/scripts/get-workspaces new file mode 100755 index 0000000..fcc34e2 --- /dev/null +++ b/home-manager/modules/eww/config/scripts/get-workspaces @@ -0,0 +1,10 @@ +#!/bin/bash + +spaces (){ + hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .}) | from_entries' -Mc +} + +spaces +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + spaces +done \ No newline at end of file diff --git a/home-manager/modules/eww/config/scripts/volume b/home-manager/modules/eww/config/scripts/volume new file mode 100755 index 0000000..cf77a02 --- /dev/null +++ b/home-manager/modules/eww/config/scripts/volume @@ -0,0 +1,95 @@ +#!/usr/bin/env bash + +# FROM HERE: https://github.com/end-4/dots-hyprland/blob/6c09531bc2d168e79b2a76f0174b297a3b66b9b0/.config/eww/scripts/volume + +cd ~/.config/eww + +volicons=("" "󰖀" "󰕾") +XDG_CACHE_HOME="$HOME/.cache" +lock=0 + +vol() { + wpctl get-volume @DEFAULT_AUDIO_$1@ | awk '{print int($2*100)}' +} +ismuted() { + wpctl get-volume @DEFAULT_AUDIO_"$1"@ | rg -i muted + echo $? +} +setvol() { + wpctl set-volume @DEFAULT_AUDIO_"$1"@ "$(awk -v n="$2" 'BEGIN{print (n / 100)}')" +} +setmute() { + wpctl set-mute @DEFAULT_AUDIO_"$1"@ toggle +} + +if [ "$1" = "--once" ]; then + lvl=$(awk -v n="$(vol "SINK")" 'BEGIN{print int(n/34)}') + ismuted=$(ismuted "SINK") + + if [ "$ismuted" = 1 ]; then + icon="${volicons[$lvl]}" + else + icon="󰝟" + fi + audio=1 + if [ "$(wpctl status | grep 'MUTED')" == "" ]; then + audio=1 + else + audio=0 + fi + + echo '{"icon":"'"$icon"'","audio":"'"$audio"'","percent":"'"$(vol "SINK")"'","microphone":"'"$(vol "SOURCE")"'"}' + exit 0 +fi + +if [ "$1" = "mute" ]; then + if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then + echo "Can only mute SINK or SOURCE"; exit 1 + fi + setmute "$2" +elif [ "$1" = "setvol" ]; then + if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then + echo "Can only set volume for SINK or SOURCE"; exit 1 + elif [ "$3" -lt 1 ] || [ "$3" -gt 100 ]; then + echo "Volume must be between 1 and 100"; exit 1 + fi + setvol "$2" "$3" +else + # initial values + lvl=$(awk -v n="$(vol "SINK")" 'BEGIN{print int(n/34)}') + ismuted=$(ismuted "SINK") + + if [ "$ismuted" = 1 ]; then + icon="${volicons[$lvl]}" + else + icon="󰝟" + fi + audio=1 + if [ "$(wpctl status | grep 'MUTED')" == "" ]; then + audio=1 + else + audio=0 + fi + + echo '{"icon":"'"$icon"'","audio":"'"$audio"'","percent":"'"$(vol "SINK")"'","microphone":"'"$(vol "SOURCE")"'"}' + + # event loop + pactl subscribe | rg --line-buffered "on sink" | while read -r _; do + lvl=$(awk -v n="$(vol "SINK")" 'BEGIN{print int(n/34)}') + ismuted=$(ismuted "SINK") + + if [ "$ismuted" = 1 ]; then + icon="${volicons[$lvl]}" + else + icon="󰝟" + fi + audio=1 + if [ "$(wpctl status | grep 'MUTED')" == "" ]; then + audio=1 + else + audio=0 + fi + + echo '{"icon":"'"$icon"'","audio":"'"$audio"'","percent":"'"$(vol "SINK")"'","microphone":"'"$(vol "SOURCE")"'"}' + done +fi \ No newline at end of file diff --git a/home-manager/modules/eww/default.nix b/home-manager/modules/eww/default.nix new file mode 100644 index 0000000..4b9a381 --- /dev/null +++ b/home-manager/modules/eww/default.nix @@ -0,0 +1,15 @@ +{ + pkgs, + config, + ... +}: { + home.file."${config.xdg.configHome}/eww" = { + source = ./config; + recursive = true; + }; + + home.packages = with pkgs; [ + socat + eww + ]; +} \ No newline at end of file diff --git a/home-manager/modules/nixvim/default.nix b/home-manager/modules/nixvim/default.nix index f6015e2..9ac9288 100644 --- a/home-manager/modules/nixvim/default.nix +++ b/home-manager/modules/nixvim/default.nix @@ -11,7 +11,7 @@ programs.nixvim = { enable = true; - options = { + opts = { number = true; relativenumber = false; tabstop = 4; @@ -75,20 +75,15 @@ lsp = { enable = true; - servers.nil_ls.enable = true; + servers.nil-ls.enable = true; }; lspkind = { enable = true; }; - nvim-cmp = { + cmp = { enable = true; - sources = [{ name = "nvim_lsp"; }]; - mappingPresets = [ "insert" ]; - mapping = { - "" = "cmp.mapping.confirm({ select = true })"; - }; }; }; }; diff --git a/machines/legion/configuration.nix b/machines/legion/configuration.nix index bdc7724..8b22832 100644 --- a/machines/legion/configuration.nix +++ b/machines/legion/configuration.nix @@ -8,6 +8,7 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./nvidia.nix ]; # Bootloader. @@ -17,11 +18,19 @@ environment.sessionVariables = { WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; }; programs.hyprland.enable = true; - programs.hyprland.package = inputs.hyprland.packages.${pkgs.system}.hyprland; programs.hyprland.xwayland.enable = true; + + services.automatic-timezoned.enable = true; + + virtualisation.docker.enable = true; + + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "Hack" ]; }) + ]; home-manager.users.${username}.imports = [ ./home-manager.nix @@ -31,15 +40,13 @@ pkgs.gtk3 ]; - hardware.opengl = { - enable = true; - driSupport = true; - }; - networking.wireless.enable = true; networking.wireless.networks = { Brother = { psk = "fireproof"; }; + "Drakenvej12-5G-1" = { + psk = "Eg9928nt."; + }; }; } diff --git a/machines/legion/home-manager.nix b/machines/legion/home-manager.nix index 8099561..ec60800 100644 --- a/machines/legion/home-manager.nix +++ b/machines/legion/home-manager.nix @@ -1,29 +1,61 @@ { pkgs, + config, ... }: { + + nixpkgs.config.permittedInsecurePackages = [ + "electron-25.9.0" # Obsidian + ]; + home.packages = with pkgs; [ + kitty + wofi + xfce.thunar + xterm + firefox + obsidian + + # Dev nodejs_20 - kitty - alacritty - wofi - vscode - xfce.thunar - xterm - foot - firefox + supabase-cli + vscode + jetbrains.pycharm-professional + jetbrains.rust-rover + sublime-merge ]; programs.kitty = { enable = true; }; + + programs.vscode = { + enable = true; + enableUpdateCheck = true; + enableExtensionUpdateCheck = true; + extensions = with pkgs.vscode-extensions; [ + github.copilot + ms-python.python + ms-vscode-remote.remote-ssh + # ms-vscode-remote.remote-ssh-edit + ]; + userSettings = { + "window.titleBarStyle" = "custom"; + "remote.SSH.useLocalServer" = false; + "github.copilot.enable" = { + "*" = true; + }; + }; + }; + wayland.windowManager.hyprland = { enable = true; package = pkgs.hyprland; systemd.enable = true; settings = { "monitor" = ",preferred,auto,1"; + "exec-once" = "eww daemon & eww open primary"; - workspace = [ + workspace = [ "1, monitor:eDP-1, default:true" "2, monitor:eDP-1" "3, monitor:eDP-1" @@ -39,7 +71,7 @@ follow_mouse = "2"; # Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window. touchpad = { - natural_scroll = "no"; + natural_scroll = true; }; sensitivity = "0"; # -1.0 - 1.0, 0 means no modification. @@ -50,11 +82,22 @@ gaps_in = 5; gaps_out = 10; border_size = 2; - #col.active_border = "rgb(cf6a4c)"; - no_cursor_warps = true; + "col.inactive_border" = "rgb(2f2f2f)"; + "col.active_border" = "rgb(cf6a4c)"; layout = "dwindle"; }; + cursor = { + no_warps = true; + }; + + dwindle = { + pseudotile = true; + preserve_split = true; + force_split = 2; + use_active_for_splits = true; + }; + misc = { focus_on_activate = true; }; @@ -71,13 +114,18 @@ bind = [ "$mod, RETURN, exec, kitty" "$mod, BACKSPACE, killactive" - "$mod, SPACE, exec, wofi" + "$mod, SPACE, exec, wofi --show drun" "$mod, q, workspace, 1" "$mod, w, workspace, 2" "$mod, e, workspace, 3" "$mod, r, workspace, 4" "$mod, t, workspace, 5" + "SUPER_SHIFT, q, movetoworkspace, 1" + "SUPER_SHIFT, w, movetoworkspace, 2" + "SUPER_SHIFT, e, movetoworkspace, 3" + "SUPER_SHIFT, r, movetoworkspace, 4" + "SUPER_SHIFT, t, movetoworkspace, 5" "$mod, left, movefocus, l" "$mod, right, movefocus, r" diff --git a/machines/legion/nvidia.nix b/machines/legion/nvidia.nix new file mode 100644 index 0000000..3962519 --- /dev/null +++ b/machines/legion/nvidia.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: +{ + + # Enable OpenGL + hardware.opengl = { + enable = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; + + boot = { + blacklistedKernelModules = lib.mkDefault [ "nouveau" ]; + kernelParams = [ "nvidia-drm.fbdev=1" ]; + kernelModules = [ "kvm-intel" "nvidia" "i915" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ]; + }; + + hardware.nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.stable; + nvidiaSettings = true; + modesetting.enable = true; + }; +} \ No newline at end of file diff --git a/nixos/configuration.nix b/nixos/configuration.nix index ba940c5..6186840 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -21,14 +21,15 @@ nix.settings = { experimental-features = "nix-command flakes"; auto-optimise-store = true; - substituters = ["https://hyprland.cachix.org"]; - trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; }; home-manager = { extraSpecialArgs = { inherit inputs outputs username hostname; }; users.${username}.imports = [ ../home-manager/default.nix + ../home-manager/modules/eww/default.nix ]; }; @@ -45,7 +46,7 @@ ${username} = { initialPassword = "fireproof"; isNormalUser = true; - extraGroups = ["wheel"]; + extraGroups = ["wheel" "docker"]; }; };