• 0 Posts
  • 22 Comments
Joined 2 years ago
cake
Cake day: July 14th, 2023

help-circle

    • tab completion works in more places than you might expect
    • ctrl-a/ctrl-e for start/end of line
    • ctrl-u to clear the command you’ve typed so far but store it into a temporary pastebuffer
    • ctrl-y to paste the ctrl-u’d command
    • ctrl-w to delete by word (I prefer binding to alt-backspace though)
    • ctrl-r to search your command history
    • alt-b/alt-f to move cursor back/forwards by word
    • !! is shorthand for the previous run command; handy for sudo !!
    • !$ is the last argument of the previous command; useful more often than you’d think
    • which foo tells you where the foo program is located
    • ls -la
    • cd without any args takes you to your home dir
    • cd - takes you to your previous dir
    • ~ is a shorthand for your home dir

  • kibiz0r@midwest.socialtolinuxmemes@lemmy.worldSnap bad
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    6 days ago

    Well, Nix is a programming language, so there’s no getting around having to learn basic principles of coding.

    That said, I feel like coming into Nix with a lot of programming experience actually worked against me at first, because I made a lot of assumptions that weren’t true and basically had to “unlearn” certain things.

    The main things being:

    • Lazy evaluation is trippy as hell sometimes
    • The language truly does not allow for side-effects. Everything you might think is a side-effect is really executed from outside the language runtime itself
    • It might be more accurate to think of Nix as a database, where the keys are the parameters of what to build and the values are directories full of the built artifacts

    What really made it click for me was seeing how a derivation object is basically equivalent to a path. So if I do ${pkgs.foo}/bar”, that’s the exact absolute path (plus /bar) where Nix will end up storing the output of the pkgs.foo derivation. Even without actually building the derivation, you can know where it will end up.

    Anyway, the documentation is pretty shitty, so you basically have to scour every community resource you can find and read way more of it than it seems like you should have to. Discord/Matrix servers help a lot too. And learning to navigate the source code for nixpkgs.

    Also: Don’t start with NixOS, imo. Start with dumb throwaway stuff where you make a derivation that downloads a file and unzips it and runs a single command. Once you understand that, do something that requires understanding a bit of nixpkgs, like using overlays. Then you can use NixOS. Otherwise, there’s too much going on all at once.

    Edit:

    • Nix pills is good
    • Vimjoyer is amazing