Giter VIP home page Giter VIP logo

Comments (8)

thedavidmeister avatar thedavidmeister commented on September 16, 2024 1

nix definitely does auto cleanup, and docker --rm doesn't clean up base images, nix-collect-garbage is more like the various docker prune commands

nix would be cleaner overall i'd say, if you do nix -p curl -p git then you get a shell with curl and git, docker has 2000 different curl options some of which include git, but then doing nix -p curl doesn't add any more overhead as it reuses the curl it already has, docker would need a new image for that

i dunno if docker images or nix packages are more beautiful or easier to guess, or how important that is... that's pretty subjective

i could argue that it is "beautiful" that packages are namespaced and nix is a full functional language with a REPL ;)

FYI though, -p has tab completion and nix-env has --query, and can search here https://nixos.org/nixos/packages.html#

i found a whole wiki article on getting R setup in nix, including the standard IDE, but didn't find it that easy to find R on docker 🤷‍♂️

behat is definitely not "no hope", several options:

  • use composer directly nix-shell -p php73Packages.composer
  • "nixify" an existing composer project automatically with composer2nix https://github.com/svanderburg/composer2nix
  • hit a tarball/url with builtin nix functionality
  • use magic one day, nix-shell -p docker -p magic --run magic behat :P

i haven't tried the docker approach with more "day to day" stuff like GUIs and long running processes

a fully validating/synching ETH node:

nix-shell -p parity --run "parity --no-warp"

firefox:

nix-shell -p firefox --run firefox

from magic.

pendashteh avatar pendashteh commented on September 16, 2024

nix-shell seems to be a powerful tool. I'd say it covers almost everything magic does. However, magic has advatnages in specific cases that it is designed for.

Firstly, it's auto-cleanup. (using docker run --rm) One less command to memorise, to remember and to type. Big deal!

The other advatnage is guessing the package names. magic uses images from docker hub. I've found those on docker hub much easier to guess compared to nix repository. You can clearly see the difference in the 'haskell' example.

Also, searching for the name of a package seems to be easier for docker hub. For example, try finding 'r' in both.

Another advtange could be the range of available options. I'm assuming docker hub images are more diverse and up-to-date than nix. I could be wrong.
For example, there doesn't seem to be a nix package for behat. (I must say I haven't managed to get a magic behat thing working either, but at least there is hope :D)

Also, may I say magic is just more beautiful?!

from magic.

pendashteh avatar pendashteh commented on September 16, 2024

Good points.

Being able to get two or more packages in one shell, can be handy. Something that magic can't do as it's at the mercy of the image provider.

Examples of parity and firefox are also not possible with magic.

I tried nix-shell, it's handy. However, it doesn't seem to be an isolated shell; which is not what it's designed for. Whereas, a magic command only has access to the current directory. So, isolation can be an advtange, when it's desired.

In contrast, nix-shell has an advatnage when dealing with ports; like php -S localhost:8000. Something that you need to handle sperately when using docker.

In summary, nix-shell seems to be flexible and powerful. I am already thinking of a wrapper around nix-shell to do things that I couldn't easily do on top of docker. Something like a SQL query:

$ nixelect USING drush, sqlite RUN drush si --db-url=sqlite://.db THEN PURGE

from magic.

thedavidmeister avatar thedavidmeister commented on September 16, 2024

if you're looking for more isolation, try --pure or checkout nix-build or even nix-container for increasing levels of isolation :)

from magic.

pendashteh avatar pendashteh commented on September 16, 2024

Here is a use-case in which nix-shell is not an option but magic works:

On a fresh OSX you can run native linux command without any extra software like brew:

$ magic bash wget

Same applies to Windows or any environment that runs docker.

from magic.

thedavidmeister avatar thedavidmeister commented on September 16, 2024

windows only supports docker on more expensive versions :(

nix-shell is on OSX also ;)

one thing... they're not mutually exclusive as nix can be run inside docker pretty easily

from magic.

pendashteh avatar pendashteh commented on September 16, 2024

I'm actually playing with running nix in a docker (magic style): #3
Very powerful, much more predictable packages plus the ability to load more than one package. And that's before I even know about the nix concepts (which look very alien)

from magic.

thedavidmeister avatar thedavidmeister commented on September 16, 2024

@pendashteh awesome

i think some of the alien-ness comes from how minimal it is: https://learnxinyminutes.com/docs/nix/

you have to BYO mental models and abstractions to fill in the gaps of more word-y languages

from magic.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.