Matthew Croughan - Use flake.nix, not Dockerfile - MCH2022

  Рет қаралды 43,891

Matthew Croughan

Matthew Croughan

Жыл бұрын

A lightning talk I gave at May Contain Hackers 2022, prepared overnight after a beer.

Пікірлер: 77
@felixlipski3956
@felixlipski3956 Жыл бұрын
based and nixpilled
@ChrisMcDonough
@ChrisMcDonough Жыл бұрын
Love the distinction between repeatable and reproducible :)
@FreeSpeechWarrior
@FreeSpeechWarrior 11 ай бұрын
You're a great speaker and you have an extreme passion for all things nix. Your breadth of knowledge and technical proficiency is amazing. I love the way you don't waste any time giving the audience useless fluff, you're all business. I have shared your videos with all my colleagues and friends.
@Becoming-Human
@Becoming-Human Жыл бұрын
Thank you, Matthew, for presenting this presentation! It was awesome! Please do more! :-)
@itme_brain
@itme_brain Жыл бұрын
Love the nixOS shill at the end. Great presentation.
@fabiandrinksmilk6205
@fabiandrinksmilk6205 Жыл бұрын
I really liked this talk. I also like how you can make really minimal images with Nix. Normally the minimal way was to just use the Alpine image, but with Nix you essentially build from scratch pretty easily.
@wojtekkrupski8583
@wojtekkrupski8583 Жыл бұрын
Goddam! The best high-level explanation in the whole internet! Now, I comprehend what Nix is!
@vitriowibisono2875
@vitriowibisono2875 Жыл бұрын
Great! Finally something new. I just what i needed
@biigsmokee
@biigsmokee 11 ай бұрын
fantastic presentation, was about to ask for a longer one but just seen there is one.
@johanyngman7793
@johanyngman7793 4 ай бұрын
Awesome, I love it, great presentation. I'm going to start learning this right away!
@anthonyoleinik6472
@anthonyoleinik6472 Жыл бұрын
Great talk, thanks for doing it! Format is a little too speedy but that's not your problem :). A good area for future public education here would be deployment. I'm evaluating this for work / life - one benefit of docker is that it plugs in quite easy to GCP Cloud Run. Going to have to research if flakes allow a similar easy integration.
@matthewcroughan
@matthewcroughan Жыл бұрын
Indeed, the industry of Flake native providers and hosting companies has to be created, and I'm working on that too. You still need to create legacy formats like OCI if you want to use GCP Cloud Run.
@JonathanLucas-cr5nu
@JonathanLucas-cr5nu 4 ай бұрын
the best presentation about nix, Show me how powerful nix is, and it's so enjoyable to learn nix.
@soupglasses
@soupglasses Жыл бұрын
Definitely a bumpy presentation to watch, lots of thoughts and not enough time for them all. Cool idea to use nix for container creation. Next time i would love to see bigger fonts on a light background to help with contrast. As nice as dark mode is for work, projectors do not do it justice. Love to see what you do in the future! :D
@matthewcroughan
@matthewcroughan Жыл бұрын
Hehe, that's definitely how it felt. And I plan on giving this talk a lot more in order to get better at it. Was definitely good to get up and do it, regardless.
@soupglasses
@soupglasses Жыл бұрын
@@matthewcroughan a bumpy presentation is better than no presentation at all! Keep it up! 😎
@DalePatch
@DalePatch 5 ай бұрын
I did not know about AArch64 emulation this way. That could definitely make creating software stacks for my Pine64 devices easier. Reproducibility across AArch64 and x86-64 is what attracted me to NixOS initially.
@EricTorreborre
@EricTorreborre Жыл бұрын
Thanks Matthew!
@luisaranda9015
@luisaranda9015 Жыл бұрын
nice comparison of nix vs docker
@sata1938
@sata1938 Жыл бұрын
Nice talk, subbed
@aaronegatesong
@aaronegatesong Жыл бұрын
so good
@designernasser
@designernasser Жыл бұрын
Good job!
@StevePentland
@StevePentland Жыл бұрын
Quite interesting! What was the software you used for the slides? I really like the look of them
@matthewcroughan
@matthewcroughan Жыл бұрын
github.com/maaslalani/slides
@Sparkritiker
@Sparkritiker Жыл бұрын
🔥🔥🔥🔥🔥 😎
@RedneckPythagorean-ms9ox
@RedneckPythagorean-ms9ox 6 ай бұрын
Impressive, self-apparent competence. Fuck ya man, much respect.
@knightwolf8877
@knightwolf8877 Жыл бұрын
Is it possible to read the thesis?
@BringMe_Back
@BringMe_Back Жыл бұрын
I'll get back
@efraimdeluxe
@efraimdeluxe 11 ай бұрын
great cap, where did you get it from?
@matthewcroughan
@matthewcroughan 11 ай бұрын
Made it :)
@trejohnson7677
@trejohnson7677 Жыл бұрын
no crows in your cornfield, thats for sure!
@bingolio
@bingolio 9 күн бұрын
Bra, No credits to R Stallman for your preso style?
@eatthemalive93
@eatthemalive93 Жыл бұрын
you can pin a container in docker via sha ... admittedly this isn't very common I'd be surprised if we couldn't do the same using something like apt I'd also be pretty stoked to get the C build process down. I don't like muddying my path for headers 3/3 talk
@matthewcroughan
@matthewcroughan Жыл бұрын
Not only is it uncommon, but Nix wouldn't allow you to make this mistake. Nix demands that you specify a sha256 when performing impure computation, as a language should. Dockerfiles are not a language, so they do not prevent mistakes like this.
@gasdia73
@gasdia73 Ай бұрын
the Paddy the Baddy of software development :)
@0xDAEF0F
@0xDAEF0F Жыл бұрын
i need to up my game. this guy is a f*ing chad
@cybertrike
@cybertrike 9 ай бұрын
Gigachad
@skirnir393
@skirnir393 11 ай бұрын
In the past I've encountered problems with Debian based images that are no longer supported (Wheezy for example), because the official repositories where moved to archived so apt stopped working or the gpg signatures are no longer valid, etc. This is a nice idea, but it don't feel that it is worth the effort for me (and likely to must people). The syntax is (imho) ugly compared to the simplicity of a docker file. Also If some one has to fix something I did that person is more likely to know dockerfiles than flake.nix. I guess that what I'm trying to say is that most of the time docker files are good enough.
@DrewIsFail
@DrewIsFail Жыл бұрын
The best hope here is that nix can easily produce a docker file, that integration would let people switch without adding the overheard of managing two similar sets of tools. Is there any chance of that?
@matthewcroughan
@matthewcroughan Жыл бұрын
Not necessarily. The point of this presentation, for me at least, was to show why Docker is not very reproducible and why Nix is a better choice. This naturally leads to questioning whether you need Docker at all in the first place.
@DrewIsFail
@DrewIsFail Жыл бұрын
@@matthewcroughan because of the enormous amount of preexisting functionality around it. Adoption is easier with a bridge, don't make people swim if you can help it.
@matthewcroughan
@matthewcroughan Жыл бұрын
@@DrewIsFail I think you might be using Docker wrong then, if you think this collides at all. Docker is for running software, not building it. That's the point I'm trying to make.
@syrus3k
@syrus3k 10 күн бұрын
Wait hang on, nix can create images? That's.. Game changing
@Cenot4ph
@Cenot4ph 2 ай бұрын
Dockerfile can have specified versioning applied, even if you want you'd could use dpkg to retrieve specific dependency versions such as; sudo apt-get install apache2=2.4.29-1 in the case of Debian based distr. such as ubuntu example used here There are definitely ways to make docker builds specific that reproducibility is near guaranteed
@matthewcroughan
@matthewcroughan 2 ай бұрын
The point is that Dockerfiles allow you to make this mistake, whereas the Nix expression language doesn't permit this mistake, and forces you to specify a version, which is clearly better than allowing people to be lazy and make silly mistakes that will lead to unfun and boring debugging sessions in the future. Your debian example is apples to oranges, because those are binaries and aren't compiled from source like Nix. They are definitely not reproducible, because when you `apt install` something you're simply grabbing a binary, not reproducing anything. And even if you wanted to, it would not be trivial to build it from source again, therefore making yourself reliant on third party infrastructure to host those binaries, with no easy way out.
@bart9522
@bart9522 Жыл бұрын
Why not both?
@matthewcroughan
@matthewcroughan Жыл бұрын
Because only one actively prevents you from making mistakes.
@AungusMacgyver
@AungusMacgyver 5 ай бұрын
All of this sounds more like a problem with common Docker practices than the actual functionality of Docker. 3:08 You can specify a specific base image using an SHA instead ubuntu:latest if you need/want that level of specificity. Or use a specific Ubuntu release tag as a middle way. 3:53 You can create a base image with all your apt installation already done. You can specify specific versions for apt packages if you need/want package installation to be part of the dockerfile. Nix also relies on the Internet to download stuff so I don't see how that is different. Ex., pulling the hello-world tar from GNU servers. 8:13 "Nix guarantees that we're going to get the input from the Internet every time".... How on earth can you do that? You might be able to check if you got a different input if a hash has changed but that's not the same thing as getting the sams input every time. Docker builds in a sandbox too. That's the entire idea behind a container.
@matthewcroughan
@matthewcroughan 5 ай бұрын
Yes, and using a language like Nix prevents you from making those mistakes with common practices, and also eliminates the need for a container runtime as a plus.
@Cenot4ph
@Cenot4ph 2 ай бұрын
@@matthewcroughan your statement would have merit if you could nix container in kubernetes, as far as im aware it's for Docker exclusively. Secondly, it's not always a requirement to have that level of reproducibility and as said Docker has ways to make it more specific to mitigate such cases pretty much.
@matthewcroughan
@matthewcroughan 2 ай бұрын
@@Cenot4ph OCI images are a standard, and run everywhere, whether it's Podman, Docker or in Kubernetes. I also don't believe there's any scenario where reproducibility should be valued less. What's the point of software if it doesn't run everywhere? If you build it to be reproducible at the bottom, then it will remain reproducible when you're done. If you give up the principle early on, then you'll have to salvage it later, which is a waste of time in my opinion.
@IvanGreguricOrtolan
@IvanGreguricOrtolan 3 ай бұрын
I mean, really cool but what if I don't care since 99.9% of the times it just works. I like the NIX approach and I think it makes more sense to lock the version but still he is making the approach of using lates look very bad when often is just fine. On top of that you can use version numbers instead and if you use a stable base system you should not worry about breaking changes by design. NIX has it's beauty and place but I don't see this as a game changer that will replace docker.
@Cenot4ph
@Cenot4ph 2 ай бұрын
plus if you want you can version your OS dependencies on an LTS release to get a pretty fine grained control over what is installed on top of such a base image using again dependency versioning; e.g. apt install apache2=2.3.4
@danepane527
@danepane527 Жыл бұрын
I don't get it.. you could use docker + tags, create you own base image, etc... How is a docker file not reproduceable?
@matthewcroughan
@matthewcroughan Жыл бұрын
Because it doesn't produce the same result twice when you run 'docker build', it produces two different rootfs contents. You can build it and redistribute the tarball, and mark it as golden with a tag. Of course distributing something you built one-time is reproducible. But, if you took the same Dockerfile and ran 'docker build' on it twice, it would not produce the same rootfs.
@danepane527
@danepane527 Жыл бұрын
Thanks for the reply! Checking out nixos.. just trying to wrap my head around the use case I guess. In my head if I write a docker file and am using tags its seems to me to be repeatable, I can control what is pulling into the container, what deps are used, etc.. Thanks man! Going to give nixos a go
@matthewcroughan
@matthewcroughan Жыл бұрын
@@danepane527 You can't control what apt does when you apt install hello. You're at the whim of it, because it isn't reproducible. Whereas nix uses the nix expression language to give you full control over the inputs. Apt, by comparison, at least by default, will go and do some random stuff and populate a package database differently every time it is ran. Note how you first have to do `apt update` which populates this database differently and non-deterministically every time it is ran.
@mumk
@mumk 2 ай бұрын
Docker just doesn't work for me
@NostraDavid2
@NostraDavid2 2 ай бұрын
So Docker isn't idempotent? Dang.
@uziboozy4540
@uziboozy4540 Жыл бұрын
Use Podman ;)
@matthewcroughan
@matthewcroughan Жыл бұрын
All the same flaws exist there. Podman and Docker are just container runtimes. How the OCI (Tarball) image is built is what this talk is about, and Podman's 'buildah' is just as unreproducible as a Dockerfile. Podman would be no better than Docker at building software reproducibly. It still allows unconditional access to the internet in the build environment and doesn't provide you with a domain specific language to make builds happen reproducibly.
@uziboozy4540
@uziboozy4540 Жыл бұрын
@@matthewcroughanhmm, gonna have to look into Nix then.
@lonterel4704
@lonterel4704 Жыл бұрын
@@uziboozy4540 you would not. There are messy docs about old nix, now its more messy with flakes
@matthewcroughan
@matthewcroughan Жыл бұрын
@@lonterel4704 I can agree with that. But I don't think it takes anything away from what Nix is, or is going to be. It will only get better. You could probably say the same about the Python2 and Python3 transition. I don't think that detracts from Python at all, just because the transition was messy.
@lonterel4704
@lonterel4704 Жыл бұрын
@@matthewcroughan my point is lack of docs exists already several years. Nixos community should delegate someone to update docs.
@enlighteneddoggo5803
@enlighteneddoggo5803 Жыл бұрын
No.
@matthewcroughan
@matthewcroughan Жыл бұрын
Maybe.
@ruroruro
@ruroruro Жыл бұрын
Yes.
@PatrikStutz
@PatrikStutz Жыл бұрын
Definitely.
@cybertrike
@cybertrike 9 ай бұрын
Go on then
@pancakesupreme5071
@pancakesupreme5071 Жыл бұрын
Thanks, I hate it. I'd much rather use dockerfile.
@matthewcroughan
@matthewcroughan Жыл бұрын
Lol.
Getting Started with Nix
25:49
OpenTechLab
Рет қаралды 63 М.
NixOS Has One BIG Problem
17:48
The Linux Cast
Рет қаралды 61 М.
Stupid Barry Find Mellstroy in Escape From Prison Challenge
00:29
Garri Creative
Рет қаралды 20 МЛН
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 25 МЛН
Just try to use a cool gadget 😍
00:33
123 GO! SHORTS
Рет қаралды 85 МЛН
Flakes: Nix Unshackled - Graham Christensen | PackagingCon 2023
24:20
Matthew Croughan - What Nix Can Do (Docker Can't) - SCaLE 20x
2:04:54
Matthew Croughan
Рет қаралды 44 М.
Writing your own NixOS modules for fun and (hopefully) profit
23:25
All Systems Go!
Рет қаралды 10 М.
Say Goodbye to Containers - Ephemeral Environments with Nix Shell
16:58
Nix Flakes - An Overview
5:39
Jake Hamilton
Рет қаралды 5 М.
Nix flakes explained
7:22
Vimjoyer
Рет қаралды 64 М.
Nix and NeoVim
13:38
ThePrimeTime
Рет қаралды 119 М.
I was WRONG! This is the BEST Package Manager.
10:25
Chris Titus Tech
Рет қаралды 134 М.
Nix Dev Environments | Declare Your Coding Projects
5:43
Vimjoyer
Рет қаралды 28 М.
Cadiz smart lock official account unlocks the aesthetics of returning home
0:30
i like you subscriber ♥️♥️ #trending #iphone #apple #iphonefold
0:14
#miniphone
0:16
Miniphone
Рет қаралды 3,5 МЛН