From d7147baefccad2e6643fadc3600b76e8dbd2d67a Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 9 Jul 2020 14:57:39 +0200 Subject: [PATCH] Don't use with. Using with is an antipattern: https://nix.dev/anti-patterns/language.html#with-attrset-expression --- ginsim.nix | 12 +++++------- shell.nix | 13 +++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ginsim.nix b/ginsim.nix index 9614a1c..e1a710f 100644 --- a/ginsim.nix +++ b/ginsim.nix @@ -86,14 +86,12 @@ stdenv.mkDerivation rec { --set _JAVA_AWT_WM_NONREPARENTING 1 ''; - # Some easy metadata, in case I forget. I use the with statement to - # avoid typing stdenv.lib to specify the license, the platform and - # the maintainer. - meta = with stdenv.lib; { + # Some easy metadata, in case I forget. + meta = { homepage = "http://ginsim.org/"; description = "A computer tool for the modeling and simulation of genetic regulatory networks."; - license = licenses.gpl3; - platforms = platforms.unix; - maintainers = [ maintainers.scolobb ]; + license = stdenv.lib.licenses.gpl3; + platforms = stdenv.lib.platforms.unix; + maintainers = [ stdenv.lib.maintainers.scolobb ]; }; } diff --git a/shell.nix b/shell.nix index 112e910..d4704b1 100644 --- a/shell.nix +++ b/shell.nix @@ -19,11 +19,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . - -# The with statement imports the nixpkgs namespace, so the tools like -# stdenv and callPackage become available. -with import {}; -stdenv.mkDerivation { +# Import nixpkgs under the local binding pkgs to be able to use stdenv +# and callPackage. +let + pkgs = import {}; +in +pkgs.stdenv.mkDerivation { name = "GINsim-shell"; # Bring the package defined in ginsim.nix in scope. buildInputs is @@ -35,5 +36,5 @@ stdenv.mkDerivation { # callPackage can also be replaced by import. In this case, the # arguments of the anonymous function defined in ginsim.nix get # their respective default values. - buildInputs = [ (callPackage ./ginsim.nix {}) ]; + buildInputs = [ (pkgs.callPackage ./ginsim.nix {}) ]; }