I have been using git crypt to encrypt my wifi passwords in a separate file. I recently switch to using flakes for my NixOS config. This worked well and the nix build process got the decrypted file from my local working tree. But since recently the file that the nix build process sees is encrypted so it is probably taken from the git repository (local) instead of the git worktree (where I have it decrypted with git crypt unlock
).
It looks like it depends on the version of nix that is used to build my configuration, not the nxipkgs revision that is used as input for my flake. I did this in zsh to “bisect” and find a last known good nixpkgs version that can build my configuration and a first known bad one:
for sys in /nix/var/nix/profiles/system-*-link/bin/switch-to-configuration(On); do
echo $sys
sudo $sys switch &>/dev/null
nixos-version
nixos-rebuild build && break
echo; echo
done
The out put is rather short:
/nix/var/nix/profiles/system-365-link/bin/switch-to-configuration
[sudo] password for luc:
21.11.20210923.51bcdc4 (Porcupine)
building the system configuration...
error: syntax error, unexpected end of file
at /nix/store/hggl6jg1xg2b62301n659rbg2d0q5y3y-source/modules/wifi.nix:1:1:
1| GITCRYPT�
cv�v湇�����ß%��Fݳk47�6��[�v^-��Z����f���Vqʏ�|�e0�S=�n�����>�o,�z��ЁԳ9\���F7��=�Y����$�+�>K�G�,���^��!�/>�h-���7�9B�
�F-jt}!4bp�z�}_u�H�9�d��i�o��1��"���Q�jC�[�
| ^
2| IV�����a�H��՟�S���aʋ�
�ߡ���\!6��������B��+Ep�K�����[`�le z��x�@�6��ߵ�@QK*~��Dt�,�%�/��u��ιha7u��Q�Q�ƪ����/Q_�.�����^������������g�����z-H`��{B�\��K��F��!�A��l[��!-Kg㰲8�yF��$�QI�
(use '--show-trace' to show detailed location information)
/nix/var/nix/profiles/system-364-link/bin/switch-to-configuration
21.11.20210923.51bcdc4 (Porcupine)
building the system configuration...
error: syntax error, unexpected end of file
at /nix/store/hggl6jg1xg2b62301n659rbg2d0q5y3y-source/modules/wifi.nix:1:1:
1| GITCRYPT�
cv�v湇�����ß%��Fݳk47�6��[�v^-��Z����f���Vqʏ�|�e0�S=�n�����>�o,�z��ЁԳ9\���F7��=�Y����$�+�>K�G�,���^��!�/>�h-���7�9B�
�F-jt}!4bp�z�}_u�H�9�d��i�o��1��"���Q�jC�[�
| ^
2| IV�����a�H��՟�S���aʋ�
�ߡ���\!6��������B��+Ep�K�����[`�le z��x�@�6��ߵ�@QK*~��Dt�,�%�/��u��ιha7u��Q�Q�ƪ����/Q_�.�����^������������g�����z-H`��{B�\��K��F��!�A��l[��!-Kg㰲8�yF��$�QI�
(use '--show-trace' to show detailed location information)
/nix/var/nix/profiles/system-363-link/bin/switch-to-configuration
21.11.20210910.bbbe2b3 (Porcupine)
building the system configuration...
and tells me that nix-unstable from nixpkgs bbbe2b3 is able to build my configuration but nix-unstable from 51bcdc4 is not.
Now I have some questions:
- Why can I no longer build my configuration from the working tree?
- How can I bisect this further in order to answer 1? I do not need to use different nixpkgs revisions as input for my flake but nix itself needs to be build from different nixpkgs revisions. I then want to build the same revision of my flake with these different nix versions.
- Is there a good alternative to git-crypt? I started a similar discussion here and in the wiki but I think nothing has features similar to git-crypt, unless I misunderstand something.