Skip to content
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

How to use --flake #110

Closed
Mic92 opened this issue Jul 21, 2021 · 4 comments · Fixed by #138
Closed

How to use --flake #110

Mic92 opened this issue Jul 21, 2021 · 4 comments · Fixed by #138

Comments

@Mic92
Copy link
Member

Mic92 commented Jul 21, 2021

it seems that nixosConfigurations.<machine> is not overridable, hence the question is how to use --flake.

@Sorixelle
Copy link

Looks like it depends on NixOS/nixpkgs#101475. A workaround for now would be doing something like:

{
  nixosConfigurations = let
    lib = nixpkgs.lib;
  in {
    machineName = (lib.makeOverridable lib.nixosSystem) {
      # ...
    };
  };
}

@legendofmiracles
Copy link

legendofmiracles commented Sep 16, 2021

How do you even get so far? Whenever I try to use the --flake option it tells me that the option is not found:

> nixos-generate --system aarch-64 --flake ./dotnix#nixosConfigurations.pi
error: 'flake' is not a recognised command
Try 'nix --help' for more information.

Weirdly enough the error itself seems to be coming from nix. Not nixos-generate...

@Sorixelle
Copy link

You need to make sure nixos-generate is using a flake-enabled Nix (ie. nixos-generate.override { nix = nixUnstable; }).

foo-dogsquared added a commit to foo-dogsquared/nixos-config that referenced this issue Feb 4, 2022
The NixOS system is now made overridable as a workaround for
nixos-generators.

See nix-community/nixos-generators#110
for more details.
@Pacman99
Copy link
Contributor

Can the --flake feature be implemented with NixOS/nixpkgs#143207 instead? It seems like that could be a better solution and not require users to set mkOverridable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants