Open srid opened 2 years ago
In your example, you could still import at the perSystem
level, but for consistency, reusable ones should be written for the "top level", as that is the more powerful one. Mixing the two will create confusion errors and a mkSimpleFlake
that doesn't support those imports would make the solution unnecessarily hard. This would include adding templates
, or a nixosConfigurations.example
.
A default value for systems
might be a good idea. I hope that the need for this option will go away with a flake format redesign.
It gets you halfway there without adding to the learning curve.
outputs = { self, nixpkgs, flake-parts, ... }: flake-parts.lib.mkFlake { inherit self; } { perSystem = { self', inputs', pkgs, system, ... }: ..
A default value for
systems
might be a good idea [..] It gets you halfway there without adding to the learning curve.
Agreed, I think that's a good idea. 👍🏿
Interesting project btw. It would be interesting to turn the template into a reusable module. That way you could achieve a new level of user-friendliness, if you capture the most common haskellPackages configuration and "tricks" in options.
And unlike with a template, existing users will benefit from improvements.
Interesting project btw. It would be interesting to turn the template into a reusable module. That way you could achieve a new level of user-friendliness, if you capture the most common haskellPackages configuration and "tricks" in options.
Done! https://github.com/srid/haskell-flake
Perhaps worth creating a page listing all the flake-parts
modules in existence. A module registry of some sorts.
Made a start with that in start/index.html
earlier. Don't ask me why I wrote that in raw html :joy:; #31
It'd make sense for nixpkgs.flakeModule
(TBD) to set a mkDefault
for systems
, as well as provide nixpkgs.*
options for initializing pkgs
differently, similar to how NixOS does it, but without the legacy options.
This can be resolved by Nix not requiring the enumeration of supported systems
Alternatively, or in addition, a nixpkgs
flake module could set a default value. nixpkgs
does not have a flakeModule
yet.
In https://github.com/srid/haskell-template I'm using
flake-parts
in place offlake-utils
. The minimal code I came up with in order to replace the latter'seachDefaultSystem
is as follows:https://github.com/srid/haskell-template/blob/3fc6858830ecee3d2fe1dfe9a8bfa2047cf561ac/flake.nix#L14-L19
Since I imagine most non-monorepos using
flake-parts
to repeat the above verbatim, would it be worthwhile to expose a function that obviates bothsystems
andperSystem
? i.e.ie.,
mkSimpleFlake
is likemkFlake
but uses all systems built by Hydra, as well as assumes the user specifies a single-module flake.