I had a flake.nix file that properly set up agenix secrets and ran nextcloud. It partially looked like this:
outputs = { self, nixpkgs, agenix, home-manager, ... }:
let
lib = nixpkgs.lib;
system = "x86_64-linux";
in {
nixosConfigurations = {
nix0 = lib.nixosSystem {
defaultPackage.${system} = home-manager.defaultPackage.${system};
modules = [
./conf.nix
agenix.nixosModules.default
{
environment.systemPackages = [
agenix.packages.x86_64-linux.default
];
}
{
age.secrets.nextcloud_admin_pass.file = ./nextcloud_admin_pass.age;
age.secrets.nextcloud_admin_pass.owner = "nextcloud";
age.secrets.easydns.file = ./easydns.age;
}
./nextcloud.nix
...
Now I’m reorganizing my files and trying to move those agenix secrets into my nextcloud.nix file and I can’t figure out what I’m doing wrong. Here’s the start of the nextcloud.nix file, all I did was move agenix stuff into it out of the flake:
{ self, config, lib, pkgs, agenix, ... }: {
agenix.nixosModules.default =
{
environment.systemPackages = [
agenix.packages.x86_64-linux.default
];
};
age.secrets.nextcloud_admin_pass.file = ./nextcloud_admin_pass.age;
age.secrets.nextcloud_admin_pass.owner = "nextcloud";
age.secrets.easydns.file = ./easydns.age;
...
But this gives me an error:
error: The option `age' does not exist. Definition values:
- In `/nix/store/y7dxqpdcik28jm89bwz5f27lxxgq1zij-source/nixos/nextcloud.nix':
{
secrets = {
easydns = {
file = /nix/store/y7dxqpdcik28jm89bwz5f27lxxgq1zij-source/nixos/easydns.age;
};
...
I can’t figure out how the age
option got created properly in the flake.nix but doesn’t work in the nextcloud.nix.
Entire source is available at GitHub - montyz/nixes --the directory first_attempt
is what I had that was working. I’ve been trying to restructure my files and get stuck here.