Consolidated and moved modules/{nixos,darwin} to modules/system

This commit is contained in:
Nikodem Rabuliński 2024-01-02 20:08:20 +01:00
parent 77cf9d4396
commit 679496f5b4
20 changed files with 258 additions and 250 deletions

View file

@ -0,0 +1,49 @@
{perInput}: {
config,
lib,
pkgs,
...
}: let
cfg = config.settei.flake-qol;
in {
_file = ./flake-qol.nix;
options.settei.flake-qol = with lib; {
enable = mkEnableOption "QoL defaults when using flakes";
reexportAsArgs = mkOption {
type = types.bool;
default = true;
};
inputs = mkOption {
type = types.unspecified;
};
inputs-flakes = mkOption {
type = types.attrs;
readOnly = true;
};
inputs' = mkOption {
type = types.attrs;
readOnly = true;
};
};
config = let
reexportedArgs = lib.mkIf cfg.reexportAsArgs {
inherit (cfg) inputs inputs-flakes inputs';
};
in
lib.mkIf cfg.enable {
settei.flake-qol = {
inputs-flakes = lib.filterAttrs (_: input: input ? flake -> input.flake) cfg.inputs;
inputs' = lib.mapAttrs (_: perInput pkgs.stdenv.system) cfg.inputs-flakes;
};
_module.args = reexportedArgs;
settei.user.extraArgs = reexportedArgs;
nix = {
registry = lib.mapAttrs (_: flake: {inherit flake;}) cfg.inputs-flakes;
nixPath = lib.mapAttrsToList (name: _: "${name}=flake:${name}") cfg.inputs-flakes;
};
};
}