refactor: restructure my custom nix functions

This commit is contained in:
matt1432 2024-08-07 14:47:32 -04:00
parent dafb2cf8ce
commit f06b0d9c5b
10 changed files with 94 additions and 69 deletions

19
lib/default.nix Normal file
View file

@ -0,0 +1,19 @@
{
inputs ? {},
pkgs ? {},
}: 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) optionalAttrs;
mkVersion = src: "0.0.0+" + src.shortRev;
in
{inherit lib mkVersion;}
// (import ./inputs.nix lib lock)
// optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs)
// optionalAttrs (pkgs != {}) (import ./pkgs.nix pkgs mkVersion)