mirror of
https://codeberg.org/jopejoe1/nix-conf.git
synced 2025-06-07 21:39:23 +02:00
Turn home manager into sperate module
This commit is contained in:
parent
441028f65b
commit
cd5a912929
6 changed files with 333 additions and 315 deletions
|
@ -10,6 +10,6 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
imports = [ ./home.nix ];
|
||||
custom.user.root.home.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let cfg = config.home-manager.users.root;
|
||||
in
|
||||
{
|
||||
home-manager.users.root = {
|
||||
home = {
|
||||
# Basic information for home-manager
|
||||
username = "root";
|
||||
homeDirectory = "/${cfg.home.username}";
|
||||
|
||||
# Enviroment variables
|
||||
sessionVariables = {
|
||||
XCOMPOSECACHE = "${cfg.xdg.cacheHome}/X11/xcompos";
|
||||
XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority";
|
||||
};
|
||||
|
||||
stateVersion = config.system.stateVersion;
|
||||
};
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
mime.enable = true;
|
||||
cacheHome = "${cfg.home.homeDirectory}/.cache";
|
||||
configHome = "${cfg.home.homeDirectory}/.config";
|
||||
dataHome = "${cfg.home.homeDirectory}/.local/share";
|
||||
stateHome = "${cfg.home.homeDirectory}/.local/state";
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = false;
|
||||
desktop = "${cfg.home.homeDirectory}/Desktop";
|
||||
documents = "${cfg.home.homeDirectory}/Documents";
|
||||
download = "${cfg.home.homeDirectory}/Downloads";
|
||||
music = "${cfg.home.homeDirectory}/Music";
|
||||
pictures = "${cfg.home.homeDirectory}/Pictures";
|
||||
publicShare = "${cfg.home.homeDirectory}/Public";
|
||||
templates = "${cfg.home.homeDirectory}/Templates";
|
||||
videos = "${cfg.home.homeDirectory}/Videos";
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
userEmail = "johannes@joens.email";
|
||||
userName = "jopejoe1";
|
||||
};
|
||||
bash = {
|
||||
enable = true;
|
||||
historyFile = "${cfg.xdg.stateHome}/bash/history";
|
||||
shellAliases = {
|
||||
gc = "sudo nix store gc";
|
||||
rb = "sudo nix flake update /etc/nixos/ && sudo nixos-rebuild switch";
|
||||
};
|
||||
};
|
||||
zsh.shellAliases = cfg.programs.bash.shellAliases;
|
||||
fish.shellAbbrs = cfg.programs.bash.shellAliases;
|
||||
};
|
||||
};
|
||||
}
|
71
modules/user/root/home/default.nix
Normal file
71
modules/user/root/home/default.nix
Normal file
|
@ -0,0 +1,71 @@
|
|||
{ options, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
#with lib.internal;
|
||||
let cfg = config.custom.user.root.home;
|
||||
let hcfg = config.home-manager.users.root;
|
||||
in
|
||||
{
|
||||
options.custom.user.root.home = with types; {
|
||||
enable = mkBoolOpt false "Enable the home-manger for root";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.root = {
|
||||
home = {
|
||||
# Basic information for home-manager
|
||||
username = "root";
|
||||
homeDirectory = "/${hcfg.home.username}";
|
||||
|
||||
# Enviroment variables
|
||||
sessionVariables = {
|
||||
XCOMPOSECACHE = "${hcfg.xdg.cacheHome}/X11/xcompos";
|
||||
XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority";
|
||||
};
|
||||
|
||||
stateVersion = config.system.stateVersion;
|
||||
};
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
mime.enable = true;
|
||||
cacheHome = "${hcfg.home.homeDirectory}/.cache";
|
||||
configHome = "${hcfg.home.homeDirectory}/.config";
|
||||
dataHome = "${hcfg.home.homeDirectory}/.local/share";
|
||||
stateHome = "${hcfg.home.homeDirectory}/.local/state";
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = false;
|
||||
desktop = "${hcfg.home.homeDirectory}/Desktop";
|
||||
documents = "${hcfg.home.homeDirectory}/Documents";
|
||||
download = "${hcfg.home.homeDirectory}/Downloads";
|
||||
music = "${hcfg.home.homeDirectory}/Music";
|
||||
pictures = "${hcfg.home.homeDirectory}/Pictures";
|
||||
publicShare = "${hcfg.home.homeDirectory}/Public";
|
||||
templates = "${hcfg.home.homeDirectory}/Templates";
|
||||
videos = "${hcfg.home.homeDirectory}/Videos";
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
userEmail = "johannes@joens.email";
|
||||
userName = "jopejoe1";
|
||||
};
|
||||
bash = {
|
||||
enable = true;
|
||||
historyFile = "${hcfg.xdg.stateHome}/bash/history";
|
||||
shellAliases = {
|
||||
gc = "sudo nix store gc";
|
||||
rb = "sudo nix flake update /etc/nixos/ && sudo nixos-rebuild switch";
|
||||
};
|
||||
};
|
||||
zsh.shellAliases = hcfg.programs.bash.shellAliases;
|
||||
fish.shellAbbrs = hcfg.programs.bash.shellAliases;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue