Nix derivations explained | Unleash the full potential of NixOS

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 57

  • @yash1152
    @yash1152 3 หลายเดือนก่อน +6

    0:39 - 1:23 holly molly, just like that he covered ALLL THE THREE/FOUR syntax in a smooth seamless story manner. thanks a lotttt for this.
    1. minimal/direct nix expression
    2. nix function expression
    3. importing [2.] in flake
    4. embedding this inside a standalone flake

  • @unknown-otter
    @unknown-otter ปีที่แล้ว +28

    Another comment just for the yt algorithm! Thank you for your work!

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว +3

      Thanks!

    • @unknown-otter
      @unknown-otter ปีที่แล้ว +3

      Pardon me, I'm just curious, are you from CIS countries? Your accent sounds familiar to me (well, I'm from Russia)

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว +7

      @@unknown-otter I'm from Ukraine

  • @Gaivs
    @Gaivs ปีที่แล้ว +10

    I'm so glad I found this channel, great explanations for something I know I've wanted to learn for a long time!

    • @_modiX
      @_modiX ปีที่แล้ว

      I'm so happy for that as well. The documentation is vast, but shallow, with many sources to learn from. It's nice to have someone condense all the necessary information to get learn how to do specific things with very easy examples.

  • @lamprospitsillou6325
    @lamprospitsillou6325 ปีที่แล้ว +4

    I am running Nixos-install as we speak, keep up the amazing work , thank you!

  • @ardwetha
    @ardwetha หลายเดือนก่อน +1

    This is just amazing. It makes building simpler.

  • @BartekBroniszewski
    @BartekBroniszewski ปีที่แล้ว +4

    Awesome as always! It is like Nix inception, you wrap your binary in a wrapper of a wrapper...yes and then we have cowsay. I totally got it.

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว +1

      Haha, yes.

  • @hotdog2c
    @hotdog2c ปีที่แล้ว +7

    Awesome explanation! loving the nix videos!

  • @wojciech-kulik
    @wojciech-kulik 2 หลายเดือนก่อน +1

    I think you provide the most valuable and smooth content about Nix! Your videos helped me a lot!

  • @AppsTricksByNazakatUmrani
    @AppsTricksByNazakatUmrani 5 หลายเดือนก่อน +2

    ManI love what you are doing for the community, no one can thank you enough for your work, I don't know what to say

  • @dillon4248
    @dillon4248 ปีที่แล้ว +6

    Awesome! Still working on getting use to nix to switch to it as my daily driver. Really interested in seeing more on how to build projects and push to the nix package manager for my own projects and projects I find that are not in the nix package manager yet

  • @yash1152
    @yash1152 3 หลายเดือนก่อน

    2:47 > _"to be explicit, we could also like $src/hw"_
    3:10 > _"if u dont specify a build phase, nix will attempt to use a Makefile from src dir"_
    4:26 > _"we can define our own list [phases] containing phase names, for easy learning derovations"_
    ohw, niice. yeah, it makes much more sense in explicit manner while getting started.

    • @yash1152
      @yash1152 3 หลายเดือนก่อน

      3:10 _"if u dont specify a build phase, nix will attempt to use a Makefile from src dir"_
      awesommme. super helpful for those of us beginners who like to use makefiles for easy understanding/overview & also compatibility with IDEs & editors etc.

  • @infernocop31
    @infernocop31 ปีที่แล้ว +3

    You are incredible. Keep it up

  • @mr.tm-yt
    @mr.tm-yt ปีที่แล้ว +5

    Great video as always

  • @DooMWhite
    @DooMWhite 4 หลายเดือนก่อน +1

    Amazing content, just what I wanted to understand.

    • @DooMWhite
      @DooMWhite 4 หลายเดือนก่อน

      Just a thing, I tried using cp $src/hello-world, but that didn't work, cuz cp needed "" in the source part, how do I fix that? I tried using "$src/hello-world" and "${src}/hello-world", but that wouldn't work.

  • @MiaLovesRod
    @MiaLovesRod ปีที่แล้ว +2

    LETS GOOO

  • @fulsomenko
    @fulsomenko ปีที่แล้ว +1

    great stuff

  • @johannesCmayer
    @johannesCmayer 7 หลายเดือนก่อน +1

    You forgot to add this to the nix playlist iirc.

    • @vimjoyer
      @vimjoyer  7 หลายเดือนก่อน +1

      Done, thanks

  • @MrPielover19
    @MrPielover19 ปีที่แล้ว +1

    hype

  • @evgen4681
    @evgen4681 ปีที่แล้ว +1

    Спасибо за такие классные видео! Можешь, пожалуйста, рассказать про создание единого окружения разработки (как я понял, для этого используют nix develop или nix shell). Мой самый главный вопрос в том, что там по умолчанию используется bash, но я хотел бы использовать свой конфиг zsh (это уже не nix way?).

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว +2

      Да, я планирую сделать видео про Nix shell & Nix develop, а запускать их с zsh совсем несложно. Там можно указать shell-hook, который запустит нужную программу, включая любые оболочки.
      Так как по умолчанию все переменные из окружения пользователя сохряняются при входе в nix shell, .zshrc тоже будет там работать.

    • @dillon4248
      @dillon4248 ปีที่แล้ว +1

      Also interested in nix develop for my projects (:

  • @yash1152
    @yash1152 3 หลายเดือนก่อน

    0:49 hi! what does those curly braces {} between import and semicolon ; convey?
    i had to put "pkgs" at this place while importing my nix-file containing packages array. i.e.
    "let mp = import ./my-pkgs.nix pkgs; in ..."
    but i dont understand what part of syntax this is. or say, what the "pkgs" or curly braces is doing here.

  • @yash1152
    @yash1152 2 หลายเดือนก่อน

    3:37 hi again. when to use the devShells.${system}.default vs packages.${system}.default?
    i mean, the devShell _has_ to be defined
    * for tools like debugger, linter, lang-servers, etc...
    * regardless of whether the package is built with manual make runs, or via nix build.
    so, what's the benefit of defining the "package" when doing iterative rapid development for learning the programming concepts (i.e. not in a hardcore project)?
    i have no problem defining even both, but i want to properly know the rationale behind.
    this may sound dumb, but i kinda can't see clearly.

  • @sailendragautam3736
    @sailendragautam3736 2 หลายเดือนก่อน

    Is there a way to use sudo inside the nix-shell -pure ? Even after having the package sudo would throw some errors

  • @yash1152
    @yash1152 3 หลายเดือนก่อน

    1:44 _"there are also buncha optional keys"_
    1:58 it would be awesome if u showed the documentation before showing the demonstration.
    the experience with documentation for nix-pkgs (super frustrating) is exact opposite of xp with nixos-config (very good and smooth).
    so, showing the documentation/reference and _how_ to follow or _to which part_ of documentation's structure to pay attention to, would help new users a lotttt.

    • @yash1152
      @yash1152 3 หลายเดือนก่อน

      before or alongside showing the demonstration

  • @yash1152
    @yash1152 3 หลายเดือนก่อน

    4:09 > _"we could put it in buildInputs, but better is nativeBuildInputs; to make it available in phases, not in runtime"_
    umh, whatt? isnt the cowsay used in the program itself? so i'd think it would be required at runtime too no?
    i think it is smth like dynamic linking to a system path executable. but can u please expand on it?

    • @yash1152
      @yash1152 2 หลายเดือนก่อน

      3:56 ...

  • @DooMWhite
    @DooMWhite 4 หลายเดือนก่อน +1

    I tried splitting the default.nix to 3 files, one for each case, but for some reason, I get an error that those files don't exist, only default.nix works, do you know why?

    • @vimjoyer
      @vimjoyer  4 หลายเดือนก่อน +1

      If you are using git, make sure to git add them. Flakes don't see unstaged files.

    • @DooMWhite
      @DooMWhite 4 หลายเดือนก่อน

      @@vimjoyer That was the issue, ty!

  • @SantiagoFraire
    @SantiagoFraire ปีที่แล้ว +1

    How does nix know which commands to run from the Makefile?

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว

      you can find all the logic here: github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/make-derivation.nix.

  • @MARKHENSTROM
    @MARKHENSTROM ปีที่แล้ว +1

    Is there an algorithm that will make the end-user not spend copious amounts of time clicking cat-related videos on TH-cam - thereby ruining my productivity?

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว +1

      If you find one, tell me).

  • @sachinchaudhary1310
    @sachinchaudhary1310 9 หลายเดือนก่อน +2

    b;eh comment just for the algorithm baba bleh

  • @sharperguy
    @sharperguy 7 หลายเดือนก่อน

    Why do you import default.nix rather than using callPackage?

    • @vimjoyer
      @vimjoyer  7 หลายเดือนก่อน

      Yeah, callPackage is preferred.

  • @zperk13
    @zperk13 6 หลายเดือนก่อน

    How does it know what g++ is? Why did you not have to define it in the buildInputs or i guess the nativeBuildInputs

    • @matthias2447
      @matthias2447 3 หลายเดือนก่อน +1

      mkDerivation wraps around the derivation function and provides common utilities such as g++. The build is executed in a sandboxed environment, where g++ is enclosed via mkDerivation.

    • @alexanderleschanz9991
      @alexanderleschanz9991 หลายเดือนก่อน

      my question too @Vimjoyer

  • @rotteegher39
    @rotteegher39 ปีที่แล้ว +2

    What about you rename your channel to nixjoyer instead of vimjoyer ? xD

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว

      I'd have to change avatar too

    • @rotteegher39
      @rotteegher39 ปีที่แล้ว +1

      why not then @@vimjoyer

    • @vimjoyer
      @vimjoyer  ปีที่แล้ว +1

      @@rotteegher39 I don't care about the name much, but some people like this one, and I wont just be making nix videos here.

    • @rotteegher39
      @rotteegher39 ปีที่แล้ว +1

      respect +++ @@vimjoyer

  • @_modiX
    @_modiX ปีที่แล้ว +2

    I've seen some packages coming with a flake.nix in their repository. Could you please show in a video how to have a project with a flake.nix instead and how it is properly consumed on my own flake.nix? You are a good teacher btw. :)