Skip to content

Improve flake usability #3849

@mkenigs

Description

@mkenigs

Copying discussion from #3573. @edolstra is this something that needs to wait until flakes stabilize a bit more, or are there things I could work on starting to change? Can close this if it doesn't make sense at this point.

I've been thinking about usability, and I guess some of this might be more of my thoughts related to nix in general. But if I was trying to to convince someone to use nix, I would want a flake to look something more like this:

{
  description = "optional description";
  inputs.build = [ boost ];
  inputs.test = [ testframework ];
  outputs = { self, inputs }: {
    mkFlake {
      name = "name";
      build =
        ''
          make
        '';
      install =
        ''
          cp name $out/bin/
        '';
      run = "$out/bin/name";
      test =
        ''
          test
        '';
    }
  }
}

I don't know how things like nixpkgs, system, mkDerivation, and other outputs would be handled, so I guess this is more just my thoughts rather than something concrete. But if it was possible, I think something along these lines would be way easier to digest as a newcomer to nix. It's pretty easy to understand what's going on: you say what dependencies you need, nix does it's nix magic, and you get something you can build/run/develop/test anywhere with nix build/run/develop/test (flake check). I think it's hard to realize that's what nix can do when it's hidden behind complexity, but it's actually incredibly appealing once you see it.

Originally posted by @mkenigs in #3573 (comment)

@mkenigs Agree completely but that's out of scope for the first iteration of flakes. In the future we might have a flake.toml containing a high-level description of a package, without any extraneous cruft like mkDerivation, function calls etc.

Originally posted by @edolstra in #3573 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions