From ef2b5ea9f2f9450eac7ac2a875a8f1c6599c1ed0 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 24 May 2024 04:46:59 -0400 Subject: don't use flake module --- lib/lib.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/lib.nix (limited to 'lib/lib.nix') diff --git a/lib/lib.nix b/lib/lib.nix new file mode 100644 index 0000000..5b7ee7d --- /dev/null +++ b/lib/lib.nix @@ -0,0 +1,47 @@ +{ + lib, + self, + inputs, + ... +}: let + wrapBuilderWith = apply: builder: args: builder (apply args); + + wrapBuilder = type: + wrapBuilderWith ({ + modules ? [], + specialArgs ? {}, + ... + } @ args: + args + // { + modules = + modules + ++ lib.attrValues (self."${type}Modules" or {}); + + specialArgs = specialArgs // {inherit inputs;}; + }); + + wrapNixOS = wrapBuilder "nixos"; + wrapDarwin = wrapBuilder "darwin"; + + wrapUser = wrapBuilderWith ({ + modules ? [], + extraSpecialArgs ? {}, + ... + } @ args: + args + // { + modules = + modules + ++ lib.attrValues (self.homeManagerModules or {}); + + extraSpecialArgs = extraSpecialArgs // {inherit inputs;}; + }); +in { + nixosSystem = wrapNixOS inputs.nixpkgs.lib.nixosSystem; + nixosSystemStable = wrapNixOS inputs.nixpkgs-stable.lib.nixosSystem; + darwinSystem = wrapDarwin inputs.nix-darwin.lib.darwinSystem; + homeManagerConfiguration = wrapUser inputs.home-manager.lib.homeManagerConfiguration; + + nginx = import ./nginx.nix lib; +} -- cgit v1.2.3