From 1c291723b9f204d37641c405680e8b86d424c1d3 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Mon, 12 Aug 2024 17:57:09 -0700 Subject: [PATCH] fix: use the official-release bit from the Lix sources to skip versionSuffix I wrote that json file intending to use it for this and then forgot. lol oops. --- flake.nix | 8 ++++++-- overlay.nix | 11 ++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index ec4c53f..887e561 100644 --- a/flake.nix +++ b/flake.nix @@ -8,8 +8,12 @@ inputs.flakey-profile.url = "github:lf-/flakey-profile"; outputs = inputs@{ self, nixpkgs, lix, flake-utils, flakey-profile, ... }: - let versionSuffix = "pre${builtins.substring 0 8 lix.lastModifiedDate}-${lix.shortRev or lix.dirtyShortRev}"; - in { + let + lixVersionJson = builtins.fromJSON (builtins.readFile (lix + "/version.json")); + versionSuffix = nixpkgs.lib.optionalString (!lixVersionJson.official_release) + "-pre${builtins.substring 0 8 lix.lastModifiedDate}-${lix.shortRev or lix.dirtyShortRev}"; + in + { inherit inputs; nixosModules = { # Use a locally built Lix diff --git a/overlay.nix b/overlay.nix index e424e8f..e43f498 100644 --- a/overlay.nix +++ b/overlay.nix @@ -6,7 +6,7 @@ let # usage. # https://github.com/nixos/nixpkgs/blob/6afb255d976f85f3359e4929abd6f5149c323a02/nixos/modules/config/nix.nix#L121 lixPackageFromSource = final.callPackage (lix + "/package.nix") ({ - versionSuffix = "-${versionSuffix}"; + inherit versionSuffix; }); # These packages depend on Nix features that Lix does not support @@ -23,7 +23,8 @@ let override_2_18 = prev.lib.genAttrs overridelist_2_18 ( name: prev.${name}.override { nix = final.nixVersions.nix_2_18_upstream; - }); + } + ); inherit (prev) lib; @@ -56,7 +57,7 @@ let maybeWarnDuplicate = x: if final.lix-overlay-present > 1 then builtins.trace warning x else x; versionJson = builtins.fromJSON (builtins.readFile ./version.json); - supportedLixMajor = builtins.elemAt (builtins.match ''^([[:digit:]]+\.[[:digit:]]+)\..*'' versionJson.version) 0; + supportedLixMajor = lib.versions.majorMinor versionJson.version; lixPackageToUse = if lix != null then lixPackageFromSource else prev.lix; # Especially if using Lix from nixpkgs, it is plausible that the overlay # could be used against the wrong Lix major version and cause confusing build @@ -98,7 +99,7 @@ let nix-doc = prev.callPackage ./nix-doc/package.nix { withPlugin = false; }; }; in - # Make the overlay idempotent, since flakes passing nixos modules around by +# Make the overlay idempotent, since flakes passing nixos modules around by # value and many other things make it way too easy to include the overlay # twice - if (prev ? lix-overlay-present) then { lix-overlay-present = 2; } else overlay +if (prev ? lix-overlay-present) then { lix-overlay-present = 2; } else overlay