.i .ui coi rodo
I’ve been diving into nix flakes recently, and had some questions about the best practices of building my things using them.
I’ve been attempting to (a lot of the time to no prevail), package programs as a flake, containing a single package, and an overlay containing that package.
As an example:
{
description = "example flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
overlay = final: prev: {
vim = self.defaultPackage;
};
defaultPackage = pkgs.vim_configurable.customize {
name = "vim";
vimrcConfig.customRC = ''
set colorcolumn=80
'';
};
});
}
(side note, this exact code hasnt been working for me, related to the overlay, but for the purposes of the question hopefully it’ll convey the gist of what Im trying to do)
from what I understand, this allows users to use the new nix shell
to grab this, nix shell github:blah/blah
, and users who are using flakes for their system configuration can use input-name.overlay
to add the override to their package set.
Is this how I should be going about using flakes? I’ve had trouble figuring out the best practices from what Ive read, about what outputs I should have, and whether or not to use flake-utils (if I don’t, I’m not sure how to choose what systems to allow, or whether its too narrow to just use the one I’d be using).
I guess the main things I’m asking are:
- What’s a good skeleton for packaging a program as a flake
- What’s good practice for defining systems
- What outputs are required / good to define / unhelpful, when packaging a program
Any help would be appreciated a lot, thank you