Skip to content

Commit

Permalink
Merge pull request #47 from NotAShelf/master
Browse files Browse the repository at this point in the history
add `flakeDir` option to automatically set the FLAKE variable
  • Loading branch information
viperML authored Dec 14, 2023
2 parents fc720bb + e085952 commit 5254741
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 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 = null;
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,19 @@ self: {
assertion = config.nh.clean.enable -> config.nh.enable;
message = "nh.clean.enable requires nh.enable";
}

{
assertion = (config.nh.flake != null) -> !(lib.hasSuffix ".nix" config.nh.flake);
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 5254741

Please sign in to comment.