mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 06:19:00 +00:00
lib: restructure folder structure
To easily support channels and flake.
This commit is contained in:
parent
9e170dd6ec
commit
a5ababe88d
@ -1,8 +1,7 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
let
|
||||
lib' = pkgs.lib.extend (final: prev:
|
||||
import ./lib { lib = prev; } // import ./lib/private.nix { lib = final; });
|
||||
lib' = pkgs.lib.extend (import ./lib/extras/extend-lib.nix);
|
||||
in
|
||||
{
|
||||
lib = import ./lib { lib = pkgs.lib; };
|
||||
|
@ -87,7 +87,7 @@
|
||||
users = lib'.importTOML ./users.toml;
|
||||
|
||||
# A set of image-related utilities for the flake outputs.
|
||||
inherit (import ./lib/images.nix { inherit inputs; lib = lib'; }) mkHost mkHome mkImage listImagesWithSystems;
|
||||
inherit (import ./lib/extras/images.nix { inherit inputs; lib = lib'; }) mkHost mkHome mkImage listImagesWithSystems;
|
||||
|
||||
# The order here is important(?).
|
||||
overlays = [
|
||||
|
16
lib/extras/extend-lib.nix
Normal file
16
lib/extras/extend-lib.nix
Normal file
@ -0,0 +1,16 @@
|
||||
# A lambda suitable to be used for `pkgs.lib.extend`.
|
||||
self: super: let
|
||||
publicLib = import ../. { lib = super; };
|
||||
in
|
||||
{
|
||||
inherit (publicLib) filesToAttr countAttrs getSecrets
|
||||
attachSopsPathPrefix;
|
||||
|
||||
# Until I figure out how to properly add them only for their respective
|
||||
# environment, this is the working solution for now. Not really perfect
|
||||
# since we use one nixpkgs instance for each configuration (home-manager or
|
||||
# otherwise).
|
||||
private = publicLib
|
||||
// import ../private.nix { lib = self; }
|
||||
// import ../home-manager.nix { lib = self; };
|
||||
}
|
@ -4,15 +4,7 @@
|
||||
|
||||
let
|
||||
# A function that generates a lambda suitable for `lib.extend`.
|
||||
extendLib = self: super: let
|
||||
publicLib = import ./. { lib = super; };
|
||||
in
|
||||
{
|
||||
inherit (publicLib) filesToAttr countAttrs getSecrets
|
||||
attachSopsPathPrefix;
|
||||
private = publicLib
|
||||
// import ./private.nix { lib = self; };
|
||||
};
|
||||
extendLib = import ./extend-lib.nix;
|
||||
in
|
||||
{
|
||||
# A thin wrapper around the NixOS configuration function.
|
Loading…
Reference in New Issue
Block a user