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

sops-nix.service not found #581

Open
spencer3035 opened this issue Jun 22, 2024 · 3 comments
Open

sops-nix.service not found #581

spencer3035 opened this issue Jun 22, 2024 · 3 comments

Comments

@spencer3035
Copy link

spencer3035 commented Jun 22, 2024

I am trying to set up sops as a home-manager module. Ive followed the readme mostly, but it seems like it doen't install the sops-nix.service properly. Here are the last few lines after I do home-manager switch --flake /path/to/flake.nix

Activating onFilesChange
Activating reloadSystemd
systemctl --user daemon-reload
Suggested commands:
systemctl --user start sops-nix.service
Activating sops-nix
Failed to restart sops-nix.service: Unit sops-nix.service not found.

Predictably, systemctl status --user sops-nix.service and variations also produce a service not found error.

Trimmed down version of my flake.nix:

{
  description = "My flake";

  inputs = {
    # Source of Home Manager and Nixpkgs.
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    sops-nix.url = "github:Mic92/sops-nix";
    sops-nix.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { nixpkgs, home-manager, ... }@inputs:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
      homeConfigurations."user@hostname" = home-manager.lib.homeManagerConfiguration {
        inherit pkgs;
        modules = [ ./home.nix ];
        extraSpecialArgs = {
          inherit inputs;
          settings = import ./home-manager/hosts/spencer-laptop/settings.nix;
        };
      };
    };
}

Trimmed down version of my home.nix file

{ inputs, ... }: {

  imports = [
    inputs.sops-nix.homeManagerModules.sops
  ];

  sops = {
    defaultSopsFile = ./secrets/secrets.yaml;
    defaultSopsFormat = "yaml";
    age = {
      keyFile = "/path/to/key.txt";
    };
    secrets = { };
  };
}

From my understanding, the service should be automatically installed? I'm not sure if there is a small detail I missed or there is a bug in the version of sops I am using.

Any help is appreciated.

@nasdvoya
Copy link

I'm using home manager on Arch Linux and I have the same issue. The config is pretty much the same, I even tried to remove sops config (in case a path was wrong or something).
When I rebuild I get this message:


❯ rebuild

Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
Activating linkGeneration
Cleaning up orphan links from /home/user
No change so reusing latest profile generation 306
Creating home file links in /home/user
Activating onFilesChange
Activating reloadSystemd
The user systemd session is degraded:
  UNIT             LOAD      ACTIVE SUB    DESCRIPTION
● sops-nix.service not-found failed failed sops-nix.service

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

1 loaded units listed.
Attempting to reload services anyway...

@Mic92
Copy link
Owner

Mic92 commented Jun 30, 2024

Maybe @SebTM has an idea. I am not really using the home-manager integration.

@SebTM
Copy link
Contributor

SebTM commented Jun 30, 2024

I can't reproduce the issue (built with sops-nix b5974d4331fb6c893e808977a2e1a6d34b3162d6 and home-manager 36317d4d38887f7629876b0e43c8d9593c5cc48d), the major difference to my config I assume is the case in both cases is that I use home-manager as nixosModule not standalone.

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