News for hackers. Stuff that matters.
Re:NixOS – Purely Functional Linux Distribution by gmfawcett on Friday November 02, 2018 @12:31PM (#18364372)
Another approach is not to patch nixpkgs at all, but just to "override" packages in Nixpkgs outside of the repository, and build them from your own project directories.

A simple example: I wanted to build FFMPEG, but with non-free libraries enabled (which is not the default). Rather than edit "ffmpeg-full" in the nixpkgs repo, I just overrode it:

    # default.nix (in some project directory; call "nix build -f ." to run it)
    with nixpkgs;
    {
      my-ffmpeg =
        let overrides = {
        nonfreeLicensing = true;
        fdkaacExtlib = true;
        ffplayProgram = false;
        qtFaststartProgram = false;
      };
      attrs = {
        name="my-ffmpeg-" + ffmpeg.version;
      };
    in
      ffmpeg-full.override overrides // attrs;
    }
Re:NixOS – Purely Functional Linux Distribution by lilyball on Friday November 02, 2018 @08:26PM (#18367865)
I haven't ever tried this myself, but I was under the impression that the `--arg` and `--argstr` arguments to nix-env were supposed to let you change build options. So could you not say `nix-env -iA nixpkgs.ffmpeg-full --arg nonfreeLicensing true --arg fdkaacExtlib true --arg ffplayProgram false --arg qtFaststartProgram false`?
Re:NixOS – Purely Functional Linux Distribution by gmfawcett on Friday November 02, 2018 @08:41PM (#18367935)
You may well be right. In my first attempts, I did try various combinations of `--arg` and `--argstr`, but I never succeeded in getting a proper build. That's why I ended up using the override approach instead. I understand a little bit more (very little!) about Nix now, so perhaps I should give it another try.
Re:NixOS – Purely Functional Linux Distribution by kreetx on Friday November 02, 2018 @04:02PM (#18366242)
You are ahead of me! Thank you for the example :)
Re:NixOS – Purely Functional Linux Distribution by gmfawcett on Friday November 02, 2018 @04:23PM (#18366400)
You're welcome!

One last tip... If you build this way, it will write everything to /nix/store, but it won't install it into your local profile. However, the 'nix-build' process creates a 'result' symlink in your project directory which points at the package you just built. So Calling 'nix-env -i ./result' ought to install it into your profile as well.

Re:NixOS – Purely Functional Linux Distribution by Nullabillity on Friday November 02, 2018 @04:59PM (#18366700)
You can also just call `nix-env -i .` to build and install in one go.
Re:NixOS – Purely Functional Linux Distribution by gmfawcett on Friday November 02, 2018 @08:42PM (#18367942)
Ah! thanks for that.
Re:NixOS – Purely Functional Linux Distribution by Stammon on Friday November 02, 2018 @05:24PM (#18366906)
You can also use an overlay
Re:NixOS – Purely Functional Linux Distribution by gmfawcett on Friday November 02, 2018 @08:43PM (#18367944)
Thanks, I've heard the term 'overlay' but I haven't learned quite that much yet. I'll look into this.