From ee1d288dce7f4a8d542ce9f121b3eb4a0d3ab823 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Wed, 21 Apr 2021 03:11:27 +0300 Subject: [PATCH] chore: more cleanup --- lib/utils.nix | 6 +- overlays/grit.nix | 21 +++-- overlays/hikari.nix | 2 +- overlays/hydrus.nix | 33 +++---- overlays/kakoune.nix | 2 +- users/patriot/home.nix | 190 ++++++++++++++++++++--------------------- 6 files changed, 131 insertions(+), 123 deletions(-) diff --git a/lib/utils.nix b/lib/utils.nix index 53ccfe7..04ae1a4 100644 --- a/lib/utils.nix +++ b/lib/utils.nix @@ -3,13 +3,15 @@ let inherit (builtins) attrNames isAttrs isInt readDir toJSON; inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix; -in -rec { + # mapFilterAttrs :: # (name -> value -> bool ) # (name -> value -> { name = any; value = any; }) # attrs mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs); +in +{ + inherit mapFilterAttrs; recImport = { dir, _import ? base: import "${dir}/${base}.nix" }: mapFilterAttrs (_: v: v != null) diff --git a/overlays/grit.nix b/overlays/grit.nix index 8af14fd..626d2f0 100644 --- a/overlays/grit.nix +++ b/overlays/grit.nix @@ -1,12 +1,15 @@ final: prev: { - grit = prev.grit.overrideAttrs (old: rec { - version = "0.3.0"; + grit = prev.grit.overrideAttrs (old: + let version = "0.3.0"; + in + { + inherit version; - src = prev.fetchFromGitHub { - owner = "climech"; - repo = old.pname; - rev = "v${version}"; - sha256 = "sha256-c8wBwmXFjpst6UxL5zmTxMR4bhzpHYljQHiJFKiNDms="; - }; - }); + src = prev.fetchFromGitHub { + owner = "climech"; + repo = old.pname; + rev = "v${version}"; + sha256 = "sha256-c8wBwmXFjpst6UxL5zmTxMR4bhzpHYljQHiJFKiNDms="; + }; + }); } diff --git a/overlays/hikari.nix b/overlays/hikari.nix index 391b2e7..67c816a 100644 --- a/overlays/hikari.nix +++ b/overlays/hikari.nix @@ -1,5 +1,5 @@ final: prev: { - hikari = prev.hikari.overrideAttrs (old: rec { + hikari = prev.hikari.overrideAttrs (old: { src = prev.fetchzip { url = "https://hub.darcs.net/raichoo/hikari/dist/hikari.zip"; sha256 = "sha256-c7i/lekoS8FcsAHwXUw5IojC1xWS+sNeLVOzMf+dA5Q="; diff --git a/overlays/hydrus.nix b/overlays/hydrus.nix index a30b648..1dbc22c 100644 --- a/overlays/hydrus.nix +++ b/overlays/hydrus.nix @@ -1,19 +1,22 @@ final: prev: { - hydrus = prev.hydrus.overrideAttrs (old: rec { - version = "435"; + hydrus = prev.hydrus.overrideAttrs (old: + let version = "435"; + in + { + inherit version; - src = prev.fetchFromGitHub { - owner = "hydrusnetwork"; - repo = old.pname; - rev = "v${version}"; - sha256 = "sha256-+YOFqRgyNtdVBBCb6MWb+PqUoGvt8M0/ygiHrvxdWWg="; - }; + src = prev.fetchFromGitHub { + owner = "hydrusnetwork"; + repo = old.pname; + rev = "v${version}"; + sha256 = "sha256-+YOFqRgyNtdVBBCb6MWb+PqUoGvt8M0/ygiHrvxdWWg="; + }; - postPatch = '' - sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${prev.miniupnpc_2}/bin/upnpc";' \ - -i ./hydrus/core/networking/HydrusNATPunch.py - sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${prev.swftools}/bin/swfrender";' \ - -i ./hydrus/core/HydrusFlashHandling.py - ''; - }); + postPatch = '' + sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${prev.miniupnpc_2}/bin/upnpc";' \ + -i ./hydrus/core/networking/HydrusNATPunch.py + sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${prev.swftools}/bin/swfrender";' \ + -i ./hydrus/core/HydrusFlashHandling.py + ''; + }); } diff --git a/overlays/kakoune.nix b/overlays/kakoune.nix index d2cb46d..995837a 100644 --- a/overlays/kakoune.nix +++ b/overlays/kakoune.nix @@ -1,4 +1,4 @@ -final: prev: rec { +final: prev: { kakoune-unwrapped = prev.kakoune-unwrapped.overrideAttrs (old: { version = "5696ed02"; src = builtins.fetchGit { diff --git a/users/patriot/home.nix b/users/patriot/home.nix index 5c5250e..1bdae73 100644 --- a/users/patriot/home.nix +++ b/users/patriot/home.nix @@ -43,26 +43,28 @@ let #!${pkgs.stdenv.shell} chromium --enable-features=UseOzonePlatform --ozone-platform=wayland ''; - chromiumWaylandPkg = with pkgs; stdenv.mkDerivation { - name = "chromium-wayland"; - version = chromium.version; + chromiumWaylandPkg = with pkgs; + let name = "chromium-wayland"; in + stdenv.mkDerivation { + pname = name; + version = chromium.version; - nativeBuildInputs = [ copyDesktopItems ]; - desktopItems = [ - (makeDesktopItem rec { - name = "chromium-wayland"; - exec = name; - desktopName = "Chromium Wayland"; - genericName = "Web Browser"; - }) - ]; + nativeBuildInputs = [ copyDesktopItems ]; + desktopItems = [ + (makeDesktopItem { + inherit name; + exec = name; + desktopName = "Chromium Wayland"; + genericName = "Web Browser"; + }) + ]; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out/bin - ln -s ${chromiumWayland}/bin/chromium-wayland $out/bin/chromium-wayland - ''; - }; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin + ln -s ${chromiumWayland}/bin/chromium-wayland $out/bin/chromium-wayland + ''; + }; colorSchemeLight = { primary = { @@ -99,40 +101,45 @@ let }; }; - colorSchemeDark = rec { - primary = { + colorSchemeDark = + let normal = { - background = "181818"; - foreground = "b9b9b9"; + black = "252525"; + gray = "5b5b5b"; + red = "ed4a46"; + green = "70b433"; + yellow = "dbb32d"; + blue = "368aeb"; + magenta = "eb6eb7"; + cyan = "3fc5b7"; + white = "777777"; }; bright = { - background = bright.black; - foreground = bright.white; + black = "3b3b3b"; + gray = "7b7b7b"; + red = "ff5e56"; + green = "83c746"; + yellow = "efc541"; + blue = "4f9cfe"; + magenta = "ff81ca"; + cyan = "56d8c9"; + white = "dedede"; + }; + in + { + inherit normal bright; + + primary = { + normal = { + background = "181818"; + foreground = "b9b9b9"; + }; + bright = { + background = bright.black; + foreground = bright.white; + }; }; }; - normal = { - black = "252525"; - gray = "5b5b5b"; - red = "ed4a46"; - green = "70b433"; - yellow = "dbb32d"; - blue = "368aeb"; - magenta = "eb6eb7"; - cyan = "3fc5b7"; - white = "777777"; - }; - bright = { - black = "3b3b3b"; - gray = "7b7b7b"; - red = "ff5e56"; - green = "83c746"; - yellow = "efc541"; - blue = "4f9cfe"; - magenta = "ff81ca"; - cyan = "56d8c9"; - white = "dedede"; - }; - }; colorScheme = # if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark; @@ -181,11 +188,24 @@ let indicator = "#111111"; # don't care }; fonts = [ fontComb ]; + + extraEnv = '' + export SDL_VIDEODRIVER=wayland + # needs qt5.qtwayland in systemPackages + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + # Fix for some Java AWT applications (e.g. Android Studio), + # use this if they aren't displayed properly: + export _JAVA_AWT_WM_NONREPARENTING=1 + export QT_QPA_PLATFORMTHEME=qt5ct + export QT_PLATFORM_PLUGIN=qt5ct + ''; in { home-manager.users.patriot = { config, pkgs, ... }: { imports = [ ../profiles/hikari.nix ]; + # needs to be fixed to use nix profile??? /*gtk = { enable = false; font = { @@ -215,8 +235,6 @@ in homeDirectory = nixosConfig.users.users.patriot.home; packages = with pkgs; [ - discord - ripcord # Font stuff fontPackage noto-fonts-cjk @@ -224,6 +242,8 @@ in font-awesome (nerdfonts.override { fonts = [ "Iosevka" ]; }) # Programs + discord + ripcord audacity krita kdenlive @@ -265,17 +285,7 @@ in }; sway = { enable = true; - extraSessionCommands = '' - #export SDL_VIDEODRIVER=wayland - # needs qt5.qtwayland in systemPackages - #export QT_QPA_PLATFORM=wayland - #export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" - # Fix for some Java AWT applications (e.g. Android Studio), - # use this if they aren't displayed properly: - export _JAVA_AWT_WM_NONREPARENTING=1 - export QT_QPA_PLATFORMTHEME=qt5ct - export QT_PLATFORM_PLUGIN=qt5ct - ''; + extraSessionCommands = extraEnv; wrapperFeatures.gtk = true; config = { inherit fonts; @@ -477,10 +487,12 @@ in enableCompletion = true; plugins = let - fast-syntax-highlighting = rec { - name = "fast-syntax-highlighting"; - src = pkgs."zsh-${name}".out; - }; + fast-syntax-highlighting = + let name = "fast-syntax-highlighting"; in + { + inherit name; + src = pkgs."zsh-${name}".out; + }; per-directory-history = { name = "per-directory-history"; src = pkgs.fetchFromGitHub { @@ -495,17 +507,7 @@ in # xdg compliant dotDir = ".config/zsh"; history.path = ".local/share/zsh/history"; - envExtra = '' - #export SDL_VIDEODRIVER=wayland - # needs qt5.qtwayland in systemPackages - #export QT_QPA_PLATFORM=wayland - #export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" - # Fix for some Java AWT applications (e.g. Android Studio), - # use this if they aren't displayed properly: - export _JAVA_AWT_WM_NONREPARENTING=1 - export QT_QPA_PLATFORMTHEME=qt5ct - export QT_PLATFORM_PLUGIN=qt5ct - ''; + envExtra = extraEnv; loginExtra = '' if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then @@ -516,7 +518,7 @@ in export TERM=alacritty function tomp4 () { - ${pkgs.ffmpeg}/bin/ffmpeg -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k $2 + ${pkgs.ffmpeg}/bin/ffmpeg -i $1 -c:v libx264 -preset slow -crf 30 -c:a aac -b:a 128k "$1.mp4" } bindkey "$terminfo[kRIT5]" forward-word @@ -727,7 +729,7 @@ in ''; }; vscode = { - enable = true; + enable = false; package = pkgs.vscodium; extensions = let @@ -773,29 +775,27 @@ in }; services = { - gpg-agent = rec { - enable = true; - enableSshSupport = true; - sshKeys = [ "8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965" ]; - defaultCacheTtl = 3600 * 6; - defaultCacheTtlSsh = defaultCacheTtl; - maxCacheTtl = 3600 * 24; - maxCacheTtlSsh = maxCacheTtl; - grabKeyboardAndMouse = false; - pinentryFlavor = "qt"; - }; + gpg-agent = + let + defaultCacheTtl = 3600 * 6; + maxCacheTtl = 3600 * 24; + in + { + inherit defaultCacheTtl maxCacheTtl; + + enable = true; + enableSshSupport = true; + sshKeys = [ "8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965" ]; + defaultCacheTtlSsh = defaultCacheTtl; + maxCacheTtlSsh = maxCacheTtl; + grabKeyboardAndMouse = false; + pinentryFlavor = "qt"; + }; }; xdg = { enable = true; configFile = { - # "oguri/config".text = '' - # [output *] - # image=/home/patriot/wallpaper.gif - # filter=nearest - # scaling-mode=fill - # anchor=center - # ''; "kak/user/kakrc".text = '' source "%val{config}/user/color/colorscheme.kak" '';