Skip to content

Commit

Permalink
add flakeDir option to automatically set the FLAKE variable
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Dec 12, 2023
1 parent 375c6cf commit 368bfe6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ self: {
description = "Which NH package to use";
};

flake = mkOption {
type = with types; nullOr path;
default = "";
description = "The path that will be used for the `FLAKE` environment variable";
};

clean = {
enable = mkOption {
type = types.bool;
Expand Down Expand Up @@ -45,9 +51,18 @@ self: {
assertion = config.nh.clean.enable -> config.nh.enable;
message = "nh.clean.enable requires nh.enable";
}
{
assertion = lib.hasSuffix config.nh.flake ".nix";
message = "nh.flake must be a directory";
}
];

environment.systemPackages = [config.nh.package];
environment = {
systemPackages = [config.nh.package];
variables = lib.optionalAttrs (config.nh.flake != null) {
FLAKE = config.nh.flake;
};
};

systemd = lib.mkIf config.nh.clean.enable {
services.nh-clean = {
Expand Down

0 comments on commit 368bfe6

Please sign in to comment.