Move your NixOS into a Flake!

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024
  • Schema:
    nixos.wiki/wik...
    Starter nixos configurations:
    github.com/Mis...

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

  • @Xorume.
    @Xorume. ปีที่แล้ว +44

    Here's an interesting detail:
    The flake name ("myNixos" in the video) can be omitted if it matches the hostname.
    So if you're deploying to a machine named "nixos", naming the flake "nixos" allows you to simply run:
    sudo nixos-rebuild switch --flake ~/mysystem

  • @smutnywalen
    @smutnywalen ปีที่แล้ว +46

    You popped out from nowhere, your videos are concise and your channel has a based name. Thanks for the content and keep going!

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

      Based? Based on what?

  • @alexxitoprivacy5189
    @alexxitoprivacy5189 11 หลายเดือนก่อน +3

    this channel is underrated as hell, you really deserve a lot more. Your vids are just perfect, they're short, concise, simple and really easy to understand. I love all of this. I was trying to use a dude's flake to copy his hyprland configuration but i couldn't understand wtf was going on, now i took a look at your vids and I'm already on a good spot. Love your vids so much, keep it on

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

    Hey! Thanks for continuing the series!
    Do you have your dotfiles published anywhere by chance?

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

      No, not yet. I've had them public before with a link on reddit, but it was a mess. Maybe I'll clean them up a little, and review later.

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

      @@vimjoyer looking forward to that! That would be a nice conclusion to the series. Suggesting on how to organize everything with different modules and for different hosts

  • @JIWallin3
    @JIWallin3 5 หลายเดือนก่อน +3

    I found your account a week ago. Now every system I work in is nix based and I'm using vim. WTF did you do to me? You are exactly the hero we need right now to help save us from those who shall not be named.

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

      Welcome to -the cult- nixos!

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

    Hey, lots of thanks for these tutorials, they help a lot and due to the mere existance of them I'm installing nix

    • @true.ja3son
      @true.ja3son หลายเดือนก่อน

      This is my reason too.

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

    I know I just commented on another video about getting unfree stuff working. This video actually solved that! Thanks!
    Question: What benefits do you gain by moving the entire configuration.nix to a flake?

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

      You get version locking with flake.lock, and nice dependency management with flake inputs. Also access to new nix commands

  • @patomackcodes4093
    @patomackcodes4093 19 วันที่ผ่านมา +1

    After moving the configuration to your home directory, do you go back and delete the original config in /etc/nixos?

    • @vimjoyer
      @vimjoyer  18 วันที่ผ่านมา

      Sure

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

    Thank you for this I wanted this after the last video

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

    Where do you recommend storing your Nixos configuration as a flake? It’s my understanding that once it’s a flake you can technically put it anywhere (ie, somewhere where your used as write permissions for convenience) however, it seems like this isn’t super helpful when it comes to setting up new systems where you needs to run your configuration in order to get your user account

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

      I have it in my home directory. You can set the flake path when rebuilding, so there's no issue on any new systems.
      And I usually install regular NixOS config as a first generation just to be sure that everything works.

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

      @@vimjoyer ah gotcha. So you’re using whatever the default is that nixos ships with to get things running- specifically a user account. And then running your actual nixos config flake from your home directory to make further tweaks, add permissions to that user, and whatever else.

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

      @@vimjoyer echoing everyone else, super grateful for the time you’ve put into this tutorials! You rock!

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

      @@aleclowry7654 Yes, my setup is not completely declarative. If you really want, you can build your own NixOS ISO with your config. It's just not really worth it for most.
      Thanks for kind words!

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

    Can I use this to pin a specific application to a version, while being able to keep updating others? Something like Wine for example

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

      Sure, just include another git revision in inputs, and then pass it to outputs.
      soemthing like:
      myWineNixpks.url = "github:nixos/nixpkgs/42245guehd5253..."
      Pass it to outputs, and then to your configuration.nix.
      I'll probably do a more in-depth tutorial on this in the future.

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

      @@vimjoyer Alright, thank you!

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

    Thank you for the video! Do you also plan on doing one about home-manager?

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

      Of course!

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

    Where i can look your color theme, it's so beautiful...I want the same thing, It's not just a gruvbox, is it?

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

      It is

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

    How did you apply dark theme to the nixos wiki page?

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

      I installed the night eye plugin to firefox. How could I miss that one?

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

    What are the reasons to do this? What are you gaining from moving it to a flake?

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

      th-cam.com/video/S3VBi6kHw5c/w-d-xo.html

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

    For some reason this video is missing from the NixOS playlist. Had me really confused since yesterday.

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

      Forgot to add it, thanks!

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

    Short and sweet how you like them ! 🍪

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

    two problems i ran into, maybe this helps somebody:
    - If you are using a flake.nix from git-repo you should beforehand use "nix flake init", otherwise it will only opens the man page of nixos if you try to build your flake
    - If your flake.nix is in a git-repo, stage your files first ("git add ."), otherwise it won't build either

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

      Yep, I mentioned the git repo thing in the "flakes explained" video. As for the first problem, I'm not sure, never had it.

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

      @@vimjoyer Oh, then i overheard that. Maybe some others are deaf like me :)
      And thank you for your superb nixOS videos. I'm just at the beginning of my nixOS journey but your videos are tremendously helpful!

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

    do you have plans to share dottfiles or similar

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

      Yes, later

  • @EricHanson-j5e
    @EricHanson-j5e ปีที่แล้ว +1

    Thank You!

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

    So there is no reason to move the configuration into flake now as you just imported it into a flake. Maybe when flakes will be the default standard in 20 years more or less.

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

      Well, that's the point. To move the configuration into a flake you just import it. You don't even have to change anything, but still get all the benefits.

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

      @@vimjoyer Yeah but I don't see any benefits, in main configuration you already specify the channel. I love you video don't get me wrong I just want to know the benefits for now :) Thank you very much

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

      @@BartekBroniszewski By default, you don't specify the channel in main configuration. If you mean the system.stateversion, it is not your channel, but the version of your system when you originally installed it, and it should not be changed. You could manually import needed channel without flakes, but it would be quie a lot of unnecessary work. Thanks for your comments anyway!

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

    Hi, there will be more videos on Nixos?

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

      Sure will, I was just quite busy this week. Thanks for asking!

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

    Are you switching over to nix?

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

      I've been using it on all machines for 6 months now

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

    биг сэнкс фром май харт 😄
    after `nixos-rebuild switch --flake .` it started downloading all 5Gb of system packages from scratch. It should be like this or I screwed up something?

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

      Yeah, that is fine, flake probably has a different nixpkgs version. Ю ар Велком.

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

      @@vimjoyer exactly! nixos-unstable vs nixos-23.05 in default configuration

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

    Great video! Please build a community discord, would be lovely. I want to switch to Nix flakes but I keep getting lost, would be nice being able to chat with people about it

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

      We have a discord, check last video's description

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

    In the file at 1:01, shouldn't `nixpkgs.lib.nixosSystem` be `pkgs.lib.nixosSystem`? Otherwise, the variable `pkgs` which is defined in the `let` block is never used.

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

      It is supposed to be `nixpkgs.lib.nixosSystem`, but you are right, pkgs is redundant in this case

  • @natural-selection-69
    @natural-selection-69 ปีที่แล้ว +1

    Great video!