From a8bc77d40cb639a68be6e57a8833a06e6cddebdd Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 5 Mar 2024 00:06:08 +0000 Subject: [PATCH] nixpkgs sourceInfo patching: move to nixpatches/ previously i was using the sourceInfo of the flake, which is kinda wrong: and it would force a _new_ nixpkgs for every time i commit to my own repo -- not just when i bump it --- flake.nix | 25 +------------------------ nixpatches/flake.nix | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/flake.nix b/flake.nix index 0d580983..222a2b8d 100644 --- a/flake.nix +++ b/flake.nix @@ -97,30 +97,7 @@ patchNixpkgs = variant: nixpkgs: (import ./nixpatches/flake.nix).outputs { inherit variant nixpkgs; self = patchNixpkgs variant nixpkgs; - } // { - # sourceInfo includes fields (square brackets for the ones which are not always present): - # - [dirtyRev] - # - [dirtyShortRev] - # - lastModified - # - lastModifiedDate - # - narHash - # - outPath - # - [rev] - # - [revCount] - # - [shortRev] - # - submodules - # - # these values are used within nixpkgs: - # - to give a friendly name to the nixos system (`readlink /run/current-system` -> `...nixos-system-desko-24.05.20240227.dirty`) - # - to alias `import ` so that nix uses the system's nixpkgs when called externally (supposedly). - # - # these values seem to exist both within the `sourceInfo` attrset and at the top-level. - # for a list of all implicit flake outputs (which is what these seem to be): - # $ nix-repl - # > lf . - # > - inherit (self) sourceInfo; - } // self.sourceInfo; + }; nixpkgs' = patchNixpkgs "master" nixpkgs-unpatched; nixpkgsCompiledBy = system: nixpkgs'.legacyPackages."${system}"; diff --git a/nixpatches/flake.nix b/nixpatches/flake.nix index cff5a0f2..5a7182e4 100644 --- a/nixpatches/flake.nix +++ b/nixpatches/flake.nix @@ -7,7 +7,7 @@ let patchedPkgsFor = system: nixpkgs.legacyPackages.${system}.applyPatches { name = "nixpkgs-patched-uninsane"; - version = self.lastModifiedDate; + version = nixpkgs.sourceInfo.lastModifiedDate; src = nixpkgs; patches = builtins.filter (p: p != null) ( nixpkgs.legacyPackages."${system}".callPackage ./list.nix { } variant nixpkgs.lastModifiedDate @@ -45,5 +45,28 @@ ).lib.nixosSystem args; legacyPackages = (self._forSystem null).legacyPackages; - }; + + # sourceInfo includes fields (square brackets for the ones which are not always present): + # - [dirtyRev] + # - [dirtyShortRev] + # - lastModified + # - lastModifiedDate + # - narHash + # - outPath + # - [rev] + # - [revCount] + # - [shortRev] + # - submodules + # + # these values are used within nixpkgs: + # - to give a friendly name to the nixos system (`readlink /run/current-system` -> `...nixos-system-desko-24.05.20240227.dirty`) + # - to alias `import ` so that nix uses the system's nixpkgs when called externally (supposedly). + # + # these values seem to exist both within the `sourceInfo` attrset and at the top-level. + # for a list of all implicit flake outputs (which is what these seem to be): + # $ nix-repl + # > lf . + # > + inherit (nixpkgs) sourceInfo; + } // nixpkgs.sourceInfo; }