flake.nix: rename lib' to lib

I don't know why did I do that but whatever.
This commit is contained in:
Gabriel Arazas 2023-12-24 18:10:19 +08:00
parent c8c972dc29
commit d55865beb0
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -81,16 +81,16 @@
# A set of images with their metadata that is usually built for usual # A set of images with their metadata that is usually built for usual
# purposes. The format used here is whatever formats nixos-generators # purposes. The format used here is whatever formats nixos-generators
# support. # support.
images = import ./setups/nixos.nix { lib = lib'; inherit inputs; }; images = import ./setups/nixos.nix { inherit lib inputs; };
# A set of users with their metadata to be deployed with home-manager. # A set of users with their metadata to be deployed with home-manager.
users = import ./setups/home-manager.nix { lib = lib'; inherit inputs; }; users = import ./setups/home-manager.nix { inherit lib inputs; };
# A set of image-related utilities for the flake outputs. # A set of image-related utilities for the flake outputs.
inherit (import ./lib/extras/images.nix { inherit inputs; lib = lib'; }) mkHost mkHome mkImage listImagesWithSystems; inherit (import ./lib/extras/images.nix { inherit lib inputs; }) mkHost mkHome mkImage listImagesWithSystems;
# The order here is important(?). # The order here is important(?).
overlays = lib'.attrValues self.overlays; overlays = lib.attrValues self.overlays;
defaultSystem = "x86_64-linux"; defaultSystem = "x86_64-linux";
@ -112,9 +112,7 @@
# We're considering this as the variant since we'll export the custom # We're considering this as the variant since we'll export the custom
# library as `lib` in the output attribute. # library as `lib` in the output attribute.
lib' = nixpkgs.lib.extend (final: prev: lib = nixpkgs.lib.extend (import ./lib/extras/extend-lib.nix);
import ./lib { lib = prev; }
// import ./lib/private.nix { lib = final; });
# The shared configuration for the entire list of hosts for this cluster. # The shared configuration for the entire list of hosts for this cluster.
# Take note to only set as minimal configuration as possible since we're # Take note to only set as minimal configuration as possible since we're
@ -372,7 +370,7 @@
# A list of NixOS configurations from the `./hosts` folder. It also has # A list of NixOS configurations from the `./hosts` folder. It also has
# some sensible default configurations. # some sensible default configurations.
nixosConfigurations = nixosConfigurations =
lib'.mapAttrs lib.mapAttrs
(host: metadata: (host: metadata:
mkHost { mkHost {
extraModules = [ (hostSpecificModule host metadata) ]; extraModules = [ (hostSpecificModule host metadata) ];
@ -382,12 +380,12 @@
# We're going to make our custom modules available for our flake. Whether # We're going to make our custom modules available for our flake. Whether
# or not this is a good thing is debatable, I just want to test it. # or not this is a good thing is debatable, I just want to test it.
nixosModules.default = import ./modules/nixos { lib = lib'; }; nixosModules.default = import ./modules/nixos { inherit lib; };
# I can now install home-manager users in non-NixOS systems. # I can now install home-manager users in non-NixOS systems.
# NICE! # NICE!
homeConfigurations = homeConfigurations =
lib'.mapAttrs lib.mapAttrs
(user: metadata: (user: metadata:
mkHome { mkHome {
pkgs = import inputs.${metadata.nixpkgs-channel or "nixpkgs"} { pkgs = import inputs.${metadata.nixpkgs-channel or "nixpkgs"} {
@ -399,7 +397,7 @@
(listImagesWithSystems users); (listImagesWithSystems users);
# Extending home-manager with my custom modules, if anyone cares. # Extending home-manager with my custom modules, if anyone cares.
homeModules.default = import ./modules/home-manager { lib = lib'; }; homeModules.default = import ./modules/home-manager { inherit lib; };
# In case somebody wants to use my stuff to be included in nixpkgs. # In case somebody wants to use my stuff to be included in nixpkgs.
overlays = import ./overlays // { overlays = import ./overlays // {
@ -423,9 +421,9 @@
images = images =
forAllSystems (system: forAllSystems (system:
let let
images' = lib'.filterAttrs (host: metadata: system == metadata._system) (listImagesWithSystems images); images' = lib.filterAttrs (host: metadata: system == metadata._system) (listImagesWithSystems images);
in in
lib'.mapAttrs' lib.mapAttrs'
(host: metadata: (host: metadata:
let let
name = metadata._name; name = metadata._name;
@ -433,7 +431,7 @@
pkgs = import inputs.${nixpkgs-channel} {}; pkgs = import inputs.${nixpkgs-channel} {};
format = metadata.format or "iso"; format = metadata.format or "iso";
in in
lib'.nameValuePair name (mkImage { lib.nameValuePair name (mkImage {
inherit format pkgs; inherit format pkgs;
extraModules = [ (hostSpecificModule host metadata) ]; extraModules = [ (hostSpecificModule host metadata) ];
})) }))
@ -484,12 +482,12 @@
# command-line shells have support for (e.g., Bash, zsh, fish). # command-line shells have support for (e.g., Bash, zsh, fish).
deploy.nodes = deploy.nodes =
let let
nixosConfigurations = lib'.mapAttrs' nixosConfigurations = lib.mapAttrs'
(name: value: (name: value:
let let
metadata = images.${name}; metadata = images.${name};
in in
lib'.nameValuePair "nixos-${name}" { lib.nameValuePair "nixos-${name}" {
hostname = metadata.deploy.hostname or name; hostname = metadata.deploy.hostname or name;
autoRollback = metadata.deploy.auto-rollback or true; autoRollback = metadata.deploy.auto-rollback or true;
magicRollback = metadata.deploy.magic-rollback or true; magicRollback = metadata.deploy.magic-rollback or true;
@ -502,13 +500,13 @@
}; };
}) })
self.nixosConfigurations; self.nixosConfigurations;
homeConfigurations = lib'.mapAttrs' homeConfigurations = lib.mapAttrs'
(name: value: (name: value:
let let
metadata = users.${name}; metadata = users.${name};
username = metadata.deploy.username or name; username = metadata.deploy.username or name;
in in
lib'.nameValuePair "home-manager-${name}" { lib.nameValuePair "home-manager-${name}" {
hostname = metadata.deploy.hostname or name; hostname = metadata.deploy.hostname or name;
autoRollback = metadata.deploy.auto-rollback or true; autoRollback = metadata.deploy.auto-rollback or true;
magicRollback = metadata.deploy.magic-rollback or true; magicRollback = metadata.deploy.magic-rollback or true;
@ -526,7 +524,7 @@
# How to make yourself slightly saner than before. So far the main checks # How to make yourself slightly saner than before. So far the main checks
# are for deploy nodes. # are for deploy nodes.
checks = lib'.mapAttrs checks = lib.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy) (system: deployLib: deployLib.deployChecks self.deploy)
inputs.deploy.lib; inputs.deploy.lib;