From 6760ddade60b7a016ff36c90917c35b1d542f336 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Thu, 21 Nov 2024 21:44:30 -0500 Subject: [PATCH] feat(nix): use version from nixd --- common/default.nix | 19 ++++++++++++++++--- inputs/default.nix | 1 - 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/common/default.nix b/common/default.nix index f9def960..e0743ff5 100644 --- a/common/default.nix +++ b/common/default.nix @@ -3,10 +3,13 @@ home-manager, lib, nh, + nixd, pkgs, self, ... -}: { +}: let + inherit (lib) attrValues filter findFirst isAttrs hasAttr mkIf mkOption types; +in { imports = [ ./vars @@ -27,7 +30,18 @@ }; nix = { - package = pkgs.nixVersions.nix_2_24; + package = let + nixdInput = + findFirst + (x: x.pname == "nix") {} + nixd.packages.${pkgs.system}.nixd.buildInputs; + + throws = x: !(builtins.tryEval x).success; + hasVersion = x: isAttrs x && hasAttr "version" x; + + nixVersions = filter (x: ! throws x && hasVersion x) (attrValues pkgs.nixVersions); + in + findFirst (x: x.version == nixdInput.version) {} nixVersions; # Edit nix.conf settings = { @@ -97,7 +111,6 @@ }; home-manager.users = let - inherit (lib) mkIf mkOption types; inherit (config.vars) mainUser; default = { diff --git a/inputs/default.nix b/inputs/default.nix index 9885a83b..10071f8f 100644 --- a/inputs/default.nix +++ b/inputs/default.nix @@ -52,7 +52,6 @@ let }; nvimInputs = { - # uses nixVersions.nix_2_24 nixd = mkDep { owner = "nix-community"; repo = "nixd";