nixos-config/modules/system/nix-helper.nix

32 lines
729 B
Nix

{ config, lib, ... }:
let
cfg = config.myConfig.nix-helper;
in
{
options.myConfig.nix-helper = {
enable = lib.mkEnableOption "";
auto-gc.enable = lib.mkEnableOption "";
};
config = lib.mkIf cfg.enable {
environment.sessionVariables.FLAKE = "/home/seb/Projects/nixos/my-config";
programs.nh.enable = true;
environment.shellAliases =
let
rebuild = "sudo -v && nh os";
in
{
nrs = "${rebuild} switch";
nrt = "${rebuild} test";
nrb = "${rebuild} boot";
nrrb = "nrb && reboot";
};
programs.nh.clean = lib.mkIf cfg.auto-gc.enable {
enable = true;
dates = "daily";
extraArgs = "--keep 10 --keep-since 3d";
};
};
}