Add extra function for lib, and refactor with loadImports

This commit is contained in:
ulic-youthlic 2025-07-11 21:04:42 +08:00
parent 317a2b4a28
commit 2c997cddce
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
28 changed files with 111 additions and 204 deletions

View file

@ -1,10 +0,0 @@
{
imports = [
./nixos.nix
./home.nix
./templates.nix
./perSystem.nix
./deploy.nix
./overlays.nix
];
}

View file

@ -2,9 +2,9 @@
lib,
inputs,
self,
rootPath,
...
}: let
rootPath = ./..;
inherit (self) outputs;
homeModules =
(
@ -46,6 +46,11 @@
])
++ [
homeModules."${unixName}"
]
++ [
{
lib = {inherit (lib) youthlic;};
}
];
extraSpecialArgs = {
inherit

View file

@ -2,11 +2,10 @@
inputs,
lib,
self,
rootPath,
...
}: let
rootPath = ./..;
inherit (self) outputs;
inherit (inputs) nixpkgs;
in {
flake = {
nixosModules = {
@ -15,10 +14,10 @@ in {
};
nixosConfigurations = let
makeNixosConfiguration = hostName:
nixpkgs.lib.nixosSystem {
lib.nixosSystem {
modules = [(rootPath + "/nixos/configurations/${hostName}")];
specialArgs = {
inherit inputs outputs rootPath;
inherit inputs outputs rootPath lib;
};
};
in

View file

@ -2,9 +2,9 @@
self,
inputs,
lib,
rootPath,
...
}: let
rootPath = ./..;
inherit (self) outputs;
importWithArgs = lib.flip import {inherit inputs outputs;};
in {

View file

@ -1,6 +1,8 @@
{inputs, ...}: let
rootPath = ./..;
in {
{
inputs,
rootPath,
...
}: {
imports = [
(rootPath + "/treefmt.nix")
];
@ -12,7 +14,7 @@ in {
...
}: let
inherit (inputs) nixpkgs;
callPackages = lib.callPackagesWith (pkgs // {inherit callPackages inputs rootPath;});
callPackages = lib.callPackagesWith (pkgs // {inherit callPackages inputs rootPath lib;});
in {
_module.args.pkgs = import nixpkgs {
inherit system;

View file

@ -1,10 +1,9 @@
{
flake-parts-lib,
lib,
rootPath,
...
}: let
rootPath = ./..;
in {
}: {
options = {
flake = flake-parts-lib.mkSubmoduleOptions {
templates = lib.mkOption {