#firefox on completely newly installed #nixos using default #configuratoin .nix file file on (Acer) laptop does not crash initially; after doing #upgrade
sudo nixos-rebuild switch --upgrade
however #firefox crashes i.e. shuts down completely with error message #mozilla #crash reporter #mozillacrashreporter for example when clicking photos in posts in this fosstodon instance or trying to perform online payments. Is there an error in the current #nixosrepo ? I have the same problem on my #T480
When I roll back #nixos to an earlier build I not only do not have a #firefox #crash problem but also problems with #authy and #bitwarden apps seem to go away. Problem is I do not want to roll back my configuration.nix - that would lose software installs, right?? #newbie question: is the #nixosconfiguration in configuration.nix preserved (latest version kept) when on rolls back ? Or do I reinstall #nixos from image (boot from usb image) and use the latest backup of my configuration.nix file?
NixOS rollback questions

Ok thanks. So let me make sure I have this clear. System configurations don’t keep a snapshot of the configuration.nix file that created them....

reddit

@adingbatponder

Hey, sorry if nobody else replied to you. This is a legitimate question a lot of new people have about the way configuration.nix/nixos-rebuild works (and I've been bitten by this behaviour more than once).

Essentially, the contents of /etc/nixos are user-managed and not stored anywhere in the nix store as part of a generation (by default). The user is expected to back them up or version control them themselves. This means rolling back doesn't restore them to their previous state as when they were built.

This can be good, because it won't erase your work whenever you switch configurations, but also frustrating if you forgot to backup and have to find the last-good config.

I'd suggest setting the following line in your config:
```nix
environment.etc = { nixos-built-with: { source: ./.; }; };
```
This will create a folder in /etc named nixos-built-with that will be filled with the contents of /etc/nixos at the time that the current generation was built.

Hope this helps in the future.

@twoolie Hi. I tried this and variations but get only syntax errors. Any hints ?

@adingbatponder

Serves me right for writing code on my phone. I think it's because I used hyphens in the attribute name without quotes. Let's spin the wheel again and suggest this correction also written on my phone.

```nix
environment.etc = { "nixos-built-with" = { source = ./.; }; };
```

@twoolie Hi. Very kind of you to iterate this but I still cannot just paste that without error messages. To be honest I am not clear what the ```means nor how nix can be just there without a . dot after but that does not work either. This links does not help parse it either. https://unix.stackexchange.com/questions/500025/how-to-add-a-file-to-etc-in-nixos
any help gratefully received....
How to add a file to /etc in NixOS?

What is the NixOS-way to put a configuration file in /etc? E.g. I want to drop /etc/nanorc. I found some forum entries talking about programming it into /etc/nixos/configuration.nix, but could not...

Unix & Linux Stack Exchange

@adingbatponder

Oh, the ``` is a markdown code fence, and the nix right after it just specifies that the code block should be highlighted as nix language (see: https://markdown.land/markdown-code-block).
Seems the mastodon client you're using doesn't render markdown?

It occured to me there's a simpler way to write the snippet anyway, so I'll include that here:

environment.etc."nixos-built-with".source = ./.;

Both versions should work identically.

Markdown Code Block: Including Code In .md Files - Markdown Land

Learn three ways to insert a Markdown code block in your document, including a method that supports syntax highlighting.

Markdown Land
@twoolie Woah ! Works ! Lovely. Such things are so helpful to get a hang of nixOS. To see an example of how the settings work. Thanks again.