From 1c809e14605cf7f07c6c07461ad47f052f9e9b15 Mon Sep 17 00:00:00 2001 From: reo101 Date: Sat, 1 Jun 2024 16:07:36 +0300 Subject: [PATCH] fix(nix-monitored)!: put in `nixVersions.monitored` Also fix `devShell` - did not correctly use the `monitored` version of `nix` Also apply the overlays to the `pkgs` instance, used by `flake-parts` --- flake.nix | 9 ++- .../aarch64-darwin/limonka/configuration.nix | 2 +- overlays/default.nix | 64 ++++++++++--------- shells/default/default.nix | 2 +- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/flake.nix b/flake.nix index 1630e9f..5130362 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,7 @@ nix-monitored = { url = "github:ners/nix-monitored"; + inputs.nixpkgs.follows = "nixpkgs"; }; disko = { @@ -143,7 +144,13 @@ "x86_64-darwin" ]; - perSystem = { pkgs, ... }: { + perSystem = { pkgs, lib, system, ... }: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + overlays = lib.attrValues outputs.overlays; + config = { }; + }; + # Packages (`nix build`) packages = import ./pkgs { inherit pkgs; }; diff --git a/machines/nix-darwin/aarch64-darwin/limonka/configuration.nix b/machines/nix-darwin/aarch64-darwin/limonka/configuration.nix index 5c4cfcf..c14656e 100644 --- a/machines/nix-darwin/aarch64-darwin/limonka/configuration.nix +++ b/machines/nix-darwin/aarch64-darwin/limonka/configuration.nix @@ -10,7 +10,7 @@ nix = { # Ensure we can work with flakes - package = pkgs.nixVersions.latest-monitored; + package = pkgs.nixVersions.monitored.latest; # extraOptions = '' # # Enable flakes and new 'nix' command diff --git a/overlays/default.nix b/overlays/default.nix index ef39cd8..5a87267 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -35,36 +35,40 @@ nix-output-monitor = prev.nix-output-monitor; }; - nixVersions = prev.nixVersions // final.lib.flip final.lib.concatMapAttrs prev.nixVersions (version: package: - final.lib.optionalAttrs - (final.lib.and - (final.lib.all (prefix: ! final.lib.hasPrefix prefix version) - # TODO: smarter filtering of deprecated and non-packages - [ - "nix_2_4" - "nix_2_5" - "nix_2_6" - "nix_2_7" - "nix_2_8" - "nix_2_9" - "nix_2_10" - "nix_2_11" - "nix_2_12" - "nix_2_13" - "nix_2_14" - "nix_2_15" - "nix_2_16" - "nix_2_17" - "unstable" - ]) - (final.lib.isDerivation package)) - { - "${version}-monitored" = inputs.nix-monitored.packages.${final.system}.default.override { - nix = package; - nix-output-monitor = prev.nix-output-monitor; - }; - } - ); + nixVersions = prev.nixVersions // { + monitored = + final.lib.flip final.lib.concatMapAttrs prev.nixVersions (version: package: + final.lib.optionalAttrs + (final.lib.and + (final.lib.all (prefix: ! final.lib.hasPrefix prefix version) + # TODO: smarter filtering of deprecated and non-packages + [ + "nix_2_4" + "nix_2_5" + "nix_2_6" + "nix_2_7" + "nix_2_8" + "nix_2_9" + "nix_2_10" + "nix_2_11" + "nix_2_12" + "nix_2_13" + "nix_2_14" + "nix_2_15" + "nix_2_16" + "nix_2_17" + "unstable" + ]) + (final.lib.isDerivation package)) + { + # NOTE: `lib.getBin` is needed, otherwise the `-dev` output is chosen + "${version}" = final.lib.getBin (inputs.nix-monitored.packages.${final.system}.default.override { + nix = package; + nix-output-monitor = prev.nix-output-monitor; + }); + } + ); + }; river = prev.river.overrideAttrs (oldAttrs: rec { xwaylandSupport = true; diff --git a/shells/default/default.nix b/shells/default/default.nix index f4ce7c8..d964c37 100644 --- a/shells/default/default.nix +++ b/shells/default/default.nix @@ -8,7 +8,7 @@ extra-experimental-features = nix-command flakes ''; nativeBuildInputs = with pkgs; [ - nix + nixVersions.monitored.latest home-manager git wireguard-tools