Refactor home manager
Make it a bit more modular.
This commit is contained in:
parent
f2eae24609
commit
5f9cada55b
3 changed files with 53 additions and 51 deletions
|
|
@ -1,44 +1,9 @@
|
||||||
{ config, pkgs, inputs, isDesktop, ... }:
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
home.username = "alex";
|
home.username = "alex";
|
||||||
home.homeDirectory = "/home/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 = {
|
home.shellAliases = {
|
||||||
e = "ls -lh";
|
e = "ls -lh";
|
||||||
tree = "eza --tree";
|
tree = "eza --tree";
|
||||||
|
|
@ -55,7 +20,6 @@
|
||||||
home.file.".config/nvim/init.lua".source = ./nvim/init.lua;
|
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".source = ./tmux/tmux.conf;
|
||||||
home.file.".config/tmux/tmux.conf.local".source = ./tmux/tmux.conf.local;
|
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/jrnl/jrnl.yaml".source = ./jrnl/jrnl.yaml;
|
||||||
home.file.".config/fish/functions" = {
|
home.file.".config/fish/functions" = {
|
||||||
source = ./fish/functions;
|
source = ./fish/functions;
|
||||||
|
|
@ -135,11 +99,7 @@
|
||||||
pciutils # lspci
|
pciutils # lspci
|
||||||
usbutils # lsusb
|
usbutils # lsusb
|
||||||
zoxide
|
zoxide
|
||||||
] ++ (if isDesktop then [
|
];
|
||||||
anki-bin
|
|
||||||
wezterm
|
|
||||||
chromium
|
|
||||||
] else []);
|
|
||||||
|
|
||||||
# basic configuration of git, please change to your own
|
# basic configuration of git, please change to your own
|
||||||
programs.git = {
|
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:
|
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||||
let
|
let
|
||||||
# Shared Home Manager configuration function
|
# Shared Home Manager configuration function
|
||||||
mkHomeManagerConfig = { isDesktop }: {
|
mkHomeManagerConfig = { extraModules ? [] }: {
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.backupFileExtension = "backup";
|
home-manager.backupFileExtension = "backup";
|
||||||
home-manager.users.alex = import ./alex/home.nix;
|
home-manager.users.alex = {
|
||||||
home-manager.extraSpecialArgs = { inherit inputs isDesktop; };
|
imports = [ ./alex/core.nix ] ++ extraModules;
|
||||||
|
};
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
|
@ -33,7 +35,7 @@
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/case/configuration.nix
|
./hosts/case/configuration.nix
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
(mkHomeManagerConfig { isDesktop = true; })
|
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -43,7 +45,7 @@
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/count/configuration.nix
|
./hosts/count/configuration.nix
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
(mkHomeManagerConfig { isDesktop = true; })
|
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -53,7 +55,7 @@
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/armitage/configuration.nix
|
./hosts/armitage/configuration.nix
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
(mkHomeManagerConfig { isDesktop = true; })
|
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -63,7 +65,7 @@
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/alt/configuration.nix
|
./hosts/alt/configuration.nix
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
(mkHomeManagerConfig { isDesktop = false; })
|
(mkHomeManagerConfig {})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -73,10 +75,10 @@
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/nightcity/configuration.nix
|
./hosts/nightcity/configuration.nix
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
(mkHomeManagerConfig { isDesktop = false; })
|
(mkHomeManagerConfig {})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
# other hosts...
|
# other hosts...
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue