nixos-configs/lib/default.nix

21 lines
752 B
Nix
Raw Normal View History

{
inputs ? {},
pkgs ? {},
self ? {},
}: 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;
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)
2024-09-25 15:34:56 -04:00
// optionalAttrs (pkgs != {}) (import ./pkgs.nix {inherit pkgs mkVersion capitalise self;})