I am trying to install agenix on nixos. I use a flake for the configuration.
{
description = "System configuration";
inputs = {
nixpkgs.url = "nixpkgs/nixos-21.11";
#for secrets
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, agenix, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
lib = nixpkgs.lib;
in {
nixosConfigurations = {
acamar = lib.nixosSystem {
inherit system;
modules = [
./systems/acamar/configuration.nix
agenix.nixosModules.age
];
};
};
};
}
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ânixos-helpâ).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
..... Network, boot , other stuff here
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = [
pkgs.git
pkgs.htop
pkgs.tmux
agenix.defaultPackage.x86_64-linux
];
According to the instructions here, environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
should allow me to install agenix on the system. However, I get this error message:
error: undefined variable 'agenix'
at /nix/store/np0l57isw4a12q0q2a75dpb8c34prx7d-source/systems/acamar/configuration.nix:111:5:
110| pkgs.tmux
111| agenix.defaultPackage.x86_64-linux
| ^
112| ];
(use '--show-trace' to show detailed location information)
If I uncomment the line from systemPackages a rebuild works as expected. I probably need to pass the variable somehow? I just dont now where or how to do this. Adding âagenixâ as an input to configuration.nix does not work.