From 372df8b48a31a354411a24fb1799e9b37f237c81 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 22 Jul 2025 03:17:23 +0300 Subject: [PATCH] treewide: get rid of attrValues pattern because nixd doesn't support goto def on it --- modules/common/agenix.nix | 10 +-- modules/common/editor/default.nix | 62 ++++++++------- modules/common/git.nix | 12 ++- modules/common/jujutsu.nix | 16 ++-- modules/common/nix.nix | 14 ++-- modules/common/packages.nix | 115 +++++++++++++--------------- modules/common/rust.nix | 33 ++++---- modules/common/shell/carapace.nix | 16 ++-- modules/linux/fonts.nix | 20 +++-- modules/linux/hyprland/hyprland.nix | 28 ++++--- modules/linux/thunar.nix | 30 +++----- 11 files changed, 160 insertions(+), 196 deletions(-) diff --git a/modules/common/agenix.nix b/modules/common/agenix.nix index e95b084..3c7b95e 100644 --- a/modules/common/agenix.nix +++ b/modules/common/agenix.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: let - inherit (lib) attrNames attrValues filterAttrs hasPrefix head mkAliasOptionModule mkIf; + inherit (lib) attrNames filterAttrs hasPrefix head mkAliasOptionModule mkIf; in { imports = [(mkAliasOptionModule [ "secrets" ] [ "age" "secrets" ])]; @@ -12,10 +12,8 @@ in { environment = mkIf config.isDesktop { shellAliases.agenix = "agenix --identity ~/.ssh/id"; - systemPackages = attrValues { - inherit (pkgs) - agenix - ; - }; + systemPackages = [ + pkgs.agenix + ]; }; } diff --git a/modules/common/editor/default.nix b/modules/common/editor/default.nix index 6f0d919..d723d7a 100644 --- a/modules/common/editor/default.nix +++ b/modules/common/editor/default.nix @@ -129,49 +129,47 @@ in { shellAliases.e = config.editor.defaultAlias; variables.EDITOR = config.editor.defaultAlias; - systemPackages = mkIf config.isDesktop <| attrValues { - inherit (pkgs) - # CMAKE - cmake-language-server + systemPackages = mkIf config.isDesktop [ + # CMAKE + pkgs.cmake-language-server - # GO - gopls + # GO + pkgs.gopls - # HTML - vscode-langservers-extracted + # HTML + pkgs.vscode-langservers-extracted - # KOTLIN - kotlin-language-server + # KOTLIN + pkgs.kotlin-language-server - # LATEX - texlab + # LATEX + pkgs.texlab - # LUA - lua-language-server + # LUA + pkgs.lua-language-server - # MARKDOWN - markdown-oxide + # MARKDOWN + pkgs.markdown-oxide - # NIX - nixfmt-rfc-style - nixd + # NIX + pkgs.nixfmt-rfc-style + pkgs.nixd - # PYTHON - basedpyright + # PYTHON + pkgs.basedpyright - # RUST - rust-analyzer-nightly - lldb + # RUST + pkgs.rust-analyzer-nightly + pkgs.lldb - # TYPESCRIPT & OTHERS - deno + # TYPESCRIPT & OTHERS + pkgs.deno - # YAML - yaml-language-server + # YAML + pkgs.yaml-language-server - # ZIG - zls - ; - }; + # ZIG + pkgs.zls + ]; }; } diff --git a/modules/common/git.nix b/modules/common/git.nix index dbca01f..20afd3e 100644 --- a/modules/common/git.nix +++ b/modules/common/git.nix @@ -1,5 +1,5 @@ { self, config, lib, pkgs, ... }: let - inherit (lib) attrValues head mkAfter enabled merge mkIf; + inherit (lib) head mkAfter enabled merge mkIf; inherit (lib.strings) match; in { environment.shellAliases = merge { @@ -68,12 +68,10 @@ in { "ask-git" = "gh copilot suggest --target git --"; }; - environment.systemPackages = attrValues { - inherit (pkgs) - git-absorb - tig - ; - }; + environment.systemPackages = [ + pkgs.git-absorb + pkgs.tig + ]; home-manager.sharedModules = [ (homeArgs: let diff --git a/modules/common/jujutsu.nix b/modules/common/jujutsu.nix index c5b749b..48eab9d 100644 --- a/modules/common/jujutsu.nix +++ b/modules/common/jujutsu.nix @@ -1,14 +1,12 @@ { self, config, lib, pkgs, ... }: let - inherit (lib) attrValues enabled head mkIf; + inherit (lib) enabled head mkIf; in { - environment.systemPackages = attrValues { - inherit (pkgs) - difftastic - jjui - mergiraf - radicle-node - ; - }; + environment.systemPackages = [ + pkgs.difftastic + pkgs.jjui + pkgs.mergiraf + pkgs.radicle-node + ]; home-manager.sharedModules = [{ programs.jujutsu = enabled { diff --git a/modules/common/nix.nix b/modules/common/nix.nix index a397a6d..d485fb3 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -1,5 +1,5 @@ { self, config, inputs, lib, pkgs, ... }: let - inherit (lib) attrValues attrsToList concatStringsSep const disabled filter filterAttrs flip id isType mapAttrs mapAttrsToList match merge mkAfter optionalAttrs optionals; + inherit (lib) attrsToList concatStringsSep const disabled filter filterAttrs flip id isType mapAttrs mapAttrsToList merge mkAfter optionalAttrs optionals; inherit (lib.strings) toJSON; registryMap = inputs @@ -53,13 +53,11 @@ in { nix.optimise.automatic = true; - environment.systemPackages = attrValues { - inherit (pkgs) - nh - nix-index - nix-output-monitor - ; - }; + environment.systemPackages = [ + pkgs.nh + pkgs.nix-index + pkgs.nix-output-monitor + ]; home-manager.sharedModules = [{ programs.nushell.configFile.text = mkAfter /* nu */ '' diff --git a/modules/common/packages.nix b/modules/common/packages.nix index 93bebad..a02571a 100644 --- a/modules/common/packages.nix +++ b/modules/common/packages.nix @@ -1,76 +1,65 @@ { config, lib, pkgs, ... }: let - inherit (lib) attrValues optionalAttrs; + inherit (lib) optionals; in { unfree.allowedNames = [ "claude-code" ]; - environment.systemPackages = attrValues <| { - inherit (pkgs) - asciinema - cowsay - curlHTTP3 - dig - doggo - eza - fastfetch - fd - hyperfine - jc - moreutils - openssl - p7zip - pstree - rsync - sd - timg - tokei - typos - uutils-coreutils-noprefix - xh - yazi - yt-dlp - ; + environment.systemPackages = [ + pkgs.asciinema + pkgs.cowsay + pkgs.curlHTTP3 + pkgs.dig + pkgs.doggo + pkgs.eza + pkgs.fastfetch + pkgs.fd + pkgs.hyperfine + pkgs.jc + pkgs.moreutils + pkgs.openssl + pkgs.p7zip + pkgs.pstree + pkgs.rsync + pkgs.sd + pkgs.timg + pkgs.tokei + pkgs.typos + pkgs.uutils-coreutils-noprefix + pkgs.xh + pkgs.yazi + pkgs.yt-dlp + (pkgs.fortune.override { withOffensive = true; }) + ] ++ optionals config.isLinux [ + pkgs.traceroute + pkgs.usbutils + pkgs.strace + ] ++ optionals config.isDesktop [ + pkgs.claude-code - fortune = pkgs.fortune.override { withOffensive = true; }; - } // optionalAttrs config.isLinux { - inherit (pkgs) - traceroute - usbutils - strace - ; - } // optionalAttrs config.isDesktop { - inherit (pkgs) - claude-code + pkgs.clang_16 + pkgs.clang-tools_16 + pkgs.deno + pkgs.gh + pkgs.go + pkgs.lld + pkgs.zig - clang_16 - clang-tools_16 - deno - gh - go - lld - zig + pkgs.qbittorrent + ] ++ optionals (config.isLinux && config.isDesktop) [ + pkgs.thunderbird - qbittorrent - ; - } // optionalAttrs (config.isLinux && config.isDesktop) { - inherit (pkgs) - thunderbird + pkgs.whatsapp-for-linux - whatsapp-for-linux + pkgs.element-desktop + pkgs.zulip + pkgs.fractal - element-desktop - zulip - fractal + pkgs.obs-studio - obs-studio + pkgs.krita - krita + pkgs.libreoffice - libreoffice - ; - - inherit (pkgs.hunspellDicts) - en_US - en_GB-ize - ; - }; + pkgs.en_US + pkgs.en_GB-ize + ]; } diff --git a/modules/common/rust.nix b/modules/common/rust.nix index 57a3e2c..4b41892 100644 --- a/modules/common/rust.nix +++ b/modules/common/rust.nix @@ -1,34 +1,31 @@ { config, lib, pkgs, ... }: let - inherit (lib) attrValues makeLibraryPath mkIf; + inherit (lib) makeLibraryPath mkIf; in { environment.variables = { CARGO_NET_GIT_FETCH_WITH_CLI = "true"; - LIBRARY_PATH = mkIf config.isDarwin <| makeLibraryPath <| attrValues { - inherit (pkgs) - libiconv - ; - }; + LIBRARY_PATH = mkIf config.isDarwin <| makeLibraryPath [ + pkgs.libiconv + ]; }; - environment.systemPackages = attrValues { - inherit (pkgs) - cargo-deny - cargo-expand - cargo-fuzz - cargo-nextest + environment.systemPackages = [ + pkgs.cargo-deny + pkgs.cargo-expand + pkgs.cargo-fuzz + pkgs.cargo-nextest - evcxr + pkgs.evcxr - taplo - ; + pkgs.taplo - fenix = pkgs.fenix.complete.withComponents [ + + (pkgs.fenix.complete.withComponents [ "cargo" "clippy" "rust-src" "rustc" "rustfmt" - ]; - }; + ]) + ]; } diff --git a/modules/common/shell/carapace.nix b/modules/common/shell/carapace.nix index 426539a..6ce38bd 100644 --- a/modules/common/shell/carapace.nix +++ b/modules/common/shell/carapace.nix @@ -1,14 +1,12 @@ { lib, pkgs, ... }: let - inherit (lib) attrValues enabled; + inherit (lib) enabled; in { - environment.systemPackages = attrValues { - inherit (pkgs) - carapace - fish - zsh - inshellisense - ; - }; + environment.systemPackages = [ + pkgs.carapace + pkgs.fish + pkgs.zsh + pkgs.inshellisense + ]; home-manager.sharedModules = [{ programs.carapace = enabled; diff --git a/modules/linux/fonts.nix b/modules/linux/fonts.nix index acdcc05..029f4ca 100644 --- a/modules/linux/fonts.nix +++ b/modules/linux/fonts.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: let - inherit (lib) attrValues disabled merge mkIf; + inherit (lib) disabled merge mkIf; in merge (mkIf config.isDesktop { @@ -9,17 +9,15 @@ in merge packages = [ pkgs.terminus_font ]; }; - fonts.packages = attrValues { - sans = config.theme.font.sans.package; - mono = config.theme.font.mono.package; + fonts.packages = [ + config.theme.font.sans.package + config.theme.font.mono.package - inherit (pkgs) - noto-fonts - noto-fonts-cjk-sans - noto-fonts-lgc-plus - noto-fonts-emoji - ; - }; + pkgs.noto-fonts + pkgs.noto-fonts-cjk-sans + pkgs.noto-fonts-lgc-plus + pkgs.noto-fonts-emoji + ]; }) (mkIf config.isServer { diff --git a/modules/linux/hyprland/hyprland.nix b/modules/linux/hyprland/hyprland.nix index e55548b..49b5cfa 100644 --- a/modules/linux/hyprland/hyprland.nix +++ b/modules/linux/hyprland/hyprland.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: let - inherit (lib) attrValues enabled merge mkIf flatten range; + inherit (lib) enabled merge mkIf flatten range; in merge <| mkIf config.isDesktop { hardware.graphics = enabled; @@ -19,20 +19,18 @@ in merge <| mkIf config.isDesktop { programs.xwayland = enabled; - environment.systemPackages = attrValues { - inherit (pkgs) - brightnessctl - grim - hyprpicker - slurp - swappy - swaybg - wl-clipboard - wtype - xdg-utils - xwaylandvideobridge - ; - }; + environment.systemPackages = [ + pkgs.brightnessctl + pkgs.grim + pkgs.hyprpicker + pkgs.slurp + pkgs.swappy + pkgs.swaybg + pkgs.wl-clipboard + pkgs.wtype + pkgs.xdg-utils + pkgs.xwaylandvideobridge + ]; home-manager.sharedModules = [{ wayland.windowManager.hyprland = enabled { diff --git a/modules/linux/thunar.nix b/modules/linux/thunar.nix index 0a5f5e4..51f5cd5 100644 --- a/modules/linux/thunar.nix +++ b/modules/linux/thunar.nix @@ -1,25 +1,19 @@ { config, lib, pkgs, ... }: let - inherit (lib) attrValues enabled merge mkIf; + inherit (lib) enabled merge mkIf; in merge <| mkIf config.isDesktop { programs.thunar = enabled { - plugins = attrValues { - inherit (pkgs.xfce) - thunar-archive-plugin - thunar-media-tags-plugin - thunar-volman - ; - }; + plugins = [ + pkgs.xfce.thunar-archive-plugin + pkgs.xfce.thunar-media-tags-plugin + pkgs.xfce.thunar-volman + ]; }; - environment.systemPackages = attrValues { - inherit (pkgs) - ark - ffmpegthumbnailer - libgsf - ; + environment.systemPackages = [ + pkgs.ark + pkgs.ffmpegthumbnailer + pkgs.libgsf - inherit (pkgs.xfce) - tumbler - ; - }; + pkgs.xfce.tumbler + ]; }