It feels like magic. I think of it as the glue that makes almost all of my software work together seamlessly. I can’t wait to use it for one-click deployments of my software on a server or high-availability cluster.
Plutus, Haskell, Nix, Purescript, Swift/Kotlin. laser-focused on FP: formality, purity, and totality; repulsed by pragmatic, unsafe, “move fast and break things” approaches
AC24 1DE5 AE92 3B37 E584 02BA AAF9 795E 393B 4DA0
It feels like magic. I think of it as the glue that makes almost all of my software work together seamlessly. I can’t wait to use it for one-click deployments of my software on a server or high-availability cluster.
This is why I decided to learn Nix. I built dev environment flakes that provision the devshell for any language I intend to use. I actually won’t even bother unless I can get something working reliably with Nix. ;)
For example, here’s a flake that I use for my Python dev environment to provide all needed wiring and setup for an interactive Python web scraper I built:
{
description = "Interactive Web Scraper";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }: utils.lib.eachSystem ["x86_64-linux"] (system: let
pkgs = import nixpkgs { system = system; };
in rec {
packages = {
pyinputplus = pkgs.python3Packages.buildPythonPackage rec {
pname = "pyinputplus";
version = "0.2.12";
src = pkgs.fetchPypi {
inherit pname version;
sha256 = "sha256-YOUR_SHA256_HASH_HERE";
};
};
pythonEnv =
pkgs.python3.withPackages (ps: with ps; [ webdriver-manager openpyxl pandas requests beautifulsoup4 websocket-client selenium packages.pyinputplus ]);
};
devShell = pkgs.mkShell {
buildInputs = [
pkgs.chromium
pkgs.undetected-chromedriver
packages.pythonEnv
];
shellHook = ''
export PATH=${pkgs.chromium}/bin:${pkgs.undetected-chromedriver}/bin:$PATH
'';
};
});
}
Threads used to bewilder me until I started using Haskell. Holy shit that felt like magic, turning an app parallel with two lines of code.
Now, I just have to worry about memory limits….
You guys will probably groan but lots of people in this comment section should look into NixOS. My old Ubuntu machine was loaded with hacks I got from stack overflow to get certain things working (a script that runs at boot and shutdown to mount and unmount some network drives I wanted to appear natively). But now, I just use NixOS and there’s nothing on my machines that is even remotely hackey now. I just declare the drives as I want them and when I boot they are there and work as needed.
I absolutely adore xmonad. You can do ANYTHING you dream up in it. Additionally, it helped make Haskell less intimidating for me.
I have high hopes for their Wayland port called Waymonad. But it’s a long way off.
Little known fact: xmonad is the only WM that has a formally-verified base.
I run an xmonad community here: https://infosec.pub/c/xmonad
Perhaps you’re tired of hearing it but this is very close to exactly how NixOS works with home manager.
I do this in combination with Nix-Darwin for one of my machines. I also have some Kubernetes clusters and RISC-V machines running bare metal executables using NixOS-Anywhere and some other stuff.
Interesting perspective. Thanks for elaborating. You twisted my original concept in knots and won me over to your read of it.
I posted this meme in three places. Did you not read any of the threads where old, cranky FHS luddites came out of the woodwork to angrily dismiss the concept of immutable distros?
Duly noted. I DO NOT use Arch, btw. ;)
What I meant to try and say is that GUIX is like NixOS for Chad programmers.
I’d look into building all of that in a flake just so you can encapsulate (and have a central version control of) all of your dependencies in case something does change.
I’m a bit of a Nix dork but I tend to try and declare my entire dev stack in a flake so it can follow me to every machine. It offers some of the “it works on every machine” guarantees that Docker offers while also forcing the compilation of the stack to happen natively (or at least pulls in some content addressed cache that offers security by being the exact hash for the whole dependency graph). I like that
Here’s how I used the Nix way to declare an interactive Python scraper the other day. With this method, I can lock dependencies between machines as a matter of course without having to use Docker:
{
description = “Weed Scraper”;
inputs = {
nixpkgs.url = “github:NixOS/nixpkgs?ref=nixpkgs-unstable”;
utils.url = “github:numtide/flake-utils”;
};
outputs = { self, nixpkgs, utils }: utils.lib.eachSystem [“x86_64-linux”] (system: let
pkgs = import nixpkgs { system = system; };
in rec {
packages = {
pythonEnv =
pkgs.python3.withPackages (ps: with ps; [ webdriver-manager openpyxl pandas requests beautifulsoup4 websocket-client selenium keyboard ]);
};
devShell = pkgs.mkShell {
buildInputs = [
pkgs.chromium
pkgs.undetected-chromedriver
packages.pythonEnv
];
shellHook = ‘’
export PATH=${pkgs.chromium}/bin:${pkgs.undetected-chromedriver}/bin:$PATH
‘’;
};
});
}
Yeah. I think they’ll catch on in much the same way that lock files have become the standard in many languages. IMO, it just makes more sense to declare all dependencies atomically. I also think/hope it will supplant our overreliance on Docker containers to achieve these kinds of guarantees (where it actually makes sense or presents undeniable benefits).
This person gets it.
GUIX for one.
GUIX is to NixOS what Gentoo or Manjaro are to Arch.
I’ll probably try it someday when I get bored enough of systemd.
Yes for sure. Actually Nix is pretty long in the tooth and there are better implementations of Eelco’s brilliant idea. It’s just that they have a lot less effort, ubiquity, and hype behind them. GUIX is a good example of that. They literally can build an OS from scratch. I find Nix to be rock solid, so I stick with it. But, it’s an idea (all dependencies being content addressed in an immutable folder structure) to allow complexity that isn’t even achievable on FHS style systems.
For example: THE main feature is that you could have a different version of say Python (for the sake of this example) installed for each dependency in your system and they would just work alongside each other due to their unique, hash based folder locations. Each folder is named based on the sha256 hash of the dependency graph, which has powerful implications. Because of this hash, they’re effectively hermetically sealed from each other and cannot step on each other. This is the very definition of Nix and taken far enough to define a whole OS is SUPER powerful concept.
Shit, I’m rambling. Maybe I’ll pause to let you guide my rant. ;)
Nix actually IS Bash under the hood. It uses Perl and Bash to create an atomic installation. I tend to do a LOT less maintenance than I’d need to do if I rolled everything from scratch in Bash.
👍🏽
Much like the fediverse, we’re very early on that technology. We’re waiting for the network effect to take hold in both areas. Once it does, things will improve significantly, IMO.
Amen. I’d love to see Home Assistant start using it. I’m not holding out hope, though, because the guy behind Home Assistant is actively hostile.
Hopefully this sticks. IMO, movie studios need to keep attracting customers or the whole film industry will stay dead.