-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using nixosSystem? Flake future? #60
Comments
Hi, I'm solving this problem with a small helper function: colmena = {
meta = {
description = "My personal machines";
nixpkgs = pkgs; # This is just a let-binding to `import nixpkgs`, with overlays and so on - not important for this, in general
};
} // builtins.mapAttrs (name: value: {
nixpkgs.system = value.config.nixpkgs.system;
imports = value._module.args.modules;
}) (self.nixosConfigurations); For the extraModules = [ colmena.nixosModules.deploymentOptions ]; Note that you'd typically use the argument |
I've noticed recently, that lib.nixosSystem implements a function that adds That's handy to improve error reporting on "anonymous" modules. |
+1, working with |
Thanks a lot, this should be on the main |
REF: <zhaofengli/colmena#60 (comment)> Signed-off-by: Gaoyang Zhang <gy@blurgy.xyz>
REF: <zhaofengli/colmena#60 (comment)> Signed-off-by: Gaoyang Zhang <gy@blurgy.xyz>
IMO the best solution would be to mimic what This lets you integrate seamlessly with any way users might want to generate NixOS configs. For example, I use a similar |
I've been hesitant of separating the deployment configs from the system configs due to lower composability (e.g., adding |
Hey everyone, I've got a better workaround! Just try this: { config, self, inputs, ... }:
# add colmena compatibility
let
conf = self.nixosConfigurations;
in
{
colmena = {
meta = {
description = "my personal machines";
# This can be overriden by node nixpkgs
nixpkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
nodeNixpkgs = builtins.mapAttrs (name: value: value.pkgs) conf;
nodeSpecialArgs = builtins.mapAttrs (name: value: value._module.specialArgs) conf;
};
} // builtins.mapAttrs (name: value: { imports = value._module.args.modules; }) conf;
} Also tested with flake-parts. Just change Special thanks to @figsoda for reminding me the specialArgs in |
FYI: I just hit an issue caused by setting the |
Hi. It seems mainstream NixOS is heading toward using
nixpkgs.lib.nixosSystem
, and standard ways of defining nixos hosts in a flake.nix: https://nixos.wiki/wiki/Flakes#Using_nix_flakes_with_NixOSAny thoughts on integrating with that world with colmena? I'm keen to keep my configuration as close to "mainstream" as I can, while using remote deploys (some of my hosts are definitely too weak to build themselves).
It seems mainstream NixOS is getting remote deploys too:
nixos-rebuild --flake .#mymachine --target-host mymachine-hostname --build-host localhost switch
The text was updated successfully, but these errors were encountered: