Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

envchain: init at 1.0.1 #99978

Merged
merged 1 commit into from Nov 26, 2020
Merged

envchain: init at 1.0.1 #99978

merged 1 commit into from Nov 26, 2020

Conversation

@bbigras
Copy link
Contributor

@bbigras bbigras commented Oct 7, 2020

Motivation for this change

This tool is to avoid having sensible things in .env files.

Things done

Note that 1.0.1 is 4 years old.

The last commit in the repo is about 5 months old.

Tested saving a secret on Gnome. Didn't test it with envrc yet.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@bbigras bbigras force-pushed the bbigras:envchain branch from cb94874 to 95e7b5b Oct 8, 2020
@bbigras
Copy link
Contributor Author

@bbigras bbigras commented Oct 8, 2020

Done. My bad,

@bbigras bbigras force-pushed the bbigras:envchain branch from 95e7b5b to 68c17e9 Oct 8, 2020
@bbigras bbigras requested a review from jonringer Oct 20, 2020
@nixos-discourse
Copy link

@nixos-discourse nixos-discourse commented Oct 31, 2020

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/351

Copy link
Contributor

@r-burns r-burns left a comment

Needed some changes to build on darwin

diff --git a/pkgs/tools/misc/envchain/default.nix b/pkgs/tools/misc/envchain/default.nix
index 401714ca3e0..fae1f99de78 100644
--- a/pkgs/tools/misc/envchain/default.nix
+++ b/pkgs/tools/misc/envchain/default.nix
@@ -1,4 +1,7 @@
-{ stdenv, fetchFromGitHub, libsecret, pkg-config, readline }:
+{ stdenv, fetchFromGitHub, libsecret, pkg-config, readline
+, Security
+, libedit
+}:
 
 stdenv.mkDerivation rec {
   pname = "envchain";
@@ -13,8 +16,14 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  buildInputs = [ libsecret readline ];
+  buildInputs = [ libsecret readline ]
+  ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin [
+    Security libedit
+  ];
 
+  preBuild = stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
+    substituteInPlace Makefile --replace '-ltermcap' ' '
+  '';
   makeFlags = [ "DESTDIR=$(out)" ];
 
   meta = {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1a72d0656f6..43f09113069 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3645,7 +3645,9 @@ in
 
   entr = callPackage ../tools/misc/entr { };
 
-  envchain = callPackage ../tools/misc/envchain { };
+  envchain = callPackage ../tools/misc/envchain {
+    inherit (darwin.apple_sdk.frameworks) Security;
+  };
 
   eot_utilities = callPackage ../tools/misc/eot-utilities { };
pkgs/tools/misc/envchain/default.nix Outdated Show resolved Hide resolved
@bbigras bbigras force-pushed the bbigras:envchain branch from 4cba411 to 9d986e5 Nov 2, 2020
@nixos-discourse
Copy link

@nixos-discourse nixos-discourse commented Nov 8, 2020

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/361

@SuperSandro2000
Copy link
Contributor

@SuperSandro2000 SuperSandro2000 commented Nov 24, 2020

Result of nixpkgs-review pr 99978 run on x86_64-linux 1

1 package built:
  • envchain
@SuperSandro2000
Copy link
Contributor

@SuperSandro2000 SuperSandro2000 commented Nov 25, 2020

To build on darwin the following patch is required:

diff --git a/pkgs/tools/misc/envchain/default.nix b/pkgs/tools/misc/envchain/default.nix
index 7f6cca2c1f87..fbd596c5f662 100644
--- a/pkgs/tools/misc/envchain/default.nix
+++ b/pkgs/tools/misc/envchain/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libsecret, pkg-config, readline }:
+{ stdenv, fetchFromGitHub, libedit, libsecret, ncurses, pkg-config, readline, Security }:
 
 stdenv.mkDerivation rec {
   pname = "envchain";
@@ -11,9 +11,14 @@ stdenv.mkDerivation rec {
     sha256 = "0qxwiqhb8cg0zbn5p0mvnbyxx1xwvgiricrkjlvxz13sf2ngq87p";
   };
 
+  postPatch = ''
+    sed -i -e "s|-ltermcap|-lncurses|" Makefile
+  '';
+
   nativeBuildInputs = [ pkg-config ];
 
-  buildInputs = [ libsecret readline ];
+  buildInputs = [ libsecret readline ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ libedit ncurses Security ];
 
   makeFlags = [ "DESTDIR=$(out)" ];
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 37f0447b1e9e..fa71e5fca493 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3692,7 +3692,7 @@ in
 
   entr = callPackage ../tools/misc/entr { };
 
-  envchain = callPackage ../tools/misc/envchain { };
+  envchain = callPackage ../tools/misc/envchain { inherit (pkgs.darwin.apple_sdk.frameworks) Security; };
 
   eot_utilities = callPackage ../tools/misc/eot-utilities { };
 
@bbigras bbigras force-pushed the bbigras:envchain branch from 9d986e5 to e07e769 Nov 25, 2020
Co-authored-by: Jon <jonringer@users.noreply.github.com>
Co-authored-by: r-burns <52847440+r-burns@users.noreply.github.com>
Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
@bbigras bbigras force-pushed the bbigras:envchain branch from 7b11055 to dc83d21 Nov 25, 2020
@bbigras
Copy link
Contributor Author

@bbigras bbigras commented Nov 25, 2020

Done. Thanks @SuperSandro2000

@SuperSandro2000
Copy link
Contributor

@SuperSandro2000 SuperSandro2000 commented Nov 26, 2020

Result of nixpkgs-review pr 99978 run on x86_64-linux 1

1 package built:
  • envchain
@SuperSandro2000
Copy link
Contributor

@SuperSandro2000 SuperSandro2000 commented Nov 26, 2020

Result of nixpkgs-review pr 99978 run on x86_64-darwin 1

1 package built:
  • envchain
@SuperSandro2000 SuperSandro2000 merged commit d39981e into NixOS:master Nov 26, 2020
19 checks passed
19 checks passed
tests
Details
action
Details
Evaluation Performance Report Evaluator Performance Report
Details
Wait for ofborg
Details
envchain, envchain.passthru.tests on aarch64-linux Success
Details
envchain, envchain.passthru.tests on x86_64-linux Success
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="dc83d21"; rev="dc83d21140cbf390a3afc8c17fbf75d7a2388c56"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="dc83d21"; rev="dc83d21140cbf390a3afc8c17fbf75d7a2388c56"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="dc83d21"; rev="dc83d21140cbf390a3afc8c17fbf75d7a2388c56"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="dc83d21"; rev="dc83d21140cbf390a3afc8c17fbf75d7a2388c56"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="dc83d21"; rev="dc83d21140cbf390a3afc8c17fbf75d7a2388c56"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="dc83d21"; rev="dc83d21140cbf390a3afc8c17fbf75d7a2388c56"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="dc83d21"; rev="dc83d21140cbf390a3afc8c17fbf75d7a2388c56"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.