From 8134350545305cc970069ea92fe9dbadbc346840 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sun, 18 Apr 2021 22:40:53 -0500 Subject: [PATCH] ref: simplify pkgs-lib deps injection --- lib/pkgs-lib/default.nix | 23 ++++++----------------- lib/pkgs-lib/shell/default.nix | 7 +++++-- lib/pkgs-lib/tests/default.nix | 4 +++- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/lib/pkgs-lib/default.nix b/lib/pkgs-lib/default.nix index a298d411..1b7c6422 100644 --- a/lib/pkgs-lib/default.nix +++ b/lib/pkgs-lib/default.nix @@ -1,20 +1,9 @@ -args@{ lib, nixpkgs, deploy, devshell }: -lib.genAttrs lib.defaultSystems (system: - lib.makeExtensible (final: - let - pkgs = import nixpkgs { inherit system; }; - callLibs = file: import file - (args // { - inherit pkgs system; - pkgs-lib = final; - }); - in - with final; - { - inherit callLibs; +{ lib, nixpkgs, deploy, devshell }: - tests = callLibs ./tests; - shell = callLibs ./shell; +lib.genAttrs + lib.defaultSystems (system: + { + tests = import ./tests { inherit lib deploy nixpkgs pkgs system; }; + shell = import ./shell { inherit lib devshell deploy nixpkgs system; }; } ) -) diff --git a/lib/pkgs-lib/shell/default.nix b/lib/pkgs-lib/shell/default.nix index 71c6c29e..e43155b1 100644 --- a/lib/pkgs-lib/shell/default.nix +++ b/lib/pkgs-lib/shell/default.nix @@ -1,14 +1,17 @@ -{ lib, devshell, deploy, system, nixpkgs, ... }: +{ lib, nixpkgs, devshell, deploy, system }: let overlays = [ + devshell.overlay + (final: prev: { deploy-rs = deploy.packages.${prev.system}.deploy-rs; }) + ]; - pkgs = lib.os.pkgImport nixpkgs overlays system; + pkgs = import nixpkgs { inherit system overlays;; config = {}; }; flk = pkgs.callPackage ./flk.nix { }; diff --git a/lib/pkgs-lib/tests/default.nix b/lib/pkgs-lib/tests/default.nix index a72ade6e..6111acde 100644 --- a/lib/pkgs-lib/tests/default.nix +++ b/lib/pkgs-lib/tests/default.nix @@ -1,5 +1,7 @@ -{ pkgs, system, deploy, nixpkgs, lib, ... }: +{ lib, nixpkgs, deploy, system }: let + pkgs = import nixpkgs { inherit system; overlays = []; config = {}; }; + mkChecks = { hosts, nodes, homes ? { } }: let deployHosts = lib.filterAttrs