Restructure home-manager config

This commit is contained in:
ItsDrike 2024-03-24 13:18:51 +01:00
parent 019372838b
commit b4acb6e15f
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
6 changed files with 138 additions and 151 deletions

View file

@ -4,11 +4,6 @@ let
username = config.myOptions.system.username; username = config.myOptions.system.username;
in in
{ {
imports = [
./packages
./programs
];
home-manager = lib.mkIf myHmConf.enabled { home-manager = lib.mkIf myHmConf.enabled {
# Use verbose mode for home-manager # Use verbose mode for home-manager
verbose = true; verbose = true;
@ -31,9 +26,18 @@ in
extraSpecialArgs = { inherit inputs self; }; extraSpecialArgs = { inherit inputs self; };
users.${username} = { users.${username} = {
# These imports will be scoped under this key so all settings
# in them will be added to `home-manager.users.${username}`..
imports = [
./packages
./programs
];
config = {
# Let home-manager manage itself in standalone mode # Let home-manager manage itself in standalone mode
programs.home-manager.enable = true; programs.home-manager.enable = true;
# Basic user config
home = { home = {
inherit username; inherit username;
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
@ -41,4 +45,5 @@ in
}; };
}; };
}; };
};
} }

View file

@ -1,9 +1,4 @@
{ config, pkgs, lib, ... }: { pkgs, ... }: {
let
username = config.myOptions.system.username;
in
{
home-manager.users.${username} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
fzf # fuzzy finder fzf # fuzzy finder
jq # JSON processor jq # JSON processor
@ -41,5 +36,4 @@ in
meson # C/C++ build system meson # C/C++ build system
gh # GitHub CLI tool gh # GitHub CLI tool
]; ];
};
} }

View file

@ -1,11 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
username = config.myOptions.system.username;
inherit (lib.meta) getExe getExe'; inherit (lib.meta) getExe getExe';
in in
{ {
home-manager.users.${username} = {
programs.zsh.shellAliases = { programs.zsh.shellAliases = {
# I'm not the greatest typist # I'm not the greatest typist
sl = "ls"; sl = "ls";
@ -60,5 +57,4 @@ in
# Expand aliases from sudo # Expand aliases from sudo
sudo = "sudo "; sudo = "sudo ";
}; };
};
} }

View file

@ -1,18 +1,10 @@
{ config, pkgs, ... }: { config, pkgs, ... }: {
let
username = config.myOptions.system.username;
hmCfg = config.home-manager.users.${username};
in
{
imports = [ imports = [
./plugins.nix ./plugins.nix
./aliases.nix ./aliases.nix
]; ];
programs.zsh.enable = true; config = {
users.users.${username}.shell = pkgs.zsh;
home-manager.users.${username} = {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
dotDir = ".config/zsh"; dotDir = ".config/zsh";
@ -25,7 +17,7 @@ in
share = true; share = true;
# don't clutter $HOME # don't clutter $HOME
path = "${hmCfg.xdg.dataHome}/zsh/zsh_history"; path = "${config.xdg.dataHome}/zsh/zsh_history";
# save timestamps to histfile # save timestamps to histfile
extended = true; extended = true;

View file

@ -1,11 +1,8 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
username = config.myOptions.system.username;
inherit (pkgs) fetchFromGitHub; inherit (pkgs) fetchFromGitHub;
in in
{ {
home-manager.users.${username} = {
programs.zsh.plugins = [ programs.zsh.plugins = [
{ {
name = "zsh-nix-shell"; name = "zsh-nix-shell";
@ -37,5 +34,4 @@ in
}; };
} }
]; ];
};
} }

View file

@ -1,9 +1,12 @@
{ config, lib, ... }: with lib; let { config, lib, pkgs, ... }: with lib; let
cfg = config.myOptions.system; cfg = config.myOptions.system;
in in
{ {
networking.hostName = cfg.hostname; networking.hostName = cfg.hostname;
# Default shell for the user
programs.zsh.enable = true;
users = { users = {
# Prevent mutating users outside of our configurations. # Prevent mutating users outside of our configurations.
# TODO: Solve this, currentry it fails with no password # TODO: Solve this, currentry it fails with no password
@ -15,6 +18,7 @@ in
users.${cfg.username} = { users.${cfg.username} = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
shell = pkgs.zsh;
}; };
}; };
} }