From c3415b264982cbe1a84723a5f54a6b0bade2bbea Mon Sep 17 00:00:00 2001 From: yukkop Date: Wed, 5 Feb 2025 23:38:56 +0000 Subject: [PATCH] feat: lib makeEnvironment --- flake.nix | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/flake.nix b/flake.nix index 00c9844..eb9e35b 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,14 @@ in forAllSystemsWithPkgs [ (import rust-overlay) ] ({ system, pkgs }: { - packages.${system} = { + packages.${system} = + let + rust.nativeBuildInputs = [ + pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default + pkgs.pkg-config + ]; + in + { nvim-alias = pkgs.callPackage ./package/nvim-alias.nix {}; nvim-pager = pkgs.callPackage ./package/nvim-pager.nix {}; printobstacle = pkgs.callPackage ./package/printobstacle.nix {}; @@ -61,17 +68,17 @@ migration-name = pkgs.callPackage ./package/migration-name.nix {}; prettify-log = pkgs.callPackage ./package/prettify-log/default.nix { inherit (self.lib) cargoToml; - nativeBuildInputs = [ - pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default - pkgs.pkg-config - ]; + inherit (rust) nativeBuildInputs; }; - pg.pg-from = pkgs.callPackage ./package/postgres/pg-from/default.nix { - inherit (self.lib) cargoToml; - nativeBuildInputs = [ - pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default - pkgs.pkg-config - ]; + pg = { + pg-from = pkgs.callPackage ./package/postgres/pg-from/default.nix { + inherit (self.lib) cargoToml; + inherit (rust) nativeBuildInputs; + }; + pg-migration = pkgs.callPackage ./package/postgres/pg-migration/default.nix { + inherit (self.lib) cargoToml; + inherit (rust) nativeBuildInputs; + }; }; }; @@ -86,6 +93,7 @@ #prettify-log nvim-pager ]) ++ (with pkgs; [ + git jq yq-go curl @@ -190,6 +198,10 @@ # -- For all systems -- inherit dotEnv minorEnvironment parseEnv forAllSystemsWithPkgs forSpecSystemsWithPkgs; + makeEnvironment = envVars: + builtins.listToAttrs + (map (name: { inherit name; value = self.lib.getEnv name; }) envVars); + # -- Env processing -- getEnv = varName: let var = builtins.getEnv varName;