-
Notifications
You must be signed in to change notification settings - Fork 165
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
Sops nix as a home-manager module does not create a symlink #478
Comments
As I understand it the |
Hi @w4tsn, thanks for your kind tips. It is indeed the case. After restarting the |
I wasted some time investigating why sops-nix doesn't generate the secret files for me after using |
I am currently not using the home-manager sops module but I am open to merge fixes. |
Exactly the same workaround I applied to my current config. |
I made a pull request, #485, documenting that you have to restart the service so that someone running into this issue can work around it. It doesn't fix the service not automatically reloading when a secret is changed but this is the best I can do since I don't have the knowledge required to actually fix that. Should I change the name of the issue to more accurately reflect what the actually issue is or keep it the same for discoverability? |
I don't understand why you are talking about "home-manager switch"; is that even used when home-manager is a module? I also don't understand why I get
I'm on Pi4 and I also can't get any file created;) |
@madorian are you using home-manager to configure the root user's home-directory? I've only gotten that when I have no secrets being deployed by home-manager in my current user's configuration. |
Same for me. By default if there is no secret, that unit service will not be created. |
Not sure what you both mean. I have this setting for root in home-manager
|
|
I use the below in my home-manager config file to workaround this issue:
You may change |
Should use |
I created a pull request based on the suggestion from @floating-cat with the addition of @yqlbu #491 I added some more description on the issue in the commit message together with two alternatives how this could be fixed inside the sops-nix home-manager module code. |
when using that work around and using deploy-rs with root as
It works if |
Those three lines: home.activation.setupEtc = config.lib.dag.entryAfter [ "writeBoundary" ] ''
/run/current-system/sw/bin/systemctl start --user sops-nix
''; Cause an error when starting the home-manager-$user.service: × home-manager-hadi.service - Home Manager environment for hadi
Loaded: loaded (/etc/systemd/system/home-manager-hadi.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sun 2024-03-17 02:35:18 CET; 48s ago
Process: 1027 ExecStart=/nix/store/wyb6kadb8311qdv19kvrsqb7i6zqaw08-hm-setup-env /nix/store/z9jzqhmi9rrs361b71nfmjvcxvydb4ha-home-manager-generation (code=exited, status=1/FAILURE)
Main PID: 1027 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
CPU: 683ms
mars 17 02:35:18 nixy hm-activate-hadi[1027]: No change so reusing latest profile generation 275
mars 17 02:35:18 nixy hm-activate-hadi[1027]: Creating home file links in /home/hadi
mars 17 02:35:18 nixy hm-activate-hadi[1027]: Activating onFilesChange
mars 17 02:35:18 nixy hm-activate-hadi[1027]: Activating reloadSystemd
mars 17 02:35:18 nixy hm-activate-hadi[1027]: User systemd daemon not running. Skipping reload.
mars 17 02:35:18 nixy hm-activate-hadi[1027]: Activating setupEtc
mars 17 02:35:18 nixy systemctl[1617]: Failed to connect to bus: No medium found
mars 17 02:35:18 nixy systemd[1]: home-manager-hadi.service: Main process exited, code=exited, status=1/FAILURE
mars 17 02:35:18 nixy systemd[1]: home-manager-hadi.service: Failed with result 'exit-code'.
mars 17 02:35:18 nixy systemd[1]: Failed to start Home Manager environment for hadi. Does anyone have an idea why? |
it looks like the user is not logged in (interactively) so the user systemd is not running, thus there's no daemon to tell to start the service |
Can we tell home manager to wait for the user to log in before launching the sops service? |
Can somebody explain why the home-manager module now symlinks to This really confused me when searching for one secret today... |
I have followed the README instructions, importing sops-nix in home manager via
(as I am using home-manager as a nixos module), set the sops default file, format and key via
and attempted to decrypt it via
The expected behavior would be that the decrypted file would be put in the specified location. However, no symlink is made, though running
prints the contents of the secret.
I am unsure if this is a duplicate of #287 or not.
The text was updated successfully, but these errors were encountered: