mirror of
https://github.com/divnix/digga.git
synced 2025-01-09 01:26:43 +03:00
mkFlake: replace config.self -> self
config.self seems to cause infinite recursion when using nix-shell in a non-git repository
This commit is contained in:
parent
ad45b01534
commit
dcf744906f
@ -48,7 +48,7 @@ nix flake
|
||||
|
||||
*_Default_*
|
||||
```
|
||||
"config.self.inputs.<name>"
|
||||
"self.inputs.<name>"
|
||||
```
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
{ self, inputs, ... } @ args:
|
||||
let
|
||||
# avoid infinite recursions w.r.t. using self or inputs in imports
|
||||
injectedDeps' = injectedDeps // { inherit (args) self inputs; };
|
||||
injectedDeps' = injectedDeps // { inherit self inputs; };
|
||||
|
||||
options' = import ./options.nix injectedDeps';
|
||||
fupAdapter' = import ./fup-adapter.nix injectedDeps';
|
||||
|
@ -1,5 +1,5 @@
|
||||
# constructor dependencies
|
||||
{ lib, flake-utils-plus, internal-modules, ... }:
|
||||
{ lib, self, inputs, flake-utils-plus, internal-modules, ... }:
|
||||
|
||||
{
|
||||
# evaluated digga configuration
|
||||
@ -24,7 +24,7 @@ let
|
||||
|
||||
defaultHostModules = [
|
||||
(internal-modules.hmNixosDefaults {
|
||||
specialArgs = config.home.importables // { inherit (config) self inputs; };
|
||||
specialArgs = config.home.importables // { inherit self inputs; };
|
||||
modules = config.home.modules ++ config.home.exportedModules;
|
||||
})
|
||||
(internal-modules.globalDefaults {
|
||||
@ -60,11 +60,9 @@ let
|
||||
|
||||
diggaFupArgs = {
|
||||
inherit (config)
|
||||
self
|
||||
inputs
|
||||
channelsConfig
|
||||
supportedSystems;
|
||||
inherit sharedOverlays;
|
||||
inherit self inputs sharedOverlays;
|
||||
|
||||
hosts = builtins.mapAttrs (_: stripHost) config.nixos.hosts;
|
||||
|
||||
@ -79,7 +77,7 @@ let
|
||||
|
||||
hostDefaults = flake-utils-plus.lib.mergeAny (stripHost config.nixos.hostDefaults) {
|
||||
# add `self` & `inputs` as specialargs so their libs can be used in imports
|
||||
specialArgs = config.nixos.importables // { inherit (config) self inputs; };
|
||||
specialArgs = config.nixos.importables // { inherit self inputs; };
|
||||
modules = config.nixos.hostDefaults.exportedModules ++ defaultHostModules;
|
||||
};
|
||||
|
||||
@ -93,8 +91,8 @@ let
|
||||
# since we can't detect overlays owned by self
|
||||
# we have to filter out ones exported by the inputs
|
||||
# optimally we would want a solution for NixOS/nix#4740
|
||||
inherit (config.self) pkgs;
|
||||
inherit (config) inputs;
|
||||
inherit (self) pkgs;
|
||||
inherit inputs;
|
||||
};
|
||||
|
||||
outputsBuilder = channels:
|
||||
|
@ -255,8 +255,8 @@ let
|
||||
inputOpt = name: {
|
||||
input = mkOption {
|
||||
type = flakeType;
|
||||
default = config.self.inputs.${name};
|
||||
defaultText = "config.self.inputs.<name>";
|
||||
default = self.inputs.${name};
|
||||
defaultText = "self.inputs.<name>";
|
||||
description = ''
|
||||
nixpkgs flake input to use for this channel
|
||||
'';
|
||||
|
@ -1,5 +1,5 @@
|
||||
# constructor dependencies
|
||||
{ lib, deploy, devshell, home-manager, flake-utils-plus, tests, ... }:
|
||||
{ lib, self, inputs, deploy, devshell, home-manager, flake-utils-plus, tests, ... }:
|
||||
config: channels:
|
||||
let
|
||||
|
||||
@ -21,7 +21,7 @@ let
|
||||
inherit username homeDirectory pkgs system;
|
||||
|
||||
extraModules = config.home.modules ++ config.home.exportedModules;
|
||||
extraSpecialArgs = config.home.importables // { inherit (config) self inputs; };
|
||||
extraSpecialArgs = config.home.importables // { inherit self inputs; };
|
||||
|
||||
configuration = {
|
||||
imports = [ configuration ];
|
||||
@ -46,7 +46,7 @@ in
|
||||
|
||||
inherit homeConfigurationsPortable;
|
||||
|
||||
packages = flake-utils-plus.lib.exportPackages config.self.overlays channels;
|
||||
packages = flake-utils-plus.lib.exportPackages self.overlays channels;
|
||||
|
||||
devShell =
|
||||
let
|
||||
@ -58,21 +58,21 @@ in
|
||||
in
|
||||
(eval {
|
||||
inherit configuration;
|
||||
extraSpecialArgs = { inherit (config) self inputs; };
|
||||
extraSpecialArgs = { inherit self inputs; };
|
||||
}).shell;
|
||||
|
||||
checks =
|
||||
(
|
||||
# for config.self.homeConfigurations if present & non empty
|
||||
# for self.homeConfigurations if present & non empty
|
||||
if (
|
||||
(builtins.hasAttr "homeConfigurations" config.self) &&
|
||||
(config.self.homeConfigurations != { })
|
||||
(builtins.hasAttr "homeConfigurations" self) &&
|
||||
(self.homeConfigurations != { })
|
||||
) then
|
||||
let
|
||||
seive = _: v: v.system == system; # only test for the appropriate system
|
||||
collectActivationPackages = n: v: { name = "user-" + n; value = v.activationPackage; };
|
||||
in
|
||||
lib.filterAttrs seive (lib.mapAttrs' collectActivationPackages config.self.homeConfigurations)
|
||||
lib.filterAttrs seive (lib.mapAttrs' collectActivationPackages self.homeConfigurations)
|
||||
else { }
|
||||
)
|
||||
//
|
||||
@ -89,13 +89,13 @@ in
|
||||
)
|
||||
//
|
||||
(
|
||||
# for config.self.deploy if present & non-empty
|
||||
# for self.deploy if present & non-empty
|
||||
if (
|
||||
(builtins.hasAttr "deploy" config.self) &&
|
||||
(config.self.deploy != { })
|
||||
(builtins.hasAttr "deploy" self) &&
|
||||
(self.deploy != { })
|
||||
) then
|
||||
let
|
||||
deployChecks = deploy.lib.${system}.deployChecks config.self.deploy;
|
||||
deployChecks = deploy.lib.${system}.deployChecks self.deploy;
|
||||
renameOp = n: v: { name = "deploy-" + n; value = deployChecks.${n}; };
|
||||
in
|
||||
lib.mapAttrs' renameOp deployChecks
|
||||
@ -103,14 +103,14 @@ in
|
||||
)
|
||||
//
|
||||
(
|
||||
# for config.self.nixosConfigurations if present & non-empty
|
||||
# for self.nixosConfigurations if present & non-empty
|
||||
if (
|
||||
(builtins.hasAttr "nixosConfigurations" config.self) &&
|
||||
(config.self.nixosConfigurations != { })
|
||||
(builtins.hasAttr "nixosConfigurations" self) &&
|
||||
(self.nixosConfigurations != { })
|
||||
) then
|
||||
let
|
||||
systemSieve = _: host: host.config.nixpkgs.system == system;
|
||||
hostConfigsOnThisSystem = lib.filterAttrs systemSieve config.self.nixosConfigurations;
|
||||
hostConfigsOnThisSystem = lib.filterAttrs systemSieve self.nixosConfigurations;
|
||||
|
||||
createCustomTestOp = n: host: test:
|
||||
lib.warnIf (!(test ? name)) ''
|
||||
|
Loading…
Reference in New Issue
Block a user