Don't use with.

Using with is an antipattern:

https://nix.dev/anti-patterns/language.html#with-attrset-expression
This commit is contained in:
Sergiu Ivanov 2020-07-09 14:57:39 +02:00
parent 400c2dac1c
commit d7147baefc
2 changed files with 12 additions and 13 deletions

View File

@ -86,14 +86,12 @@ stdenv.mkDerivation rec {
--set _JAVA_AWT_WM_NONREPARENTING 1 --set _JAVA_AWT_WM_NONREPARENTING 1
''; '';
# Some easy metadata, in case I forget. I use the with statement to # Some easy metadata, in case I forget.
# avoid typing stdenv.lib to specify the license, the platform and meta = {
# the maintainer.
meta = with stdenv.lib; {
homepage = "http://ginsim.org/"; homepage = "http://ginsim.org/";
description = "A computer tool for the modeling and simulation of genetic regulatory networks."; description = "A computer tool for the modeling and simulation of genetic regulatory networks.";
license = licenses.gpl3; license = stdenv.lib.licenses.gpl3;
platforms = platforms.unix; platforms = stdenv.lib.platforms.unix;
maintainers = [ maintainers.scolobb ]; maintainers = [ stdenv.lib.maintainers.scolobb ];
}; };
} }

View File

@ -19,11 +19,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# Import nixpkgs under the local binding pkgs to be able to use stdenv
# The with statement imports the nixpkgs namespace, so the tools like # and callPackage.
# stdenv and callPackage become available. let
with import <nixpkgs> {}; pkgs = import <nixpkgs> {};
stdenv.mkDerivation { in
pkgs.stdenv.mkDerivation {
name = "GINsim-shell"; name = "GINsim-shell";
# Bring the package defined in ginsim.nix in scope. buildInputs is # 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 # callPackage can also be replaced by import. In this case, the
# arguments of the anonymous function defined in ginsim.nix get # arguments of the anonymous function defined in ginsim.nix get
# their respective default values. # their respective default values.
buildInputs = [ (callPackage ./ginsim.nix {}) ]; buildInputs = [ (pkgs.callPackage ./ginsim.nix {}) ];
} }