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

Location of configuration #296

Open
dmvianna opened this issue Feb 16, 2024 · 4 comments
Open

Location of configuration #296

dmvianna opened this issue Feb 16, 2024 · 4 comments

Comments

@dmvianna
Copy link

I have deployed a VM to GCP. It works fine.

Now I want to change its configuration without redeploying. I just want to use sudo nixos-rebuild switch. But /etc/nixos/configuration.nix just has

{ ... }:
{
  imports = [
    <nixpkgs/nixos/modules/virtualisation/google-compute-image.nix>
  ];
}

Where can I find a copy of the configuration I used within the VM? Is it anywhere there? Can I just place a new configuration anywhere and do the switch?

@liamdiprose
Copy link

liamdiprose commented Mar 7, 2024

The file is being imported from the nixpkgs repository. This is directory where the google-compute-image.nix file lives:
https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/virtualisation

You can leave the import statement there, and add (or overwrite) the options you want to change.

@dmvianna
Copy link
Author

dmvianna commented Mar 8, 2024

So that means there's no declarative configuration within the VM? And what I add to /etc/nixos/configuration.nix will be added to the current configuration, rather than clobbering it?

@phonkd
Copy link

phonkd commented Sep 4, 2024

I have the same question.

@Mic92
Copy link
Member

Mic92 commented Sep 4, 2024

You have to either manually update /etc/nixos/configuration.nix to be in sync with what you have used creating the image, or you just ignore this file completely and use sudo nixos-rebuild switch --flake .#myvm --target-host root@ip on your local machine update your VM.

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

No branches or pull requests

4 participants