From 1db8ba6f4b4b6120702845027604d5da598a991e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 6 Aug 2022 12:50:56 -0700 Subject: ref(tools): simplify the import of tools In the `mkSystem` function, instead of defining each tools, let's import all of them at once. This works both with installing a tool from a module or running them from the CLI. Change-Id: Ia44ff9a45b54a1ecea6f6b02b4cad2956799f627 Reviewed-on: https://cl.fcuny.net/c/world/+/682 Tested-by: CI Reviewed-by: Franck Cuny --- nix/mkSystem.nix | 6 +----- tools/default.nix | 9 +++++---- tools/dnsupdate/default.nix | 4 ++-- tools/git-blame-stats/default.nix | 4 ++-- tools/govanity/default.nix | 4 ++-- tools/ipconverter/default.nix | 4 ++-- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/nix/mkSystem.nix b/nix/mkSystem.nix index d019e28..a411a98 100644 --- a/nix/mkSystem.nix +++ b/nix/mkSystem.nix @@ -15,11 +15,7 @@ inputs.nixpkgs.lib.nixosSystem { inputs.emacs-overlay.overlay inputs.nur.overlay (final: prev: { - tools = { - gerrit-hook = import ../tools/gerrit-hook final; - ipconverter = import ../tools/ipconverter final; - git-blame-stats = import ../tools/git-blame-stats final; - }; + tools = import "${self}/tools" { pkgs = prev; }; }) ]; }; diff --git a/tools/default.nix b/tools/default.nix index c599bc2..954a362 100644 --- a/tools/default.nix +++ b/tools/default.nix @@ -1,10 +1,11 @@ { pkgs }: + pkgs.lib.makeScope pkgs.newScope (pkgs: { - dnsupdate = pkgs.callPackage ./dnsupdate { inherit pkgs; }; + dnsupdate = pkgs.callPackage ./dnsupdate { }; - govanity = pkgs.callPackage ./govanity { inherit pkgs; }; + govanity = pkgs.callPackage ./govanity { }; - ipconverter = pkgs.callPackage ./ipconverter { inherit pkgs; }; + ipconverter = pkgs.callPackage ./ipconverter { }; - git-blame-stats = pkgs.callPackage ./git-blame-stats { inherit pkgs; }; + git-blame-stats = pkgs.callPackage ./git-blame-stats { }; }) diff --git a/tools/dnsupdate/default.nix b/tools/dnsupdate/default.nix index b8201c0..85f0285 100644 --- a/tools/dnsupdate/default.nix +++ b/tools/dnsupdate/default.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ pkgs, buildGoModule, ... }: -pkgs.buildGoModule rec { +buildGoModule rec { name = "dnsupdate"; src = ./.; vendorSha256 = "sha256-DQ/kYC/EZpcOKk0Y+DvwJtAPZpamxvEl7gKk8uEB2Ls="; diff --git a/tools/git-blame-stats/default.nix b/tools/git-blame-stats/default.nix index 8897b67..5071f10 100644 --- a/tools/git-blame-stats/default.nix +++ b/tools/git-blame-stats/default.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ pkgs, buildGoModule, ... }: -pkgs.buildGoModule rec { +buildGoModule rec { name = "git-blame-stats"; src = ./.; vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; diff --git a/tools/govanity/default.nix b/tools/govanity/default.nix index d0239a6..750b91f 100644 --- a/tools/govanity/default.nix +++ b/tools/govanity/default.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ pkgs, buildGoModule, ... }: -pkgs.buildGoModule rec { +buildGoModule rec { name = "govanity"; src = ./.; vendorSha256 = "sha256-iu2QE+vvenFWpOOz1NHVQHudiWkvkKqZvD4ZX4Xa1sY="; diff --git a/tools/ipconverter/default.nix b/tools/ipconverter/default.nix index 3be25fc..c4d2f3a 100644 --- a/tools/ipconverter/default.nix +++ b/tools/ipconverter/default.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ pkgs, buildGoModule, ... }: -pkgs.buildGoModule rec { +buildGoModule rec { name = "ipconverter"; src = ./.; vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; -- cgit 1.4.1