[Nix-dev] [Help] Accidentally removed configuration.nix

Layus layus.on at gmail.com
Mon Apr 10 22:04:29 CEST 2017


On 10/04/17 19:41, Vince wrote:
> Benjamin Herr <ben at 0x539.de> schreef op 10 april 2017 19:17:44 CEST:
>
>     I've been putting
>
>          environment.etc = {
>              nixos-orig.source = ./.;
>          };
>
>     into my configuration.nix and for my still fairly trivial but at least
>     somewhat moduralized config it seems to work out all right.
>
>
>     On Thu, 2017-04-06 at 18:12 +0200, Guillaume Maudoux (Layus) wrote:
>
>         Hi, system.copySystemConfiguration is far from perfect. As
>         soon as you modularize your config, you will miss all the
>         other files. If you want a correct
>         system.copySystemConfiguration, you really need
>         https://github.com/NixOS/nix/pull/709. It allows you to
>         snapshot all the sources of a nix derivation, not just one
>         file. I tested it back then, and it worked pretty well. --
>         Layus. On 06/04/17 17:46, nixos at vince.lol wrote:
>
>             No I don't have `system.copySystemConfiguration=true` set
>             :-( Luckily I documented my recent efforts in some gists.
>             I managed to install NixOS on ZFS here:
>             https://gist.github.com/awesomefireduck/c763e168a62a0ef559a1fb94732
>             61459 And my (yet untested) attempt at PCI passthrough
>             here:
>             https://gist.github.com/awesomefireduck/1be07805081a4d7a51c527e452b
>             87b26 There is still some missing, but nothing I can't
>             handle, I guess. This is a great time to enable my ZFS
>             snapshots... :-/ Does anyone know why
>             `system.copySystemConfiguration` is set to false by
>             default? It seems like it would be better to default this
>             to true, right? Or at least have this listed in the
>             generated config? (`nixos-generate-config`) Anyway, I'll
>             be okay, thanks folks!! Sincerely, Vince On Thursday,
>             April 6, 2017 4:58 PM, Sergiu Ivanov <sivanov at colimite.fr>
>             wrote:
>
>                 Hi Vince, Thus quoth  nixos at vince.lol  at 14:12 on
>                 Thu, Apr 06 2017:
>
>                     I acidentally removed my
>                     /etc/nixos/configuration.nix is there any way I
>                     can get it back? 
>
>                 Citing directly from:
>                 http://stackoverflow.com/questions/28603773/recover-accidentally
>                 -deleted-configuration-nix-file  '''
>                  system.copySystemConfiguration  If enabled, copies
>                 the NixOS configuration file $NIXOS_CONFIG (usually
>                  /etc/nixos/configuration.nix) to the system store
>                 path.  Type:"boolean"  Default:false  Declared
>                 by:  <nixpkgs/nixos/modules/system/activation/top-
>                 level.nix>  ''' Do you happen to have this option set
>                 to true? /me goes and sets it to true on his system --
>                 Sergiu 
>
>             ------------------------------------------------------------------------
>             nix-dev mailing list nix-dev at lists.science.uu.nl
>             http://lists.science.uu.nl/mailman/listinfo/nix-dev 
>
>         ------------------------------------------------------------------------
>         nix-dev mailing list nix-dev at lists.science.uu.nl
>         http://lists.science.uu.nl/mailman/listinfo/nix-dev 
>
> What does that do, exactly? The entry at 
> http://nixos.org/nixos/options.html#environment.etc.%3Cname?%3E.source 
> is somewhat lacking... I made a PR at 
> https://github.com/NixOS/nixpkgs/pull/24707 . If some of you could 
> check it out and give me some feedback that’d be great :-) cheers, Vince 

It defines ./. as the content to be copied into /etc/nixos-orig. This 
means that everything in the same directory as the file where this is 
defined will be copied to the store and made available in 
/etc/nixos-orig. Be careful not to secret files and private keys 
potentially located there, as nixos-rebuild often runs as root and will 
happily copy them to the store.

-- Layus.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170410/f618ea5c/attachment.html>


More information about the nix-dev mailing list