config: update and refactor home-manager baseline config

This commit is contained in:
Gabriel Arazas 2024-01-17 17:32:34 +08:00
parent 77fb48e95c
commit a7e4c430d5
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -7,58 +7,6 @@
, ...
}:
let
# The default config for our home-manager configurations. This is also to
# be used for sharing modules among home-manager users from NixOS
# configurations with `nixpkgs.useGlobalPkgs` set to `true` so avoid
# setting nixpkgs-related options here.
defaultHomeManagerConfig =
{ pkgs, config, lib, ... }: {
# Set some extra, yeah?
_module.args = defaultExtraArgs;
# Hardcoding this is not really great especially if you consider using
# other locales but its default values are already hardcoded so what
# the hell. For other users, they would have to do set these manually.
xdg.userDirs =
let
# The home directory-related options should be already taken care
# of at this point. It is an ABSOLUTE MUST that it is set properly
# since other parts of the home-manager config relies on it being
# set properly.
#
# Here are some of the common cases for setting the home directory
# options.
#
# * For exporting home-manager configurations, this is done in this
# flake definition.
# * For NixOS configs, this is done automatically by the
# home-manager NixOS module.
# * Otherwise, you'll have to manually set them.
appendToHomeDir = path: "${config.home.homeDirectory}/${path}";
in
{
desktop = appendToHomeDir "Desktop";
documents = appendToHomeDir "Documents";
download = appendToHomeDir "Downloads";
music = appendToHomeDir "Music";
pictures = appendToHomeDir "Pictures";
publicShare = appendToHomeDir "Public";
templates = appendToHomeDir "Templates";
videos = appendToHomeDir "Videos";
};
programs.home-manager.enable = true;
manual = lib.mkDefault {
html.enable = true;
json.enable = true;
manpages.enable = true;
};
home.stateVersion = lib.mkDefault "23.11";
};
in
{
setups.home-manager = {
configs = {
@ -96,7 +44,22 @@ in
inputs.sops-nix.homeManagerModules.sops
inputs.nix-index-database.hmModules.nix-index
defaultHomeManagerConfig
# The default shared config for our home-manager configurations. This
# is also to be used for sharing modules among home-manager users from
# NixOS configurations with `nixpkgs.useGlobalPkgs` set to `true` so
# avoid setting nixpkgs-related options here.
({ pkgs, config, lib, ... }: {
# Set some extra, yeah?
_module.args = defaultExtraArgs;
manual = lib.mkDefault {
html.enable = true;
json.enable = true;
manpages.enable = true;
};
home.stateVersion = lib.mkDefault "23.11";
})
];
standaloneConfigModules = [
@ -109,7 +72,7 @@ in
xdg.userDirs.createDirectories = lib.mkForce false;
programs.home-manager.enable = lib.mkForce true;
targets.genericLinux.enable = true;
targets.genericLinux.enable = lib.mkDefault true;
})
];
};