refactor: expose custom libs through self flake

This commit is contained in:
matt1432 2024-11-20 16:13:12 -05:00
parent 838df34dfb
commit a5fdb3e5d4
8 changed files with 18 additions and 23 deletions

View file

@ -1,20 +1,13 @@
{
inputs ? {},
pkgs ? {},
self ? {},
perSystem,
inputs,
}: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
lib = import "${builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
sha256 = lock.nodes.nixpkgs.locked.narHash;
}}/lib";
inherit (lib) concatStringsSep optionalAttrs stringToCharacters substring tail toUpper;
inherit (inputs.nixpkgs.lib) concatStringsSep stringToCharacters substring tail toUpper;
mkVersion = src: "0.0.0+" + src.shortRev;
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
in
{inherit lib mkVersion capitalise;}
// optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs)
// optionalAttrs (pkgs != {}) (import ./pkgs.nix {inherit pkgs mkVersion capitalise self;})
{inherit mkVersion capitalise;}
// (import ./flake-lib.nix inputs)
// perSystem (pkgs:
import ./pkgs.nix {inherit pkgs mkVersion capitalise inputs;})