Flake-utils-plus v1.0.0

I built this cute little project to simplify NixOS systems configuration using Nix flakes. It would be great if you guys were to check it out :slight_smile:

TL;DR:

  1. Simplifies flakes consumption by creating a concept of shared resources
  2. Simplifies exposing packages/apps/etc by automagically providing <system> argument
  3. Extends flake-utils.lib
  4. Inspired by flake-utils.lib.simpleFlake
  5. Adds a few little extra features like the ability to apply patches to nixpkgs
3 Likes

Looks very nice!
I have a flake based config where I just import old configuration.nix, and looking towards properly refactoring it to fully use flakes only.

Devos, even when it was nixflk way back is too big and too intimidating.

I like your setup and example configs. I’ll give it a shot probably over weekend.

2 Likes

I tried it out last night and had couple of hickups.

  1. It doesn’t allow me to configure Nix options on my own like GC and auto optimize interval, because apparently that’s already declared within the lib.
  2. nixos-rebuild dry-build failed with error something like “do not know how to build this (probably because store is read only)”. This occurred even with sudo.

I’ll prepare proper logs tonight, but pretty sure I’m doing something wrong here.

I am not sure what the issue could be since i am using more or less the same options myself.

If you are implementing saneFlakeDefaults module (which is optional) - I can see nix.package conflicting with whatever you have in your config - the rest of the arguments should get merged together

Note: nix.nixPath will get removed in upcoming release

Also currently only NixOS is supported/tested - if you are using something else, that might be the issue. (Darwin support is comming soon!)

Thanks for the reply, I removed package and extraOptions and it doesn’t complain about nix anymore. But, this issue is still there:

~/git/flake on  master [✘!+?] 
❯ sudo nixos-rebuild dry-build --flake '.#hostName'
[sudo] password for user: 
warning: Git tree '/home/user/git/flake' is dirty
building the system configuration...
warning: Git tree '/home/user/git/flake' is dirty
don't know how to build these paths (may be caused by read-only store access):
  /nix/store/6kqlwvq3gkgq4fq8r6lbmx3wzqrbrzg7-nixos-system-hostName-21.05.20210319.f5e8bdd.drv

Also, I have couple of extra, um, extraOptions configured to keep derivations for nix-direnv. Will I be able to override/merge your options with mine?

1 Like

Oh, I got it, you must have overwritten sharedExtraArgs, you are expected to supply it with inputs anyways. https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/2f7abc9a83e8cda20cf7c5a9ca3d5226f24782a2/systemFlake.nix#L5

You can overwrite it by passing inputs in addition to whatever you are passing yourself or using nixosProfiles.<name>.extraArgs

On the next release (which is planned this weekend) ill enforce passing inputs to the system configuration to make it less error-prone.

1 Like

I’m… not sure what you mean. It is not complaining about my config anymore, but that it cannot build the final store path. I checked and this [path does not already exist. Same log as above. Although I’ve been using Nix for a while now, I’m still more or less a noob, so apologies if I missed something obvious.

I also switched to staging branch of flake-utils-plus, to ensure I’m passing inputs correctly.