You really need to produce more videos. This is by far one of the best walkthrough/tutorial in YT.
@jasonclark1149Ай бұрын
I've been watching YT vids on Nix/nix-darwin/home-manager for a couple of days, and getting increasingly frustrated. So many are incomplete or incomprehensible, or assume a bunch of prior knowledge, or simply say "do A, do B, do C, smash that like button" with no explanation of what is being done, or why. This video is exactly what I've been looking for. Thanks for making such a comprehensive tutorial. Subbed in case you make any more of these.
@SwordAndShotgunАй бұрын
Did I miss where you explained the VM environment? Hope you still look comments on old videos, but what VM are you using in the terminal, and what's the guest OS you're installing NixOS on to? Are you using an Intel Mac or Applie Silicon?
@zmreАй бұрын
For this video, I used Parallels to run MacOS to use a fresh environment. I didn't install NixOS exactly as that is a Linux distro (one of these days I can go over that). This was an install of nix-darwin and some other bits and pieces. If I were installing NixOS, there wouldn't be a guest OS under it.
@SwordAndShotgunАй бұрын
@@zmre okay, so you're using Nix as a package manager / macOS system configuration tool? That's definitely an aspect of what I plan on using it for, but my primary search right now has been to get it running in a VM like Tart, VMWare, or maybe Parallels. Off topic, but wondering if you've seen this... I just ran out of time on the Parallels trial and didn't end up buying it because when I set the Parallels security settings to any of the "Require password to:" settings (like change VM state or settings) it would accept my Touch ID, but then immediately ask me to type my password as well. Every time, every option, on and off. Have you seen that bug/behavior? This was on Sequoia with the latest version of Parallels and their support couldn't help me. If you haven't experienced that, I may retry with a fresh macOS install.
@zmreАй бұрын
@@SwordAndShotgun I have nixos running in parallels but haven’t had a need to fire it up since upgrading to sequoia. I haven’t seen that bug but also only use parallels periodically. Parallels is amazing at running windows and is nice for spinning up a fresh macOS too but for running Linux in a VM on Mac, I’d probably just use qemu maybe via utm. I run docker via Colima which is running qemu anyway so for me it would probably make sense that way. Your mileage may vary…
@JoeBuza2 ай бұрын
I'm barely a quarter in and already so impressed with the walkthrough. Amazing stuff. Thank you for sharing this knowledge freely.
@wojciech-kulik3 ай бұрын
Wow, this tutorial is extremely well done! Thank you for all your effort, it's very helpful for a new Nix enthusiast :D
@PaKa-kj3rj4 ай бұрын
Extremely well explained. No reddit post or internet article has explained it this well. As a first-rime nix user, knowing nothing about the nix language (although write mobile, desktop & web apps), any resources I found just bombarded me with info that was not even close to relevant in actually learning how to configure flakes. I've used various bootsrapping methods available on gh, all with different approaches (and varied results of success), and just confused the heck out of me. Subbed.
@닐리아담4 ай бұрын
9:00 finally someone explains the essence of declarative+functional programming in an understandable way. many can't do this.
@HasanOzgan4 ай бұрын
Thank you so much, it's really useful. I know kungfu a little. :P
@sharukhrahman79254 ай бұрын
Hi, is there a way to maintain couple of xcode versions.. i have some desktop app projects with different macos versions(comes with preinstalled swift versions).. Is there a way to reproduce old mac to develop legacy apps using nix.?
@zmre4 ай бұрын
@@sharukhrahman7925 the macOS frameworks are the one place nix on Mac loses some reproducibility. In Xcode itself you can target old devices. In nix, I’m not sure. I haven’t attempted it. I know in some cases it will download and build a specific framework but in others it just references the system. Here’s a list of impure frameworks: github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/darwin/apple-sdk/impure-deps.nix Sorry I’m not sure if there’s a way to do what you want.
@sharukhrahman79254 ай бұрын
@@zmre ok, i think ill just learn nixos first then ill get some idea to use it with macos or windows.. thanks for the reply! 🖖🖖
@zmre4 ай бұрын
@@sharukhrahman7925 I've thought about this a bit more and I got a couple of things wrong. Yes, you can use Nix to use older MacOS SDKs. I know I could make this work manually -- I'm not sure what tools are available to make it easier. But in terms of xcode tools like "xcodebuild" -- as far as I know, you can't, but maybe someone who does more MacOS/iOS programming will know better than me.
@sharukhrahman79254 ай бұрын
@@zmre oh ok got it.. thanks for sharing!!
@binh1298ify5 ай бұрын
I have come back to this video more than three times. Thank you so much
@SoulaORyvall6 ай бұрын
Amazing video!
@c_j736 ай бұрын
imho - Best resource for explaining the setup on OSX in the community great stuff thank you very much!
@jasonjones50798 ай бұрын
Thank you. Learned a lot. Not sure what "extraSpecialArgs" was, how you figured out that you needed "stateVersion" and would _love_ a walkthrough video of neovim setup. Also not sure when to source files like you did with inputrc versus putting into main config and remain confused why we still need to deal with brew. This was really helpful and much appreciated. Great job!
@zmre8 ай бұрын
extraSpecialArgs: it's a list of things to pass into any home manager modules. It's mentioned in the documentation and is a good way to thread variables through to modules that you break out. Neovim setup: I really need to post that. Regarding sourcing vs. embedding in nix docs: that's just personal preference. I generally inline short configs and reference bigger config files, but it's just a question of organization. As for brew: I mostly use brew for Casks. Mac-only applications won't be in Nix, sadly. If you were so inclined, you could probably make a nix package or overlay for anything you can find in homebrew and then not use it at all. The reason not to do this is if you're lazy and don't want to handle updates manually but want someone else to stay on top of releases. I've change my personal config to use github:zhaofengli-wip/nix-homebrew now, which lets me pin homebrew repo states so I can restore my system more fully when desired.
@lobielobes8 ай бұрын
Absolutely fantastic work mate!
@learnityourself9 ай бұрын
Insane stuff, man thanks so much.
@aloufin9 ай бұрын
Thank you so much for this video. I'm so thankful we live in an age where we can find videos like this with a great teacher.
@TheMarkman199511 ай бұрын
tremendously useful, thanks for making this video!!
@zmre11 ай бұрын
Glad it was helpful!
@xorlop Жыл бұрын
Thank you so mcuh! Very helpful!
@xbz24 Жыл бұрын
i really would wish sfml and box2d would work in m1 macs using nix
@zmre Жыл бұрын
I hear you. I have a long list of such requests. Looks like both of those are in brew. I've improved my control of brew of late using github:zhaofengli-wip/nix-homebrew which basically pins a point in time for the brew repo along with a system snapshot so you can have rollbacks. Still imperfect and not as good as something building natively, but it makes me feel better about the things I install this way.
@gzoechi Жыл бұрын
Great video🚀
@kaiowasdeath Жыл бұрын
I enjoyed this workshop very much! I don’t know if it’s much to ask, but would you be willing to the same with NixOS when you have time for it? You have a great talent on walking through the things you are familiar with. I would suggest you keep on making walkthroughs like this more often. For instance, I’m particularly interested in your neovim setup.
@zmre Жыл бұрын
I'm going to try to do more in the coming months including NixOS, neovim, and probably something on the apps I use to make the Mac more usable for me (from the keyboard).
@nasang7478 Жыл бұрын
Hello, how to add a new file and rebuild the flake? I always get error: getting status of '/nix/store/...': No such file or directory
@zmre Жыл бұрын
Sounds like something failed for you on the install step. Try again from the beginning?
@nasang7478 Жыл бұрын
@@zmre oh i need to git add the new files, missed this part
@nasang7478 Жыл бұрын
@@zmre hello i've seen your nix-config repo and found raycast and other mac apps preferences/options there, where do you get the docs of these?
@zmre Жыл бұрын
@@nasang7478 not sure exactly what you’re looking for. On the nix/terminal side, I use man pages mostly. For Mac apps like Raycast, usually the website for the app. No single source.
@AnkushNarula Жыл бұрын
great walkthrough! hope you create more content! thanks!
@rhymeflakes Жыл бұрын
Thanks for this amazing & straightforward tutorial, your are amazing.. I wanna ask, How to add allowunfree setting in this home manager?
@zmre Жыл бұрын
So "allowUnfree" is a concept that comes from nixpkgs (which home-manager uses so it impacts both). So you want to change the config for nixpkgs. In a flake, you do this when doing the nixpkgs import. In my example, we have this line: "pkgs = import nixpkgs { system = "aarch64-darwin"; };" You'd want to add something like: "pkgs = import nixpkgs { system = "aarch64-darwin"; config = { allowUnfree = true; }; };" And that will set it up to work within your flake. Now if you also want it working system-wide in case you use "nix-env" or whatever (not my preferred way), then you can also add it to "nix.extraOptions" I think. I probably wouldn't bother with that second part myself though.
@rhymeflakes Жыл бұрын
@@zmre that's cool, perfectly work, u just save my life twice @zmre !
@jeanrodrigues6249 Жыл бұрын
who
@CarlosVixil Жыл бұрын
not sure if it's explained, nix-env is the closest to something like brew (pollutes), nix-shell is like a mini isolated temporary env. They can be cleaned up with nix-collect-garbage. The recommended way is like you suggested, to config or flake.
@larsthomasdenstad9082 Жыл бұрын
Great! Liked and subscribed! And commented!
@mitchhanberg Жыл бұрын
Is there a trick to get settings like system.defaults.NSGlobalDomain.KeyRepeat to activate? I'm not seeing them activate even after restarting, killing the finder, or running `/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u`
@zmre Жыл бұрын
I use the activateSettings -u trick, which works for most things. You can build it into your config (example here: medium.com/@zmre/nix-darwin-quick-tip-activate-your-preferences-f69942a93236). Make sure System Preferences is closed when you run that. If it isn't working for the key repeat settings, you might have to logout/login. I haven't changed my key repeat since adding the activateSettings stuff so I'm not sure if it needs some kind of bigger kick. Doubt there's a running app you can kill for that (not Finder specific).
@NickFields4 Жыл бұрын
This video slaps! Thank you for making it! Do you lean on Nix for initializing your dev boxes? I've been exploring this topic heavily for a while. We've got: Immutable Linux builds Distrobox Comtrya Custom bash scripts Docker And on and on As life goes, seems that each, including King-Nix, comes with significant draw backs. But nonetheless, myself (and I think many others) are holding on to hope for truly reproducible desktops / dev-boxes. That are still easy to design/modify/update as needed. Maybe nix base with one or more others stacked on top? Your input / experience / opinion here would be greatly appreciated. Whether in text or future videos. Also, please lemme know where i can find more of your content/etc. Pervasive well wishes! Much love! Nick
@NickFields4 Жыл бұрын
^gets answered as I progress thru the video. But still deeply interested in your insights / preferences concerning such. 😊😊😊
@zmre Жыл бұрын
I appreciate the nice feedback. We use nix for reproducible local dev environments and I wholeheartedly recommend it for that especially if you're working across repos and languages. It makes things way more predictable and stable. But we don't use nix to build docker containers (we build from scratch) or to manage machines so I can't speak much to that. But best practices around making flakes for dev projects is something I could do a video on as it's a bit of a dark art that could use more sunshine. If you're looking for me elsewhere, I show up in videos more often in my day job (kzbin.info/door/t14QWc1tkHyO3irAiQo_dg), I write long form on Medium (medium.com/@zmre) and occasionally I engage on mastodon @[email protected].
@joshuabatty Жыл бұрын
Thanks so much for putting this together. Followed along but when I run darwin-rebuild switch --flake ~/src/system-config/.# my whole graphical interface shutsdown and reboots with none of the previous programs running. Have spent a few days trying to get past this but no luck. Have you seen this happen before?
@zmre Жыл бұрын
Hmm. I have not. Does it build fine? If you say “build” instead of “switch”?
@zmre Жыл бұрын
And this is using the flake from this video?
@joshuabatty Жыл бұрын
@@zmre nix build --show-trace also causes the same shutdown reboot to occur
@joshuabatty Жыл бұрын
what's strange is i have access to alacritty and ripgrep so the initial install must have worked. I just can't get it to build again anymore after that initial time.
@zmre Жыл бұрын
@@joshuabatty I can’t imagine what would cause that. A build doesn’t trigger any system commands. I’d update dependencies before trying again and also get really minimal in case you’re trying to build something in particular that’s somehow triggering a shutdown. I’d also open up the console app and try to see if there’s something in the logs that gives a clue. I’ve never heard of something like this. Maybe also run a ram test?
@CristianHeredia0 Жыл бұрын
This is the tutorial that brought it all together for me. Thanks!
@zmre Жыл бұрын
Glad it helped!
@brennanseymour4367 Жыл бұрын
Great intro. Coming back to this now that i know nix better, I really appreciate the idiomatic, flake based config. It really helped me get started with the system. Also, pwnvim got me into neovim
@dagrlx Жыл бұрын
wow, nice video, congratulations. I've only been reading about NixOS for 2 days, and with this video I see the potential of nix.
@lminotaful Жыл бұрын
that is a great video! I have been using nix flakes and home manager for over 6 months now and I got to learn a bunch from this video! Thank you!
@paulchenpi7893 Жыл бұрын
Without this video I wouldn't have been able to get nix-darwin running. Thank you so much!
@HarrySolovay Жыл бұрын
AWESOME VIDEO. THANK YOU!
@jeffsauer2198 Жыл бұрын
wow... very well done. I've been wanting to try nix for a while, but saw that many of the packages I needed were missing or not up to date. I didn't know nix could control brew, which is great... I think I'm hooked.
@alivecoding4995 Жыл бұрын
This is probably the most confusing syntax of a language that I have ever seen. And I know M a bit.
@zmre Жыл бұрын
Wish I could disagree.
@IndigoVFX Жыл бұрын
I'm not even half-way through your video and loving every minute as I follow along. I'm not sure how new to YT you are, but I instantly subbed. Looking forward to watching and working through the rest of the video, and to many more to come. Your way of explaining in simple terms, how and why you do specific steps whilst being sure to not leave anyone behind is simply brilliant. I can't thank you enough!
@zmre Жыл бұрын
Wow, thanks for the amazing compliment. I'll try to make some more videos (maybe less lengthy next time) to help with some other common issues. I tend to show up more in my company's channel and haven't created a lot of other content, but I do enjoy sharing what I've learned with others. Glad it's helpful to you.
@barefeg Жыл бұрын
What is your company’s channel?
@YoTengoUnLCD Жыл бұрын
@@zmre Thank you so much for this video, nix is (as popularly mentioned) incredibly unapproachable, but you made it so much easier with this video.
@zmre9 ай бұрын
@@barefeg KZbin.com/@ironcorelabs
@erectlocution Жыл бұрын
Is there a reason to maybe write a Nix derivation rather than use Homebrew?
@zmre Жыл бұрын
You don't really get to snapshot system state and rollback with homebrew so if something breaks on upgrade you're probably going to have to deal with it RIGHT THEN instead of when it's convenient. For me, personally, I also keep my config working across Mac and Linux so it's nice when a tool that is cross platform can come from nix. But for proper mac apps (generally homebrew casks) that aren't cross platform, it probably isn't worth the bother to make a derivation.
@erectlocution Жыл бұрын
@@zmre Oh yeah, good point. If it's not available in the nix package repo due to being macOS-only, there's not much point in doing that. Thanks!
@diegodorado Жыл бұрын
Thanks! that was really helpful!
@DanielSantaCruz Жыл бұрын
@zmre, thanks for putting this together! Was really helpful. Quick question: I understand that you use `nix flake update` to update the nixpkgs commit that the flake uses, right? However, I can't find how to see what packages/programs would be upgraded by running switch on that updated flake. Thanks!
@zmre Жыл бұрын
I would also love to know a better way to do this. For some use cases (not your system flake probably, but a dev shell or a tool) you could actually specify each package in nixpkgs as a separate input. That would give you a lot of control. But for your system, take a look at the nvd command. gitlab.com/khumba/nvd So then you can build your flake using "darwin-switch build" instead of "switch" and then do something like "nvd diff /nix/var/nix/profiles/system ~/.config/nixpkgs/result" with the result path adjusted to where your flake lives. That will tell you about changes before you activate them. You can alternately do "nix store diff-closures /nix/var/nix/profiles/system ./path-to/result" instead of using nvd, though I think nvd is prettier.
@DanielSantaCruz Жыл бұрын
@@zmre nvd did the job nicely. Was specially nice to be able to run in comparing previous system profiles. Thanks!
@kaihendry Жыл бұрын
How do you do the MacOS VM?
@zmre Жыл бұрын
I used parallels. But you don’t get GPU in there so some unexpected things break. Worked well enough for my purposes though.
@4amu_nie Жыл бұрын
Great walkthrough! Thanks for putting it together!
@reiko551 Жыл бұрын
This is the intro I have been looking for a year ago! :)
@andredealbuquerque105 Жыл бұрын
Great job!
@freddyboy84 Жыл бұрын
Great intro to building a nix flake file from scratch
@FarhanSaeedg Жыл бұрын
Amazing video you have made me curious to try out dev environments on nixos
@zmre Жыл бұрын
I should show how I go about that somewhere. Hmmmm….