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
Copy link
Contributor Author

bbigras commented Oct 8, 2020

Done. My bad,

@nixos-discourse
Copy link

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@nixos-discourse
Copy link

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
Member

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

1 package built:
  • envchain

@SuperSandro2000
Copy link
Member

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 { };
 

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
Copy link
Contributor Author

bbigras commented Nov 25, 2020

Done. Thanks @SuperSandro2000

@SuperSandro2000
Copy link
Member

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

1 package built:
  • envchain

@SuperSandro2000
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants