Home : Refactor.

This commit is contained in:
Dmitry Voronin 2024-04-14 23:48:14 +03:00 committed by Dmitry Voronin
parent 66882a8820
commit 56e3f9ec6c
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 98 additions and 82 deletions

View file

@ -1,10 +1,10 @@
{ pkgs, inputs, const, style, util, key, setting, ... } @args: let { pkgs, inputs, const, style, util, key, setting, secret, ... } @args: let
homePath = "/data/data/com.termux.nix/files/home"; homePath = "/data/data/com.termux.nix/files/home";
tmux = import ./common/tmux/Init.nix args; tmux = import ./common/tmux args;
tmuxScript = pkgs.writeShellScriptBin "tmux_script" tmux.script; tmuxScript = pkgs.writeShellScriptBin "tmux_script" tmux.script;
bash = import ./common/bash/Init.nix args; bash = import ./common/bash args;
nvim = import ./common/nvim/Init.nix args; nvim = import ./common/nvim args;
ssh = import ./common/ssh/Init.nix args; ssh = import ./common/ssh args;
font = pkgs.runCommandNoCC "font" {} '' font = pkgs.runCommandNoCC "font" {} ''
cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out cp ${pkgs.nerdfonts.override { fonts = [ "Terminus" ]; }}/share/fonts/truetype/NerdFonts/TerminessNerdFontMono-Regular.ttf $out
''; '';
@ -60,49 +60,62 @@ in {
''; '';
home-manager.config = { home-manager.config = {
home.stateVersion = const.droidStateVersion; home = {
home.file = { stateVersion = const.droidStateVersion;
".dotfiles".source = inputs.self; file = {
".ssh/config".text = ssh.config; ".dotfiles".source = inputs.self;
".termux/_font.ttf".source = font; ".ssh/config".text = ssh.config;
".termux/_colors.properties".text = colors; ".termux/_font.ttf".source = font;
}; ".termux/_colors.properties".text = colors;
home.sessionVariables = { };
EDITOR = "nvim"; sessionVariables = {
MANPAGER = "nvim +Man!"; EDITOR = "nvim";
NIXPKGS_ALLOW_UNFREE = "1"; MANPAGER = "nvim +Man!";
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}"; NIXPKGS_ALLOW_UNFREE = "1";
TERM = "xterm-256color"; NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}";
}; TERM = "xterm-256color";
programs.bash = {
enable = true;
bashrcExtra = bash.config + ''
[[ -f ~/.termux/font.ttf ]] || {
cp ~/.termux/_font.ttf ~/.termux/font.ttf
cp ~/.termux/_colors.properties ~/.termux/colors.properties
_warn "Termux config installed, please restart."
};
'';
};
programs.tmux = {
enable = true;
extraConfig = tmux.config;
};
programs.git = {
enable = true;
extraConfig = {
credential.helper = "store";
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
rebase.autoStash = true;
}; };
}; };
programs.neovim = {
enable = true; programs = {
viAlias = true; bash = {
vimAlias = true; enable = true;
extraConfig = nvim.config; bashrcExtra = bash.config + ''
[[ -f ~/.termux/font.ttf ]] || {
cp ~/.termux/_font.ttf ~/.termux/font.ttf
cp ~/.termux/_colors.properties ~/.termux/colors.properties
_warn "Termux config installed, please restart."
};
'';
};
tmux = {
enable = true;
extraConfig = tmux.config;
};
git = {
enable = true;
extraConfig = {
credential.helper = "store";
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
rebase.autoStash = true;
};
};
neovim = {
enable = true;
viAlias = true;
vimAlias = true;
extraConfig = nvim.config;
};
gpg = {
enable = true;
publicKeys = secret.crypto.publicKeys;
};
}; };
}; };
} }

View file

@ -5,45 +5,48 @@
btop = import ./top/btop args; btop = import ./top/btop args;
htop = import ./top/htop args; htop = import ./top/htop args;
in { in {
home-manager.backupFileExtension = "old"; home-manager = {
backupFileExtension = "old";
home-manager.users.${username} = { users.${username} = {
programs.home-manager.enable = true; home = {
home.username = username; username = username;
home.homeDirectory = homeDir; homeDirectory = homeDir;
home.stateVersion = const.stateVersion; stateVersion = const.stateVersion;
file = {
home.file = { ".config/btop/btop.conf".text = btop.config;
".config/btop/btop.conf".text = btop.config; ".config/htop/htoprc".text = htop.config;
".config/htop/htoprc".text = htop.config; ".config/mako/config".text = mako.config;
".config/mako/config".text = mako.config; ".config/foot/foot.ini".text = foot.config;
".config/foot/foot.ini".text = foot.config; ".editorconfig".text = editorconfig.config;
".editorconfig".text = editorconfig.config; ".parallel/will-cite".text = "";
".parallel/will-cite".text = ""; "media/template".source = ./template;
"media/template".source = ./template; };
};
# Directories.
xdg.userDirs = {
enable = true;
createDirectories = true;
desktop = "${homeDir}/";
documents = "${homeDir}/document/";
download = "${homeDir}/download/";
music = "${homeDir}/media/music/";
pictures = "${homeDir}/media/picture/";
publicShare = "${homeDir}/media/share/";
templates = "${homeDir}/media/template/";
videos = "${homeDir}/media/video/";
extraConfig = {
XDG_TMP_DIR = "${homeDir}/tmp/";
}; };
};
# GPG. xdg.userDirs = {
programs.gpg = { enable = true;
enable = true; createDirectories = true;
publicKeys = secret.crypto.publicKeys; desktop = "${homeDir}/";
documents = "${homeDir}/document/";
download = "${homeDir}/download/";
music = "${homeDir}/media/music/";
pictures = "${homeDir}/media/picture/";
publicShare = "${homeDir}/media/share/";
templates = "${homeDir}/media/template/";
videos = "${homeDir}/media/video/";
extraConfig = {
XDG_TMP_DIR = "${homeDir}/tmp/";
};
};
programs = {
home-manager.enable = true;
gpg = {
enable = true;
publicKeys = secret.crypto.publicKeys;
};
};
}; };
}; };
} }