21 ms·
macOS Nix setup: an alternative to Homebrew (2020)
- seanparsons 5y ago> there is no CLI equivalent to brew install that I am aware of There is! You use `nix-env` for that by running something like: `nix-env -iA ripgrep`.
- defulmere 5y agoThe author had me until he mentioned installing ripgrep *temporarily*. Stopped there because I don't do heresy.
- est31 5y agoI really love the temporary installs feature of nix OS. Often I just want to try some software once and don't want to use it afterwards. The temporary install feature is perfect for that, to help avoiding building up bloat from forgotten uninstalls. But yes, you absolutely must have ripgrep.
- luckyorlame 5y ago" I don't do heresy." please explain.
- jahnu 5y agoIt's a joke that they they love and depend on ripgrep so much that to uninstall it would be an act tantamount to heresy
- haskal 5y agoJust replace "ripgrep" with "cowsay" or "neofetch" and read again.
- pxc 5y agoSeconded! I think ripgrep is my favorite of all of these next-gen fundamental CLI tools. For me, it replaces both grep and sed (except for in-place use of the latter), because I never write complicated sed programs.
- stevefolta 5y ago"nix-shell" is exactly how I first tried ripgrep. Of course, I installed it permanently moments later.
- jeofken 5y agoIt’s with you for eternity, just hidden from programs unworthy of its excellence. Immutable is forever :)
- kaba0 5y agoUntil you run the gc :D My record with nix-collect-garbage was like 30 GB. I since enable the auto-gc.
- ihumanable 5y agoI think one thing that's interesting about "temporary" installation is that nix has this notion of "present" vs "installed." When you run a nix-shell the program is downloaded and if necessary built and put into the nix store, after leaving the shell it's all right there on your disk ("present") just not "installed" into the environment. This is why the first time you run nix-shell with something new it downloads stuff while subsequent invocations are immediate. It also means that if you liked ripgrep in a shell, installing it is just has nix write out some new symlinks.
- mitchellh 5y agoI switched my primary dev environment to NixOS in a graphical VM on macOS towards the end of 2020 and I love it: https://twitter.com/mitchellh/status/1346136404682625024?s=21 https://twitter.com/mitchellh/status/1346136404682625024?s=2... Previously, I used Nix on Mac (as this blog post suggests) but I had enough “gotchas” with Nix on Mac that I decided to go full NixOS. For those who ask why a VM or why I keep Mac around at all: I like macOS for everything else besides dev work. I use iMessages heavily, I like the Mac App ecosystem such as calendars, mail clients, etc. This gives me the best of both worlds. I usually run this on an iMac Pro but also have a MacBook Pro. It runs great on either. It’s also really nice with Nix to update one machine and the other is just one command away from being equivalent. I recognize this is a “weird” setup but wanted to point it out since it seems relevant to this post.
- cyberpunk 5y agoWhat hypervisor/vm software are you using? I’m running some Linux vms under parallels on a m1 and the graphics performance could be better..
- Gaelan 5y agoLooks like VMWare from the tweet they linked.
- mitchellh 5y agoVMware Fusion. I don’t use an M1 Mac right now (I have one for testing but not primary dev work).
- reddit_clone 5y ago> VMware Fusion Does it work? When I upgraded to BigSur and Fusion 12 the networking just stopped working. VMs dont work with NAT at all. In Bridged mode, it partially works. Completely stops if I get the Mac host in to company VPN. All of this used to work prior version of Mac OSX and Fusion 11.
- 5y ago
- stockholm_sloth 5y agoInteresting read as I am a huge OSX and CLI fan. Thanks for that! I too am worried by the root file system "security enhancements" in recent versions of OSX that make it harder and harder for me to do my job (develop website backends). However I may wait to try Nix until it has better support for my primary tools (mainly php and ruby based websites) ... because I LOVE the simplicity of homebrew. And if there are any homebrew developers reading this, I frickin' love you guys. You make everything I need to do extremely easy.
- FullyFunctional 5y agoIndeed, as a newcomer to Nix I was immediately put off by the arcaness of everything. I don't want my first experience to be memorized obscure paths and funky command line arguments (such may justified _later_ when more advanced options are wanted). I'm glad it works for people and I gather nix-env is a step in the right direction, but it's IMO not quite there yet. EDIT: example, why is it nix-env -qaP git instead of nix search git
- ianthehenry 5y agoIt actually is! There are lots of examples of arcane Nix commands, but as of Nix 2.0, you actually can type `nix search git`. And it works much better than `nix-env -qa` ever did. Your point stands, though. For example, why is it: nix-env -iA nixpkgs.git Instead of: nix install git (I know what the answer is, but still, it's a question that I think a lot of newcomers are going to ask.)
- carlthome 5y agoNewcomer here. What's the answer?
- SavantIdiot 5y agoIf php and ruby are your primary packages, why would you need something other than macports? Both are up to date with the latest versions.
- ianthehenry 5y agoTo others who might be interested in trying Nix instead of Homebrew: There is a `brew install` equivalent in vanilla Nix -- `nix-env` provides an imperative interface pretty similiar to `brew`. `nix-darwin` is a third-party thing that tries to give you a NixOS-like experience on macOS. It's not necessary if you're only interested in replacing Homebrew. You can have `shell.nix` files and ad-hoc environments without replacing your entire system configuration. Vanilla Nix is very well isolated, and you can try it side by side with Homebrew to see how you like it -- one of the nice side effects of Nix-installed software being independent from the rest of your system is that, well, you can install whatever you want without breaking the Homebrew equivalents. For example instead of putting binaries in `/usr/local/bin`, Nix creates a directory of symlinks to files in `/nix/store`, and you can add that directory to your `PATH` if you wish. I switched to Nix a few months ago and have found it... fun. It's not something I would recommend if you want things to just work, but if you're curious about Nix, you can learn quite a lot about it from the comfort of your MacBook. I wrote a little about this experience here, including how to map common `brew` commands into their `nix-env` equivalents: https://ianthehenry.com/posts/how-to-learn-nix/switching-from-homebrew-to-nix https://ianthehenry.com/posts/how-to-learn-nix/switching-fro... (Warning: it's more of a rambling diary entry than a blog post.)
- parkerduckworth 5y agoThanks for posting this, it’s very helpful.
- rahen 5y agoVery helpful. Unfortunately Nix doesn't support aarch64 yet, only x86_64... It seems to be coming though: https://github.com/NixOS/nixpkgs/issues/95903 https://github.com/NixOS/nixpkgs/issues/95903
- ianthehenry 5y agoYeah, it, like, mostly works? But maybe only in multi-user mode? I don't know; I didn't read the whole thread. I don't have an M1 machine, but it seems like there are binaries cached for the arch in the official cache: $ nix-env -qasA nixpkgs.git --argstr system 'aarch64-darwin' --S git-2.31.1 Which implies that it's supported in some capacity. (The "S" means "there's a substitute available;" i.e. git at least is cached for aarch64. Yeah, Nix's CLI... needs work.) I don't know exactly what the state of it is -- i.e how many packages can build natively on M1 -- but I know that the Nixpkgs community has done a lot of work in the last year to support M1 nicely, and I thought that it was fully usable at this point. But there's a big difference between "Nix works on M1" and "every package in Nixpkgs works on M1."
- _query 5y agoI've been using nix on macOS as my primary package manager for years. Really love it! Specifically nix-shell is a blessing a you can quickly try out things without worrying about breaking some other packages on the system. Initially we've only used nix for development at my company, but now we're also running most of our servers with NixOS. This allows us to use our dev package definitions in production, so our dependencies are always in sync between dev and prod. I've written a blog post about all the advantages we get with nix in our framework IHP a while ago, if you're curious, check it out: https://ihp.digitallyinduced.com/blog/2020-07-22-why-ihp-is-using-nix.html https://ihp.digitallyinduced.com/blog/2020-07-22-why-ihp-is-... If you're using an older mac and have troubles with installing nix, try out the new installer in this GH issue: https://github.com/NixOS/nix/pull/4289 https://github.com/NixOS/nix/pull/4289 (the command is in the "Try it out" section). It's already merged, but not released yet. So far this has solved all the issues on older macs for me. Also check out https://nix.dev/ https://nix.dev/ which has many great resources to get started :)
- mikepurvis 5y ago> Unpredictable command times. As a novice Nix user, I would say that I've hit a certain amount of this too. Basically every time you update your channel, it's a dice roll how much you're going to have to rebuild or re-download. Now, it's easy to let it run in the background or interrupt/resume it at any time, so that at least is a plus— and it does provide a clear indication of how much it's downloading, and how many packages are being built.
- domenkozar 5y agoWe've just made Nix support Apple Silicon natively! I've also been working on tutorials for beginners at https://nix.dev https://nix.dev, for example how to set up declarative developer environments.
- mark_l_watson 5y agoThanks, that was a question in my mind. Brew does a fairly good job on M1 Macs by maintaining two environments, one M1 native, and one using Rosetta.
- takeda 5y agoOh wow, I see it grew a lot since last time I checked. I got interested in the cross compile section. I normally work on Mac and whenever I need to create a docker container I need to generate binaries for x86_64 linux. I typically did it by creating another nixpkgs: instance like: linux_pkgs = import <nixpkgs> { system = "x86_64-linux"; }; This doesn't exactly do cross compilation and it actually requires linux builder to work (I have one running in docker). There's also option to specify cross compiling, there, but from my experience requires rebuilding pretty much everything from scratch :/ Using pkgCross seems appealing, but I can't find a linux x86_64 target there. The closest I can find is musl64 (which is great, but can't get everything to work with it). Is it under perhaps another name that I don't recognize, and if it isn't, would be possible to add it, it would greatly help creating docker images on mac.
- samueldr 5y agoFor non-musl (so GNU libc), it's the awkwardly named gnu64. To test with the classic test package "hello": $ nix-build '<nixpkgs>' -A pkgsCross.gnu64.hello Note that since this is cross-compiled, and not native compilation, you will have to build a lot more. All "pkgsCross" systems are found in https://github.com/NixOS/nixpkgs/blob/master/lib/systems/examples.nix https://github.com/NixOS/nixpkgs/blob/master/lib/systems/exa...
- takeda 5y ago
- gigatexal 5y agoPin your home brew versions and upgrade at non-critical times and you’ll be fine? I’ve been doing this for years and not had any issues. :shrug:
- jeofken 5y agoA feature declarative programming gives Nix is being able to commit a list of dependencies in the file default.nix, and when entering just run $nix-shell, and have the right version, and it works for my Linux colleagues as well. Typing on the go so may have missed a param
- adkadskhj 5y agoHow does default.nix handle dependencies? From what i've (i'm on NixOS) seen you just see something like `gcc` or `openssl`, with no clue what version. Tbh i've found Nix very very lacking in the dependency department. What i _want_ is something like Cargo.toml from Rust (or maybe packages.json/yarn.lock if you're familiar with NodeJS), which compiles to a Cargo.lock. Instead what i have is a name for a dependency with no clue what version the writer expected, or what version my computer will install. Pulling a new commit from nixpkgs repo can lead to chaos and random things update with no rhyme or reason. Flakes, in alpha i believe, is the first thing from Nix that actually felt repeatable. But even with Flakes i still don't know what version anything is, but at least i know what concrete commit sha worked for me and can always revert as needed. My next NixOS install will use Flakes with a very granular approach. The OS on one package ref, and other packages all have their own isolated refs. This will be verbose and bloaty, but being able to update Vim without my OS going crazy will be really nice. I'd still like Flakes to behave more like Cargo.lock, but it's at least progress.
- kfajdsl 5y agoThe way I currently pin packages is to just import a specific commit hash of nixpkgs as a variable. Niv[0] is a tool that makes doing that and updating very painless. [0]: https://github.com/nmattia/niv https://github.com/nmattia/niv
- nuker 5y agoSo how do i do ‘pip3 install requests’ for example?
- myWindoonn 5y ago$ nix-shell -p python3Packages.requests Nix generally only manifests temporary environments, rather than mutating global state. For a more Pythonic environment, try the direnv integration, which will let you both `use nix` and also `use python3` together, as long as it's in that order.
- gpanders 5y agoThis exact thing is what trips me up about using Nix and I haven't been able to figure out how to get around it. Sometimes you want a global Python library. Here's one example from my own use case: I want to use a Weechat Python script that depends on a Python library called "pync". With e.g. MacPorts I can just run sudo port install py-pync and now the Weechat Python script will be able to "import pync". But this doesn't work with Nix since every package is completely isolated from each other. I spent quite a bit of time trying to figure this out and was unsuccessful. I'd love to know what Nix's answer to use cases like this is.
- jonringer117 5y agoWhat you're looking for is `(python3Packages.withPackages (ps: with ps; [ pync ... ]))` This will create a python which has pync and other packages in the sitePackages already.
- sirodoht 5y agoI'm slowly venturing a full switch from brew to nix (mainly due to its slowness) using nix-env and this guide: https://www.youtube.com/watch?v=NYyImy-lqaA https://www.youtube.com/watch?v=NYyImy-lqaA It's been a few weeks. Concerns until now: * Things like fzf have bash completion accompanying files. I have not figured out where these reside using nix. * Things like mysql make heave use of directories such as /usr/local/var/mysql or similar. I was unsuccessful in surpassing permission problems with these.
- pxc 5y ago> Things like fzf have bash completion accompanying files. I have not figured out where these reside using nix. Bash completions get installed under Nix profiles (yours, root's (a.k.a., the ‘default profile’), or the ‘system’ profile, if you're using nix-darwin or NixOS), just like binaries. On my system, I have some bash completions under my user profile, in /nix/var/nix/profiles/per-user/$USER/profile/share/bash-completion/completions/ and some in the system profile, in /nix/var/nix/profiles/system/sw/share/bash-completion/completions If you use a shell installed from Nixpkgs, it'll automatically pick up on all such completions installed to your profiles (which come bundled with the packages they're for). (To try this with bash, make sure to install `bashInteractive` rather than just `bash`.) If you use a shell configured by a Nix module system, like NixOS or Nix-Darwin, it will provide an option to enable the installation of such completions to your system profile, which you can enable like this: https://github.com/LnL7/nix-darwin/blob/a7492a8c76dcc702d0a65cd820a5f9baa8702684/modules/examples/lnl.nix#L196 https://github.com/LnL7/nix-darwin/blob/a7492a8c76dcc702d0a6... > Things like mysql make heave use of directories such as /usr/local/var/mysql or similar. I was unsuccessful in surpassing permission problems with these. It's clear that you're pointing to a real issue, but there's either a typo or a misunderstanding above. If your `mysql` binary really does spit out messages about /usr/local/, it didn't come from Nixpkgs. But if it comes from Nixpkgs, it might be emitting similar complaints about directories under /nix/store. The explanation: Nix packages don't know or care anything about /usr/local, but they are compiled so that they think all of their ‘prefixes’ (e.g., what by default on a system are just /usr, /lib, /etc, etc.) live in package-specific directories under /nix/store. It's an important part of Nix's design that everything in the store be immutable, and so everything there is marked read-only. The solution: to use stateful services like databases that you install from Nixpkgs, point them to writeable directories outside of the Nix store to use for their data storage. You can do this manually for mysql with options like `--datadir=/some/writeable/path/you/own` and similar. These same options are used inside Nix module systems when they enable configuration of services like MySQL, e.g., here: https://github.com/NixOS/nixpkgs/blob/nixos-21.05/nixos/modules/services/databases/mysql.nix#L12 https://github.com/NixOS/nixpkgs/blob/nixos-21.05/nixos/modu... Hope that helps!
- pxc 5y agoI find that the isolation of Nix/Nixpkgs makes it pretty natural to use it in tandem with Homebrew. I don't need any CLI tools that aren't in Nixpkgs anymore, so I use Homebrew exclusively as an installer-fetcher-and-runner rather than a source-based package manager (i.e., only for ‘casks’ rather than for ‘formulae’), and the combination is very nice. Nix similarly plays nice with Pkgsrc and MacPorts, so if you're interested in switching away from Homebrew but unsure about Nix, there's no special work you have to do to install one of those alongside Nix for use as an escape hatch that doesn't involve Homebrew.
- varenc 5y agoBrew's slowness is a huge pain point. A basic `brew info` command takes 1.8 seconds and requires executing 6 ruby processes. (with online analytics disabled) And `brew search` is so slow that I've just made a function[0] to search taps locally for formula/cask filenames matching my query. Takes 0.08 seconds instead of 10-20 seconds. Makes me want to try `nix`. Anyone have experience using them both together? [0] brewSearchFast() { fd "$1" -e rb /usr/local/Homebrew/Library/Taps }
- ianthehenry 5y agoNix generally performs pretty well... as long as you're using the "right" commands. For example `nix-env -i git` takes about 30 seconds on my laptop (it evaluates the entire package universe and does a bunch of sorting and string comparison), but `nix-env -iA nixpkgs.git` takes about 600ms (it... doesn't). `nix search` is really fast, and gives much better results than Homebrew's search. It creates a local cache of Nix evaluation results and searches that, and you have to update the cache yourself, but that hasn't bothered me in practice. There isn't really an equivalent of `brew info`, but this is close: $ time brew info git git: stable 2.32.0 (bottled), HEAD ... lots of other stuff omitted... 0.98s user 1.28s system 61% cpu 3.678 total $ time NIX_PAGER= nix-env -qaA nixpkgs.git --description git-2.31.1 Distributed version control system 0.13s user 0.02s system 95% cpu 0.165 total You can have a much faster package manager, if you're willing to put up with the ergonomics. i.e. Nix currently lacks an equivalent to `brew upgrade`, which is kind of bad. It has something that sounds like an upgrade (`nix-env --upgrade`), it doesn't actually do what you expect. And it takes several minutes to run, depending on how many packages you have installed. Another performance datapoint: $ time brew update ...infinite output omitted... 82.11s user 99.19s system 95% cpu 3:10.58 total $ time nix-channel --update unpacking channels... created 1 symlinks in user environment 4.13s user 11.29s system 97% cpu 15.812 total I haven't updated Homebrew in a while, which might explain part of the slowness there. But as the original post points out, Nix updates take the same amount of time regardless of how long it's been since you last updated.
- res0nat0r 5y agoI don't know if the reason brew is so slow anymore is because they changed the default 'brew search' command to query github for a bunch of matching regex open issues and return those results or what. I don't want it looking for packages upstream, just search locally. If I want the latest list of packages not cached on my system, I'll just run 'brew update'. And if 'brew update' is so slow now just due to the size of the .git repo growing so large over time.
- abathur 5y agoIf you want to try this but balk at the ~rough install experience around the Nix volume/encryption: a bunch of work I did to sand this down last Fall was merged into master this Spring. There are some headwinds wrt backporting those improvements to include them in the 2.3.x release series, but you should be able to take advantage of them in the meantime via the installer numtide publishes from master: https://github.com/numtide/nix-unstable-installer https://github.com/numtide/nix-unstable-installer (no special flags needed).
- azalemeth 5y agoOne thing I'd love to know is what the advantages of the different systems are, objectively. I've always used macports, from the very early days, and I just use it because it works, and I know its quirks. I remember brew starting, and thinking "oh, that looks interesting". Yet I never really felt a compelling reason to change. This article is refreshingly honest about why the author decided to give nix a try, and I very much appreciated that. A large chunk is "it's new and I wanted to try it out", combined with deterministic update times, which I respect. Is there a detailed technical comparison of macports, homebrew and nix anywhere?
- sneak 5y agoThe main reason I switched from brew to nixpkgs is the homebrew developers' approach to users who object to the spyware they embedded in homebrew.
- beermonster 5y agoAny references?
- rgoulter 5y agoNix comes with some friction since its approach to packaging is so different. When you start using it, 95% of the time it's great. But because Nix does things in such a different way that it can be difficult how to navigate that last 5%. In terms of installing packages, it's an advantage to Nix that it works with both macOS and Linux. While not every package is as cross-platform as it could be (e.g. some desktop apps that are available on both are only packaged on Linux), it does mean it's easy to use e.g. the same version on Tmux in all computers you have access to. Nix can be used for more than installing packages. e.g. the nix-shell allows for dropping into a shell with particular programs installed.. like a generalisation of rvm/nvm/whatever. Nix can be used to describe Docker images instead of using Dockerfile. NixOS uses Nix to describe its OS's configuration and services, rather than just packages. (Whole OS setup described from a single file is pretty neat).
- jonringer117 5y ago
- X6S1x6Okd1st 5y agoI'm a big fan of Nix! nix on OSX was my gateway drug to nixos. Nixos is much more intimidating & when you stray outside of what is supported by nixpkgs the learning curve really ramps up. I wouldn't be surprised if we start seeing shell.nix and build.nix showing up in more and more OSS projects & it spreads mostly that way.
- NelsonMinar 5y agoHow is Fink doing these days? It looks still actively maintained. The advantage with Fink is it uses dpkg; I winced as I watched years of Homebrew reinventing a Unix package system, badly.
- deleted 5y ago[deleted]
- a-dub 5y agoi've wanted to like nix, but both times i tried it i got turned off by the config. not the language per se, but how it's used. i was expecting some ocd space church dream where all the configs for the packages had been coalesced into nice clean abstractions on top of this language, what i found was that it felt like most config was kinda random and arbitrary. the naming of settings wasn't consistent and that older alternatives felt more consistent. (whether it be --with flags in autotools or the use flag system in gentoo). i really like the reproducibility goals and the separation and gnu stow like structuring of installed packages, i just had a hard time with the inconsistencies with how the nix language was used to express configuration for packages.
- otabdeveloper4 5y ago> i was expecting some ocd space church dream The goal isn't to replace Linux with a "grand unified distribution". Rather, Nix complements and extends the usual way of doing things where the usual way is painful.
- e3bc54b2 5y agoNix grew mostly organically, as a community effort, and it shows. If you want a more consistent interface, Guix might be enticing. I'm not sure of its state on OS X, though.
- rekado 5y agoThere is no glibc for OS X, so there is no way to use Guix on macos without virtualization.
- crazygringo 5y ago> Unpredictable command times. I never know if running brew install or brew upgrade is going to take 5 seconds or 20 minutes. This usually means knowing if a program or dependency is being downloaded as a prebuilt binary or compiled on the spot. Wait, does Nix solve this? And how? The author never mentions how Nix does. I've never encountered a package manager with this capability, so just curious how such a "global progress bar" even gets implemented.
- jonringer117 5y agoRelease channels. If you follow one for nixpkgs, it means that the infrastructure has at least attempted all possible builds. If you're starting to build something, it's likely broken. However, that's usually not the case. https://hydra.nixos.org/jobset/nixos/release-21.05 https://hydra.nixos.org/jobset/nixos/release-21.05
- haolez 5y agoCan Nix be installed in any dir? Or does it need to be on root?
- takeda 5y agoThe answer is yes, and no. Yes, it provides this feature and you can change location of the store, but when you use custom location, you won't be able to rely on the precompiled binaries and will end up recompiling everything. This is because when nix links shared libraries it modifies binary to point back to /nix/store/... location. This way it is completely isolated from the rest of the system. Normally nix won't allow you to place a symlink /nix to point to other place, because while it mostly works, some packages that are resolving symlinks to actual path might end up being broken. You can define an env variable (forgot what it was, but you should be able to find it by searching the error message) that allows you use this setup. This actually was an issue when OS X Catalina first appeared. In that version Apple made root disk read only and also wiped anything that was manually created. Ultimately the solution was to create a /nix as a mount. The nix installer does it on mac (in the past you needed to add an installation option, not sure if that's still needed).
- deleted 5y ago[deleted]
- Evidlo 5y ago[apt/dnf/brew] install package_name vs. nix-env -iA package_name [apt/dnf/brew] search keyword vs. nix-env -qaP '*keyword*' Is Nix going to become the git of package managers? Why can't there be a 'nix install' or 'nix search' for people who just want to use software? That's why I like pip. I can tell a newbie to 'pip install' a package and they can immediately intuit what it does. It gets installed to their PATH, too.
- akiselev 5y agoNot to mention nix-env has been kinda-sorta-but-not-really-but-yes-really deprecated in favor of nix-shell... or has it? I don't know.
- callahad 5y agoThis is an active area of work; check out the docs for "experimental commands" at https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix.html https://nixos.org/manual/nix/unstable/command-ref/new-cli/ni..., especially `nix profile` and `nix search`, where your examples would become: nix profile install nixpkgs#package_name nix search nixpkgs keyword
- dmitriid 5y ago1. How common is it to search outside nixpkgs? 2. How common is it to install from outside nixpkgs? Depending on the answers to the above: `nix install packagename` should default to nixpkgs and install into currently active profile (if auch a thing as currently active profile is a thing in nix, of course) `nix search packagename` should default to searching nixpkgs Boom. You improved developer/user experience 100-fold with little effort. Edit: 99.9% of examples in the linked page have nixpkgs# prefix for packages. Just drop it, and make it default. Everyone will thank you.
- kaba0 5y agoI remember there is a thread on this exact issue. The problem is more that there is no one nixpkgs channel, but several.
- rswail 5y agoI don't understand the attraction of homebrew. Macports is effectively the same as the *BSD ports and supports the MacOS environment in terms of using the native compiler and toolchains. I looked at Homebrew and saw that (at the time) it wanted to blast crap into /usr and did weird root shit. Macports does everything in /opt/macports and keeps itself clean and out of the way of either Apple's OS (and the locked down root volume) or other MacOS native apps that install in /Applications.
- throwaway4good 5y agoApple should create an integrated package manager for OSX. And I agree: I have only had bad experiences with Homebrew and the "cuteness" of its user interface just becomes a massive annoyance when the core of it is not working.
- riffraff 5y agoBack in the day homebrew allowed you to use system libraries for stuff like openssl while macports did not, which was nice for some things, especially at a time when there were no binary ports which meant installing something like imagemagick would take a loooooong time because of all the dependencies. Also brew cask was pretty nice, and generally the experience to add a port was not as seamless as adding a formula to homebrew. I very much prefer macports, anyway.
- klmr 5y ago> it wanted to blast crap into /usr Homebrew only ever writes into `/usr/local`, which was unused by macOS until very recently (though unfortunately a few third-party tools also use it and lead to very occasional conflicts with Homebrew). The original rationale for using `/usr/local` over `/opt` was that, at the time several widely-used software packages had hard-coded installation paths and would require extensive patching to work in other locations [1]. This hasn’t been true for a long time though. On systems with Apple M1, Homebrew finally made the move to `/opt/homebrew`. > and did weird root shit On the contrary, the philosophy of Homebrew is that package installations should never require superuser privileges. The only time Homebrew does “root shit” is when initially setting up `/usr/local` writability. Not weird at all. Though it does mean that Homebrew is effectively unusable (and a very bad idea!) on a multiuser system. [1]: https://docs.brew.sh/FAQ#why-does-homebrew-prefer-i-install-to-usrlocal https://docs.brew.sh/FAQ#why-does-homebrew-prefer-i-install-...
- heurisko 5y agoI like brew, but am ever aware of the risk of supply-chain hacks, such as https://brew.sh/2018/08/05/security-incident-disclosure/ https://brew.sh/2018/08/05/security-incident-disclosure/. It's one of the reasons why I like Ubuntu. Of course, there is also the possibility here that a package could be compromised, but I feel there is more scrutiny, especially as it is based on Debian. I've become increasingly uncomfortable with running brew ruby scripts on my work machine, and try to keep usage of brew to a minimum.
- fortyseven 5y agoMisread this. "An alternative to Hebrew? That's rather bold."
- peterhil 5y agoI have been using this setup for a few months now, and generally it works really nicely, except for clang_12 on Mojave and Python packages. When you combine direnv with shell.nix or default.nix by adding "use nix" in a `.envrc` file, it autoloads the Nix shell environment when cd’ing to a directory and it is amazing for development!
- peterhil 5y agoThis requires nix-direnv installed with Nix.
- mlindner 5y agoHomebrew has been getting worse and worse as they continue to add more dark patterns and remove features from the software. The new maintainers aren't even well liked by the original creator. Homebrew was always about compiling and installing your own software the way you want to. Now it's been turned into a glorified binary package manager with centralized control.
- bfrog 5y agoI love nix if only because for a given project apt/yum/pacman updating my host won’t break things, the environment is replicable easily, and cross compile environments are a breeze. It’s like pythons virtualenv on steroids and it’s freakin awesome. The build never breaks until I decide to update something, even the compiler!
- JamesSwift 5y agoAfter a long time dabbling with nix packages on OSX, never quite understanding what the heck I was doing syntax wise, I finally "got it" after watching these _excellent_ tutorials [1] by @burke. I still have no idea what CLI commands to use for anything, but I never need to understand that since I only use Home Manager and work directly in derivations. The revelation that _everything_ is an attribute set was the key I think, along with understanding syntactic quirks like the multiline string ('') and attribute set merge (//). The latter is especially disorienting if you aren't familiar with it. With that small foundation you can easily dig through the source code for nix packages and craft whatever you need, or at least I so far have been able to. I am now fully on a nix packages / Home Manager setup except for various homebrew casks I haven't ported. That isn't fully necessary, but it would be nice to have everything in one place (although I _do_ manage my homebrew Brewfile by way of Home Manager). [1] - https://www.youtube.com/watch?v=NYyImy-lqaA&list=PLRGI9KQ3_HP_OFRG6R-p4iFgMSK1t5BHs https://www.youtube.com/watch?v=NYyImy-lqaA&list=PLRGI9KQ3_H...
- bpiv400 5y agoThis is really cool. Temporary development shells are a great reason to start using Nix. It makes new tools much easier to test without wreaking havoc on your existing projects. A project I'm working on called flox (floxdev.com) is aiming to make Nix easier to use and install. You can define collections of packages ("profiles") that install with all their dependencies locally, and automatically sync across every machine where you have flox installed. It works on all linux distros now, but we're working to add macOS support.
- c7DJTLrn 5y agoI spent about an hour looking into putting Nix on my work MacBook but the installation seemed too complicated and I couldn't find any official documentation. I frankly just don't want to have to create a volume, that's a pain in the ass. A colleague who tried Nix also informed me that he was coming across outdated packages like Terraform. Brew's packages are updated fairly often.
- takeda 5y agoI don't think that's true, at least about terraform. I see[1] version 1.0.2 updated 8 days ago (same day it was released). The installation[2] is also not that complicated. The documentation also seems to be easily to be found on the project's site[3]. Nix has its issues, like steep learning curve due to the language being functional and lazily evaluated, but it doesn't look like you even got to that point. If these things were causing you difficulties, perhaps you dodged a bullet. [1] https://github.com/NixOS/nixpkgs/blob/af65c312fb1b7dd93a78810af7f6e6b990dad088/pkgs/applications/networking/cluster/terraform/default.nix#L196-L202 https://github.com/NixOS/nixpkgs/blob/af65c312fb1b7dd93a7881... [2] https://nixos.org/download.html#nix-quick-install https://nixos.org/download.html#nix-quick-install [3] https://nixos.org/learn.html https://nixos.org/learn.html
- arun6582 5y agoI installed nginx using macports didn't have uwsgi params module. I tried finding solution on Google couldn't find. Deleted macports installed nginx via brew Everything works well again