refactor(home-manager): try to not repeating myself

This commit is contained in:
Yorick Barbanneau 2024-09-25 23:49:22 +02:00
parent b0d455217f
commit e862d4b35c
3 changed files with 21 additions and 24 deletions

13
home-manager/base.nix Normal file
View file

@ -0,0 +1,13 @@
{ lib, hostname, ...}:
{
programs.home-manager.enable = true;
home.sessionPath = [
"$HOME/.local/bin"
];
imports = [
../hosts/${hostname}/home-config.nix
../modules/home-manager/default.nix
] ++ lib.optional (
builtins.pathExists ../hosts/${hostname}/includes/home-manager.nix
) ../hosts/${hostname}/includes/home-manager.nix;
}

View file

@ -1,18 +1,11 @@
{ lib, stateVersion, username, hostname, ... }: { stateVersion, username, ... }:
{ {
home.stateVersion = stateVersion;
home.username = "${username}"; home.username = "${username}";
home.homeDirectory = "/home/${username}"; home.homeDirectory = "/home/${username}";
home.stateVersion = stateVersion; fonts.fontconfig.enable = true;
programs.home-manager.enable = true;
fonts.fontconfig.enable = true;
home.sessionPath = [
"$HOME/.local/bin"
];
imports = [ imports = [
./base.nix
../nixos/includes/system/overlay.nix ../nixos/includes/system/overlay.nix
../hosts/${hostname}/home-config.nix ];
../modules/home-manager/default.nix
]++ lib.optional (
builtins.pathExists ../hosts/${hostname}/includes/home-manager.nix
) ../hosts/${hostname}/includes/home-manager.nix;
} }

View file

@ -1,4 +1,4 @@
{ inputs, pkgs, lib, stateVersion, hostname, username, hostConfig, config, ... }: { inputs, pkgs, stateVersion, hostname, username, hostConfig, ... }:
{ {
imports = [ # Include the results of the hardware scan. imports = [ # Include the results of the hardware scan.
../hosts/${hostname}/hardware-configuration.nix ../hosts/${hostname}/hardware-configuration.nix
@ -51,18 +51,9 @@
users.${username} = { users.${username} = {
home.stateVersion = stateVersion; home.stateVersion = stateVersion;
programs.home-manager.enable = true;
home.sessionPath = [
"$HOME/.local/bin"
];
imports = [ imports = [
../hosts/${hostname}/home-config.nix ../home-manager/base.nix
../modules/home-manager/default.nix ];
] ++ lib.optional (
builtins.pathExists ../hosts/${hostname}/includes/home-manager.nix
) ../hosts/${hostname}/includes/home-manager.nix;
}; };
}; };