1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-02 04:53:33 +02:00
home-manager/home-manager/default.nix
Alex Brandt 3b9b897af3
home-manager: add generation expiration command
This adds a new command to the home-manager shell script that allows
generations to be removed that are older than an given absolute or
relative date.

This allows users to manage the expiration of their home-manager
generations separately from their system or user profiles via
nix-collect-garbage. It is most important if the user desires to have
a convenient way to have different expiration times for Home Manager
generations than other system or user profiles.
2018-10-18 23:12:29 +02:00

37 lines
914 B
Nix

{ pkgs
# Extra path to Home Manager. If set then this path will be tried
# before `$HOME/.config/nixpkgs/home-manager` and
# `$HOME/.nixpkgs/home-manager`.
, path ? null
}:
let
pathStr = if path == null then "" else path;
in
pkgs.stdenv.mkDerivation {
name = "home-manager";
buildCommand = ''
install -v -D -m755 ${./home-manager} $out/bin/home-manager
substituteInPlace $out/bin/home-manager \
--subst-var-by bash "${pkgs.bash}" \
--subst-var-by coreutils "${pkgs.coreutils}" \
--subst-var-by findutils "${pkgs.findutils}" \
--subst-var-by gnused "${pkgs.gnused}" \
--subst-var-by less "${pkgs.less}" \
--subst-var-by HOME_MANAGER_PATH '${pathStr}'
'';
meta = with pkgs.stdenv.lib; {
description = "A user environment configurator";
maintainers = [ maintainers.rycee ];
platforms = platforms.unix;
license = licenses.mit;
};
}