7 ms·
Honestly - how painful was it to learn and get working? And what limitations/niggles are left when using as a workstation? I love the principles behind Nix, an
by rkangel 5y ago
Honestly - how painful was it to learn and get working? And what limitations/niggles are left when using as a workstation?
I love the principles behind Nix, and I like to use it to provide development environments (through nix-shell locally and then using the same setup in CI). But some things can be moderately painful to get going.
- nvarsj 5y agoYou're looking at a solid 10-20 hours of hacking stuff together to get a decent working system, and you still won't understand a good 80% of what you copied from various repos. I've been using NixOS for a year now, and I have a definite love/hate relationship. Many times I miss the simplicity of Arch, where I understood _everything_ about my system and how it was configured. NixOS is like learning everything all over again, but in a weird, poorly documented language+standard lib that nothing else uses. I think when you are super comfortable with it, is when it becomes truly amazing. But that takes a lot of dedicated time and effort.
- OhSoHumble 5y agoThis is where I'm sitting right now. I'm trying out Void Linux on my laptop and it's just so simple. I love that I understand my system. I look at Nix as a language and I just have no idea what is going on. What I'd really like, as a learning resource, is a "Nix for apt/yum users" or a "Nix for Ansible" users guide. There is the cheat sheet (https://nixos.wiki/wiki/Cheatsheet https://nixos.wiki/wiki/Cheatsheet) but it's just not enough. For example, I wanted to just... create an arbitrary directory in my home directory (~/workspace). Does Home Manager do this? If so, how? Do I just have a shell script that is called within a package? That seems excessive. Is this not a use case for Nix? It looks like it can do arbitrary tasks across the system but the documentation is so bogged down with theory that it takes forever to find practical applications.
- m45t3r 5y ago> For example, I wanted to just... create an arbitrary directory in my home directory (~/workspace). Does Home Manager do this? If so, how? Do I just have a shell script that is called within a package? That seems excessive. Is this not a use case for Nix? It looks like it can do arbitrary tasks across the system but the documentation is so bogged down with theory that it takes forever to find practical applications. You are definitively trying to do too much at the same time. Before using Home-Manager (that is a community project, it is not endorsed by NixOS except by allowing to be hosted on the nix-community group on GitHub), I stayed at two years playing with only NixOS. It is only after I got comfortable with Nix and NixOS that I decided to migrate my configuration to Home-Manager. Not saying that you need that much time to use HM, just that HM assumes that you're know a reasonable good amount about Nix and NixOS. So I would say, start with less: try NixOS first, it is kinda easy to use compared to other "advanced" Linux distros like Arch and Void. The easy things are really easy, the hard things can be really hard at first but I don't think you need to know much about Nix to be proeficient on NixOS nowadays. Also yeah, you will need to search some things, but since the scope is reduced it is easier to find answers.
- frio 5y agoMy advice would be (per the other person here) to ignore home-manager when you're getting started, and then, when you're ready, treat it as a dotfiles manager on steroids. I've never used it to manage visible directories in my ~/, but for ~/.gitconfig? Absolutely :).
- takeda 5y agoYes, it's extremely powerful once you truly understand Nix. There are efforts to improve documentation, but it still is lacking (I think the biggest problem is that Nix is so big, not just the OS but it can be utilized as a build system). Just with NixOS is not exactly clear how can you for example build your custom image. I think https://nix.dev/ https://nix.dev/ is approaching the documentation from the right direction. There are also many pieces that people built that you need to find. For example some things that I found accidentally: * https://github.com/nix-community/poetry2nix https://github.com/nix-community/poetry2nix * https://github.com/matthewbauer/nix-bundle https://github.com/matthewbauer/nix-bundle * https://github.com/cleverca22/not-os https://github.com/cleverca22/not-os Unfortunately those side projects often have even worse documentation.
- Mic92 5y agoIf you want to build custom images just use https://github.com/nix-community/nixos-generators https://github.com/nix-community/nixos-generators It's documentation is on point.
- takeda 5y agoWould it be possible to add a minimalistic image that contains app, kernel and essential packages? Like what you would get when building a docker container or using the not-os repo that I mentioned earlier. I think having mini images would be awesome.
- gmfawcett 5y agoYou might like: https://nixery.dev/ https://nixery.dev/ e.g. if you want a Nix container with a shell environment, git, and htop: docker run -ti nixery.dev/shell/git/htop bash
- lloeki 5y ago> how painful was it to learn and get working? nixpkgs (which you can use on macOS or any Linux distro), quite little, you can get up to speed in 15min as a Homebrew replacement: nix-env -qas ruby # 'q'uery 'a'vailable 'search' nix-env -I ruby. # install by package name (not recommended) nix-env -iA nixpkgs.ruby_3_0 # install by "attribute", recommended nix-env -q # 'q'uery (i.e list installed) nix-env -e ruby # uninstall (like deleting a git ref) nix-env -q nix-collect-garbage # cleanup, like `git gc` # etc... And as a general purpose virtualenv/rvm/whatever replacement: $ cat shell.nix { pkgs ? import <nixpkgs> {}, # you can have multiple of these with different names to have e.g a mix of stable and unstable }: let openssl = pkgs.openssl; # just an example of how to set a var in pkgs.mkShell { buildInputs = [ openssl pkgs.ruby_3_0 # or reference attires directly ]; } $ nix-shell (nix) $ ruby --version ruby 3.0.1p64 (2021-04-05) [x86_64-darwin17] (nix) $ openssl version OpenSSL 1.1.1k 25 Mar 2021 (nix) $ exit $ openssl version # back to the system one LibreSSL 2.8.3 That way it's immediately useful and you can dig in deeper into the concepts as you go, if you want to. NixOS, it's barely different, only generalised to the whole OS, but it's a bit tougher, because there's this abstraction via configuration that generates e.g systems files or other configurations that you'd operate with directly otherwise on a traditional distro. But the minute you screw things up, having the generation selector to pick and boot on straight in the boot loader you can see the absolutely unparalleled value of the proposition.
- rkangel 5y agoI use nix-shell for dev environments. Once I've got it working it's wonderful - full replicable, across multiple development machines and CI. It's painful though. Some problems I've encountered recently on different projects: Old version of fwup packaged. Can override to get newer version, but needed to add another dependency to make tests pass (and it gets built locally rather than being cached) Pain getting my environment to include the right Python packages so I can run the gigalixir command line tool. Have to workaround an oddity to do with how Erlang is packaged so that I don't get lots of warnings when anything is compiled: shellHook = '' export ERL_LIBS="" '';
- nitsky 5y agoUsing NixOS with flakes is actually quite simple once you already know how to do it, but the lack of high quality tutorials made it difficult for me to get started. I hope the community will improve this situation over time.
- scns 5y agoCould you write one?
- ashtonkem 5y agoMy experience, a while ago I will admit, is that your experience will vary wildly based on what you’re doing with it. Writing Haskell in it was a joy, but Ruby was pure pain. I actually never could get RoR to run (this might have changed), so I gave up and went to OSX for that stuff.
- takeda 5y agoI haven't used Ruby, but Python also was a huge pain and there were many attempts at fixing it, but all had some issues for me. That is until I found poetry2nix.
- pxc 5y agoHow does poetry2nix compare to mach-nix, in your opinion? The way mach-nix handles native (non-Python) dependencies strikes me as really slick.
- takeda 5y agoSo I haven't used mach-nix, but from what I see it provides its own way of specifying dependencies. While in case of poetry2nix you are using poetry for dependency management and poetry2nix just translates it to Nix. The biggest benefit for using poetry is the dependency resolver which is much smarter than in pip and actually finds packages that match the version requirements (although looks like mach-nix also has a smart resolver. Other benefits are: * nice CLI * ability to package application and upload to PyPI * poetry can still be used by people who don't use Nix Regarding non-python dependencies, this is solved by overrides file[1]. That way most of the time you don't have to think about it. You can also override the override in your project as well. [1] https://github.com/nix-community/poetry2nix/blob/master/overrides.nix https://github.com/nix-community/poetry2nix/blob/master/over...
- ashtonkem 5y agoMy understanding is that Python packages are directly installable via nix, at least some of them. This is a completely parallel way of installing packages from the regular way, which sucks, but at least it works in theory. I never personally tried it though. Stack (Haskell) was awesome because it’s Nix aware, enabling it to create its own env to handle C deps on it’s own.