nixos-configs/lib/default.nix
matt1432 f06b0d9c5b
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: restructure my custom nix functions
2024-08-07 14:47:32 -04:00

19 lines
571 B
Nix

{
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)