mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
lib/env-builders: refactor and add lib
parameter for builder functions
This commit is contained in:
parent
70acd5f83c
commit
9bffd41676
@ -4,14 +4,15 @@
|
|||||||
# and basically redoing what the upstream projects are doing so maintenance is
|
# and basically redoing what the upstream projects are doing so maintenance is
|
||||||
# pretty much higher here.
|
# pretty much higher here.
|
||||||
#
|
#
|
||||||
|
# Anyways, all we're doing here is to see how much of a pain to use those Nix
|
||||||
|
# projects especially those that are entirely relying on flakes.
|
||||||
|
#
|
||||||
# Despite named similarly to npins `sources` convention, it should also work
|
# Despite named similarly to npins `sources` convention, it should also work
|
||||||
# for flake-based setups as long as the inputs attrset from the flake output
|
# for flake-based setups as long as the inputs attrset from the flake output
|
||||||
# function is the one that is passed.
|
# function is the one that is passed.
|
||||||
{ lib, foodogsquaredLib, sources }:
|
{ lib, foodogsquaredLib, sources }:
|
||||||
|
|
||||||
let
|
let
|
||||||
nixosModules = ../modules/nixos;
|
|
||||||
|
|
||||||
# A set of nixos-generators modules including our custom ones.
|
# A set of nixos-generators modules including our custom ones.
|
||||||
nixosGeneratorModules =
|
nixosGeneratorModules =
|
||||||
let
|
let
|
||||||
@ -39,6 +40,8 @@ rec {
|
|||||||
specialArgs ? { },
|
specialArgs ? { },
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
nixosModules = ../modules/nixos;
|
||||||
|
|
||||||
# Evaluating the system ourselves (which is trivial) instead of relying
|
# Evaluating the system ourselves (which is trivial) instead of relying
|
||||||
# on nixpkgs.lib.nixosSystem flake output.
|
# on nixpkgs.lib.nixosSystem flake output.
|
||||||
nixosSystem = args: import "${pkgs.path}/nixos/lib/eval-config.nix" args;
|
nixosSystem = args: import "${pkgs.path}/nixos/lib/eval-config.nix" args;
|
||||||
@ -49,9 +52,13 @@ rec {
|
|||||||
foodogsquaredUtils = import ./utils/nixos.nix { inherit lib; };
|
foodogsquaredUtils = import ./utils/nixos.nix { inherit lib; };
|
||||||
foodogsquaredModulesPath = builtins.toString nixosModules;
|
foodogsquaredModulesPath = builtins.toString nixosModules;
|
||||||
};
|
};
|
||||||
modules = extraModules ++ [{
|
modules = extraModules ++ lib.singleton {
|
||||||
|
imports = [
|
||||||
|
nixosModules
|
||||||
|
../modules/nixos/_private
|
||||||
|
];
|
||||||
nixpkgs.hostPlatform = lib.mkForce system;
|
nixpkgs.hostPlatform = lib.mkForce system;
|
||||||
}];
|
};
|
||||||
|
|
||||||
# Since we're setting it through nixpkgs.hostPlatform, we'll have to pass
|
# Since we're setting it through nixpkgs.hostPlatform, we'll have to pass
|
||||||
# this as null.
|
# this as null.
|
||||||
@ -62,6 +69,7 @@ rec {
|
|||||||
mkNixosImage = {
|
mkNixosImage = {
|
||||||
pkgs,
|
pkgs,
|
||||||
system,
|
system,
|
||||||
|
lib ? pkgs.lib,
|
||||||
extraModules ? [ ],
|
extraModules ? [ ],
|
||||||
specialArgs ? { },
|
specialArgs ? { },
|
||||||
format ? "iso",
|
format ? "iso",
|
||||||
@ -69,7 +77,7 @@ rec {
|
|||||||
let
|
let
|
||||||
extraModules' = extraModules ++ [ nixosGeneratorModules.${format} ];
|
extraModules' = extraModules ++ [ nixosGeneratorModules.${format} ];
|
||||||
nixosSystem = mkNixosSystem {
|
nixosSystem = mkNixosSystem {
|
||||||
inherit pkgs system specialArgs;
|
inherit pkgs lib system specialArgs;
|
||||||
extraModules = extraModules';
|
extraModules = extraModules';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user