Reorganize imports to prevent infinite recursions

This commit is contained in:
Fabian Hauser 2025-03-25 12:49:03 +02:00
parent ee6b756d3c
commit ff0ce9d94c
18 changed files with 136 additions and 89 deletions

View file

@ -1,37 +1,28 @@
{
self,
flakeSelf,
system,
private,
pkgs,
...
}:
with pkgs.lib;
let
inherit (self.lib) foldersWithNix;
inherit (pkgs.lib)
path
genAttrs
;
in
{
${system} =
let
packages = pipe (self.lib.foldersWithNix ./.) [
(map (name: {
inherit name;
path = path.append ./. "./${name}/default.nix";
}))
(map (
{ name, path }:
{
inherit name;
value = pkgs.callPackage path {
inherit self;
inherit system;
};
}
))
listToAttrs
];
in
packages
// {
default =
let
nixosConfigs = mapAttrsToList (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
in
pkgs.linkFarmFromDrvs "all" (nixosConfigs ++ (attrValues packages));
};
${system} = genAttrs (foldersWithNix ./.) (
name:
pkgs.callPackage (path.append ./. "./${name}/default.nix") {
inherit
self
flakeSelf
system
private
;
}
);
}

View file

@ -1,6 +1,6 @@
{
deploy-rs,
self,
flakeSelf,
writeShellApplication,
...
}:
@ -9,6 +9,6 @@ writeShellApplication {
meta.description = "Deploy configuration to specificed targets.";
runtimeInputs = [ deploy-rs ];
text = ''
deploy --interactive --targets "''${@:-${self}}"
deploy --interactive --targets "''${@:-${flakeSelf}}"
'';
}

View file

@ -3,12 +3,12 @@
mdbook-plantuml,
mdbook,
plantuml,
self,
flakeSelf,
stdenv,
...
}:
let
version = self.rev or self.dirtyRev;
version = flakeSelf.rev or flakeSelf.dirtyRev;
in
stdenv.mkDerivation {
inherit version;
@ -19,6 +19,6 @@ stdenv.mkDerivation {
mdbook-plantuml
plantuml
];
src = self;
src = flakeSelf;
buildPhase = "mdbook build --dest-dir $out";
}

View file

@ -3,7 +3,7 @@
gnupg,
lib,
runCommand,
self,
private,
ssh-to-age,
writeText,
...
@ -13,7 +13,7 @@ let
metaHostConfigs = import ../../defaults/meta/hosts.nix { };
userPgpKeys =
let
keysFolder = "${self.inputs.private}/sops_keys";
keysFolder = "${private}/sops_keys";
gpgFingerprintsFile =
runCommand "userPgpKeys"
{