Refactor home manager
Make it a bit more modular.
This commit is contained in:
@@ -1,44 +1,9 @@
|
||||
{ config, pkgs, inputs, isDesktop, ... }:
|
||||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
home.username = "alex";
|
||||
home.homeDirectory = "/home/alex";
|
||||
|
||||
# link the configuration file in current directory to the specified location in home directory
|
||||
# home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg;
|
||||
|
||||
# link all files in `./scripts` to `~/.config/i3/scripts`
|
||||
# home.file.".config/i3/scripts" = {
|
||||
# source = ./scripts;
|
||||
# recursive = true; # link recursively
|
||||
# executable = true; # make all files executable
|
||||
# };
|
||||
|
||||
# encode the file content in nix configuration file directly
|
||||
# home.file.".xxx".text = ''
|
||||
# xxx
|
||||
# '';
|
||||
|
||||
dconf.settings = if isDesktop then {
|
||||
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||
custom-keybindings = [ "/org/gnome/settings-daemon/plugins/media-keys/custom0/" ];
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/media-keys/custom0" = {
|
||||
binding = "<Primary><Alt>t";
|
||||
command = "wezterm";
|
||||
name = "open-terminal";
|
||||
};
|
||||
"org/gnome/desktop/interface" = {
|
||||
color-scheme = "prefer-dark";
|
||||
};
|
||||
} else {};
|
||||
|
||||
imports = [
|
||||
] ++ (if isDesktop then [
|
||||
./sway.nix
|
||||
] else []);
|
||||
|
||||
|
||||
home.shellAliases = {
|
||||
e = "ls -lh";
|
||||
tree = "eza --tree";
|
||||
@@ -55,7 +20,6 @@
|
||||
home.file.".config/nvim/init.lua".source = ./nvim/init.lua;
|
||||
home.file.".config/tmux/tmux.conf".source = ./tmux/tmux.conf;
|
||||
home.file.".config/tmux/tmux.conf.local".source = ./tmux/tmux.conf.local;
|
||||
home.file.".wezterm.lua".source = ./wezterm.lua;
|
||||
home.file.".config/jrnl/jrnl.yaml".source = ./jrnl/jrnl.yaml;
|
||||
home.file.".config/fish/functions" = {
|
||||
source = ./fish/functions;
|
||||
@@ -135,11 +99,7 @@
|
||||
pciutils # lspci
|
||||
usbutils # lsusb
|
||||
zoxide
|
||||
] ++ (if isDesktop then [
|
||||
anki-bin
|
||||
wezterm
|
||||
chromium
|
||||
] else []);
|
||||
];
|
||||
|
||||
# basic configuration of git, please change to your own
|
||||
programs.git = {
|
||||
40
alex/desktop.nix
Normal file
40
alex/desktop.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./sway.nix
|
||||
];
|
||||
|
||||
home.file.".wezterm.lua".source = ./wezterm.lua;
|
||||
|
||||
dconf.settings = {
|
||||
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||
custom-keybindings = [ "/org/gnome/settings-daemon/plugins/media-keys/custom0/" ];
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/media-keys/custom0" = {
|
||||
binding = "<Primary><Alt>t";
|
||||
command = "wezterm";
|
||||
name = "open-terminal";
|
||||
};
|
||||
"org/gnome/desktop/interface" = {
|
||||
color-scheme = "prefer-dark";
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
anki-bin
|
||||
wezterm
|
||||
chromium
|
||||
loupe
|
||||
];
|
||||
|
||||
xdg.mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
"image/jpeg" = [ "org.gnome.Loupe.desktop" ];
|
||||
"image/png" = [ "org.gnome.Loupe.desktop" ];
|
||||
"image/gif" = [ "org.gnome.Loupe.desktop" ];
|
||||
"image/webp" = [ "org.gnome.Loupe.desktop" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
20
flake.nix
20
flake.nix
@@ -18,12 +18,14 @@
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
let
|
||||
# Shared Home Manager configuration function
|
||||
mkHomeManagerConfig = { isDesktop }: {
|
||||
mkHomeManagerConfig = { extraModules ? [] }: {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "backup";
|
||||
home-manager.users.alex = import ./alex/home.nix;
|
||||
home-manager.extraSpecialArgs = { inherit inputs isDesktop; };
|
||||
home-manager.users.alex = {
|
||||
imports = [ ./alex/core.nix ] ++ extraModules;
|
||||
};
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
};
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
@@ -33,7 +35,7 @@
|
||||
modules = [
|
||||
./hosts/case/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
(mkHomeManagerConfig { isDesktop = true; })
|
||||
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
|
||||
];
|
||||
};
|
||||
|
||||
@@ -43,7 +45,7 @@
|
||||
modules = [
|
||||
./hosts/count/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
(mkHomeManagerConfig { isDesktop = true; })
|
||||
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
|
||||
];
|
||||
};
|
||||
|
||||
@@ -53,7 +55,7 @@
|
||||
modules = [
|
||||
./hosts/armitage/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
(mkHomeManagerConfig { isDesktop = true; })
|
||||
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
|
||||
];
|
||||
};
|
||||
|
||||
@@ -63,7 +65,7 @@
|
||||
modules = [
|
||||
./hosts/alt/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
(mkHomeManagerConfig { isDesktop = false; })
|
||||
(mkHomeManagerConfig {})
|
||||
];
|
||||
};
|
||||
|
||||
@@ -73,10 +75,10 @@
|
||||
modules = [
|
||||
./hosts/nightcity/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
(mkHomeManagerConfig { isDesktop = false; })
|
||||
(mkHomeManagerConfig {})
|
||||
];
|
||||
};
|
||||
# other hosts...
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user