From 4477d0d4a2ead8c050520ac3d78ddfee0d623494 Mon Sep 17 00:00:00 2001 From: atagen Date: Thu, 28 Sep 2023 13:15:38 +1000 Subject: [PATCH] modularise home conf --- flake.lock | 94 ++++- flake.nix | 9 +- flakes/kile/flake.nix | 77 ++-- flakes/qtile/flake.nix | 150 +++---- flakes/qtile/pywlroots/flake.nix | 97 +++-- home/dots/qtile/config.py | 43 +- home/dots/qtile/flake.nix | 49 ++- home/home.nix | 664 +------------------------------ home/programs/firefox.nix | 25 ++ home/programs/fuzzel.nix | 38 ++ home/programs/helix.nix | 190 +++++++++ home/programs/ironbar.nix | 77 ++++ home/programs/kitty.nix | 42 ++ home/programs/qtile.nix | 51 +++ home/programs/sway.nix | 157 ++++++++ home/programs/swaync.nix | 50 +++ home/programs/wlogout.nix | 38 ++ home/programs/zsh.nix | 72 ++++ home/util/ez.nix | 51 +++ overlay.nix | 1 - result | 1 + system/configuration.nix | 14 +- system/quiver.nix | 17 +- 23 files changed, 1152 insertions(+), 855 deletions(-) create mode 100644 home/programs/firefox.nix create mode 100644 home/programs/fuzzel.nix create mode 100644 home/programs/helix.nix create mode 100644 home/programs/ironbar.nix create mode 100644 home/programs/kitty.nix create mode 100644 home/programs/qtile.nix create mode 100644 home/programs/sway.nix create mode 100644 home/programs/swaync.nix create mode 100644 home/programs/wlogout.nix create mode 100644 home/programs/zsh.nix create mode 100644 home/util/ez.nix create mode 120000 result diff --git a/flake.lock b/flake.lock index 845ce51..7b94b6e 100644 --- a/flake.lock +++ b/flake.lock @@ -155,7 +155,7 @@ "all-cabal-json": "all-cabal-json", "crane": "crane_3", "devshell": "devshell_2", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "flake-utils-pre-commit": "flake-utils-pre-commit", "ghc-utils": "ghc-utils", "gomod2nix": "gomod2nix", @@ -294,6 +294,24 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "persway", @@ -315,9 +333,9 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" + "nixpkgs-lib": "nixpkgs-lib_3" }, "locked": { "lastModified": 1693611461, @@ -333,9 +351,9 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_4": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_3" + "nixpkgs-lib": "nixpkgs-lib_4" }, "locked": { "lastModified": 1693611461, @@ -713,6 +731,25 @@ "type": "github" } }, + "nixd": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1695137077, + "narHash": "sha256-wJ8EpYjsqrR4GFAF67wJKmZd4q86KuODWAag4acQL5Q=", + "owner": "nix-community", + "repo": "nixd", + "rev": "e8f144ca50fe71e74d247e5308ae7ce122f0a0e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixd", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1693355128, @@ -743,6 +780,24 @@ } }, "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_3": { "locked": { "dir": "lib", "lastModified": 1693471703, @@ -760,7 +815,7 @@ "type": "github" } }, - "nixpkgs-lib_3": { + "nixpkgs-lib_4": { "locked": { "dir": "lib", "lastModified": 1693471703, @@ -827,6 +882,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1686398752, + "narHash": "sha256-nGWNQVhSw4VSL+S0D0cbrNR9vs9Bq7rlYR+1K5f5j6w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a30520bf8eabf8a5c37889d661e67a2dbcaa59e6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1695360818, "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", @@ -842,7 +913,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1695644571, "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=", @@ -987,8 +1058,8 @@ }, "pywlroots": { "inputs": { - "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs_4", + "flake-parts": "flake-parts_4", + "nixpkgs": "nixpkgs_5", "pywlroots-src": "pywlroots-src" }, "locked": { @@ -1020,7 +1091,7 @@ }, "qtile": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "nixpkgs": [ "nixpkgs" ], @@ -1063,7 +1134,8 @@ "nix-index-database": "nix-index-database", "nix-rice": "nix-rice", "nix-std": "nix-std", - "nixpkgs": "nixpkgs_3", + "nixd": "nixd", + "nixpkgs": "nixpkgs_4", "nixpkgs-stable": "nixpkgs-stable_2", "nur": "nur", "persway": "persway", diff --git a/flake.nix b/flake.nix index 305f026..ec5749a 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,9 @@ flake-utils.url = "github:numtide/flake-utils"; + # TODO get rid of fu for fp + # flake-parts.url = "github:hercules-ci/flake-parts"; + helix = { url = "github:helix-editor/helix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -46,11 +49,12 @@ nix-rice.url = "github:bertof/nix-rice"; + nixd.url = "github:nix-community/nixd"; + qtile = { - url = "path:flakes/qtile"; + url = "path:flakes/qtile"; inputs.nixpkgs.follows = "nixpkgs"; }; - }; outputs = { @@ -63,6 +67,7 @@ persway, helix, qtile, + nixd, nix-index-database, nix-rice, nix-std, diff --git a/flakes/kile/flake.nix b/flakes/kile/flake.nix index 9be5189..a375ced 100644 --- a/flakes/kile/flake.nix +++ b/flakes/kile/flake.nix @@ -15,48 +15,53 @@ }; }; - outputs = { self, nixpkgs, crane, flake-utils, kile-src, ... }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - # import nixpkgs { - # inherit system; - # }; + outputs = { + self, + nixpkgs, + crane, + flake-utils, + kile-src, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + # import nixpkgs { + # inherit system; + # }; - craneLib = crane.lib.${system}; - kile = craneLib.buildPackage { - src = kile-src; + craneLib = crane.lib.${system}; + kile = craneLib.buildPackage { + src = kile-src; - buildInputs = with pkgs; [ - wayland - ]; + buildInputs = with pkgs; [ + wayland + ]; - # Additional environment variables can be set directly - # MY_CUSTOM_VAR = "some value"; - }; - in - { - checks = { - inherit kile; - }; + # Additional environment variables can be set directly + # MY_CUSTOM_VAR = "some value"; + }; + in { + checks = { + inherit kile; + }; - packages.default = kile; + packages.default = kile; - apps.default = flake-utils.lib.mkApp { - drv = kile; - }; + apps.default = flake-utils.lib.mkApp { + drv = kile; + }; - devShells.default = craneLib.devShell { - # Inherit inputs from checks. - checks = self.checks.${system}; + devShells.default = craneLib.devShell { + # Inherit inputs from checks. + checks = self.checks.${system}; - # Additional dev-shell environment variables can be set directly - # MY_CUSTOM_DEVELOPMENT_VAR = "something else"; + # Additional dev-shell environment variables can be set directly + # MY_CUSTOM_DEVELOPMENT_VAR = "something else"; - # Extra inputs can be added here; cargo and rustc are provided by default. - packages = [ - # pkgs.ripgrep - ]; - }; - }); + # Extra inputs can be added here; cargo and rustc are provided by default. + packages = [ + # pkgs.ripgrep + ]; + }; + }); } diff --git a/flakes/qtile/flake.nix b/flakes/qtile/flake.nix index 75f04ab..a513eb3 100644 --- a/flakes/qtile/flake.nix +++ b/flakes/qtile/flake.nix @@ -1,80 +1,94 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - - flake-parts.url = "github:hercules-ci/flake-parts"; + + flake-parts.url = "github:hercules-ci/flake-parts"; qtile-src = { url = "github:qtile/qtile"; flake = false; }; - pywlroots = { - url = "path:pywlroots"; - }; + pywlroots = { + url = "path:pywlroots"; + }; }; - outputs = inputs@{ flake-parts, qtile-src, pywlroots, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" ]; - perSystem = { config, self', inputs', pkgs, system, ...}: { - packages.qtile = with pkgs; with pkgs.python3Packages; buildPythonPackage rec { - pname = "qtile"; - version = "unstable-${inputs.qtile-src.lastModifiedDate}"; - src = inputs.qtile-src; - SETUPTOOLS_SCM_PRETEND_VERSION = "0.23.0"; - postPatch = '' - substituteInPlace libqtile/pangocffi.py \ - --replace libgobject-2.0.so.0 ${pkgs.glib.out}/lib/libgobject-2.0.so.0 \ - --replace libpangocairo-1.0.so.0 ${pkgs.pango.out}/lib/libpangocairo-1.0.so.0 \ - --replace libpango-1.0.so.0 ${pkgs.pango.out}/lib/libpango-1.0.so.0 - substituteInPlace libqtile/backend/x11/xcursors.py \ - --replace libxcb-cursor.so.0 ${pkgs.xcb-util-cursor.out}/lib/libxcb-cursor.so.0 - substituteInPlace libqtile/backend/wayland/cffi/cairo_buffer.py \ - --replace drm_fourcc.h libdrm/drm_fourcc.h - substituteInPlace libqtile/backend/wayland/cffi/build.py \ - --replace /usr/include/pixman-1 ${lib.getDev pkgs.pixman}/include \ - --replace /usr/include/libdrm ${lib.getDev pkgs.libdrm}/include/libdrm - ''; - nativeBuildInputs = [ - pkg-config - setuptools-scm - setuptools - ]; - propagatedBuildInputs = [ - xcffib - (cairocffi.override { withXcffib = true; }) - python-dateutil - dbus-python - dbus-next - mpd2 - psutil - pulsectl-asyncio - pyxdg - pygobject3 - pywayland - inputs'.pywlroots.packages.default - xkbcommon - ]; - buildInputs = [ - libinput - libxkbcommon - libdrm - wayland - xorg.xcbutilwm - (wlroots.overrideAttrs (wf: wp: { - postPatch = - wp.postPatch - + '' - substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();" - ''; - })) - ]; - makeWrapperArgs = [ - "--suffix PATH : ${lib.makeBinPath [ mypy ]}" - ]; - doCheck = false; - }; - }; - }; + outputs = inputs @ { + flake-parts, + qtile-src, + pywlroots, + ... + }: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux"]; + perSystem = { + config, + self', + inputs', + pkgs, + system, + ... + }: { + packages.qtile = with pkgs; + with pkgs.python3Packages; + buildPythonPackage rec { + pname = "qtile"; + version = "unstable-${inputs.qtile-src.lastModifiedDate}"; + src = inputs.qtile-src; + SETUPTOOLS_SCM_PRETEND_VERSION = "0.23.0"; + postPatch = '' + substituteInPlace libqtile/pangocffi.py \ + --replace libgobject-2.0.so.0 ${pkgs.glib.out}/lib/libgobject-2.0.so.0 \ + --replace libpangocairo-1.0.so.0 ${pkgs.pango.out}/lib/libpangocairo-1.0.so.0 \ + --replace libpango-1.0.so.0 ${pkgs.pango.out}/lib/libpango-1.0.so.0 + substituteInPlace libqtile/backend/x11/xcursors.py \ + --replace libxcb-cursor.so.0 ${pkgs.xcb-util-cursor.out}/lib/libxcb-cursor.so.0 + substituteInPlace libqtile/backend/wayland/cffi/cairo_buffer.py \ + --replace drm_fourcc.h libdrm/drm_fourcc.h + substituteInPlace libqtile/backend/wayland/cffi/build.py \ + --replace /usr/include/pixman-1 ${lib.getDev pkgs.pixman}/include \ + --replace /usr/include/libdrm ${lib.getDev pkgs.libdrm}/include/libdrm + ''; + nativeBuildInputs = [ + pkg-config + setuptools-scm + setuptools + ]; + propagatedBuildInputs = [ + xcffib + (cairocffi.override {withXcffib = true;}) + python-dateutil + dbus-python + dbus-next + mpd2 + psutil + pulsectl-asyncio + pyxdg + pygobject3 + pywayland + inputs'.pywlroots.packages.default + xkbcommon + ]; + buildInputs = [ + libinput + libxkbcommon + libdrm + wayland + xorg.xcbutilwm + (wlroots.overrideAttrs (wf: wp: { + postPatch = + wp.postPatch + + '' + substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();" + ''; + })) + ]; + makeWrapperArgs = [ + "--suffix PATH : ${lib.makeBinPath [mypy]}" + ]; + doCheck = false; + }; + }; + }; } diff --git a/flakes/qtile/pywlroots/flake.nix b/flakes/qtile/pywlroots/flake.nix index b03a056..d6acd7a 100644 --- a/flakes/qtile/pywlroots/flake.nix +++ b/flakes/qtile/pywlroots/flake.nix @@ -2,48 +2,73 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - flake-parts.url = "github:hercules-ci/flake-parts"; - + flake-parts.url = "github:hercules-ci/flake-parts"; + pywlroots-src = { url = "github:flacjacket/pywlroots"; flake = false; }; - }; - outputs = inputs@{ flake-parts, pywlroots-src, ... }: - flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" ]; - perSystem = { config, self', inputs', pkgs, system, ...}: { - packages.default = with pkgs; with pkgs.python3Packages; buildPythonPackage rec { - pname = "pywlroots"; - version = "unstable-${inputs.pywlroots-src.lastModifiedDate}"; - format = "setuptools"; - disable = pythonOlder "3.7"; - src = inputs.pywlroots-src; + outputs = inputs @ { + flake-parts, + pywlroots-src, + ... + }: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux"]; + perSystem = { + config, + self', + inputs', + pkgs, + system, + ... + }: { + packages.default = with pkgs; + with pkgs.python3Packages; + buildPythonPackage rec { + pname = "pywlroots"; + version = "unstable-${inputs.pywlroots-src.lastModifiedDate}"; + format = "setuptools"; + disable = pythonOlder "3.7"; + src = inputs.pywlroots-src; - nativeBuildInputs = [ pkg-config ]; - propagatedNativeBuildInputs = [ cffi ]; - buildInputs = [ libinput libxkbcommon pixman xorg.libxcb xorg.xcbutilwm udev wayland - ((wlroots_0_16.override {xwayland = xwayland; enableXWayland = true;}).overrideAttrs (wf: wp: { - postPatch = - wp.postPatch - + '' - substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();" - ''; - })) - ]; - propagatedBuildInputs = [ cffi pywayland xkbcommon - ]; - nativeCheckInputs = [ pytestCheckHook ]; - postBuild = '' - ${python3.pythonForBuild.interpreter} wlroots/ffi_build.py - ''; + nativeBuildInputs = [pkg-config]; + propagatedNativeBuildInputs = [cffi]; + buildInputs = [ + libinput + libxkbcommon + pixman + xorg.libxcb + xorg.xcbutilwm + udev + wayland + ((wlroots_0_16.override { + xwayland = xwayland; + enableXWayland = true; + }) + .overrideAttrs (wf: wp: { + postPatch = + wp.postPatch + + '' + substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();" + ''; + })) + ]; + propagatedBuildInputs = [ + cffi + pywayland + xkbcommon + ]; + nativeCheckInputs = [pytestCheckHook]; + postBuild = '' + ${python3.pythonForBuild.interpreter} wlroots/ffi_build.py + ''; - pythonImportsCheck = [ "wlroots" ]; - passthru.test = { inherit qtile; }; - }; - }; - - }; #/mkFlake + pythonImportsCheck = ["wlroots"]; + passthru.test = {inherit qtile;}; + }; + }; + }; #/mkFlake } diff --git a/home/dots/qtile/config.py b/home/dots/qtile/config.py index 5012693..8e88ff1 100755 --- a/home/dots/qtile/config.py +++ b/home/dots/qtile/config.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# import coconut.api from __future__ import annotations @@ -37,8 +36,9 @@ class Apps: fm = "thunar" logout = "wlogout" noti = "swaync-client -t" - ss = '''grim -g "$(slurp)" -t png -o "~/Pictures/$(date +%F_%H-%m-%S).png" && notify-send "Screenshot taken."''' + ss = "grim -g \"$(slurp)\" -t png -o \"~/Pictures/$(date +%F_%H-%m-%S).png\" && notify-send \"Screenshot taken.\"" passmgr = "keepassxc" + music = "strawberry" class OSD: @@ -46,7 +46,7 @@ class OSD: vol_up = "swayosd --output-volume raise" vol_down = "swayosd --output-volume lower" next = "playerctl next" - prev = "playerctl prev" + prev = "playerctl previous" stop = "playerctl stop" play = "playerctl play-pause" brightup = "swayosd --brightness raise" @@ -94,7 +94,7 @@ keys = [ Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), Key([mod], "space", lazy.window.toggle_floating()), Key([mod, "shift"], "space", lazy.window.toggle_fullscreen()), - Key([mod], "Tab", lazy.layout.next_layout()), + Key([mod], "Tab", lazy.next_layout()), ] @@ -121,23 +121,34 @@ for i in groups: ) groups.append(ScratchPad("scratch", [ - DropDown("term", Apps.term, width=0.8, height=0.45, x=0.2, y=0.0), - DropDown("pass", Apps.passmgr, width=0.5, height=0.5, x=0.25, y=0.25), + DropDown("term", Apps.term, width=2.0/3.0, height=2.0/3.0, x=0.5/3.0, y=0.5/3.0), + DropDown("pass", Apps.passmgr, width=1.0/2.0, height=2.0/3.0, x=0.5/2.0, y=0.5/3.0), + DropDown("music", Apps.music, width=2.0/3.0, height=2.0/3.0, x=0.5/3.0, y=0.5/3.0), ])) keys.extend([ Key([mod], 'grave', lazy.group['scratch'].dropdown_toggle('term')), Key([mod], 'minus', lazy.group['scratch'].dropdown_toggle('pass')), + Key([mod], 'equal', lazy.group['scratch'].dropdown_toggle('music')), ]) +layout_theme = dict( + margin=#GAPS, + border_width=#BORDERWIDTH, + border_focus="#BORDERFOCUS", + border_normal="#BORDERCOL", +) + layouts = [ - layout.Bsp(margin_on_single=0), - layout.Slice(fallback=layout.Bsp(), side="top", width=1280), + layout.Bsp(fair=False, border_on_single=True, **layout_theme), + layout.Floating(**layout_theme), ] widget_defaults = dict( - font="Inria Sans", - fontsize=12, + font="#FONTFACE", + fontsize=#FONTSIZE, + background="#BGCOL", + foreground="#FGCOL", ) mouse = [ @@ -149,12 +160,12 @@ screens = [ Screen( top = bar.Bar( [ - widget.GroupBox(), - widget.WindowTabs(), - widget.CurrentLayout(), - # widget.Volume(), - # widget.Systray(), - widget.Clock() + widget.GroupBox(**widget_defaults), + widget.WindowTabs(**widget_defaults), + widget.CurrentLayout(**widget_defaults), + widget.Volume(**widget_defaults), + widget.Systray(**widget_defaults), + widget.Clock(**widget_defaults) # widget.Clock('%B %d %a %I:%M %p'), ], 16, diff --git a/home/dots/qtile/flake.nix b/home/dots/qtile/flake.nix index 10e32ce..994b420 100644 --- a/home/dots/qtile/flake.nix +++ b/home/dots/qtile/flake.nix @@ -5,25 +5,32 @@ utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, nixpkgs-unstable, utils, ... }: - utils.lib.eachDefaultSystem (system: - let - stable = import nixpkgs { inherit system; }; - unstable = import nixpkgs-unstable { inherit system; }; - in - { - devShell = with unstable; with unstable.python3Packages; mkShell { - buildInputs = [ - python-lsp-server - mypy - pylsp-mypy - black - pydantic - coconut - stable.python3Packages.qtile-extras - stable.python3Packages.qtile - ]; - }; - } - ); + outputs = { + self, + nixpkgs, + nixpkgs-unstable, + utils, + ... + }: + utils.lib.eachDefaultSystem ( + system: let + stable = import nixpkgs {inherit system;}; + unstable = import nixpkgs-unstable {inherit system;}; + in { + devShell = with unstable; + with unstable.python3Packages; + mkShell { + buildInputs = [ + python-lsp-server + mypy + pylsp-mypy + black + pydantic + coconut + stable.python3Packages.qtile-extras + stable.python3Packages.qtile + ]; + }; + } + ); } diff --git a/home/home.nix b/home/home.nix index 97535fd..1f348bf 100644 --- a/home/home.nix +++ b/home/home.nix @@ -4,7 +4,6 @@ lib, config, pkgs, - nur, ... }: let palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; @@ -13,8 +12,16 @@ in { home.stateVersion = "22.11"; imports = [ - inputs.ironbar.homeManagerModules.default # ./programs/eww/default.nix + ./programs/helix.nix + ./programs/wlogout.nix + ./programs/fuzzel.nix + ./programs/qtile.nix + ./programs/swaync.nix + ./programs/firefox.nix + ./programs/kitty.nix + ./programs/zsh.nix + ./util/ez.nix ]; home.packages = with pkgs; @@ -37,20 +44,18 @@ in { zellij grim slurp - + libnotify - xorg.xrdb swayidle - swaynotificationcenter gtklock playerctl kooha nyxt + xorg.xrdb culr swayosd - fuzzel # kdeconnect keepassxc @@ -61,7 +66,6 @@ in { mpv gtk-engine-murrine - ] ++ pkgs.rice.fonts.pkgs ++ pkgs.rice.icons.pkgs; @@ -81,255 +85,15 @@ in { services.udiskie.enable = true; + # TODO fix launch programs.vscode = { enable = true; }; - programs.ironbar = with pkgs.rice; { - # enable = true; - config = { - anchor_to_edges = true; - position = "top"; - height = 8; - icon_theme = icons.name; - - start = [ - { - type = "workspaces"; - all_monitors = true; - } - { - type = "sys_info"; - interval.memory = 30; - interval.cpu = 1; - format = [ - " {cpu_percent}%" - " {memory_used} / {memory_total} GB" - ]; - } - ]; - center = [ - { - type = "focused"; - icon_size = 8; - } - ]; - end = [ - { - type = "music"; - player_type = "mpris"; - - on_click_middle = "playerctl play-pause"; - on_scroll_up = "playerctl volume +5"; - on_scroll_down = "playerctl volume -5"; - } - {type = "clock";} - ]; - }; - style = with palette-hex; (builtins.replaceStrings - [ - "#BG" - "#DARKBG" - "#BORDER" - "#ACTIVEBORDER" - "#TEXT" - "#URGENT" - "#FONT" - "#SZFONT" - ] - [ - util.bg - normal.black - normal.black - normal.black - util.fg - normal.red - fonts.sans.name - "10" # (builtins.toString fonts.sans.size) - ] - (builtins.readFile dots/ironbar.css)); - }; - - wayland.windowManager.sway = { - enable = true; - package = pkgs.sway; - config = with pkgs.rice; { - bars = []; - # reintroduces flicker - # output = { - # "*" = { - # adaptive_sync = "on"; - # }; - # }; - focus = { - mouseWarping = "container"; - wrapping = "no"; - }; - fonts = with fonts; { - names = [sans.name emoji.name]; - size = 10.0; - }; - gaps = { - inner = borders.gaps_in; - outer = borders.gaps_out; - smartGaps = true; - smartBorders = "no_gaps"; - }; - window = { - border = borders.thickness; - hideEdgeBorders = "smart"; - titlebar = false; - commands = [ - { - command = "move scratchpad"; - criteria = { - app_id = "org.keepassxc.KeePassXC"; - }; - } - ]; - }; - workspaceAutoBackAndForth = false; - input = { - "*" = { - accel_profile = "flat"; - pointer_accel = "0.0"; - xkb_options = "caps:escape"; - }; - }; - startup = with pkgs; [ - {command = "${lib.getExe' keepassxc "keepassxc"}";} - {command = "${lib.getExe' ckb-next "ckb-next"} -c -b";} - {command = "${lib.getExe' mullvad "mullvad"} connect";} - {command = "${lib.getExe' xorg.xrdb "xrdb"} -l ~/.Xresources";} - {command = "${lib.getExe' flashfocus "flashfocus"} -o 0.95 -t 175 -n 30 --no-flash-fullscreen -l on_open_close";} - {command = "${lib.getExe' glib.bin "gsettings"} set org.gnome.desktop.interface gtk-theme '${rice.gtk-theme.name}'";} - {command = "${lib.getExe' glib.bin "gsettings"} set org.gnome.desktop.interface font-name '${rice.fonts.sans.name}'";} - {command = "${lib.getExe' glib.bin "gsettings"} set org.gnome.desktop.interface icon-theme '${rice.icons.name}'";} - ]; - terminal = "kitty"; - modifier = "Mod4"; - keybindings = { - "Mod4+Return" = "exec kitty"; - "Mod4+d" = "exec fuzzel"; - "Mod4+e" = "exec thunar"; - "Mod4+f" = "exec firefox"; - "Mod4+Shift+e" = "exec wlogout"; - "Mod4+Shift+s" = "exec grim -g \"$(slurp)\" -t png -o \"${config.home.homeDirectory}/Pictures/$(date +%F_%H-%m-%S).png\" && notify-send \"Screenshot taken.\""; - "Mod4+Shift+Ctrl+s" = "exec kooha"; - "Mod4+n" = "exec swaync-client -t"; - "Mod4+Space" = "floating toggle; move absolute position center"; - "Mod4+c" = "focus floating; move absolute position center"; - "Mod4+Shift+Space" = "fullscreen toggle"; - "Mod4+a" = "focus parent"; - "Mod4+Shift+a" = "focus child"; - "Mod4+h" = "focus left"; - "Mod4+j" = "focus down"; - "Mod4+k" = "focus up"; - "Mod4+l" = "focus right"; - "Mod4+Shift+h" = "move left"; - "Mod4+Shift+j" = "move down"; - "Mod4+Shift+k" = "move up"; - "Mod4+Shift+l" = "move right"; - "Mod4+1" = "workspace 1"; - "Mod4+Shift+1" = "move container to workspace 1"; - "Mod4+2" = "workspace 2"; - "Mod4+Shift+2" = "move container to workspace 2"; - "Mod4+3" = "workspace 3"; - "Mod4+Shift+3" = "move container to workspace 3"; - "Mod4+4" = "workspace 4"; - "Mod4+Shift+4" = "move container to workspace 4"; - "Mod4+r" = "mode resize"; - "Mod4+Shift+minus" = "move scratchpad"; - "Mod4+minus" = "scratchpad show"; - "Mod4+Shift+q" = "kill"; - "Mod4+v" = "split toggle"; - "XF86AudioMute" = "exec swayosd --output-volume mute-toggle"; - "XF86AudioRaiseVolume" = "exec swayosd --output-volume raise"; - "XF86AudioLowerVolume" = "exec swayosd --output-volume lower"; - "XF86AudioStop" = "exec playerctl stop"; - "XF86AudioPlay" = "exec playerctl play-pause"; - "XF86AudioPrev" = "exec playerctl previous"; - "XF86AudioNext" = "exec playerctl next"; - "XF86MonBrightnessUp" = "exec swayosd --brightness raise"; - "XF86MonBrightnessDown" = "exec swayosd --brightness lower"; - }; - menu = "fuzzel"; - colors = with palette-hex; { - background = util.bg; - focused = { - background = util.bg; - border = bright.yellow; - childBorder = bright.yellow; - indicator = bright.yellow; - text = util.fg; - }; - focusedInactive = { - background = normal.black; - border = util.bg; - childBorder = util.bg; - indicator = util.bg; - text = normal.white; - }; - placeholder = { - background = util.bg; - border = bright.green; - childBorder = bright.green; - indicator = bright.green; - text = util.fg; - }; - unfocused = { - background = normal.black; - border = util.bg; - childBorder = util.bg; - indicator = util.bg; - text = normal.white; - }; - urgent = { - background = normal.red; - border = normal.red; - childBorder = normal.red; - indicator = normal.red; - text = normal.blue; - }; - }; - }; - systemd.enable = true; - wrapperFeatures = { - base = true; - gtk = true; - }; - xwayland = true; - }; - systemd.user.startServices = "sd-switch"; - systemd.user.services = with pkgs; - builtins.mapAttrs (name: cmd: { - Unit = { - Description = "${name}"; - Requires = [ "graphical-session.target" "qtile-session.target" ]; - After = [ "graphical-session.target" "qtile-session.target" ]; - }; - Service = { - ExecStart = cmd; - }; - Install = { - WantedBy = ["qtile-session.target"]; - }; - }) - { - swaybg = "${lib.getExe swaybg} -i ${rice.bg.image} -m fill"; - swayosd = "${lib.getExe' swayosd "swayosd"} --max-volume 100"; - swaync = "${lib.getExe swaynotificationcenter}"; - # persway = "${lib.getExe' persway "persway"} daemon -d spiral"; - # nb. python or qt apps fail as sd services, use wm to launch - }; - systemd.user.targets.qtile-session = { - Unit = { - BindsTo = [ "graphical-session.target" ]; - Wants = [ "graphical-session-pre.target" "xdg-desktop-autostart.target" ]; - After = [ "graphical-session-pre.target" ]; - Before = [ "xdg-desktop-autostart.target" ]; - }; + ezServices = with pkgs; { + swaybg = "${lib.getExe swaybg} -i ${rice.bg.image} -m fill"; + swayosd = "${lib.getExe' swayosd "swayosd"} --max-volume 100"; }; xdg.enable = true; @@ -356,113 +120,12 @@ in { "*.color14" = bright.cyan; "*.color15" = bright.white; }; - xdg.configFile = - builtins.mapAttrs (name: value: { - enable = true; - source = value; - }) - { - "swaync/config.json" = dots/swaync/config.json; - "swaync/configSchema.json" = dots/swaync/configSchema.json; - "qtile/config.py" = dots/qtile/config.py; - "qtile/autostart.sh" = dots/qtile/autostart.sh; - } - // { - "swaync/style.css" = { - enable = true; - text = with palette-hex; (builtins.replaceStrings - [ - "#PANELBG" - "#COLBORDER" - "#NOTIBGNORM" - "#NOTIBGHOVER" - "#NOTIBGFOCUS" - "#NOTIBGCLOSE" - "#NOTIBGHVERCLOSE" - "#BGSELECTED" - "#FONT" - "#BORDER" - "#ROUNDING" - ] - [ - util.bg - normal.black - util.bg - bright.black - bright.black - normal.black - bright.black - bright.black - pkgs.rice.fonts.sans.name - (builtins.toString pkgs.rice.borders.thickness) - (builtins.toString pkgs.rice.borders.rounding) - ] - (builtins.readFile dots/swaync/style.css)); - }; - }; xdg.systemDirs.data = [ "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}" ]; - programs.wlogout = { - enable = true; - layout = builtins.fromJSON (builtins.readFile dots/wlogout/layout); - style = with palette-hex; (builtins.replaceStrings - [ - "/usr/share/wlogout" - "/etc/wlogout" - "#WINBG" - "#BTNCOL" - "#BTNBG" - "#BTNFOCUSBG" - "#WINLOGO" - ] - [ - "${pkgs.wlogout}/share/wlogout" - "${pkgs.wlogout}/etc/wlogout" - util.bg - bright.yellow - util.bg - normal.black - (builtins.path { - name = "winlogo"; - path = ./winlogo.png; - sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108"; - }) - ] - (builtins.readFile dots/wlogout/style.css)); - }; - - programs.fuzzel = with pkgs.rice; { - enable = true; - settings = { - main = { - dpi-aware = "no"; - font = with fonts.sans; lib.strings.concatStrings [name ":size=" (builtins.toString (size + 2))]; - icon-theme = icons.name; - terminal = "kitty"; - }; - dmenu = { - exit-immediately-if-empty = "yes"; - }; - border = with borders; { - width = thickness; - radius = rounding; - }; - colors = { - background = lib.strings.concatStrings [palette-hex.util.bg "A0"]; - text = lib.strings.concatStrings [palette-hex.util.fg "FF"]; - selection = lib.strings.concatStrings [palette-hex.bright.yellow "FF"]; - selection-text = lib.strings.concatStrings [palette-hex.util.bg "FF"]; - selection-match = lib.strings.concatStrings [palette-hex.normal.green "FF"]; - match = lib.strings.concatStrings [palette-hex.bright.green "FF"]; - border = lib.strings.concatStrings [palette-hex.bright.yellow "FF"]; - }; - }; - }; - gtk = with pkgs.rice; { enable = true; theme = with gtk-theme; { @@ -483,240 +146,6 @@ in { }; }; - programs.firefox = { - enable = true; - profiles.default = { - id = 0; - name = "Default"; - settings = { - "browser.startup.homepage" = "about:blank"; - }; - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - vimium-c - darkreader - localcdn - ublock-origin - keepassxc-browser - user-agent-string-switcher - ]; - }; - }; - - programs.helix = { - enable = true; - themes = with palette-hex; { - nix-rice = { - "attribute" = bright.cyan; - "keyword" = {fg = normal.red;}; - "keyword.directive" = normal.red; - "namespace" = bright.cyan; - "punctuation" = bright.yellow; - "punctuation.delimiter" = bright.yellow; - "operator" = bright.magenta; - "special" = normal.magenta; - "variable.other.member" = bright.blue; - "variable" = util.fg; - "variable.builtin" = bright.yellow; - "variable.parameter" = bright.white; - "type" = normal.yellow; - "type.builtin" = normal.yellow; - "constructor" = { - fg = bright.magenta; - modifiers = ["bold"]; - }; - "function" = { - fg = normal.green; - modifiers = ["bold"]; - }; - "function.macro" = bright.cyan; - "function.builtin" = normal.yellow; - "tag" = normal.red; - "comment" = { - fg = normal.magenta; - modifiers = ["italic"]; - }; - "constant" = {fg = bright.magenta;}; - "constant.builtin" = { - fg = bright.magenta; - modifiers = ["bold"]; - }; - "string" = normal.green; - "constant.numeric" = bright.magenta; - "constant.character.escape" = { - fg = bright.white; - modifiers = ["bold"]; - }; - "label" = bright.cyan; - "module" = bright.cyan; - "diff.plus" = bright.green; - "diff.delta" = bright.yellow; - "diff.minus" = bright.red; - "warning" = bright.yellow; - "error" = bright.red; - "info" = bright.cyan; - "hint" = bright.blue; - "ui.background" = {bg = util.bg;}; - "ui.linenr" = {fg = normal.cyan;}; - "ui.linenr.selected" = { - fg = normal.yellow; - modifiers = ["bold"]; - }; - "ui.cursorline" = {bg = normal.black;}; - "ui.statusline" = { - fg = util.fg; - bg = bright.black; - }; - "ui.statusline.normal" = { - fg = util.fg; - bg = bright.black; - }; - "ui.statusline.insert" = { - fg = util.fg; - bg = normal.blue; - }; - "ui.statusline.select" = { - fg = util.fg; - bg = bright.yellow; - }; - "ui.statusline.inactive" = { - fg = normal.white; - bg = normal.black; - }; - "ui.popup" = {bg = normal.black;}; - "ui.window" = {bg = normal.black;}; - "ui.help" = { - bg = normal.black; - fg = util.fg; - }; - "ui.text" = {fg = util.fg;}; - "ui.text.focus" = {fg = util.fg;}; - "ui.selection" = { - # modifiers = ["reversed"]; - bg = bright.yellow; - }; - "ui.selection.primary" = {modifiers = ["reversed"];}; - # "ui.selection.primary" = { bg = bright.cyan; }; - "ui.cursor.primary" = { - bg = normal.white; - fg = normal.black; - }; - "ui.cursor.match" = {bg = bright.cyan;}; - "ui.menu" = { - fg = util.fg; - bg = bright.black; - }; - "ui.menu.selected" = { - fg = bright.black; - bg = bright.blue; - modifiers = ["bold"]; - }; - "ui.virtual.whitespace" = bright.black; - "ui.virtual.ruler" = {bg = normal.black;}; - "ui.virtual.inlay-hint" = {fg = normal.magenta;}; - "diagnostic.warning" = { - underline = { - color = bright.yellow; - style = "curl"; - }; - }; - "diagnostic.error" = { - underline = { - color = bright.red; - style = "curl"; - }; - }; - "diagnostic.info" = { - underline = { - color = bright.cyan; - style = "curl"; - }; - }; - "diagnostic.hint" = { - underline = { - color = bright.blue; - style = "curl"; - }; - }; - "markup.heading" = bright.cyan; - "markup.bold" = {modifiers = ["bold"];}; - "markup.italic" = {modifiers = ["italic"];}; - "markup.strikethrough" = {modifiers = ["crossed_out"];}; - "markup.link.url" = { - fg = bright.green; - modifiers = ["underlined"]; - }; - "markup.link.text" = bright.red; - "markup.raw" = bright.red; - }; - }; - - settings = { - theme = "nix-rice"; - editor.lsp.display-messages = true; - }; - - languages = { - language = [ - { - name = "rust"; - language-servers = ["rust-analyzer"]; - } - ]; - - # having tons of fun backporting the old config style to the new config schema!!!! - language-server = { - rust-analyzer = { - config = { - cargo = { - buildScripts = { - enable = true; - }; - }; - procMacro = { - enable = true; - }; - check = { - command = "clippy"; - }; - }; - }; - }; - }; - }; - - programs.kitty = with pkgs.rice; { - enable = true; - font = with fonts; { - name = monospace.name; - size = monospace.size; - }; - settings = with palette-hex; { - foreground = util.fg; - background = util.bg; - cursor = util.cursor; - cursor_text = util.bg; - selection_foreground = util.fg_sel; - selection_background = util.bg_sel; - color0 = normal.black; - color1 = normal.red; - color2 = normal.green; - color3 = normal.yellow; - color4 = normal.blue; - color5 = normal.magenta; - color6 = normal.cyan; - color7 = normal.white; - color8 = bright.black; - color9 = bright.red; - color10 = bright.green; - color11 = bright.yellow; - color12 = bright.blue; - color13 = bright.magenta; - color14 = bright.cyan; - color15 = bright.white; - sync_to_monitor = "yes"; - }; - }; - programs.git = { enable = true; userName = "atagen"; @@ -738,67 +167,4 @@ in { "hl+" = bright.green; }; }; - - programs.zsh = { - enable = true; - enableAutosuggestions = true; - enableCompletion = true; - syntaxHighlighting.enable = true; - enableVteIntegration = true; - autocd = true; - defaultKeymap = "viins"; - initExtra = builtins.readFile ./dots/zsh; - plugins = [ - { - name = "powerlevel10k"; - src = pkgs.zsh-powerlevel10k; - file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - } - { - name = "zsh-vi-mode"; - src = pkgs.zsh-vi-mode; - file = "share/zsh-vi-mode/zsh-vi-mode.zsh"; - } - { - name = "zsh-autopair"; - src = pkgs.zsh-autopair; - file = "share/zsh-autopair/zsh-autopair.zsh"; - } - { - name = "zsh-completions"; - src = pkgs.zsh-completions; - file = "share/zsh-completions/zsh-completions.zsh"; - } - { - name = "zsh-command-time"; - src = pkgs.zsh-command-time; - file = "share/zsh-completions/zsh-command-time.zsh"; - } - { - name = "zsh-autocomplete"; - src = pkgs.zsh-autocomplete; - file = "share/zsh-autocomplete/zsh-autocomplete.zsh"; - } - { - name = "zsh-fast-syntax-highlighting"; - src = pkgs.zsh-fast-syntax-highlighting; - file = "share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh"; - } - { - name = "zsh-nix-shell"; - src = pkgs.zsh-nix-shell; - file = "share/zsh-nix-shell/zsh-nix-shell.zsh"; - } - { - name = "any-nix-shell"; - src = pkgs.any-nix-shell; - file = "share/any-nix-shell/any-nix-shell.zsh"; - } - { - name = "nix-zsh-completions"; - src = pkgs.nix-zsh-completions; - file = "share/nix-zsh-completions/nix-zsh-completions.zsh"; - } - ]; - }; } diff --git a/home/programs/firefox.nix b/home/programs/firefox.nix new file mode 100644 index 0000000..944f396 --- /dev/null +++ b/home/programs/firefox.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + pkgs, + ... +}: { + config.programs.firefox = { + enable = true; + profiles.default = { + id = 0; + name = "Default"; + settings = { + "browser.startup.homepage" = "about:blank"; + }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + vimium-c + darkreader + localcdn + ublock-origin + keepassxc-browser + user-agent-string-switcher + ]; + }; + }; +} diff --git a/home/programs/fuzzel.nix b/home/programs/fuzzel.nix new file mode 100644 index 0000000..aa97168 --- /dev/null +++ b/home/programs/fuzzel.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + pkgs, + ... +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; +in { + config.home.packages = [pkgs.fuzzel]; + config.programs.fuzzel = with pkgs.rice; { + enable = true; + settings = { + main = { + dpi-aware = "no"; + font = with fonts.sans; lib.strings.concatStrings [name ":size=" (builtins.toString (size + 2))]; + icon-theme = icons.name; + terminal = "kitty"; + }; + dmenu = { + exit-immediately-if-empty = "yes"; + }; + border = with borders; { + width = thickness; + radius = rounding; + }; + colors = { + background = lib.strings.concatStrings [palette-hex.util.bg "A0"]; + text = lib.strings.concatStrings [palette-hex.util.fg "FF"]; + selection = lib.strings.concatStrings [palette-hex.bright.yellow "FF"]; + selection-text = lib.strings.concatStrings [palette-hex.util.bg "FF"]; + selection-match = lib.strings.concatStrings [palette-hex.normal.green "FF"]; + match = lib.strings.concatStrings [palette-hex.bright.green "FF"]; + border = lib.strings.concatStrings [palette-hex.bright.yellow "FF"]; + }; + }; + }; +} diff --git a/home/programs/helix.nix b/home/programs/helix.nix new file mode 100644 index 0000000..a28575d --- /dev/null +++ b/home/programs/helix.nix @@ -0,0 +1,190 @@ +{ + config, + lib, + pkgs, + ... +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; +in { + config.programs.helix = { + enable = true; + themes = with palette-hex; { + nix-rice = { + "attribute" = bright.cyan; + "keyword" = {fg = normal.red;}; + "keyword.directive" = normal.red; + "namespace" = bright.cyan; + "punctuation" = bright.yellow; + "punctuation.delimiter" = bright.yellow; + "operator" = bright.magenta; + "special" = normal.magenta; + "variable.other.member" = bright.blue; + "variable" = util.fg; + "variable.builtin" = bright.yellow; + "variable.parameter" = bright.white; + "type" = normal.yellow; + "type.builtin" = normal.yellow; + "constructor" = { + fg = bright.magenta; + modifiers = ["bold"]; + }; + "function" = { + fg = normal.green; + modifiers = ["bold"]; + }; + "function.macro" = bright.cyan; + "function.builtin" = normal.yellow; + "tag" = normal.red; + "comment" = { + fg = normal.magenta; + modifiers = ["italic"]; + }; + "constant" = {fg = bright.magenta;}; + "constant.builtin" = { + fg = bright.magenta; + modifiers = ["bold"]; + }; + "string" = normal.green; + "constant.numeric" = bright.magenta; + "constant.character.escape" = { + fg = bright.white; + modifiers = ["bold"]; + }; + "label" = bright.cyan; + "module" = bright.cyan; + "diff.plus" = bright.green; + "diff.delta" = bright.yellow; + "diff.minus" = bright.red; + "warning" = bright.yellow; + "error" = bright.red; + "info" = bright.cyan; + "hint" = bright.blue; + "ui.background" = {bg = util.bg;}; + "ui.linenr" = {fg = normal.cyan;}; + "ui.linenr.selected" = { + fg = normal.yellow; + modifiers = ["bold"]; + }; + "ui.cursorline" = {bg = normal.black;}; + "ui.statusline" = { + fg = util.fg; + bg = bright.black; + }; + "ui.statusline.normal" = { + fg = util.fg; + bg = bright.black; + }; + "ui.statusline.insert" = { + fg = util.fg; + bg = normal.blue; + }; + "ui.statusline.select" = { + fg = util.fg; + bg = bright.yellow; + }; + "ui.statusline.inactive" = { + fg = normal.white; + bg = normal.black; + }; + "ui.popup" = {bg = normal.black;}; + "ui.window" = {bg = normal.black;}; + "ui.help" = { + bg = normal.black; + fg = util.fg; + }; + "ui.text" = {fg = util.fg;}; + "ui.text.focus" = {fg = util.fg;}; + "ui.selection" = { + # modifiers = ["reversed"]; + bg = bright.yellow; + }; + "ui.selection.primary" = {modifiers = ["reversed"];}; + # "ui.selection.primary" = { bg = bright.cyan; }; + "ui.cursor.primary" = { + bg = normal.white; + fg = normal.black; + }; + "ui.cursor.match" = {bg = bright.cyan;}; + "ui.menu" = { + fg = util.fg; + bg = bright.black; + }; + "ui.menu.selected" = { + fg = bright.black; + bg = bright.blue; + modifiers = ["bold"]; + }; + "ui.virtual.whitespace" = bright.black; + "ui.virtual.ruler" = {bg = normal.black;}; + "ui.virtual.inlay-hint" = {fg = normal.magenta;}; + "diagnostic.warning" = { + underline = { + color = bright.yellow; + style = "curl"; + }; + }; + "diagnostic.error" = { + underline = { + color = bright.red; + style = "curl"; + }; + }; + "diagnostic.info" = { + underline = { + color = bright.cyan; + style = "curl"; + }; + }; + "diagnostic.hint" = { + underline = { + color = bright.blue; + style = "curl"; + }; + }; + "markup.heading" = bright.cyan; + "markup.bold" = {modifiers = ["bold"];}; + "markup.italic" = {modifiers = ["italic"];}; + "markup.strikethrough" = {modifiers = ["crossed_out"];}; + "markup.link.url" = { + fg = bright.green; + modifiers = ["underlined"]; + }; + "markup.link.text" = bright.red; + "markup.raw" = bright.red; + }; + }; + + settings = { + theme = "nix-rice"; + editor.lsp.display-messages = true; + }; + + languages = { + language = [ + { + name = "rust"; + language-servers = ["rust-analyzer"]; + } + ]; + + language-server = { + rust-analyzer = { + config = { + cargo = { + buildScripts = { + enable = true; + }; + }; + procMacro = { + enable = true; + }; + check = { + command = "clippy"; + }; + }; + }; + }; + }; + }; +} diff --git a/home/programs/ironbar.nix b/home/programs/ironbar.nix new file mode 100644 index 0000000..c7cfb20 --- /dev/null +++ b/home/programs/ironbar.nix @@ -0,0 +1,77 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: { + config.imports = + config.imports + ++ [ + inputs.ironbar.homeManagerModules.default + ]; + config.programs.ironbar = with pkgs.rice; { + # enable = true; + config = { + anchor_to_edges = true; + position = "top"; + height = 8; + icon_theme = icons.name; + + start = [ + { + type = "workspaces"; + all_monitors = true; + } + { + type = "sys_info"; + interval.memory = 30; + interval.cpu = 1; + format = [ + " {cpu_percent}%" + " {memory_used} / {memory_total} GB" + ]; + } + ]; + center = [ + { + type = "focused"; + icon_size = 8; + } + ]; + end = [ + { + type = "music"; + player_type = "mpris"; + + on_click_middle = "playerctl play-pause"; + on_scroll_up = "playerctl volume +5"; + on_scroll_down = "playerctl volume -5"; + } + {type = "clock";} + ]; + }; + style = with palette-hex; (builtins.replaceStrings + [ + "#BG" + "#DARKBG" + "#BORDER" + "#ACTIVEBORDER" + "#TEXT" + "#URGENT" + "#FONT" + "#SZFONT" + ] + [ + util.bg + normal.black + normal.black + normal.black + util.fg + normal.red + fonts.sans.name + "10" # (builtins.toString fonts.sans.size) + ] + (builtins.readFile dots/ironbar.css)); + }; +} diff --git a/home/programs/kitty.nix b/home/programs/kitty.nix new file mode 100644 index 0000000..d844a27 --- /dev/null +++ b/home/programs/kitty.nix @@ -0,0 +1,42 @@ +{ + config, + lib, + pkgs, + ... +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; +in { + programs.kitty = with pkgs.rice; { + enable = true; + font = with fonts; { + name = monospace.name; + size = monospace.size; + }; + settings = with palette-hex; { + foreground = util.fg; + background = util.bg; + cursor = util.cursor; + cursor_text = util.bg; + selection_foreground = util.fg_sel; + selection_background = util.bg_sel; + color0 = normal.black; + color1 = normal.red; + color2 = normal.green; + color3 = normal.yellow; + color4 = normal.blue; + color5 = normal.magenta; + color6 = normal.cyan; + color7 = normal.white; + color8 = bright.black; + color9 = bright.red; + color10 = bright.green; + color11 = bright.yellow; + color12 = bright.blue; + color13 = bright.magenta; + color14 = bright.cyan; + color15 = bright.white; + sync_to_monitor = "yes"; + }; + }; +} diff --git a/home/programs/qtile.nix b/home/programs/qtile.nix new file mode 100644 index 0000000..8ca7b65 --- /dev/null +++ b/home/programs/qtile.nix @@ -0,0 +1,51 @@ +{ + config, + lib, + pkgs, + ... +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; +in { + config.ezConf = { + "qtile/autostart.sh" = ../dots/qtile/autostart.sh; + }; + config.extraTarget = ["qtile-session.target"]; + config.xdg.configFile."qtile/config.py" = { + enable = true; + executable = true; + onChange = "pkill -SIGUSR1 qtile"; + text = with palette-shex; + with pkgs.rice; (builtins.replaceStrings + [ + "#GAPS" + "#BORDERWIDTH" + "#BORDERFOCUS" + "#BORDERCOL" + "#FONTFACE" + "#FONTSIZE" + "#BGCOL" + "#FGCOL" + ] + [ + (builtins.toString borders.gaps_in) + (builtins.toString borders.thickness) + bright.yellow + util.bg + fonts.sans.name + (builtins.toString fonts.sans.size) + util.bg + util.fg + ] + (builtins.readFile ../dots/qtile/config.py)); + }; + + config.systemd.user.targets.qtile-session = { + Unit = { + BindsTo = ["graphical-session.target"]; + Wants = ["graphical-session-pre.target" "xdg-desktop-autostart.target"]; + After = ["graphical-session-pre.target"]; + Before = ["xdg-desktop-autostart.target"]; + }; + }; +} diff --git a/home/programs/sway.nix b/home/programs/sway.nix new file mode 100644 index 0000000..e070359 --- /dev/null +++ b/home/programs/sway.nix @@ -0,0 +1,157 @@ +{ + config, + lib, + pkgs, + ... +}: { + config.wayland.windowManager.sway = { + enable = true; + package = pkgs.sway; + config = with pkgs.rice; { + bars = []; + # reintroduces flicker + # output = { + # "*" = { + # adaptive_sync = "on"; + # }; + # }; + focus = { + mouseWarping = "container"; + wrapping = "no"; + }; + fonts = with fonts; { + names = [sans.name emoji.name]; + size = 10.0; + }; + gaps = { + inner = borders.gaps_in; + outer = borders.gaps_out; + smartGaps = true; + smartBorders = "no_gaps"; + }; + window = { + border = borders.thickness; + hideEdgeBorders = "smart"; + titlebar = false; + commands = [ + { + command = "move scratchpad"; + criteria = { + app_id = "org.keepassxc.KeePassXC"; + }; + } + ]; + }; + workspaceAutoBackAndForth = false; + input = { + "*" = { + accel_profile = "flat"; + pointer_accel = "0.0"; + xkb_options = "caps:escape"; + }; + }; + startup = with pkgs; [ + {command = "${lib.getExe' keepassxc "keepassxc"}";} + {command = "${lib.getExe' ckb-next "ckb-next"} -c -b";} + {command = "${lib.getExe' mullvad "mullvad"} connect";} + {command = "${lib.getExe' xorg.xrdb "xrdb"} -l ~/.Xresources";} + {command = "${lib.getExe' flashfocus "flashfocus"} -o 0.95 -t 175 -n 30 --no-flash-fullscreen -l on_open_close";} + {command = "${lib.getExe' glib.bin "gsettings"} set org.gnome.desktop.interface gtk-theme '${rice.gtk-theme.name}'";} + {command = "${lib.getExe' glib.bin "gsettings"} set org.gnome.desktop.interface font-name '${rice.fonts.sans.name}'";} + {command = "${lib.getExe' glib.bin "gsettings"} set org.gnome.desktop.interface icon-theme '${rice.icons.name}'";} + ]; + terminal = "kitty"; + modifier = "Mod4"; + keybindings = { + "Mod4+Return" = "exec kitty"; + "Mod4+d" = "exec fuzzel"; + "Mod4+e" = "exec thunar"; + "Mod4+f" = "exec firefox"; + "Mod4+Shift+e" = "exec wlogout"; + "Mod4+Shift+s" = "exec grim -g \"$(slurp)\" -t png -o \"${config.home.homeDirectory}/Pictures/$(date +%F_%H-%m-%S).png\" && notify-send \"Screenshot taken.\""; + "Mod4+Shift+Ctrl+s" = "exec kooha"; + "Mod4+n" = "exec swaync-client -t"; + "Mod4+Space" = "floating toggle; move absolute position center"; + "Mod4+c" = "focus floating; move absolute position center"; + "Mod4+Shift+Space" = "fullscreen toggle"; + "Mod4+a" = "focus parent"; + "Mod4+Shift+a" = "focus child"; + "Mod4+h" = "focus left"; + "Mod4+j" = "focus down"; + "Mod4+k" = "focus up"; + "Mod4+l" = "focus right"; + "Mod4+Shift+h" = "move left"; + "Mod4+Shift+j" = "move down"; + "Mod4+Shift+k" = "move up"; + "Mod4+Shift+l" = "move right"; + "Mod4+1" = "workspace 1"; + "Mod4+Shift+1" = "move container to workspace 1"; + "Mod4+2" = "workspace 2"; + "Mod4+Shift+2" = "move container to workspace 2"; + "Mod4+3" = "workspace 3"; + "Mod4+Shift+3" = "move container to workspace 3"; + "Mod4+4" = "workspace 4"; + "Mod4+Shift+4" = "move container to workspace 4"; + "Mod4+r" = "mode resize"; + "Mod4+Shift+minus" = "move scratchpad"; + "Mod4+minus" = "scratchpad show"; + "Mod4+Shift+q" = "kill"; + "Mod4+v" = "split toggle"; + "XF86AudioMute" = "exec swayosd --output-volume mute-toggle"; + "XF86AudioRaiseVolume" = "exec swayosd --output-volume raise"; + "XF86AudioLowerVolume" = "exec swayosd --output-volume lower"; + "XF86AudioStop" = "exec playerctl stop"; + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioPrev" = "exec playerctl previous"; + "XF86AudioNext" = "exec playerctl next"; + "XF86MonBrightnessUp" = "exec swayosd --brightness raise"; + "XF86MonBrightnessDown" = "exec swayosd --brightness lower"; + }; + menu = "fuzzel"; + colors = with palette-hex; { + background = util.bg; + focused = { + background = util.bg; + border = bright.yellow; + childBorder = bright.yellow; + indicator = bright.yellow; + text = util.fg; + }; + focusedInactive = { + background = normal.black; + border = util.bg; + childBorder = util.bg; + indicator = util.bg; + text = normal.white; + }; + placeholder = { + background = util.bg; + border = bright.green; + childBorder = bright.green; + indicator = bright.green; + text = util.fg; + }; + unfocused = { + background = normal.black; + border = util.bg; + childBorder = util.bg; + indicator = util.bg; + text = normal.white; + }; + urgent = { + background = normal.red; + border = normal.red; + childBorder = normal.red; + indicator = normal.red; + text = normal.blue; + }; + }; + }; + systemd.enable = true; + wrapperFeatures = { + base = true; + gtk = true; + }; + xwayland = true; + }; +} diff --git a/home/programs/swaync.nix b/home/programs/swaync.nix new file mode 100644 index 0000000..09e5b91 --- /dev/null +++ b/home/programs/swaync.nix @@ -0,0 +1,50 @@ +{ + config, + lib, + pkgs, + palette-hex, + ... +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; +in { + config.home.packages = [pkgs.swaynotificationcenter]; + config.ezConf = { + "swaync/config.json" = ../dots/swaync/config.json; + "swaync/configSchema.json" = ../dots/swaync/configSchema.json; + }; + config.ezServices = { + swaync = "${lib.getExe pkgs.swaynotificationcenter}"; + }; + config.xdg.configFile."swaync/style.css" = { + enable = true; + text = with palette-hex; (builtins.replaceStrings + [ + "#PANELBG" + "#COLBORDER" + "#NOTIBGNORM" + "#NOTIBGHOVER" + "#NOTIBGFOCUS" + "#NOTIBGCLOSE" + "#NOTIBGHVERCLOSE" + "#BGSELECTED" + "#FONT" + "#BORDER" + "#ROUNDING" + ] + [ + util.bg + normal.black + util.bg + bright.black + bright.black + normal.black + bright.black + bright.black + pkgs.rice.fonts.sans.name + (builtins.toString pkgs.rice.borders.thickness) + (builtins.toString pkgs.rice.borders.rounding) + ] + (builtins.readFile ../dots/swaync/style.css)); + }; +} diff --git a/home/programs/wlogout.nix b/home/programs/wlogout.nix new file mode 100644 index 0000000..6232627 --- /dev/null +++ b/home/programs/wlogout.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + pkgs, + ... +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; +in { + config.programs.wlogout = { + enable = true; + layout = builtins.fromJSON (builtins.readFile ../dots/wlogout/layout); + style = with palette-hex; (builtins.replaceStrings + [ + "/usr/share/wlogout" + "/etc/wlogout" + "#WINBG" + "#BTNCOL" + "#BTNBG" + "#BTNFOCUSBG" + "#WINLOGO" + ] + [ + "${pkgs.wlogout}/share/wlogout" + "${pkgs.wlogout}/etc/wlogout" + util.bg + bright.yellow + util.bg + normal.black + (builtins.path { + name = "winlogo"; + path = ./winlogo.png; + sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108"; + }) + ] + (builtins.readFile ../dots/wlogout/style.css)); + }; +} diff --git a/home/programs/zsh.nix b/home/programs/zsh.nix new file mode 100644 index 0000000..bcc90ea --- /dev/null +++ b/home/programs/zsh.nix @@ -0,0 +1,72 @@ +{ + config, + lib, + pkgs, + ... +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; +in { + programs.zsh = { + enable = true; + enableAutosuggestions = true; + enableCompletion = true; + syntaxHighlighting.enable = true; + enableVteIntegration = true; + autocd = true; + defaultKeymap = "viins"; + initExtra = builtins.readFile ../dots/zsh; + plugins = [ + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + { + name = "zsh-vi-mode"; + src = pkgs.zsh-vi-mode; + file = "share/zsh-vi-mode/zsh-vi-mode.zsh"; + } + { + name = "zsh-autopair"; + src = pkgs.zsh-autopair; + file = "share/zsh-autopair/zsh-autopair.zsh"; + } + { + name = "zsh-completions"; + src = pkgs.zsh-completions; + file = "share/zsh-completions/zsh-completions.zsh"; + } + { + name = "zsh-command-time"; + src = pkgs.zsh-command-time; + file = "share/zsh-completions/zsh-command-time.zsh"; + } + { + name = "zsh-autocomplete"; + src = pkgs.zsh-autocomplete; + file = "share/zsh-autocomplete/zsh-autocomplete.zsh"; + } + { + name = "zsh-fast-syntax-highlighting"; + src = pkgs.zsh-fast-syntax-highlighting; + file = "share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh"; + } + { + name = "zsh-nix-shell"; + src = pkgs.zsh-nix-shell; + file = "share/zsh-nix-shell/zsh-nix-shell.zsh"; + } + { + name = "any-nix-shell"; + src = pkgs.any-nix-shell; + file = "share/any-nix-shell/any-nix-shell.zsh"; + } + { + name = "nix-zsh-completions"; + src = pkgs.nix-zsh-completions; + file = "share/nix-zsh-completions/nix-zsh-completions.zsh"; + } + ]; + }; +} diff --git a/home/util/ez.nix b/home/util/ez.nix new file mode 100644 index 0000000..f23fac5 --- /dev/null +++ b/home/util/ez.nix @@ -0,0 +1,51 @@ +{ + config, + lib, + pkgs, + ... +}: { + options = { + ezServices = with lib; + mkOption { + type = with types; attrsOf str; + default = {}; + }; + ezConf = with lib; + mkOption { + type = with types; attrsOf path; + default = {}; + }; + + # for launching a systemd target on wm startup + extraTarget = with lib; + mkOption { + type = with types; listOf str; + default = []; + }; + }; + + config = rec { + systemd.user.services = with pkgs; + builtins.mapAttrs (name: cmd: { + Unit = { + Description = "${name}"; + Requires = ["graphical-session.target"] ++ config.extraTarget; + After = ["graphical-session.target"] ++ config.extraTarget; + }; + Service = { + ExecStart = cmd; + }; + Install = { + WantedBy = ["graphical-session.target"] ++ config.extraTarget; + }; + }) + config.ezServices; + + xdg.configFile = + builtins.mapAttrs (name: value: { + enable = true; + source = value; + }) + config.ezConf; + }; +} diff --git a/overlay.nix b/overlay.nix index 2188346..22acd69 100644 --- a/overlay.nix +++ b/overlay.nix @@ -44,5 +44,4 @@ withGtkWrapper = true; }; }; - } diff --git a/result b/result new file mode 120000 index 0000000..e0489f8 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/mr7pczbgq3gj3ca23p4g7acz232jjnla-nixos-system-quiver-23.11.20230922.e35dcc0 \ No newline at end of file diff --git a/system/configuration.nix b/system/configuration.nix index bc7bff6..426f827 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -20,6 +20,7 @@ outputs.overlays.rice inputs.helix.overlays.default inputs.persway.overlays.default + inputs.nixd.overlays.default # inputs.eww.overlays.default ]; config = { @@ -42,7 +43,6 @@ }; imports = [ - ]; nix.extraOptions = '' @@ -92,10 +92,11 @@ backend = "wayland"; package = inputs.qtile.packages.x86_64-linux.default; configFile = null; # using hm instead - extraPackages = python3Packages: with python3Packages; [ - pkgs.stable.python3Packages.qtile-extras - coconut - ]; + extraPackages = python3Packages: + with python3Packages; [ + pkgs.stable.python3Packages.qtile-extras + coconut + ]; }; services.greetd = { @@ -152,6 +153,7 @@ man-pages-posix rnix-lsp + nixd tailscale @@ -165,7 +167,7 @@ git nix-index - comma + # comma starship cachix diff --git a/system/quiver.nix b/system/quiver.nix index bac17d9..1ef64a9 100644 --- a/system/quiver.nix +++ b/system/quiver.nix @@ -16,7 +16,7 @@ boot.initrd.kernelModules = []; boot.kernelModules = ["kvm-amd" "i2c-dev"]; boot.kernelParams = [ - "nvidia_drm.modeset=1" + "nvidia_drm.modeset=1" "mitigations=off" "acpi_enforce_resources=lax" "preempt=full" @@ -110,10 +110,10 @@ extraGroups = ["wheel" "podman" "docker"]; # Enable ‘sudo’ for the user. }; - fileSystems."/" = - { device = "/dev/disk/by-uuid/b993b463-c131-4ef1-9aba-0e3eadaa2f9a"; - fsType = "btrfs"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/b993b463-c131-4ef1-9aba-0e3eadaa2f9a"; + fsType = "btrfs"; + }; fileSystems."/boot" = { device = "/dev/disk/by-uuid/6B75-AF9F"; @@ -126,10 +126,9 @@ options = ["rw" "uid=1000" "gid=100"]; }; - swapDevices = - [ { device = "/dev/disk/by-uuid/9c006925-e0e9-4165-bc0c-508ae2d1bfce"; } - ]; - + swapDevices = [ + {device = "/dev/disk/by-uuid/9c006925-e0e9-4165-bc0c-508ae2d1bfce";} + ]; networking.nftables.enable = true; networking.firewall = {