Skip to content

Why not home.file.<name>.text? #11

@nalzok

Description

@nalzok

In Chapter 6, you noted that

Before we start, I want to make something clear: in the long run, you actually
probably won't use this very often. You'll want to prefer using specific
configuration options that will generate config files, or using other
functionality to build shell scripts, etc. However, it's very easy to get
started with this, and it can be useful for sketching out some ideas or just
getting a file somewhere that you want it. Mostly it's a great excuse to show
you some more new syntax.

and

_Again, this is NOT actually the long term solution you want for writing your
own utility scripts. The long term solution you want is probably
[`writeShellApplication`](https://ryantm.github.io/nixpkgs/builders/trivial-builders/#trivial-builder-writeShellApplication)
in nixpkgs, which is available in `pkgs.writeShellApplication`. This requires
some significant extra work and understanding, so bookmark this later and return
to it once you're more comfortable with Nix generally. If you want a taste of
what this might look like, [here's what I do to generate a bunch of helpful
wrapper scripts in my own setup](https://github.com/Evertras/nix-systems/blob/main/home/modules/shell/funcs/default.nix)._

But why? Sure, using modules like https://github.com/nix-community/nixvim is more "elegant" than copying and pasting ~/.config/nvim/init.lua from an existing system, but the latter is at least as expressive as the former, and requires essentially zero effort. Is there any practical advantage besides aesthetics?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions