nixos-configs/lib/default.nix
matt1432 4f38557364
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: move inputs nix code to folder
2024-11-20 15:01:58 -05:00

20 lines
752 B
Nix

{
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)
// optionalAttrs (pkgs != {}) (import ./pkgs.nix {inherit pkgs mkVersion capitalise self;})