From 34aaaf63d2aac231f6125e241795b81e4d3bce75 Mon Sep 17 00:00:00 2001 From: Tristan Date: Sat, 23 Dec 2023 15:43:26 +0000 Subject: [PATCH] neovim lspconfig --- custom/brave-nightly/default.nix | 333 ++++++++++--------- custom/lf-sixel/default.nix | 20 +- flake.nix | 38 ++- global/home.nix | 215 ++++++------- global/system.nix | 76 ++--- hardware/displays.nix | 16 +- hardware/work.nix | 90 +++--- hardware/zenix.nix | 101 +++--- lib/home.nix | 52 +-- lib/mkapp.nix | 9 +- lib/mkconf.nix | 38 +-- lib/modules/dev.nix | 33 +- lib/modules/display.nix | 155 +++++---- lib/modules/editor.nix | 182 +++++------ lib/modules/email.nix | 396 +++++++++++------------ lib/modules/gamer.nix | 80 ++--- lib/modules/git.nix | 45 +-- lib/modules/keyboard.nix | 16 +- lib/modules/laptop.nix | 57 ++-- lib/modules/menu.nix | 33 +- lib/modules/mpd.nix | 96 +++--- lib/modules/neovim/config.lua | 19 ++ lib/modules/neovim/lspconfig.lua | 55 ++++ lib/modules/personal.nix | 62 ++-- lib/modules/scripts.nix | 54 ++-- lib/modules/terminal.nix | 33 +- lib/modules/wayland.nix | 529 ++++++++++++++++--------------- lib/modules/work.nix | 125 ++++---- lib/scripts.nix | 146 ++++++--- 29 files changed, 1705 insertions(+), 1399 deletions(-) create mode 100644 lib/modules/neovim/config.lua create mode 100644 lib/modules/neovim/lspconfig.lua diff --git a/custom/brave-nightly/default.nix b/custom/brave-nightly/default.nix index 16f0436..012c351 100644 --- a/custom/brave-nightly/default.nix +++ b/custom/brave-nightly/default.nix @@ -1,124 +1,167 @@ -{ lib, stdenv, fetchurl, wrapGAppsHook, makeWrapper -, dpkg -, alsa-lib -, at-spi2-atk -, at-spi2-core -, atk -, cairo -, cups -, dbus -, expat -, fontconfig -, freetype -, gdk-pixbuf -, glib -, gnome -, gsettings-desktop-schemas -, gtk3 -, libuuid -, libdrm -, libX11 -, libXcomposite -, libXcursor -, libXdamage -, libXext -, libXfixes -, libXi -, libxkbcommon -, libXrandr -, libXrender -, libXScrnSaver -, libxshmfence -, libXtst -, mesa -, nspr -, nss -, pango -, pipewire -, udev -, wayland -, xorg -, zlib -, xdg-utils -, snappy +{ + lib, + stdenv, + fetchurl, + wrapGAppsHook, + makeWrapper, + dpkg, + alsa-lib, + at-spi2-atk, + at-spi2-core, + atk, + cairo, + cups, + dbus, + expat, + fontconfig, + freetype, + gdk-pixbuf, + glib, + gnome, + gsettings-desktop-schemas, + gtk3, + libuuid, + libdrm, + libX11, + libXcomposite, + libXcursor, + libXdamage, + libXext, + libXfixes, + libXi, + libxkbcommon, + libXrandr, + libXrender, + libXScrnSaver, + libxshmfence, + libXtst, + mesa, + nspr, + nss, + pango, + pipewire, + udev, + wayland, + xorg, + zlib, + xdg-utils, + snappy, + # command line arguments which are always set e.g "--disable-gpu" + commandLineArgs ? "", + # Necessary for USB audio devices. + pulseSupport ? stdenv.isLinux, + libpulseaudio, + # For GPU acceleration support on Wayland (without the lib it doesn't seem to work) + libGL, + # For video acceleration via VA-API (--enable-features=VaapiVideoDecoder,VaapiVideoEncoder) + libvaSupport ? stdenv.isLinux, + libva, + enableVideoAcceleration ? libvaSupport, + # For Vulkan support (--enable-features=Vulkan); disabled by default as it seems to break VA-API + vulkanSupport ? false, + addOpenGLRunpath, + enableVulkan ? vulkanSupport, +}: let + inherit + (lib) + optional + optionals + makeLibraryPath + makeSearchPathOutput + makeBinPath + optionalString + strings + escapeShellArg + ; -# command line arguments which are always set e.g "--disable-gpu" -, commandLineArgs ? "" - -# Necessary for USB audio devices. -, pulseSupport ? stdenv.isLinux -, libpulseaudio - -# For GPU acceleration support on Wayland (without the lib it doesn't seem to work) -, libGL - -# For video acceleration via VA-API (--enable-features=VaapiVideoDecoder,VaapiVideoEncoder) -, libvaSupport ? stdenv.isLinux -, libva -, enableVideoAcceleration ? libvaSupport - -# For Vulkan support (--enable-features=Vulkan); disabled by default as it seems to break VA-API -, vulkanSupport ? false -, addOpenGLRunpath -, enableVulkan ? vulkanSupport -}: - -let - inherit (lib) optional optionals makeLibraryPath makeSearchPathOutput makeBinPath - optionalString strings escapeShellArg; - - deps = [ - alsa-lib at-spi2-atk at-spi2-core atk cairo cups dbus expat - fontconfig freetype gdk-pixbuf glib gtk3 libdrm libX11 libGL - libxkbcommon libXScrnSaver libXcomposite libXcursor libXdamage - libXext libXfixes libXi libXrandr libXrender libxshmfence - libXtst libuuid mesa nspr nss pango pipewire udev wayland - xorg.libxcb zlib snappy - ] + deps = + [ + alsa-lib + at-spi2-atk + at-spi2-core + atk + cairo + cups + dbus + expat + fontconfig + freetype + gdk-pixbuf + glib + gtk3 + libdrm + libX11 + libGL + libxkbcommon + libXScrnSaver + libXcomposite + libXcursor + libXdamage + libXext + libXfixes + libXi + libXrandr + libXrender + libxshmfence + libXtst + libuuid + mesa + nspr + nss + pango + pipewire + udev + wayland + xorg.libxcb + zlib + snappy + ] ++ optional pulseSupport libpulseaudio ++ optional libvaSupport libva; rpath = makeLibraryPath deps + ":" + makeSearchPathOutput "lib" "lib64" deps; binpath = makeBinPath deps; - enableFeatures = optionals enableVideoAcceleration [ "VaapiVideoDecoder" "VaapiVideoEncoder" ] + enableFeatures = + optionals enableVideoAcceleration ["VaapiVideoDecoder" "VaapiVideoEncoder"] ++ optional enableVulkan "Vulkan"; - # The feature disable is needed for VAAPI to work correctly: https://github.com/brave/brave-browser/issues/20935 + # The feature disable is needed for VAAPI to work correctly: https://github.com/brave/brave-browser/issues/20935 disableFeatures = optional enableVideoAcceleration "UseChromeOSDirectVideoDecoder"; braveChannel = "nightly"; in + stdenv.mkDerivation rec { + pname = "brave-${braveChannel}"; + version = "1.52.54"; -stdenv.mkDerivation rec { - pname = "brave-${braveChannel}"; - version = "1.52.54"; + src = fetchurl { + url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser-${braveChannel}_${version}_amd64.deb"; + sha256 = "sha256-k9Vxk9e9514II78pe0FPRNNXwSHKRqLigqefSOmNVjg="; + }; - src = fetchurl { - url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser-${braveChannel}_${version}_amd64.deb"; - sha256 = "sha256-k9Vxk9e9514II78pe0FPRNNXwSHKRqLigqefSOmNVjg="; - }; + dontConfigure = true; + dontBuild = true; + dontPatchELF = true; + doInstallCheck = true; - dontConfigure = true; - dontBuild = true; - dontPatchELF = true; - doInstallCheck = true; + nativeBuildInputs = [ + dpkg + (wrapGAppsHook.override {inherit makeWrapper;}) + ]; - nativeBuildInputs = [ - dpkg - (wrapGAppsHook.override { inherit makeWrapper; }) - ]; + buildInputs = [ + # needed for GSETTINGS_SCHEMAS_PATH + glib + gsettings-desktop-schemas + gtk3 - buildInputs = [ - # needed for GSETTINGS_SCHEMAS_PATH - glib gsettings-desktop-schemas gtk3 + # needed for XDG_ICON_DIRS + gnome.adwaita-icon-theme + ]; - # needed for XDG_ICON_DIRS - gnome.adwaita-icon-theme - ]; + unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner"; - unpackPhase = "dpkg-deb --fsys-tarfile $src | tar -x --no-same-permissions --no-same-owner"; - - installPhase = '' + installPhase = '' runHook preInstall mkdir -p $out $out/bin @@ -164,47 +207,47 @@ stdenv.mkDerivation rec { ln -sf ${xdg-utils}/bin/xdg-mime $out/opt/brave.com/brave-${braveChannel}/xdg-mime runHook postInstall - ''; - - preFixup = '' - # Add command line args to wrapGApp. - gappsWrapperArgs+=( - --prefix LD_LIBRARY_PATH : ${rpath} - --prefix PATH : ${binpath} - --suffix PATH : ${lib.makeBinPath [ xdg-utils ]} - ${optionalString (enableFeatures != []) '' - --add-flags "--enable-features=${strings.concatStringsSep "," enableFeatures}" - ''} - ${optionalString (disableFeatures != []) '' - --add-flags "--disable-features=${strings.concatStringsSep "," disableFeatures}" - ''} - --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" - ${optionalString vulkanSupport '' - --prefix XDG_DATA_DIRS : "${addOpenGLRunpath.driverLink}/share" - ''} - --add-flags ${escapeShellArg commandLineArgs} - ) - ''; - - installCheckPhase = '' - # Bypass upstream wrapper which suppresses errors - $out/opt/brave.com/brave-${braveChannel}/brave-browser-${braveChannel} --version - ''; - - passthru.updateScript = ./update.sh; - - meta = with lib; { - homepage = "https://brave.com/"; - description = "Privacy-oriented browser for Desktop and Laptop computers"; - changelog = "https://github.com/brave/brave-browser/blob/master/CHANGELOG_DESKTOP.md#" + replaceStrings [ "." ] [ "" ] version; - longDescription = '' - Brave browser blocks the ads and trackers that slow you down, - chew up your bandwidth, and invade your privacy. Brave lets you - contribute to your favorite creators automatically. ''; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - license = licenses.mpl20; - maintainers = with maintainers; [ uskudnik rht jefflabonte nasirhm ]; - platforms = [ "x86_64-linux" ]; - }; -} \ No newline at end of file + + preFixup = '' + # Add command line args to wrapGApp. + gappsWrapperArgs+=( + --prefix LD_LIBRARY_PATH : ${rpath} + --prefix PATH : ${binpath} + --suffix PATH : ${lib.makeBinPath [xdg-utils]} + ${optionalString (enableFeatures != []) '' + --add-flags "--enable-features=${strings.concatStringsSep "," enableFeatures}" + ''} + ${optionalString (disableFeatures != []) '' + --add-flags "--disable-features=${strings.concatStringsSep "," disableFeatures}" + ''} + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" + ${optionalString vulkanSupport '' + --prefix XDG_DATA_DIRS : "${addOpenGLRunpath.driverLink}/share" + ''} + --add-flags ${escapeShellArg commandLineArgs} + ) + ''; + + installCheckPhase = '' + # Bypass upstream wrapper which suppresses errors + $out/opt/brave.com/brave-${braveChannel}/brave-browser-${braveChannel} --version + ''; + + passthru.updateScript = ./update.sh; + + meta = with lib; { + homepage = "https://brave.com/"; + description = "Privacy-oriented browser for Desktop and Laptop computers"; + changelog = "https://github.com/brave/brave-browser/blob/master/CHANGELOG_DESKTOP.md#" + replaceStrings ["."] [""] version; + longDescription = '' + Brave browser blocks the ads and trackers that slow you down, + chew up your bandwidth, and invade your privacy. Brave lets you + contribute to your favorite creators automatically. + ''; + sourceProvenance = with sourceTypes; [binaryNativeCode]; + license = licenses.mpl20; + maintainers = with maintainers; [uskudnik rht jefflabonte nasirhm]; + platforms = ["x86_64-linux"]; + }; + } diff --git a/custom/lf-sixel/default.nix b/custom/lf-sixel/default.nix index aec00be..09229bf 100644 --- a/custom/lf-sixel/default.nix +++ b/custom/lf-sixel/default.nix @@ -1,10 +1,10 @@ -{ lib -, stdenv -, buildGoModule -, fetchFromGitHub -, installShellFiles +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + installShellFiles, }: - buildGoModule rec { pname = "lf"; version = "28-1"; @@ -18,13 +18,13 @@ buildGoModule rec { vendorHash = "sha256-oIIyQbw42+B6T6Qn6nIV62Xr+8ms3tatfFI8ocYNr0A="; - nativeBuildInputs = [ installShellFiles ]; + nativeBuildInputs = [installShellFiles]; - ldflags = [ "-s" "-w" "-X main.gVersion=r${version}" ]; + ldflags = ["-s" "-w" "-X main.gVersion=r${version}"]; # Force the use of the pure-go implementation of the os/user library. # Relevant issue: https://github.com/gokcehan/lf/issues/191 - tags = lib.optionals (!stdenv.isDarwin) [ "osusergo" ]; + tags = lib.optionals (!stdenv.isDarwin) ["osusergo"]; postInstall = '' install -D --mode=444 lf.desktop $out/share/applications/lf.desktop @@ -44,6 +44,6 @@ buildGoModule rec { changelog = "https://github.com/gokcehan/lf/releases/tag/r${version}"; license = licenses.mit; platforms = platforms.unix; - maintainers = with maintainers; [ dotlambda ]; + maintainers = with maintainers; [dotlambda]; }; } diff --git a/flake.nix b/flake.nix index f4a598b..50879aa 100644 --- a/flake.nix +++ b/flake.nix @@ -13,24 +13,28 @@ stylix.url = "github:danth/stylix"; }; - outputs = { nixpkgs, home-manager, hyprland, stylix, ... } @inputs : - let - system = "x86_64-linux"; - lib = nixpkgs.lib; - mkConf = import ./lib/mkconf.nix; + outputs = { + nixpkgs, + home-manager, + hyprland, + stylix, + ... + } @ inputs: let + system = "x86_64-linux"; + lib = nixpkgs.lib; + mkConf = import ./lib/mkconf.nix; - user = "tristan"; - userName = "Tristan Beedell"; - in - { - nixosConfigurations = { - zenix = mkConf "zenix" { - inherit inputs nixpkgs system user userName home-manager; - }; - FCS-Tristan-Nixbook = mkConf "work" { - inherit inputs nixpkgs system user userName home-manager; - work = true; - }; + user = "tristan"; + userName = "Tristan Beedell"; + in { + nixosConfigurations = { + zenix = mkConf "zenix" { + inherit inputs nixpkgs system user userName home-manager; + }; + FCS-Tristan-Nixbook = mkConf "work" { + inherit inputs nixpkgs system user userName home-manager; + work = true; }; }; + }; } diff --git a/global/home.nix b/global/home.nix index 3db58d4..53ac0ac 100644 --- a/global/home.nix +++ b/global/home.nix @@ -1,4 +1,10 @@ -{ config, pkgs, name, lib, ... }: +{ + config, + pkgs, + name, + lib, + ... +}: # https://nix-community.github.io/home-manager/options.html let my-deps = { @@ -21,9 +27,8 @@ let glow = "${pkgs.glow}/bin/glow"; ffmpegthumbnailer = "${pkgs.ffmpegthumbnailer}/bin/ffmpegthumbnailer"; }; - lf-sixel = pkgs.callPackage ../custom/lf-sixel/. { }; -in -{ + lf-sixel = pkgs.callPackage ../custom/lf-sixel/. {}; +in { programs.home-manager.enable = true; home.username = "tristan"; @@ -31,7 +36,7 @@ in xdg.userDirs.enable = true; - home.packages = (with pkgs; [ + home.packages = with pkgs; [ libnotify dig jq @@ -66,7 +71,7 @@ in desktopName = "Logseq"; exec = "${logseq}/bin/logseq --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --disable-gpu"; }) - ]); + ]; programs.fish = { enable = true; @@ -149,108 +154,108 @@ in drag = "%${pkgs.ripdrag}/bin/ripdrag -x \"$fx\""; trash = "%${pkgs.trash-cli}/bin/trash-put \"$fx\""; open = "$set -f; ${pkgs.ranger}/bin/rifle -p 0 \"$fx\""; - open-with = ''''${{ - set -f - ${pkgs.ranger}/bin/rifle -l "$fx" - read -p "Open with: " method - ${pkgs.ranger}/bin/rifle -p "$method" "$fx" - }}''; - bulk-rename = ''''${{ - old="$(mktemp)" - new="$(mktemp)" - if [ -n "$fs" ]; then - fs="$(basename -a $fs)" - else - fs="$(ls)" - fi - printf '%s\n' "$fs" >"$old" - printf '%s\n' "$fs" >"$new" - $EDITOR "$new" - [ "$(wc -l < "$new")" -ne "$(wc -l < "$old")" ] && exit - paste "$old" "$new" | while IFS= read -r names; do - src="$(printf '%s' "$names" | cut -f1)" - dst="$(printf '%s' "$names" | cut -f2)" - if [ "$src" = "$dst" ] || [ -e "$dst" ]; then - continue - fi - mv -- "$src" "$dst" - done - rm -- "$old" "$new" - lf -remote "send $id unselect" - }}''; + open-with = '' ''${{ + set -f + ${pkgs.ranger}/bin/rifle -l "$fx" + read -p "Open with: " method + ${pkgs.ranger}/bin/rifle -p "$method" "$fx" + }}''; + bulk-rename = '' ''${{ + old="$(mktemp)" + new="$(mktemp)" + if [ -n "$fs" ]; then + fs="$(basename -a $fs)" + else + fs="$(ls)" + fi + printf '%s\n' "$fs" >"$old" + printf '%s\n' "$fs" >"$new" + $EDITOR "$new" + [ "$(wc -l < "$new")" -ne "$(wc -l < "$old")" ] && exit + paste "$old" "$new" | while IFS= read -r names; do + src="$(printf '%s' "$names" | cut -f1)" + dst="$(printf '%s' "$names" | cut -f2)" + if [ "$src" = "$dst" ] || [ -e "$dst" ]; then + continue + fi + mv -- "$src" "$dst" + done + rm -- "$old" "$new" + lf -remote "send $id unselect" + }}''; }; programs.lf.previewer.source = pkgs.writeShellScript "preview" '' - image () { - echo "$1" - ${my-deps.chafa} "$1" -f sixel -s "$(($2/2))x$3" | sed 's/#/\n#/g' - ${ my-deps.exiftool } "$1" - } + image () { + echo "$1" + ${my-deps.chafa} "$1" -f sixel -s "$(($2/2))x$3" | sed 's/#/\n#/g' + ${my-deps.exiftool} "$1" + } - batted () { - cat "$@" - } - - mkdir -p "$HOME/.cache/lf" - CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))" + batted () { + cat "$@" + } - case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in - *.tgz|*.tar.gz) tar tzf "$1" ;; - *.tar.bz2|*.tbz2) tar tjf "$1" ;; - *.tar.txz|*.txz) xz --list "$1" ;; - *.tar) tar tf "$1" ;; - *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;; - *.rar) unrar l "$1" ;; - *.md) ${my-deps.glow} -s dark "$1" ;; - *.7z) 7z l "$1" ;; - *.[1-8]) man "$1" | col -b ;; - *.o) nm "$1";; - *.torrent) transmission-show "$1" ;; - *.iso) iso-info --no-header -l "$1" ;; - *.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;; - *.doc) catdoc "$1" ;; - *.docx) docx2txt "$1" - ;; - *.xml|*.html) w3m -dump "$1";; - *.xls|*.xlsx) - ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batted --language=csv - ;; - *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka) - ${ my-deps.exiftool } "$1" - ;; - *.pdf) - [ ! -f "$CACHE.jpg" ] && \ - pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" - ;; - *.epub) - [ ! -f "$CACHE" ] && \ - epub-thumbnailer "$1" "$CACHE" 1024 - image "$CACHE" "$2" "$3" "$4" "$5" - ;; - *.cbz|*.cbr|*.cbt) - [ ! -f "$CACHE" ] && \ - comicthumb "$1" "$CACHE" 1024 - image "$CACHE" "$2" "$3" "$4" "$5" - ;; - *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) - [ ! -f "$CACHE.jpg" ] && \ - ${my-deps.ffmpegthumbnailer} -i "$1" -o "$CACHE.jpg" -s 0 -q 5 - image "$CACHE.jpg" "$2" "$3" "$4" "$5" - ;; - *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.jfif) - image "$1" "$2" "$3" "$4" "$5" - ;; - *.svg) - [ ! -f "$CACHE.jpg" ] && \ - convert "$1" "$CACHE.jpg" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" - ;; - *.ino) - batted --language=cpp "$1" - ;; - *) - batted "$1" - ;; - esac + mkdir -p "$HOME/.cache/lf" + CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))" + + case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in + *.tgz|*.tar.gz) tar tzf "$1" ;; + *.tar.bz2|*.tbz2) tar tjf "$1" ;; + *.tar.txz|*.txz) xz --list "$1" ;; + *.tar) tar tf "$1" ;; + *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;; + *.rar) unrar l "$1" ;; + *.md) ${my-deps.glow} -s dark "$1" ;; + *.7z) 7z l "$1" ;; + *.[1-8]) man "$1" | col -b ;; + *.o) nm "$1";; + *.torrent) transmission-show "$1" ;; + *.iso) iso-info --no-header -l "$1" ;; + *.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;; + *.doc) catdoc "$1" ;; + *.docx) docx2txt "$1" - ;; + *.xml|*.html) w3m -dump "$1";; + *.xls|*.xlsx) + ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batted --language=csv + ;; + *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka) + ${my-deps.exiftool} "$1" + ;; + *.pdf) + [ ! -f "$CACHE.jpg" ] && \ + pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" + ;; + *.epub) + [ ! -f "$CACHE" ] && \ + epub-thumbnailer "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; + *.cbz|*.cbr|*.cbt) + [ ! -f "$CACHE" ] && \ + comicthumb "$1" "$CACHE" 1024 + image "$CACHE" "$2" "$3" "$4" "$5" + ;; + *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) + [ ! -f "$CACHE.jpg" ] && \ + ${my-deps.ffmpegthumbnailer} -i "$1" -o "$CACHE.jpg" -s 0 -q 5 + image "$CACHE.jpg" "$2" "$3" "$4" "$5" + ;; + *.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.jfif) + image "$1" "$2" "$3" "$4" "$5" + ;; + *.svg) + [ ! -f "$CACHE.jpg" ] && \ + convert "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" + ;; + *.ino) + batted --language=cpp "$1" + ;; + *) + batted "$1" + ;; + esac ''; home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ"; @@ -334,6 +339,4 @@ in pdf-engine = "xelatex"; }; }; - } - diff --git a/global/system.nix b/global/system.nix index 84b7159..fa92cda 100644 --- a/global/system.nix +++ b/global/system.nix @@ -1,22 +1,23 @@ # https://search.nixos.org/options - -user: { config, pkgs, lib, ... }: -{ - +user: { + config, + pkgs, + lib, + ... +}: { home-manager.users.${user}.imports = [ ./home.nix ]; nix.settings = { - experimental-features = [ "nix-command" "flakes" ]; + experimental-features = ["nix-command" "flakes"]; }; nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ]; - - nix.settings.trusted-users = [ "root" user ]; + nix.settings.trusted-users = ["root" user]; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -43,27 +44,42 @@ user: { config, pkgs, lib, ... }: jack.enable = true; }; # pipewire raop - networking.firewall.allowedUDPPorts = [ 6002 6001 ]; + networking.firewall.allowedUDPPorts = [6002 6001]; # network streaming - networking.firewall.allowedTCPPorts = [ 4713 ]; + networking.firewall.allowedTCPPorts = [4713]; # kde connect - networking.firewall.allowedTCPPortRanges = [{ from = 1714; to = 1764; }]; - networking.firewall.allowedUDPPortRanges = [{ from = 1714; to = 1764; }]; + networking.firewall.allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; + networking.firewall.allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } + ]; networking.firewall.interfaces.tailscale0 = { - allowedTCPPortRanges = [{ from = 0; to = 65535; }]; + allowedTCPPortRanges = [ + { + from = 0; + to = 65535; + } + ]; }; services.avahi.enable = true; - security.pam.services.swaylock = { }; + security.pam.services.swaylock = {}; security.polkit.enable = true; systemd.user.services.polkit-gnome-authentication-agent-1 = { description = "polkit-gnome-authentication-agent-1"; - wantedBy = [ "graphical-session.target" ]; - wants = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; + wantedBy = ["graphical-session.target"]; + wants = ["graphical-session.target"]; + after = ["graphical-session.target"]; serviceConfig = { Type = "simple"; ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; @@ -97,7 +113,7 @@ user: { config, pkgs, lib, ... }: users.users.${user} = { isNormalUser = true; - extraGroups = [ "wheel" "video" "networkmanager" ]; + extraGroups = ["wheel" "video" "networkmanager"]; initialPassword = "pass"; shell = pkgs.fish; }; @@ -119,30 +135,6 @@ user: { config, pkgs, lib, ... }: trash-cli wget unzip - (neovim.override { - vimAlias = true; - configure = { - packages.myPlugins = with pkgs.vimPlugins; { - start = [ vim-surround vim-commentary vim-nix ]; - opt = [ ]; - }; - customRC = '' - vnoremap * y/\V=escape(@",'/\') - vnoremap "ry:%s/=escape(@r,'/\') - vnoremap A :norm A - set number - set rnu - set ignorecase - set smartcase - set mouse=a - set path=.,** - let g:netrw_banner=0 - let g:netrw_liststyle=3 - set undofile - set undodir=~/.local/share/nvim/undo - ''; - }; - }) ]; services.dbus.enable = true; @@ -184,6 +176,4 @@ user: { config, pkgs, lib, ... }: services.blueman.enable = true; services.prometheus.exporters.node.enable = true; - } - diff --git a/hardware/displays.nix b/hardware/displays.nix index 553165f..cf23c93 100644 --- a/hardware/displays.nix +++ b/hardware/displays.nix @@ -1,20 +1,26 @@ -{ config, ... }: - -{ +{config, ...}: { displays = { enable = true; displays = [ { name = "DP-1"; description = "HP Inc. HP 24x 1CR9500W9Q"; - resolution = { x = 1920; y = 1080; freq = 144; }; + resolution = { + x = 1920; + y = 1080; + freq = 144; + }; position.x = 0; position.y = 0; wallpaper = "/home/tristan/Pictures/backgrounds/demonslayer.jpg"; } { name = "HDMI-A-1"; - resolution = { x = 1920; y = 1080; freq = 60; }; + resolution = { + x = 1920; + y = 1080; + freq = 60; + }; position = { x = 1920; y = 0; diff --git a/hardware/work.nix b/hardware/work.nix index f71715b..c630028 100644 --- a/hardware/work.nix +++ b/hardware/work.nix @@ -1,23 +1,25 @@ -{user}: { config, lib, pkgs, modulesPath, ... }: +{user}: { + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ./displays.nix + ]; -{ - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ./displays.nix - ]; + boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci"]; + boot.initrd.kernelModules = ["uas" "usbcore" "usb_storage" "vfat" "nls_cp437" "nls_iso8859_1"]; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ "uas" "usbcore" "usb_storage" "vfat" "nls_cp437" "nls_iso8859_1" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { - device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7"; - fsType = "btrfs"; - options = [ "subvol=@" "compress=zstd" "autodefrag" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7"; + fsType = "btrfs"; + options = ["subvol=@" "compress=zstd" "autodefrag"]; + }; boot.initrd.postDeviceCommands = pkgs.lib.mkBefore '' mkdir -m 0755 -p /key @@ -40,27 +42,24 @@ preLVM = false; }; - fileSystems."/home" = - { - device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7"; - fsType = "btrfs"; - options = [ "subvol=@home" "compress=zstd" "autodefrag" ]; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7"; + fsType = "btrfs"; + options = ["subvol=@home" "compress=zstd" "autodefrag"]; + }; - fileSystems."/swap" = - { - device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7"; - fsType = "btrfs"; - options = [ "subvol=@swap" ]; - }; + fileSystems."/swap" = { + device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7"; + fsType = "btrfs"; + options = ["subvol=@swap"]; + }; - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/EED9-A165"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/EED9-A165"; + fsType = "vfat"; + }; - swapDevices = [{ device = "/swap/swapfile"; }]; + swapDevices = [{device = "/swap/swapfile";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's @@ -83,18 +82,19 @@ libvdpau-va-gl ]; }; - + roles.laptop.enable = true; - + networking.hostName = "FCS-Tristan-Nixbook"; system.stateVersion = "22.11"; # do not change - home-manager.users.${user}.imports = [{ - home.stateVersion = "22.05"; - - programs.waybar.settings.mainBar."hyprland/workspaces".persistent_workspaces = { - eDP-1 = 5; - }; - }]; + home-manager.users.${user}.imports = [ + { + home.stateVersion = "22.05"; + programs.waybar.settings.mainBar."hyprland/workspaces".persistent_workspaces = { + eDP-1 = 5; + }; + } + ]; } diff --git a/hardware/zenix.nix b/hardware/zenix.nix index dcd322c..c1ec13a 100644 --- a/hardware/zenix.nix +++ b/hardware/zenix.nix @@ -1,23 +1,25 @@ -{user}: { config, lib, pkgs, modulesPath, ... }: +{user}: { + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ./displays.nix + ]; -{ - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ./displays.nix - ]; + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = ["uas" "usbcore" "usb_storage" "vfat" "nls_cp437" "nls_iso8859_1"]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ "uas" "usbcore" "usb_storage" "vfat" "nls_cp437" "nls_iso8859_1" ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { - device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909"; - fsType = "btrfs"; - options = [ "subvol=@" "compress=zstd" "autodefrag" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909"; + fsType = "btrfs"; + options = ["subvol=@" "compress=zstd" "autodefrag"]; + }; boot.initrd.postDeviceCommands = pkgs.lib.mkBefore '' mkdir -m 0755 -p /key @@ -43,21 +45,18 @@ preLVM = false; }; - fileSystems."/home" = - { - device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909"; - fsType = "btrfs"; - options = [ "subvol=@home" "compress=zstd" "autodefrag" ]; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909"; + fsType = "btrfs"; + options = ["subvol=@home" "compress=zstd" "autodefrag"]; + }; - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/FE7E-0DE3"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/FE7E-0DE3"; + fsType = "vfat"; + }; - swapDevices = - [{ device = "/dev/disk/by-uuid/da57b489-ab77-4830-b710-9f96cf43d053"; }]; + swapDevices = [{device = "/dev/disk/by-uuid/da57b489-ab77-4830-b710-9f96cf43d053";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's @@ -68,9 +67,9 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - + hardware.keyboard.zsa.enable = true; - + networking.hostName = "zenix"; services.openssh.enable = true; @@ -84,24 +83,24 @@ enable = true; }; }; - - home-manager.users.${user}.imports = [{ - home.stateVersion = "22.05"; - wayland.windowManager.hyprland = { - extraConfig = '' - workspace = DP-1, 1 - workspace = 1, monitor:DP-1 - workspace = 2, monitor:DP-1 - workspace = 3, monitor:DP-1 - workspace = 4, monitor:DP-1 - workspace = 5, monitor:DP-1 - ''; - }; - programs.waybar.settings.mainBar."hyprland/workspaces".persistent_workspaces = { - DP-1 = 5; - }; - - }]; + home-manager.users.${user}.imports = [ + { + home.stateVersion = "22.05"; + wayland.windowManager.hyprland = { + extraConfig = '' + workspace = DP-1, 1 + workspace = 1, monitor:DP-1 + workspace = 2, monitor:DP-1 + workspace = 3, monitor:DP-1 + workspace = 4, monitor:DP-1 + workspace = 5, monitor:DP-1 + ''; + }; + programs.waybar.settings.mainBar."hyprland/workspaces".persistent_workspaces = { + DP-1 = 5; + }; + } + ]; } diff --git a/lib/home.nix b/lib/home.nix index 92b4d5c..2f9ec88 100644 --- a/lib/home.nix +++ b/lib/home.nix @@ -1,29 +1,32 @@ -{ user -, name -, work ? false -, displays ? [ ] -, userName -, ... -}: -{ config, pkgs, ... }: { + user, + name, + work ? false, + displays ? [], + userName, + ... +}: { + config, + pkgs, + ... +}: { imports = [ - (import ./modules/terminal.nix { inherit user; }) - (import ./modules/scripts.nix { inherit user; }) - (import ./modules/editor.nix { inherit user; }) - (import ./modules/keyboard.nix { inherit user; }) - (import ./modules/display.nix { inherit user; }) - (import ./modules/work.nix { inherit user; }) - (import ./modules/menu.nix { inherit user; }) - (import ./modules/email.nix { inherit user userName; }) - (import ./modules/mpd.nix { inherit user; }) - (import ./modules/git.nix { inherit user userName; }) - (import ./modules/laptop.nix { inherit user; }) - (import ./modules/dev.nix { inherit user; }) - (import ./modules/personal.nix { inherit user; }) - (import ./modules/gamer.nix { inherit user; }) - (import ./modules/wayland.nix { inherit user; }) - (import ../hardware/${name}.nix { inherit user; }) + (import ./modules/terminal.nix {inherit user;}) + (import ./modules/scripts.nix {inherit user;}) + (import ./modules/editor.nix {inherit user;}) + (import ./modules/keyboard.nix {inherit user;}) + (import ./modules/display.nix {inherit user;}) + (import ./modules/work.nix {inherit user;}) + (import ./modules/menu.nix {inherit user;}) + (import ./modules/email.nix {inherit user userName;}) + (import ./modules/mpd.nix {inherit user;}) + (import ./modules/git.nix {inherit user userName;}) + (import ./modules/laptop.nix {inherit user;}) + (import ./modules/dev.nix {inherit user;}) + (import ./modules/personal.nix {inherit user;}) + (import ./modules/gamer.nix {inherit user;}) + (import ./modules/wayland.nix {inherit user;}) + (import ../hardware/${name}.nix {inherit user;}) ./scripts.nix (import ../global/system.nix user) ]; @@ -35,5 +38,4 @@ roles.personal.enable = !work; roles.mpd.enable = true; programs.editor.neovim = true; - } diff --git a/lib/mkapp.nix b/lib/mkapp.nix index 6b24888..1cc0039 100644 --- a/lib/mkapp.nix +++ b/lib/mkapp.nix @@ -1,5 +1,10 @@ -name: { pkgs, app-id, browser, desktopName, ... }: - +name: { + pkgs, + app-id, + browser, + desktopName, + ... +}: pkgs.makeDesktopItem { name = "${name}"; desktopName = "${desktopName}"; diff --git a/lib/mkconf.nix b/lib/mkconf.nix index 9f822ef..491cdfd 100644 --- a/lib/mkconf.nix +++ b/lib/mkconf.nix @@ -1,23 +1,25 @@ -name: -{ nixpkgs -, inputs -, home-manager -, system -, user -, laptop ? false -, work ? false -, userName -, ... +name: { + nixpkgs, + inputs, + home-manager, + system, + user, + laptop ? false, + work ? false, + userName, + ... }: - nixpkgs.lib.nixosSystem rec { - specialArgs = { inherit inputs; }; + specialArgs = {inherit inputs;}; inherit system; modules = [ - - ({ inputs, pkgs, ... }: { + ({ + inputs, + pkgs, + ... + }: { programs.hyprland = { enable = true; package = inputs.hyprland.packages.${pkgs.system}.hyprland; @@ -25,12 +27,12 @@ nixpkgs.lib.nixosSystem rec { }) { nix.settings = { - 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="]; }; } inputs.stylix.nixosModules.stylix - ({ pkgs, ... }: { + ({pkgs, ...}: { stylix.image = ../images/demonslayer.png; stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; }) @@ -39,6 +41,6 @@ nixpkgs.lib.nixosSystem rec { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; } - (import ./home.nix { inherit inputs user userName name laptop work; }) + (import ./home.nix {inherit inputs user userName name laptop work;}) ]; } diff --git a/lib/modules/dev.nix b/lib/modules/dev.nix index 5bd7946..892b3d9 100644 --- a/lib/modules/dev.nix +++ b/lib/modules/dev.nix @@ -1,9 +1,12 @@ -{ user, ... }: { lib, pkgs, config, ... }: -with lib; -let +{user, ...}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.roles.dev; -in -{ +in { options.roles = { dev = { enable = mkEnableOption "editor"; @@ -14,14 +17,16 @@ in programs.editor.enable = true; roles.git.enable = true; programs.terminal.enable = true; - home-manager.users.${user}.imports = [{ - home.packages = (with pkgs; [ - insomnia - dbeaver - ansible - tig - fx - ]); - }]; + home-manager.users.${user}.imports = [ + { + home.packages = with pkgs; [ + insomnia + dbeaver + ansible + tig + fx + ]; + } + ]; }; } diff --git a/lib/modules/display.nix b/lib/modules/display.nix index 7257c79..feaeff9 100644 --- a/lib/modules/display.nix +++ b/lib/modules/display.nix @@ -1,77 +1,101 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.displays; renderDisplaysForHyprland = displays: (map displayHyprlandSetting displays); - displayHyprlandSetting = display: specificDisplay display + - ", " + resToString display.resolution + - ", " + positionToHyprlandString display.position + - ", " + toString display.scaling + - ", " + "transform," + toString display.rotation; + displayHyprlandSetting = display: + specificDisplay display + + ", " + + resToString display.resolution + + ", " + + positionToHyprlandString display.position + + ", " + + toString display.scaling + + ", " + + "transform," + + toString display.rotation; - swaybgJob = displays: - { - Unit = { - Description = "SwayBG"; - }; - Service = { - ExecStart = "${pkgs.swaybg}/bin/swaybg " + - concatStringsSep " " (map swaybgCmd displays); - }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; + swaybgJob = displays: { + Unit = { + Description = "SwayBG"; }; + Service = { + ExecStart = + "${pkgs.swaybg}/bin/swaybg " + + concatStringsSep " " (map swaybgCmd displays); + }; + Install = { + WantedBy = ["graphical-session.target"]; + }; + }; swaybgCmd = display: - if (display.wallpaper != "") then "-o ${display.name} -i ${display.wallpaper} -m fill" else ""; + if (display.wallpaper != "") + then "-o ${display.name} -i ${display.wallpaper} -m fill" + else ""; specificDisplay = display: if display.description == "" then display.name else "desc:" + display.description; - positionToHyprlandString = { x, y }: - if (x == -1 || y == -1) then "auto" else toString x + "x" + toString y; + positionToHyprlandString = { + x, + y, + }: + if (x == -1 || y == -1) + then "auto" + else toString x + "x" + toString y; renderDisplaysForSway = displays: listToAttrs (map displaySwaySetting displays); displaySwaySetting = display: { name = display.name; - value = let res = display.resolution; in - { - mode = mkIf (!resUnset res) - "${toString res.x}x${toString res.y}@${toString res.freq}Hz"; - bg = display.wallpaper + " fill"; - scale = toString display.scaling; - }; + value = let + res = display.resolution; + in { + mode = + mkIf (!resUnset res) + "${toString res.x}x${toString res.y}@${toString res.freq}Hz"; + bg = display.wallpaper + " fill"; + scale = toString display.scaling; + }; }; - resolutionType = types.submodule ({ x, y, freq, ... }: - { - options = { - x = mkOption { - description = "x"; - type = types.int; - default = 0; - }; - y = mkOption { - description = "y"; - type = types.int; - default = 0; - }; - freq = mkOption { - description = "frequency"; - type = types.int; - default = 0; - }; + resolutionType = types.submodule ({ + x, + y, + freq, + ... + }: { + options = { + x = mkOption { + description = "x"; + type = types.int; + default = 0; }; - }); - displayType = types.submodule - ({ ... }: { + y = mkOption { + description = "y"; + type = types.int; + default = 0; + }; + freq = mkOption { + description = "frequency"; + type = types.int; + default = 0; + }; + }; + }); + displayType = + types.submodule + ({...}: { options = { name = mkOption { description = "name of the display"; @@ -91,7 +115,7 @@ let resolution = mkOption { description = "res"; type = resolutionType; - default = { }; + default = {}; }; position.x = mkOption { default = -1; @@ -108,36 +132,33 @@ let }; }); - resUnset = res: - (res.x == 0 || res.y == 0 || res.freq == 0); + resUnset = res: (res.x == 0 || res.y == 0 || res.freq == 0); resToString = res: if resUnset res then "preferred" else "${toString res.x}x${toString res.y}@${toString res.freq}"; - -in -{ - options.displays = - { - enable = mkEnableOption "manage displays"; - displays = mkOption { - type = types.listOf displayType; - default = [ ]; - }; +in { + options.displays = { + enable = mkEnableOption "manage displays"; + displays = mkOption { + type = types.listOf displayType; + default = []; }; + }; config = mkIf cfg.enable { home-manager.users.${user}.imports = [ { - wayland.windowManager.hyprland.settings.monitor = mkIf (cfg.displays != [ ]) + wayland.windowManager.hyprland.settings.monitor = + mkIf (cfg.displays != []) (renderDisplaysForHyprland cfg.displays); systemd.user.services.swaybg = swaybgJob cfg.displays; - wayland.windowManager.sway.config.output = mkIf (cfg.displays != [ ]) + wayland.windowManager.sway.config.output = + mkIf (cfg.displays != []) (renderDisplaysForSway cfg.displays); } ]; }; } - diff --git a/lib/modules/editor.nix b/lib/modules/editor.nix index e9ef01d..5984dd7 100644 --- a/lib/modules/editor.nix +++ b/lib/modules/editor.nix @@ -1,13 +1,16 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let editor = config.programs.editor; pkg = editor.package; terminal = config.programs.terminal.package; termcmd = "${terminal}/bin/${terminal.pname}"; menu = config.programs.menu.package + config.programs.menu.dmenuCommand; -in -{ +in { options.programs = { editor = { enable = mkEnableOption "editor"; @@ -19,92 +22,93 @@ in }; config = mkIf editor.enable { - home-manager.users.${user}.imports = [{ - programs.vscode = { - enable = true; - package = editor.package; - extensions = - if editor.neovim then with pkgs; [ - vscode-extensions.asvetliakov.vscode-neovim - ] else [ ]; - userSettings = { - "keyboard.dispatch" = "keyCode"; - "terminal.integrated.sendKeybindingsToShell" = true; - "aws.telemetry" = false; - "gitlens.telemetry.enabled" = false; - "redhat.telemetry.enabled" = false; - "cSpell.language" = "en,en-GB"; - } // (if editor.neovim then { - "vscode-neovim.neovimExecutablePaths.linux" = "${pkgs.neovim}/bin/nvim"; - "extensions.experimental.affinity" = { - "asvetliakov.vscode-neovim" = 1; - }; - } else { }); - }; - - programs.neovim = mkIf editor.neovim { - enable = true; - defaultEditor = true; - coc = { + home-manager.users.${user}.imports = [ + { + programs.vscode = { enable = true; - settings = { - languageserver = { - go = { - command = "${pkgs.gopls}/bin/gopls"; - filetypes = [ "go" ]; - }; - nix = { - command = "${pkgs.rnix-lsp}/bin/rnix-lsp"; - filetypes = [ "nix" ]; - }; - typescript = { - command = "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server"; - filetypes = [ "ts" "tsx" ]; - }; - }; - }; + package = editor.package; + extensions = + if editor.neovim + then + with pkgs; [ + vscode-extensions.asvetliakov.vscode-neovim + ] + else []; + userSettings = + { + "keyboard.dispatch" = "keyCode"; + "terminal.integrated.sendKeybindingsToShell" = true; + "aws.telemetry" = false; + "gitlens.telemetry.enabled" = false; + "redhat.telemetry.enabled" = false; + "cSpell.language" = "en,en-GB"; + } + // ( + if editor.neovim + then { + "vscode-neovim.neovimExecutablePaths.linux" = "${pkgs.neovim}/bin/nvim"; + "extensions.experimental.affinity" = { + "asvetliakov.vscode-neovim" = 1; + }; + } + else {} + ); }; - extraConfig = '' - vnoremap * y/\V=escape(@",'/\') - vnoremap "ry:%s/=escape(@r,'/\') - vnoremap A :norm A - noremap :CocCommand editor.action.formatDocument - set number - set rnu - set ignorecase - set smartcase - set mouse=a - set path=.,** - let g:netrw_banner=0 - let g:netrw_liststyle=3 - set undofile - set undodir=~/.local/share/nvim/undo + + programs.neovim = mkIf editor.neovim { + enable = true; + defaultEditor = true; + extraLuaConfig = '' + ${builtins.readFile ./neovim/config.lua} + ''; + extraPackages = with pkgs; [ + nodePackages_latest.typescript-language-server + vscode-langservers-extracted + gopls + nil + ]; + plugins = with pkgs.vimPlugins; [ + vim-surround + vim-commentary + { + plugin = telescope-nvim; + type = "lua"; + config = '' + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.live_grep, {}) + vim.keymap.set('n', 'fb', builtin.buffers, {}) + vim.keymap.set('n', 'fh', builtin.help_tags, {}) + ''; + } + { + plugin = nvim-lspconfig; + type = "lua"; + config = builtins.readFile ./neovim/lspconfig.lua; + } + firenvim + ]; + }; + } + ]; + + programs.scripts = [ + { + name = "open-code"; + text = '' + code_dir=~/Documents/code + cd $code_dir + repo=$({ ls && echo clone-repo; } | ${menu}) + case $repo in + clone-repo) + url=$(wl-paste) + ${termcmd} -e -- git clone "$url" ;; + *) [ -e "$repo" ] && ${pkg}/bin/${pkg.executableName} $repo ;; + esac ''; - plugins = with pkgs.vimPlugins; [ - vim-surround - vim-commentary - firenvim - ]; - }; - - }]; - - programs.scripts = [{ - name = "open-code"; - text = '' - code_dir=~/Documents/code - cd $code_dir - repo=$({ ls && echo clone-repo; } | ${menu}) - case $repo in - clone-repo) - url=$(wl-paste) - ${termcmd} -e -- git clone "$url" ;; - *) [ -e "$repo" ] && ${pkg}/bin/${pkg.executableName} $repo ;; - esac - ''; - install = false; - hotkeys = [{ key = "C"; }]; - }]; + install = false; + hotkeys = [{key = "C";}]; + } + ]; }; - } diff --git a/lib/modules/email.nix b/lib/modules/email.nix index f360724..4ae8abd 100644 --- a/lib/modules/email.nix +++ b/lib/modules/email.nix @@ -1,11 +1,17 @@ -{ user, userName }: { lib, pkgs, config, ... }: -with lib; -let +{ + user, + userName, +}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.roles.email; terminal = config.programs.terminal.package; termcmd = "${terminal}/bin/${terminal.pname}"; -in -{ +in { options.roles = { email = { enable = mkEnableOption "email settings"; @@ -20,7 +26,6 @@ in }; config = mkIf cfg.enable { - programs.scripts = [ { name = "email"; @@ -32,199 +37,200 @@ in } ]; - home-manager.users.${user}.imports = [{ - programs.git = { - userName = userName; - userEmail = cfg.email; - }; - - accounts.email.accounts.${cfg.email} = mkIf cfg.terminal { - notmuch.enable = true; - neomutt.enable = true; - aerc.enable = true; - mbsync.enable = true; - mbsync.create = "both"; - userName = cfg.email; - realName = userName; - address = cfg.email; - primary = true; - passwordCommand = "${pkgs.rbw}/bin/rbw get privateemail"; - smtp = { - host = "mail.privateemail.com"; - port = 465; - tls.enable = true; + home-manager.users.${user}.imports = [ + { + programs.git = { + userName = userName; + userEmail = cfg.email; }; - imap = { - host = "mail.privateemail.com"; - port = 993; - tls.enable = true; - }; - }; - - programs.notmuch.enable = cfg.terminal; - programs.neomutt = { - enable = cfg.terminal; - vimKeys = true; - sort = "reverse-date"; - sidebar.enable = true; - }; - programs.mbsync.enable = cfg.terminal; - services.mbsync.enable = cfg.terminal; - programs.aerc = { - enable = cfg.terminal; - extraBinds = '' - # Binds are of the form = - # To use '=' in a key sequence, substitute it with "Eq": "" - # If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit - = :prev-tab - = :next-tab - = :term - - [messages] - Q = :quit - - T = :toggle-threads - - j = :next - = :next - = :next 50% - = :next 100% - = :next -s 100% - - k = :prev - = :prev - = :prev 50% - = :prev - = :prev -s 100% - gg = :select 0 - G = :select -1 - - J = :next-folder - K = :prev-folder - - v = :mark -t - V = :mark -v - - f = :flag - F = :unflag - - t = :toggle-threads - - = :view - D = :mv Trash - - C = :compose - - Rr = :reply - Rq = :reply -q - rr = :reply -a - rq = :reply -aq - rt = :unflag:reply -a -Tthanks - Rt = :unflag:reply -qa -Tquoted_thanks - - a = :mv Archive - - c = :cf - $ = :term - ! = :term - | = :pipe - - ga = :flag:pipe -mb git am -3 - gp = :term git push - gl = :term git log - - / = :search - \ = :filter - n = :next-result - N = :prev-result - - o = :term mbsync -a - q = :quit - - [view] - / = :toggle-key-passthrough/ - q = :close - | = :pipe -m - S = :save - H = :toggle-headers - D = :mv Trash - = :prev-part - = :next-part - J = :next - K = :prev - - f = :forward - Rr = :reply - Rq = :reply -q - rr = :reply -a - rq = :reply -aq - rt = :reply -Tthanks - - ga = :pipe -b git am -3 - gp = :term git push - gl = :term git log - - [view::passthrough] - $noinherit = true - $ex = - = :toggle-key-passthrough - - [compose] - $ex = - = :prev-field - = :next-field - = :next-field - - [compose::editor] - # Keybindings used when the embedded terminal is selected in the compose view - $noinherit = true - $ex = - = :term - = :prev-field - = :next-field - = :prev-tab - = :next-tab - - [compose::review] - # Keybindings used when reviewing a message to be sent - y = :send - n = :abort - e = :edit - a = :attach - c = :encrypt - s = :sign - V = :header -f X-Sourcehut-Patchset-Update NEEDS_REVISION - A = :header -f X-Sourcehut-Patchset-Update APPLIED - R = :header -f X-Sourcehut-Patchset-Update REJECTED - - [terminal] - $noinherit = true - $ex = - - = :term - = :prev-tab - = :next-tab - ''; - - extraConfig = { - general = { - pgp-provider = "gpg"; - unsafe-accounts-conf = true; + accounts.email.accounts.${cfg.email} = mkIf cfg.terminal { + notmuch.enable = true; + neomutt.enable = true; + aerc.enable = true; + mbsync.enable = true; + mbsync.create = "both"; + userName = cfg.email; + realName = userName; + address = cfg.email; + primary = true; + passwordCommand = "${pkgs.rbw}/bin/rbw get privateemail"; + smtp = { + host = "mail.privateemail.com"; + port = 465; + tls.enable = true; }; - ui = { }; - viewer = { }; - filters = { - "text/plain" = "colorize"; - "text/calendar" = "calendar"; - "message/delivery-status" = "colorize"; - "message/rfc822" = "colorize"; - "image/*" = "img2sixel"; - "text/html" = "html | colorize"; + imap = { + host = "mail.privateemail.com"; + port = 993; + tls.enable = true; }; }; - }; - }]; + + programs.notmuch.enable = cfg.terminal; + programs.neomutt = { + enable = cfg.terminal; + vimKeys = true; + sort = "reverse-date"; + sidebar.enable = true; + }; + programs.mbsync.enable = cfg.terminal; + services.mbsync.enable = cfg.terminal; + + programs.aerc = { + enable = cfg.terminal; + extraBinds = '' + # Binds are of the form = + # To use '=' in a key sequence, substitute it with "Eq": "" + # If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit + = :prev-tab + = :next-tab + = :term + + [messages] + Q = :quit + + T = :toggle-threads + + j = :next + = :next + = :next 50% + = :next 100% + = :next -s 100% + + k = :prev + = :prev + = :prev 50% + = :prev + = :prev -s 100% + gg = :select 0 + G = :select -1 + + J = :next-folder + K = :prev-folder + + v = :mark -t + V = :mark -v + + f = :flag + F = :unflag + + t = :toggle-threads + + = :view + D = :mv Trash + + C = :compose + + Rr = :reply + Rq = :reply -q + rr = :reply -a + rq = :reply -aq + rt = :unflag:reply -a -Tthanks + Rt = :unflag:reply -qa -Tquoted_thanks + + a = :mv Archive + + c = :cf + $ = :term + ! = :term + | = :pipe + + ga = :flag:pipe -mb git am -3 + gp = :term git push + gl = :term git log + + / = :search + \ = :filter + n = :next-result + N = :prev-result + + o = :term mbsync -a + q = :quit + + [view] + / = :toggle-key-passthrough/ + q = :close + | = :pipe -m + S = :save + H = :toggle-headers + D = :mv Trash + = :prev-part + = :next-part + J = :next + K = :prev + + f = :forward + Rr = :reply + Rq = :reply -q + rr = :reply -a + rq = :reply -aq + rt = :reply -Tthanks + + ga = :pipe -b git am -3 + gp = :term git push + gl = :term git log + + [view::passthrough] + $noinherit = true + $ex = + = :toggle-key-passthrough + + [compose] + $ex = + = :prev-field + = :next-field + = :next-field + + [compose::editor] + # Keybindings used when the embedded terminal is selected in the compose view + $noinherit = true + $ex = + = :term + = :prev-field + = :next-field + = :prev-tab + = :next-tab + + [compose::review] + # Keybindings used when reviewing a message to be sent + y = :send + n = :abort + e = :edit + a = :attach + c = :encrypt + s = :sign + V = :header -f X-Sourcehut-Patchset-Update NEEDS_REVISION + A = :header -f X-Sourcehut-Patchset-Update APPLIED + R = :header -f X-Sourcehut-Patchset-Update REJECTED + + [terminal] + $noinherit = true + $ex = + + = :term + = :prev-tab + = :next-tab + ''; + + extraConfig = { + general = { + pgp-provider = "gpg"; + unsafe-accounts-conf = true; + }; + ui = {}; + viewer = {}; + filters = { + "text/plain" = "colorize"; + "text/calendar" = "calendar"; + "message/delivery-status" = "colorize"; + "message/rfc822" = "colorize"; + "image/*" = "img2sixel"; + "text/html" = "html | colorize"; + }; + }; + }; + } + ]; }; - } diff --git a/lib/modules/gamer.nix b/lib/modules/gamer.nix index 13b58ef..fb9d0f9 100644 --- a/lib/modules/gamer.nix +++ b/lib/modules/gamer.nix @@ -1,17 +1,22 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -{ +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; { options.roles.gamer = { enable = mkEnableOption "gamer packages"; }; config = mkIf config.roles.gamer.enable { - # required for heroic launcher - nixpkgs.config.permittedInsecurePackages = [ - "electron-25.9.0" - ]; + # required for heroic launcher + nixpkgs.config.permittedInsecurePackages = [ + "electron-25.9.0" + ]; - home-manager.users.${user}.imports = [{ + home-manager.users.${user}.imports = [ + { home.packages = with pkgs; [ airshipper minetest @@ -23,11 +28,11 @@ with lib; protontricks protonup-qt gamemode - gamescope + gamescope - monado - openxr-loader - opencomposite + monado + openxr-loader + opencomposite (makeDesktopItem { name = "x11steam"; @@ -36,37 +41,38 @@ with lib; }) oversteer ]; - }]; + } + ]; - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ "steam" "steam-run" "steam-original" "osu-lazer" ]; - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; - - hardware.steam-hardware.enable = true; - environment.etc.logitechG920 = { - target = "usb_modeswitch.d/046d:c261"; - text = '' - DefaultVendor=046d - DefaultProduct=c261 - MessageEndpoint=01 - ResponseEndpoint=01 - TargetClass=0x03 - MessageContent="0f00010142" - ''; - }; - services.udev.extraRules = '' - ATTR{idVendor}=="046d", ATTR{idProduct}=="c261", RUN+="${pkgs.usb-modeswitch}/bin/usb_modeswitch -c '/etc/usb_modeswitch.d/046d:c261'" - ''; - hardware.new-lg4ff.enable = true; - + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; }; + + hardware.steam-hardware.enable = true; + environment.etc.logitechG920 = { + target = "usb_modeswitch.d/046d:c261"; + text = '' + DefaultVendor=046d + DefaultProduct=c261 + MessageEndpoint=01 + ResponseEndpoint=01 + TargetClass=0x03 + MessageContent="0f00010142" + ''; + }; + services.udev.extraRules = '' + ATTR{idVendor}=="046d", ATTR{idProduct}=="c261", RUN+="${pkgs.usb-modeswitch}/bin/usb_modeswitch -c '/etc/usb_modeswitch.d/046d:c261'" + ''; + hardware.new-lg4ff.enable = true; + }; } diff --git a/lib/modules/git.nix b/lib/modules/git.nix index 439b2b9..3156bc8 100644 --- a/lib/modules/git.nix +++ b/lib/modules/git.nix @@ -1,9 +1,15 @@ -{ user, userName }: { lib, pkgs, config, ... }: -with lib; -let - cfg = config.roles.git; -in { + user, + userName, +}: { + lib, + pkgs, + config, + ... +}: +with lib; let + cfg = config.roles.git; +in { options.roles = { git = { enable = mkEnableOption "email settings"; @@ -11,21 +17,22 @@ in }; config = mkIf cfg.enable { - home-manager.users.${user}.imports = [{ - programs.git = { - enable = true; - aliases = { - graph = "log --oneline --all --graph"; - amend = "commit --amend --no-edit"; - }; - delta = { + home-manager.users.${user}.imports = [ + { + programs.git = { enable = true; + aliases = { + graph = "log --oneline --all --graph"; + amend = "commit --amend --no-edit"; + }; + delta = { + enable = true; + }; + extraConfig = { + pull.rebase = true; + }; }; - extraConfig = { - pull.rebase = true; - }; - }; - }]; + } + ]; }; - } diff --git a/lib/modules/keyboard.nix b/lib/modules/keyboard.nix index d394236..5de4492 100644 --- a/lib/modules/keyboard.nix +++ b/lib/modules/keyboard.nix @@ -1,6 +1,10 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -{ +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; { options.keyboard = { dvorak = { enable = mkEnableOption "use a good keyboard layout on a qwerty keyboard"; @@ -26,7 +30,9 @@ with lib; }; } ]; - services.xserver.xkbVariant = if config.keyboard.dvorak.enable then "dvorak" else ""; + services.xserver.xkbVariant = + if config.keyboard.dvorak.enable + then "dvorak" + else ""; }; - } diff --git a/lib/modules/laptop.nix b/lib/modules/laptop.nix index b594229..351bc7f 100644 --- a/lib/modules/laptop.nix +++ b/lib/modules/laptop.nix @@ -1,9 +1,12 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.roles.laptop; -in -{ +in { options.roles = { laptop = { enable = mkEnableOption "is a laptop"; @@ -14,30 +17,34 @@ in config = mkIf cfg.enable { displays = mkIf cfg.displays { enable = true; - displays = [{ - name = "eDP-1"; - scaling = 1.2; - }]; + displays = [ + { + name = "eDP-1"; + scaling = 1.2; + } + ]; }; keyboard.dvorak.enable = true; - home-manager.users.${user}.imports = [{ - wayland.windowManager.hyprland = { - settings = { - general = { - gaps_out = 10; - border_size = 3; - }; - bind = [ - "SUPER_SHIFT, Q, killactive," - ]; - "device:at-translated-set-2-keyboard" = { - kb_variant = "dvorak,"; - kb_layout = "gb,gb"; - kb_options = "grp:alt_shift_toggle,caps:escape"; + home-manager.users.${user}.imports = [ + { + wayland.windowManager.hyprland = { + settings = { + general = { + gaps_out = 10; + border_size = 3; + }; + bind = [ + "SUPER_SHIFT, Q, killactive," + ]; + "device:at-translated-set-2-keyboard" = { + kb_variant = "dvorak,"; + kb_layout = "gb,gb"; + kb_options = "grp:alt_shift_toggle,caps:escape"; + }; }; }; - }; - }]; + } + ]; }; } diff --git a/lib/modules/menu.nix b/lib/modules/menu.nix index fc6c851..c53666c 100644 --- a/lib/modules/menu.nix +++ b/lib/modules/menu.nix @@ -1,11 +1,14 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.programs.menu; terminal = config.programs.terminal.package; termcmd = "${terminal}/bin/${terminal.pname}"; -in -{ +in { options.programs = { menu = { enable = mkEnableOption "menu"; @@ -18,16 +21,18 @@ in }; }; }; - + config = mkIf cfg.enable { - home-manager.users.${user}.imports = [{ - programs.wofi = mkIf (cfg.package == pkgs.wofi) { - enable = true; - settings = { - term = termcmd; - insensitive = true; + home-manager.users.${user}.imports = [ + { + programs.wofi = mkIf (cfg.package == pkgs.wofi) { + enable = true; + settings = { + term = termcmd; + insensitive = true; + }; }; - }; - }]; + } + ]; }; } diff --git a/lib/modules/mpd.nix b/lib/modules/mpd.nix index 37ec040..fd0216d 100644 --- a/lib/modules/mpd.nix +++ b/lib/modules/mpd.nix @@ -1,47 +1,69 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.roles.mpd; -in -{ +in { options.roles.mpd = { enable = mkEnableOption "setup mpd client"; - host = mkOption { default = "192.168.1.2"; }; + host = mkOption {default = "192.168.1.2";}; }; config = mkIf cfg.enable { - home-manager.users.${user}.imports = [{ - programs.ncmpcpp = { - enable = true; - settings.mpd_host = cfg.host; - bindings = [ - { key = "j"; command = "scroll_down"; } - { key = "k"; command = "scroll_up"; } - { key = "l"; command = "next_column"; } - { key = "h"; command = "previous_column"; } - { key = "J"; command = [ "select_item" "scroll_down" ]; } - { key = "K"; command = [ "select_item" "scroll_up" ]; } - ]; - }; - services.mpd-mpris = { - enable = true; - mpd.host = cfg.host; - }; - programs.waybar.settings.mainBar.mpd.server = cfg.host; - systemd.user.services = { - snapclient = { - Unit = { - Description = "Snapclient"; - }; - Service = { - ExecStart = "${pkgs.snapcast}/bin/snapclient -h ${cfg.host}"; - }; - Install = { - WantedBy = [ "graphical-session.target" ]; + home-manager.users.${user}.imports = [ + { + programs.ncmpcpp = { + enable = true; + settings.mpd_host = cfg.host; + bindings = [ + { + key = "j"; + command = "scroll_down"; + } + { + key = "k"; + command = "scroll_up"; + } + { + key = "l"; + command = "next_column"; + } + { + key = "h"; + command = "previous_column"; + } + { + key = "J"; + command = ["select_item" "scroll_down"]; + } + { + key = "K"; + command = ["select_item" "scroll_up"]; + } + ]; + }; + services.mpd-mpris = { + enable = true; + mpd.host = cfg.host; + }; + programs.waybar.settings.mainBar.mpd.server = cfg.host; + systemd.user.services = { + snapclient = { + Unit = { + Description = "Snapclient"; + }; + Service = { + ExecStart = "${pkgs.snapcast}/bin/snapclient -h ${cfg.host}"; + }; + Install = { + WantedBy = ["graphical-session.target"]; + }; }; }; - }; - }]; + } + ]; }; - } diff --git a/lib/modules/neovim/config.lua b/lib/modules/neovim/config.lua new file mode 100644 index 0000000..ee3d396 --- /dev/null +++ b/lib/modules/neovim/config.lua @@ -0,0 +1,19 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' +vim.o.relativenumber = true +vim.o.signcolumn = 'yes' +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.o.expandtab = true +vim.o.smartindent = true +vim.o.hlsearch = false +vim.o.scrolloff = 6 + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("x", "p", "\"_dP") + +vim.keymap.set("n", "y", "\"+y") +vim.keymap.set("v", "y", "\"+y") + diff --git a/lib/modules/neovim/lspconfig.lua b/lib/modules/neovim/lspconfig.lua new file mode 100644 index 0000000..7ac8410 --- /dev/null +++ b/lib/modules/neovim/lspconfig.lua @@ -0,0 +1,55 @@ +-- Setup language servers. +local lspconfig = require('lspconfig') + +lspconfig.tsserver.setup { + on_attach = function(client) + client.server_capabilities.documentFormattingProvider = false + end +} + +lspconfig.eslint.setup { + on_attach = function(client) + client.server_capabilities.documentFormattingProvider = true + end +} + +lspconfig.gopls.setup {} +lspconfig.nil_ls.setup {} + +-- Global mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +vim.keymap.set('n', 'e', vim.diagnostic.open_float) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + +-- Use LspAttach autocommand to only map the following keys +-- after the language server attaches to the current buffer +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + end, +}) diff --git a/lib/modules/personal.nix b/lib/modules/personal.nix index 9321905..9a0d9b9 100644 --- a/lib/modules/personal.nix +++ b/lib/modules/personal.nix @@ -1,12 +1,15 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -{ +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; { options.roles.personal = { enable = mkEnableOption "personal packages"; }; config = mkIf config.roles.personal.enable { - roles.email = { enable = true; email = "tristan@tristans.cloud"; @@ -22,32 +25,33 @@ with lib; "en_US.UTF-8/UTF-8" ]; - home-manager.users.${user}.imports = [{ - services.nextcloud-client.enable = true; - services.gnome-keyring.enable = true; + home-manager.users.${user}.imports = [ + { + services.nextcloud-client.enable = true; + services.gnome-keyring.enable = true; - home.language = { - base = "eo.UTF-8"; - }; + home.language = { + base = "eo.UTF-8"; + }; - home.packages = with pkgs; [ - godot_4 - ardour - blender - musescore - jellyfin-media-player - monero-gui - electrum - xmrig - transmission-remote-gtk - krita - organicmaps - anki - hugo - libsForQt5.neochat - bookworm - ]; - - }]; + home.packages = with pkgs; [ + godot_4 + ardour + blender + musescore + jellyfin-media-player + monero-gui + electrum + xmrig + transmission-remote-gtk + krita + organicmaps + anki + hugo + libsForQt5.neochat + bookworm + ]; + } + ]; }; } diff --git a/lib/modules/scripts.nix b/lib/modules/scripts.nix index 098ee17..b5477d8 100644 --- a/lib/modules/scripts.nix +++ b/lib/modules/scripts.nix @@ -1,9 +1,13 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let scripts = config.programs.scripts; - hotkeyType = types.submodule ({ ... }: { + hotkeyType = types.submodule ({...}: { options = { key = mkOption { description = "the key"; @@ -19,7 +23,7 @@ let }; }); - scriptType = types.submodule ({ ... }: { + scriptType = types.submodule ({...}: { options = { name = mkOption { description = "name of the executable"; @@ -30,7 +34,7 @@ let hotkeys = mkOption { type = types.listOf hotkeyType; description = "keys that run this script"; - default = [ ]; + default = []; }; install = mkOption { type = types.bool; @@ -42,33 +46,35 @@ let scriptToPackage = script: pkgs.writeShellScriptBin script.name script.text; - scriptExec = { script, hotkey }: - "${scriptToPackage script}/bin/${script.name} ${hotkey.args}"; + scriptExec = { + script, + hotkey, + }: "${scriptToPackage script}/bin/${script.name} ${hotkey.args}"; - installScripts = scripts: - (map scriptToPackage (filter (s: s.install) scripts)); + installScripts = scripts: (map scriptToPackage (filter (s: s.install) scripts)); - bindScript = script: concatStrings ( - map - (hotkey: - "${hotkey.modifier}, ${hotkey.key}, exec, ${scriptExec {inherit script hotkey;}}" + bindScript = script: + concatStrings ( + map + ( + hotkey: "${hotkey.modifier}, ${hotkey.key}, exec, ${scriptExec {inherit script hotkey;}}" ) - script.hotkeys); - -in -{ + script.hotkeys + ); +in { options.programs = { scripts = mkOption { type = types.listOf scriptType; - default = [ ]; + default = []; }; }; config = { - home-manager.users.${user}.imports = [{ - home.packages = installScripts scripts; - wayland.windowManager.hyprland.settings.bind = (map bindScript scripts); - }]; + home-manager.users.${user}.imports = [ + { + home.packages = installScripts scripts; + wayland.windowManager.hyprland.settings.bind = map bindScript scripts; + } + ]; }; - } diff --git a/lib/modules/terminal.nix b/lib/modules/terminal.nix index 8a84a42..9894c45 100644 --- a/lib/modules/terminal.nix +++ b/lib/modules/terminal.nix @@ -1,9 +1,12 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.programs.terminal; -in -{ +in { options.programs = { terminal = { enable = mkEnableOption "editor"; @@ -12,15 +15,17 @@ in }; }; }; - - config = mkIf cfg.enable { - home-manager.users.${user}.imports = [{ - programs.foot = mkIf ( cfg.package == pkgs.foot ) { - enable = true; - server.enable = true; - }; - home.packages = [ cfg.package ]; - }]; + config = mkIf cfg.enable { + home-manager.users.${user}.imports = [ + { + programs.foot = mkIf (cfg.package == pkgs.foot) { + enable = true; + server.enable = true; + }; + + home.packages = [cfg.package]; + } + ]; }; } diff --git a/lib/modules/wayland.nix b/lib/modules/wayland.nix index 7923836..0e442a2 100644 --- a/lib/modules/wayland.nix +++ b/lib/modules/wayland.nix @@ -1,9 +1,12 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -let +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; let cfg = config.windowManager; -in -{ +in { options.windowManager = { hyprland = mkEnableOption "hyprland"; sway = mkEnableOption "sway"; @@ -21,269 +24,279 @@ in command = "sway"; user = user; }; - default_session = if cfg.sway then sway_session else hypr_session; + default_session = + if cfg.sway + then sway_session + else hypr_session; }; }; - home-manager.users.${user}.imports = [{ - wayland.windowManager.hyprland = mkIf cfg.hyprland { - enable = true; - systemd.enable = true; - settings = { - input = { - touchpad = { - natural_scroll = true; - scroll_factor = 0.5; - }; - }; - gestures = { - workspace_swipe = true; - workspace_swipe_numbered = true; - }; - decoration = { - rounding = 5; - drop_shadow = false; - }; - bezier = [ - "overshot, 0.05, 0.9, 0.1, 1.1" - "linear, 0.0, 0.0, 1.0, 1.0" - ]; - animations = { - enabled = true; - animation = [ - "windows, 1, 1, default, popin" - "border, 1, 1, default" - "fade, 1, 1, default" - "workspaces, 1, 3, overshot" - "borderangle,1, 50, linear, loop" - ]; - }; - bind = [ - "SUPER, h, movefocus,l" - "SUPER, l, movefocus,r" - "SUPER, j, layoutmsg,cyclenext" - "SUPER, k, layoutmsg,cycleprev" - "SUPER, space, layoutmsg,swapwithmaster master" - "SUPER, F, fullscreen," - "SUPER, V, togglefloating," - "SUPER, W, layoutmsg, orientationprev" - "SUPER_SHIFT, W, layoutmsg, orientationnext" - "SUPER_SHIFT, V, togglegroup," - "SUPER_SHIFT, h, changegroupactive,b" - "SUPER_SHIFT, h, moveintogroup,l" - "SUPER_SHIFT, l, moveintogroup,r" - "SUPER_SHIFT, l, changegroupactive,f" - "SUPER, Y, togglespecialworkspace" - "SUPER_SHIFT, Y, movetoworkspace, special" - "SUPER, R, submap, resize" - "SUPER,1,workspace,1" - "SUPER,2,workspace,2" - "SUPER,3,workspace,3" - "SUPER,4,workspace,4" - "SUPER,5,workspace,5" - "SUPER,6,workspace,6" - "SUPER,7,workspace,7" - "SUPER,8,workspace,8" - "SUPER,9,workspace,9" - "SUPER,0,workspace,10" - "SUPER,left,workspace,r-1" - "SUPER,right,workspace,r+1" - "SUPER_SHIFT,1,movetoworkspace,1" - "SUPER_SHIFT,2,movetoworkspace,2" - "SUPER_SHIFT,3,movetoworkspace,3" - "SUPER_SHIFT,4,movetoworkspace,4" - "SUPER_SHIFT,5,movetoworkspace,5" - "SUPER_SHIFT,6,movetoworkspace,6" - "SUPER_SHIFT,7,movetoworkspace,7" - "SUPER_SHIFT,8,movetoworkspace,8" - "SUPER_SHIFT,9,movetoworkspace,9" - "SUPER_SHIFT,0,movetoworkspace,10" - ]; - bindm = [ - "SUPER, mouse:272, movewindow" - "SUPER, mouse:273, resizewindow" - ]; - env = [ - "GDK_BACKEND,wayland,x11" - "QT_QPA_PLATFORM,wayland;xcb" - "SDL_VIDEODRIVER,wayland" - "CLUTTER_BACKEND,wayland" - "XDG_CURRENT_DESKTOP,Hyprland" - "XDG_SESSION_TYPE,wayland" - "XDG_SESSION_DESKTOP,Hyprland" - "QT_AUTO_SCREEN_SCALE_FACTOR,1" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "NIXOS_OZONE_WL,1" - ]; - windowrule = [ - "float, title:wlogout" - "idleinhibit always, vrmonitor" - "idleinhibit focus, steam_app" - ]; - workspace = [ - "11, default:true" - ]; - general = { - gaps_out = 10; - resize_on_border = true; - layout = "master"; - # "col.active_border" = "rgb(FFFF00) rgb(00FFFF) rgb(FF00FF)"; - border_size = lib.mkDefault 5; - }; - master = { - mfact = 0.7; - new_on_top = true; - }; - misc = { - vrr = 2; - focus_on_activate = true; - }; - }; - # https://wiki.hyprland.org/Configuring/Variables/ - extraConfig = '' - submap = resize - binde = ,right,resizeactive,10 0 - binde = ,left,resizeactive,-10 0 - binde = ,up,resizeactive,0 -10 - binde = ,down,resizeactive,0 10 - binde = ,k,resizeactive,0 -10 - binde = ,j,resizeactive,0 10 - binde = ,l,splitratio,0.05 - binde = ,h,splitratio,-0.05 - binde = SHIFT,l,splitratio,0.3 - binde = SHIFT,h,splitratio,-0.3 - - bind = , escape, submap,reset - bind = , enter, submap,reset - bind = SUPER, R, submap,reset - bind = CONTROL, C, submap,reset - submap = reset - ''; - }; - - wayland.windowManager.sway = mkIf cfg.sway { - enable = true; - }; - - programs.swaylock = { - enable = true; - package = pkgs.swaylock-effects; - settings = { - clock = true; - screenshots = true; - effect-scale = 0.5; - effect-blur = "10x10"; - grace = 5; - }; - }; - - services.swayidle = { - enable = true; - systemdTarget = "graphical-session.target"; - events = [ - { event = "before-sleep"; command = "${pkgs.swaylock-effects}/bin/swaylock"; } - { event = "lock"; command = "${pkgs.swaylock-effects}/bin/swaylock"; } - ]; - timeouts = [ - { - timeout = 300; - command = "${pkgs.swaylock-effects}/bin/swaylock -f"; - } - { - timeout = 600; - command = "systemctl suspend"; - } - ]; - }; - - services.mako = { - enable = true; - }; - - programs.waybar = { - enable = true; - settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 36; - modules-left = [ "hyprland/workspaces" "hyprland/window" ]; - modules-right = [ "mpris" "pulseaudio" "clock" "tray" "battery" ]; - clock = { - format = "πŸ“… {:%a %b-%d %I:%M %p}"; - }; - pulseaudio = { - format-muted = "πŸ”‡ {volume}"; - format = "{icon} {volume}"; - format-icons.default = [ "πŸ”ˆ" "πŸ”‰" "πŸ”Š" ]; - on-click = "${pkgs.pavucontrol}/bin/pavucontrol"; - }; - mpris = { - format = "{player_icon} {artist} - {title}"; - format-paused = "{status_icon} {player_icon} {artist} - {title}"; - player-icons = { - default = "▢️"; - mpd = "🎡"; - kdeconnect = "☎️"; - }; - status-icons = { - paused = "⏸️"; - }; - }; - battery = { - format = "{icon} {capacity}%"; - format-icons = [ "🀏" "πŸͺ«" "πŸ”‹" "πŸ”‹" ]; - format-charging = "πŸ”Œ {capacity}%"; - states = { - warning = 30; - critical = 15; - }; - }; - }; - }; - systemd = { + home-manager.users.${user}.imports = [ + { + wayland.windowManager.hyprland = mkIf cfg.hyprland { enable = true; - target = "graphical-session.target"; + systemd.enable = true; + settings = { + input = { + touchpad = { + natural_scroll = true; + scroll_factor = 0.5; + }; + }; + gestures = { + workspace_swipe = true; + workspace_swipe_numbered = true; + }; + decoration = { + rounding = 5; + drop_shadow = false; + }; + bezier = [ + "overshot, 0.05, 0.9, 0.1, 1.1" + "linear, 0.0, 0.0, 1.0, 1.0" + ]; + animations = { + enabled = true; + animation = [ + "windows, 1, 1, default, popin" + "border, 1, 1, default" + "fade, 1, 1, default" + "workspaces, 1, 3, overshot" + "borderangle,1, 50, linear, loop" + ]; + }; + bind = [ + "SUPER, h, movefocus,l" + "SUPER, l, movefocus,r" + "SUPER, j, layoutmsg,cyclenext" + "SUPER, k, layoutmsg,cycleprev" + "SUPER, space, layoutmsg,swapwithmaster master" + "SUPER, F, fullscreen," + "SUPER, V, togglefloating," + "SUPER, W, layoutmsg, orientationprev" + "SUPER_SHIFT, W, layoutmsg, orientationnext" + "SUPER_SHIFT, V, togglegroup," + "SUPER_SHIFT, h, changegroupactive,b" + "SUPER_SHIFT, h, moveintogroup,l" + "SUPER_SHIFT, l, moveintogroup,r" + "SUPER_SHIFT, l, changegroupactive,f" + "SUPER, Y, togglespecialworkspace" + "SUPER_SHIFT, Y, movetoworkspace, special" + "SUPER, R, submap, resize" + "SUPER,1,workspace,1" + "SUPER,2,workspace,2" + "SUPER,3,workspace,3" + "SUPER,4,workspace,4" + "SUPER,5,workspace,5" + "SUPER,6,workspace,6" + "SUPER,7,workspace,7" + "SUPER,8,workspace,8" + "SUPER,9,workspace,9" + "SUPER,0,workspace,10" + "SUPER,left,workspace,r-1" + "SUPER,right,workspace,r+1" + "SUPER_SHIFT,1,movetoworkspace,1" + "SUPER_SHIFT,2,movetoworkspace,2" + "SUPER_SHIFT,3,movetoworkspace,3" + "SUPER_SHIFT,4,movetoworkspace,4" + "SUPER_SHIFT,5,movetoworkspace,5" + "SUPER_SHIFT,6,movetoworkspace,6" + "SUPER_SHIFT,7,movetoworkspace,7" + "SUPER_SHIFT,8,movetoworkspace,8" + "SUPER_SHIFT,9,movetoworkspace,9" + "SUPER_SHIFT,0,movetoworkspace,10" + ]; + bindm = [ + "SUPER, mouse:272, movewindow" + "SUPER, mouse:273, resizewindow" + ]; + env = [ + "GDK_BACKEND,wayland,x11" + "QT_QPA_PLATFORM,wayland;xcb" + "SDL_VIDEODRIVER,wayland" + "CLUTTER_BACKEND,wayland" + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_TYPE,wayland" + "XDG_SESSION_DESKTOP,Hyprland" + "QT_AUTO_SCREEN_SCALE_FACTOR,1" + "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" + "NIXOS_OZONE_WL,1" + "WLR_NO_HARDWARE_CURSORS,1" + ]; + windowrule = [ + "float, title:wlogout" + "idleinhibit always, vrmonitor" + "idleinhibit focus, steam_app" + ]; + workspace = [ + "11, default:true" + ]; + general = { + gaps_out = 10; + resize_on_border = true; + layout = "master"; + # "col.active_border" = "rgb(FFFF00) rgb(00FFFF) rgb(FF00FF)"; + border_size = lib.mkDefault 5; + }; + master = { + mfact = 0.7; + new_on_top = true; + }; + misc = { + vrr = 2; + focus_on_activate = true; + }; + }; + # https://wiki.hyprland.org/Configuring/Variables/ + extraConfig = '' + submap = resize + binde = ,right,resizeactive,10 0 + binde = ,left,resizeactive,-10 0 + binde = ,up,resizeactive,0 -10 + binde = ,down,resizeactive,0 10 + binde = ,k,resizeactive,0 -10 + binde = ,j,resizeactive,0 10 + binde = ,l,splitratio,0.05 + binde = ,h,splitratio,-0.05 + binde = SHIFT,l,splitratio,0.3 + binde = SHIFT,h,splitratio,-0.3 + + bind = , escape, submap,reset + bind = , enter, submap,reset + bind = SUPER, R, submap,reset + bind = CONTROL, C, submap,reset + submap = reset + ''; }; - style = '' - * { - min-height: 0; - } - - window#waybar { - font-size: small; - background: rgba(0,0,0,0.8); - } - #workspaces button { - border-radius: 1rem; - padding: 0px .5rem; - margin: 0px .5rem 0px 0px; - } + wayland.windowManager.sway = mkIf cfg.sway { + enable = true; + }; - #workspaces button.active { - background: rgba(255,255,255,0.8); - padding: 0px 1rem; - color: black; - } + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + settings = { + clock = true; + screenshots = true; + effect-scale = 0.5; + effect-blur = "10x10"; + grace = 5; + }; + }; - #workspaces button.inactive:hover { - background: rgba(255,255,255,0.4); - color: black; - } + services.swayidle = { + enable = true; + systemdTarget = "graphical-session.target"; + events = [ + { + event = "before-sleep"; + command = "${pkgs.swaylock-effects}/bin/swaylock"; + } + { + event = "lock"; + command = "${pkgs.swaylock-effects}/bin/swaylock"; + } + ]; + timeouts = [ + { + timeout = 300; + command = "${pkgs.swaylock-effects}/bin/swaylock -f"; + } + { + timeout = 600; + command = "systemctl suspend"; + } + ]; + }; - .modules-right widget label { - padding: 0 1rem; - margin: 0 .5rem; - } - - #tray { - min-width: 5rem; - } - ''; - }; + services.mako = { + enable = true; + }; + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 36; + modules-left = ["hyprland/workspaces" "hyprland/window"]; + modules-right = ["mpris" "pulseaudio" "clock" "tray" "battery"]; + clock = { + format = "πŸ“… {:%a %b-%d %I:%M %p}"; + }; + pulseaudio = { + format-muted = "πŸ”‡ {volume}"; + format = "{icon} {volume}"; + format-icons.default = ["πŸ”ˆ" "πŸ”‰" "πŸ”Š"]; + on-click = "${pkgs.pavucontrol}/bin/pavucontrol"; + }; + mpris = { + format = "{player_icon} {artist} - {title}"; + format-paused = "{status_icon} {player_icon} {artist} - {title}"; + player-icons = { + default = "▢️"; + mpd = "🎡"; + kdeconnect = "☎️"; + }; + status-icons = { + paused = "⏸️"; + }; + }; + battery = { + format = "{icon} {capacity}%"; + format-icons = ["🀏" "πŸͺ«" "πŸ”‹" "πŸ”‹"]; + format-charging = "πŸ”Œ {capacity}%"; + states = { + warning = 30; + critical = 15; + }; + }; + }; + }; + systemd = { + enable = true; + target = "graphical-session.target"; + }; + style = '' + * { + min-height: 0; + } - }]; + window#waybar { + font-size: small; + background: rgba(0,0,0,0.8); + } + + #workspaces button { + border-radius: 1rem; + padding: 0px .5rem; + margin: 0px .5rem 0px 0px; + } + + #workspaces button.active { + background: rgba(255,255,255,0.8); + padding: 0px 1rem; + color: black; + } + + #workspaces button.inactive:hover { + background: rgba(255,255,255,0.4); + color: black; + } + + .modules-right widget label { + padding: 0 1rem; + margin: 0 .5rem; + } + + #tray { + min-width: 5rem; + } + ''; + }; + } + ]; }; } diff --git a/lib/modules/work.nix b/lib/modules/work.nix index 946b8c8..abc768b 100644 --- a/lib/modules/work.nix +++ b/lib/modules/work.nix @@ -1,12 +1,15 @@ -{ user }: { lib, pkgs, config, ... }: -with lib; -{ +{user}: { + lib, + pkgs, + config, + ... +}: +with lib; { options.roles.work = { enable = mkEnableOption "work packages"; }; config = mkIf config.roles.work.enable { - roles.email = { enable = true; email = "tristan.beedell@cryoserver.com"; @@ -20,68 +23,69 @@ with lib; package = pkgs.vscode; }; - home-manager.users.${user}.imports = [{ - - home.packages = with pkgs; [ - onedrive - kubectl - awscli2 - docker-compose - minikube - kubernetes-helm - thunderbird - (import ../mkapp.nix "slack" { - inherit pkgs; - desktopName = "Slack"; - app-id = "mpagibdhafmlkgpemeicgogjnhclenoc"; - browser = "${brave}/opt/brave.com/brave/brave-browser"; - }) - (import ../mkapp.nix "teams" { - inherit pkgs; - browser = "${brave}/opt/brave.com/brave/brave-browser"; - app-id = "cifhbcnohmdccbgoicgdjpfamggdegmo"; - desktopName = "Microsoft Teams"; - }) - (pkgs.writeShellScriptBin "codex11" '' - NIXOS_OZONE_WL= ${pkgs.vscode}/bin/code $@ - '') - remmina - ]; - - gtk.gtk3.bookmarks = [ - "file:///home/tristan/OneDrive/Documents/ OneDrive" - ]; - - programs.vscode = { - extensions = with pkgs; [ - vscode-extensions.ms-azuretools.vscode-docker + home-manager.users.${user}.imports = [ + { + home.packages = with pkgs; [ + onedrive + kubectl + awscli2 + docker-compose + minikube + kubernetes-helm + thunderbird + (import ../mkapp.nix "slack" { + inherit pkgs; + desktopName = "Slack"; + app-id = "mpagibdhafmlkgpemeicgogjnhclenoc"; + browser = "${brave}/opt/brave.com/brave/brave-browser"; + }) + (import ../mkapp.nix "teams" { + inherit pkgs; + browser = "${brave}/opt/brave.com/brave/brave-browser"; + app-id = "cifhbcnohmdccbgoicgdjpfamggdegmo"; + desktopName = "Microsoft Teams"; + }) + (pkgs.writeShellScriptBin "codex11" '' + NIXOS_OZONE_WL= ${pkgs.vscode}/bin/code $@ + '') + remmina ]; - userSettings = { - "aws.telemetry" = false; - "gitlens.telemetry.enabled" = false; - "redhat.telemetry.enabled" = false; + + gtk.gtk3.bookmarks = [ + "file:///home/tristan/OneDrive/Documents/ OneDrive" + ]; + + programs.vscode = { + extensions = with pkgs; [ + vscode-extensions.ms-azuretools.vscode-docker + ]; + userSettings = { + "aws.telemetry" = false; + "gitlens.telemetry.enabled" = false; + "redhat.telemetry.enabled" = false; + }; }; - }; - wayland.windowManager.hyprland = { - extraConfig = '' - # === WORK MODULE === - bind = SUPER, E, focuswindow, thunderbird - bind = SUPER, t, focuswindow, brave-cifhbcnohmdccbgoicgdjpfamggdegmo-Profile_2 - ''; - }; - - }]; - - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - # nonfree vscode required for dev containers - "vscode" - "steam-run" + wayland.windowManager.hyprland = { + extraConfig = '' + # === WORK MODULE === + bind = SUPER, E, focuswindow, thunderbird + bind = SUPER, t, focuswindow, brave-cifhbcnohmdccbgoicgdjpfamggdegmo-Profile_2 + ''; + }; + } ]; + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + # nonfree vscode required for dev containers + "vscode" + "steam-run" + ]; + networking = { networkmanager = { - plugins = [ pkgs.networkmanager-openvpn ]; + plugins = [pkgs.networkmanager-openvpn]; }; }; @@ -93,10 +97,9 @@ with lib; enable = false; setSocketVariable = true; daemon.settings = { - "userns-remap"= "default"; + "userns-remap" = "default"; }; }; }; - }; } diff --git a/lib/scripts.nix b/lib/scripts.nix index b124b8f..381c9bb 100644 --- a/lib/scripts.nix +++ b/lib/scripts.nix @@ -1,5 +1,9 @@ -{ config, pkgs, lib, ... }: -let +{ + config, + pkgs, + lib, + ... +}: let my-deps = { notify-send = "${pkgs.libnotify}/bin/notify-send"; playerctl = "${pkgs.playerctl}/bin/playerctl"; @@ -21,8 +25,7 @@ let hyprpicker = "${pkgs.hyprpicker}/bin/hyprpicker"; sed = "${pkgs.gnused}/bin/sed"; }; -in -{ +in { programs.scripts = [ { name = "play-pause"; @@ -38,25 +41,33 @@ in fi ''; hotkeys = [ - { modifier = ""; key = "XF86AudioPlay"; } + { + modifier = ""; + key = "XF86AudioPlay"; + } ]; } { name = "bwmenu"; text = '' items="$(rbw list)" - echo "$items" | ${ my-deps.menu } | xargs -I_ rbw get _ | wl-copy + echo "$items" | ${my-deps.menu} | xargs -I_ rbw get _ | wl-copy ''; - hotkeys = [{ key = "P"; }]; + hotkeys = [{key = "P";}]; install = false; } { name = "bwotpmenu"; text = '' items="$(rbw list)" - echo "$items" | ${ my-deps.menu } | xargs -I_ rbw code _ | wl-copy + echo "$items" | ${my-deps.menu} | xargs -I_ rbw code _ | wl-copy ''; - hotkeys = [{ modifier = "SUPER_SHIFT"; key = "P"; }]; + hotkeys = [ + { + modifier = "SUPER_SHIFT"; + key = "P"; + } + ]; install = false; } { @@ -72,7 +83,10 @@ in cat "$FILE" | wl-copy -t image/png ''; hotkeys = [ - { modifier = "SUPER_SHIFT"; key = "S"; } + { + modifier = "SUPER_SHIFT"; + key = "S"; + } ]; } { @@ -82,8 +96,16 @@ in ${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-down -t 1000 ''; hotkeys = [ - { modifier = ""; key = "XF86MonBrightnessDown"; args = "10"; } - { modifier = "SHIFT"; key = "XF86MonBrightnessDown"; args = "1"; } + { + modifier = ""; + key = "XF86MonBrightnessDown"; + args = "10"; + } + { + modifier = "SHIFT"; + key = "XF86MonBrightnessDown"; + args = "1"; + } ]; install = false; } @@ -94,8 +116,16 @@ in ${my-deps.notify-send} "Brightness" -h int:value:$(light) -a brightness-up -t 1000 ''; hotkeys = [ - { modifier = ""; key = "XF86MonBrightnessUp"; args = "10"; } - { modifier = "SHIFT"; key = "XF86MonBrightnessUp"; args = "1"; } + { + modifier = ""; + key = "XF86MonBrightnessUp"; + args = "10"; + } + { + modifier = "SHIFT"; + key = "XF86MonBrightnessUp"; + args = "1"; + } ]; install = false; } @@ -110,7 +140,7 @@ in ${my-deps.xargs} -I_ ${my-deps.hyprctl} dispatch focuswindow title:"_" ''; hotkeys = [ - { key = "TAB"; } + {key = "TAB";} ]; } { @@ -118,18 +148,22 @@ in text = '' ${my-deps.hyprpicker} | wl-copy && notify-send "Copied Colour" "$(wl-paste)" ''; - hotkeys = [{ - key = "G"; - }]; + hotkeys = [ + { + key = "G"; + } + ]; } (lib.mkIf config.roles.mpd.enable { name = "ncmpcpp"; text = '' ${my-deps.terminal} -e ncmpcpp ''; - hotkeys = [{ - key = "M"; - }]; + hotkeys = [ + { + key = "M"; + } + ]; install = false; }) { @@ -137,9 +171,11 @@ in text = '' ${my-deps.runmenu} ''; - hotkeys = [{ - key = "D"; - }]; + hotkeys = [ + { + key = "D"; + } + ]; install = false; } { @@ -147,10 +183,12 @@ in text = '' hyprctl keyword misc:cursor_zoom_factor 2 ''; - hotkeys = [{ - modifier = "SUPER"; - key = "EQUAL"; - }]; + hotkeys = [ + { + modifier = "SUPER"; + key = "EQUAL"; + } + ]; install = false; } { @@ -158,10 +196,12 @@ in text = '' hyprctl keyword misc:cursor_zoom_factor 1 ''; - hotkeys = [{ - modifier = "SUPER"; - key = "MINUS"; - }]; + hotkeys = [ + { + modifier = "SUPER"; + key = "MINUS"; + } + ]; install = false; } { @@ -170,19 +210,25 @@ in ${my-deps.amixer} sset Master 5%+ && ${my-deps.amixer} sset Master unmute ''; hotkeys = [ - { key = "bracketright"; } - { modifier = ""; key = "XF86AudioRaiseVolume"; } + {key = "bracketright";} + { + modifier = ""; + key = "XF86AudioRaiseVolume"; + } ]; install = false; } { name = "lower-volume"; text = '' - ${ my-deps.amixer } sset Master 5%- + ${my-deps.amixer} sset Master 5%- ''; hotkeys = [ - { key = "bracketleft"; } - { modifier = ""; key = "XF86AudioLowerVolume"; } + {key = "bracketleft";} + { + modifier = ""; + key = "XF86AudioLowerVolume"; + } ]; install = false; } @@ -192,8 +238,14 @@ in ${my-deps.playerctl} next ''; hotkeys = [ - { modifier = "SUPER_SHIFT"; key = "period"; } - { modifier = ""; key = "XF86AudioNext"; } + { + modifier = "SUPER_SHIFT"; + key = "period"; + } + { + modifier = ""; + key = "XF86AudioNext"; + } ]; install = false; } @@ -203,8 +255,14 @@ in ${my-deps.playerctl} previous ''; hotkeys = [ - { modifier = "SUPER_SHIFT"; key = "comma"; } - { modifier = ""; key = "XF86AudioPrev"; } + { + modifier = "SUPER_SHIFT"; + key = "comma"; + } + { + modifier = ""; + key = "XF86AudioPrev"; + } ]; install = false; } @@ -212,7 +270,7 @@ in name = "terminal"; text = my-deps.terminal; hotkeys = [ - { key = "RETURN"; } + {key = "RETURN";} ]; install = false; } @@ -220,7 +278,7 @@ in name = "fileman"; text = my-deps.fileman; hotkeys = [ - { key = "O"; } + {key = "O";} ]; install = false; } @@ -237,7 +295,7 @@ in esac ''; hotkeys = [ - { key = "Z"; } + {key = "Z";} ]; install = false; }