forked from pub-solar/os
d51cd34fb7
Subflakes should provide their wares as outputs, so wire up the pkgs flake to reflect that. Due to the unstable nature of flakes, updating the root flake doesn't currently update the subflake lock file. Therefore, add additional logic to flk update script in order to do this behind the scenes. Nix is now pulled in from the "nix" registry flake in order for users to take advantage of improvements to the UI since its last update in nixpkgs.
53 lines
1.3 KiB
Nix
53 lines
1.3 KiB
Nix
{
|
|
description = "Package Sources";
|
|
|
|
inputs = { };
|
|
|
|
outputs = { self, nixpkgs, ... }: {
|
|
overlay = final: prev: {
|
|
inherit (self) srcs;
|
|
};
|
|
|
|
srcs =
|
|
let
|
|
inherit (nixpkgs) lib;
|
|
|
|
mkVersion = name: input:
|
|
let
|
|
inputs = (builtins.fromJSON
|
|
(builtins.readFile ./flake.lock)).nodes;
|
|
|
|
ref =
|
|
if lib.hasAttrByPath [ name "original" "ref" ] inputs
|
|
then inputs.${name}.original.ref
|
|
else "";
|
|
|
|
version =
|
|
let version' = builtins.match
|
|
"[[:alpha:]]*[-._]?([0-9]+(\.[0-9]+)*)+"
|
|
ref;
|
|
in
|
|
if lib.isList version'
|
|
then lib.head version'
|
|
else if input ? lastModifiedDate && input ? shortRev
|
|
then "${lib.substring 0 8 input.lastModifiedDate}_${input.shortRev}"
|
|
else null;
|
|
in
|
|
version;
|
|
in
|
|
lib.mapAttrs
|
|
(pname: input:
|
|
let
|
|
version = mkVersion pname input;
|
|
in
|
|
input // { inherit pname; }
|
|
// lib.optionalAttrs (! isNull version)
|
|
{
|
|
inherit version;
|
|
}
|
|
)
|
|
(lib.filterAttrs (n: _: n != "nixpkgs")
|
|
self.inputs);
|
|
};
|
|
}
|