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
'';
# 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 ];
};
}

View File

@ -19,11 +19,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# The with statement imports the nixpkgs namespace, so the tools like
# stdenv and callPackage become available.
with import <nixpkgs> {};
stdenv.mkDerivation {
# Import nixpkgs under the local binding pkgs to be able to use stdenv
# and callPackage.
let
pkgs = import <nixpkgs> {};
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 {}) ];
}