From 9e5033e54247224b8162cd1b97eefdf2a2a0b0e1 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Sun, 22 Sep 2024 13:10:19 +0300 Subject: [PATCH] feat: pass lib to artautil, rename hostnameToIPv4 --- lib/util.nix | 6 +++--- systems/default.nix | 8 ++++++-- systems/profiles/default.nix | 6 +++--- systems/profiles/lxc/default.nix | 4 ++-- systems/profiles/vm/default.nix | 4 ++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/util.nix b/lib/util.nix index 5d1bd0d..c02de95 100644 --- a/lib/util.nix +++ b/lib/util.nix @@ -1,5 +1,5 @@ -{...}: let - hostNameToIPv4 = { +{lib, ...}: let + hostnameIPv4 = { "sqbuilds" = "10.1.1.50"; "dns" = "10.1.2.3"; "metrics" = "10.1.2.5"; @@ -8,7 +8,7 @@ "cloud" = "10.1.2.15"; "social" = "10.1.2.17"; }; - getIPv4 = hostName: hostNameToIPv4.${hostName}; + getIPv4 = hostName: hostnameIPv4.${hostName}; in { getIPv4 = getIPv4; } diff --git a/systems/default.nix b/systems/default.nix index c66d1b1..1414391 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -1,4 +1,8 @@ -{inputs, ...}: { +{ + lib, + inputs, + ... +}: { flake = let mkHost = name: cfg: inputs.nixpkgs.lib.nixosSystem { @@ -16,7 +20,7 @@ ]; }; - profiles = import ./profiles inputs; + profiles = import ./profiles lib inputs; hosts = import ./hosts profiles; in { nixosConfigurations = inputs.nixpkgs.lib.mapAttrs mkHost hosts; diff --git a/systems/profiles/default.nix b/systems/profiles/default.nix index 7a77ba9..2bd4ec6 100644 --- a/systems/profiles/default.nix +++ b/systems/profiles/default.nix @@ -1,6 +1,6 @@ -inputs: { +lib: inputs: { desktop = import ./desktop inputs; laptop = import ./laptop inputs; - lxc = import ./lxc inputs; - vm = import ./vm inputs; + lxc = import ./lxc lib inputs; + vm = import ./vm lib inputs; } diff --git a/systems/profiles/lxc/default.nix b/systems/profiles/lxc/default.nix index b547b75..7ab398d 100644 --- a/systems/profiles/lxc/default.nix +++ b/systems/profiles/lxc/default.nix @@ -1,4 +1,4 @@ -inputs @ { +lib: inputs @ { home-manager, sops-nix, ... @@ -15,6 +15,6 @@ inputs @ { ]; specialArgs = { inherit inputs; - artautil = import ../../../lib/util.nix {}; + artautil = import ../../../lib/util.nix {inherit lib;}; }; } diff --git a/systems/profiles/vm/default.nix b/systems/profiles/vm/default.nix index 4d939c1..a8b629a 100644 --- a/systems/profiles/vm/default.nix +++ b/systems/profiles/vm/default.nix @@ -1,4 +1,4 @@ -inputs @ { +lib: inputs @ { home-manager, sops-nix, ... @@ -14,6 +14,6 @@ inputs @ { ]; specialArgs = { inherit inputs; - artautil = import ../../../lib/util.nix {}; + artautil = import ../../../lib/util.nix {inherit lib;}; }; } -- 2.44.1