Hey there,
I’m currently starting to build packages, in order to get a grasp on how to do that and I’ve ran into the following issue…
I have successfully created some nix
code that builds a package and I’m now trying to use it with callPackage
and then reference the packages path:
{ pkgs, ... }:
let
gatus = pkgs.callPackage ../../pkgs/gatus {};
in
{
environment.systemPackages = with pkgs; [
gatus
];
...
systemd.services.gatus = {
...
serviceConfig = {
ExecStart = "GATUS_CONFIG_FILE=/etc/gatos/config.yaml ${pkgs.gatus}/bin/gatus";
WorkingDirectory = "${pkgs.gatus}/bin/gatus";
};
...
};
}
Using this code and running a nixos rebuild-switch
I get this error:
$ sudo nixos-rebuild switch
building Nix...
building the system configuration...
error: attribute 'gatus' missing
at /etc/nixos/modules/gatus/default.nix:18:63:
17| serviceConfig = {
18| ExecStart = "GATUS_CONFIG_FILE=/etc/gatos/config.yaml ${pkgs.gatus}/bin/gatus";
| ^
19| WorkingDirectory = "${pkgs.gatus}/bin/gatus";
Did you mean one of ats, bats, catfs, gams or gau?
(use '--show-trace' to show detailed location information)
So apparently I can’t reference the package using something like ${pkgs.packagename}
. How can I reference it instead…
I didn’t really have any idea how to search for that kind of issue, but I did find nix-index
, so I started a nix-shell
, ran the indexer and searched for the package, this also didn’t return anything, while searching for other installed packages did…
Can anyone help me please? Thanks in advance!