mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
feat: separate common user setup
This commit is contained in:
parent
c81de3eff9
commit
bad942c919
8 changed files with 241 additions and 6 deletions
|
@ -83,9 +83,5 @@ in {
|
||||||
network.wait-online.anyInterface = true;
|
network.wait-online.anyInterface = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.root = {
|
|
||||||
initialHashedPassword = "$6$EBo/CaxB.dQoq2W8$lo2b5vKgJlLPdGGhEqa08q3Irf1Zd1PcFBCwJOrG8lqjwbABkn1DEhrMh1P3ezwnww2HusUBuZGDSMa4nvSQg1";
|
|
||||||
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA5Uq+CDy5Pmt3If5M6d8K/Q7HArU6sZ7sgoj3T521Wm"];
|
|
||||||
};
|
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
../../modules/laptop.nix
|
../../modules/laptop.nix
|
||||||
../../modules/yubikey.nix
|
../../modules/yubikey.nix
|
||||||
../../modules/zfs.nix
|
../../modules/zfs.nix
|
||||||
|
|
||||||
|
../../users/root
|
||||||
../../users/myuser
|
../../users/myuser
|
||||||
|
|
||||||
./fs.nix
|
./fs.nix
|
||||||
|
|
|
@ -7,10 +7,11 @@
|
||||||
#./btop.nix
|
#./btop.nix
|
||||||
#./fish.nix
|
#./fish.nix
|
||||||
#./git.nix
|
#./git.nix
|
||||||
#./htop.nix
|
./htop.nix
|
||||||
#./neovim
|
#./neovim
|
||||||
|
./nushell.nix
|
||||||
#./ssh.nix
|
#./ssh.nix
|
||||||
#./starship.nix
|
./starship.nix
|
||||||
#./tmux.nix
|
#./tmux.nix
|
||||||
#./xdg.nix
|
#./xdg.nix
|
||||||
#./zsh.nix
|
#./zsh.nix
|
||||||
|
|
29
users/common/htop.nix
Normal file
29
users/common/htop.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{config, ...}: {
|
||||||
|
programs.htop = {
|
||||||
|
enable = true;
|
||||||
|
settings =
|
||||||
|
{
|
||||||
|
highlight_base_name = 1;
|
||||||
|
show_cpu_frequency = 1;
|
||||||
|
show_cpu_temperature = 1;
|
||||||
|
hide_kernel_threads = 1;
|
||||||
|
hide_userland_threads = 1;
|
||||||
|
}
|
||||||
|
// (with config.lib.htop;
|
||||||
|
leftMeters [
|
||||||
|
(bar "LeftCPUs2")
|
||||||
|
(bar "Memory")
|
||||||
|
(bar "Swap")
|
||||||
|
(bar "ZFSARC")
|
||||||
|
(text "NetworkIO")
|
||||||
|
])
|
||||||
|
// (with config.lib.htop;
|
||||||
|
rightMeters [
|
||||||
|
(bar "RightCPUs2")
|
||||||
|
(text "LoadAverage")
|
||||||
|
(text "Tasks")
|
||||||
|
(text "Uptime")
|
||||||
|
(text "Systemd")
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
78
users/common/nushell.nix
Normal file
78
users/common/nushell.nix
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
enableAutosuggestions = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
enableSyntaxHighlighting = true;
|
||||||
|
enableVteIntegration = pkgs.stdenv.isLinux;
|
||||||
|
autocd = true;
|
||||||
|
dotDir = ".config/zsh";
|
||||||
|
history = {
|
||||||
|
expireDuplicatesFirst = true;
|
||||||
|
extended = true;
|
||||||
|
ignoreDups = true;
|
||||||
|
path = "${config.xdg.dataHome}/zsh/history";
|
||||||
|
save = 10000;
|
||||||
|
share = true;
|
||||||
|
};
|
||||||
|
envExtra = ''
|
||||||
|
export LESSHISTFILE="${config.xdg.dataHome}/less_history"
|
||||||
|
export CARGO_HOME="${config.xdg.cacheHome}/cargo"
|
||||||
|
'';
|
||||||
|
initExtra = ''
|
||||||
|
nix-closure-size() {
|
||||||
|
nix-store -q --size $(nix-store -qR $(${pkgs.coreutils}/bin/readlink -e $1) ) |
|
||||||
|
${pkgs.gawk}/bin/gawk '{ a+=$1 } END { print a }' |
|
||||||
|
${pkgs.coreutils}/bin/numfmt --to=iec-i
|
||||||
|
}
|
||||||
|
bindkey "$${terminfo[khome]}" beginning-of-line
|
||||||
|
bindkey "$${terminfo[kend]}" end-of-line
|
||||||
|
bindkey "$${terminfo[kdch1]}" delete-char
|
||||||
|
bindkey '\eOA' history-substring-search-up
|
||||||
|
bindkey '\eOB' history-substring-search-down
|
||||||
|
bindkey "^[[A" history-substring-search-up
|
||||||
|
bindkey "^[[B" history-substring-search-down
|
||||||
|
bindkey "$$terminfo[kcuu1]" history-substring-search-up
|
||||||
|
bindkey "$$terminfo[kcud1]" history-substring-search-down
|
||||||
|
bindkey "^[[1;5C" forward-word
|
||||||
|
bindkey "^[[1;3C" forward-word
|
||||||
|
bindkey "^[[1;5D" backward-word
|
||||||
|
bindkey "^[[1;3D" backward-word
|
||||||
|
bindkey -s "^O" 'fzf | xargs -r $VISUAL^M'
|
||||||
|
bindkey -rpM viins '^[^['
|
||||||
|
KEYTIMEOUT=1
|
||||||
|
${pkgs.any-nix-shell}/bin/any-nix-shell zsh | source /dev/stdin
|
||||||
|
'';
|
||||||
|
sessionVariables = {
|
||||||
|
RPROMPT = "";
|
||||||
|
};
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
# https://github.com/hlissner/zsh-autopair
|
||||||
|
name = "zsh-autopair";
|
||||||
|
file = "zsh-autopair.plugin.zsh";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "hlissner";
|
||||||
|
repo = "zsh-autopair";
|
||||||
|
rev = "34a8bca0c18fcf3ab1561caef9790abffc1d3d49";
|
||||||
|
sha256 = "1h0vm2dgrmb8i2pvsgis3lshc5b0ad846836m62y8h3rdb3zmpy1";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# https://github.com/zsh-users/zsh-history-substring-search
|
||||||
|
name = "zsh-history-substring-search";
|
||||||
|
file = "zsh-history-substring-search.plugin.zsh";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "zsh-users";
|
||||||
|
repo = "zsh-history-substring-search";
|
||||||
|
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
|
||||||
|
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
29
users/common/starship.nix
Normal file
29
users/common/starship.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{lib, ...}: {
|
||||||
|
programs.starship = {
|
||||||
|
enable = true;
|
||||||
|
enableNushellIntegration = true;
|
||||||
|
settings = {
|
||||||
|
add_newline = false;
|
||||||
|
format = lib.concatStrings [
|
||||||
|
"$username"
|
||||||
|
"$hostname"
|
||||||
|
"$directory"
|
||||||
|
"$git_branch"
|
||||||
|
"$git_commit"
|
||||||
|
"$git_state"
|
||||||
|
"$git_status"
|
||||||
|
"$character"
|
||||||
|
];
|
||||||
|
right_format = lib.concatStrings [
|
||||||
|
"$cmd_duration"
|
||||||
|
"$package"
|
||||||
|
"$haskell"
|
||||||
|
"$python"
|
||||||
|
"$rust"
|
||||||
|
"$nix_shell"
|
||||||
|
"$line_break"
|
||||||
|
"$jobs"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
78
users/common/zsh.nix
Normal file
78
users/common/zsh.nix
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
enableAutosuggestions = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
enableSyntaxHighlighting = true;
|
||||||
|
enableVteIntegration = pkgs.stdenv.isLinux;
|
||||||
|
autocd = true;
|
||||||
|
dotDir = ".config/zsh";
|
||||||
|
history = {
|
||||||
|
expireDuplicatesFirst = true;
|
||||||
|
extended = true;
|
||||||
|
ignoreDups = true;
|
||||||
|
path = "${config.xdg.dataHome}/zsh/history";
|
||||||
|
save = 10000;
|
||||||
|
share = true;
|
||||||
|
};
|
||||||
|
envExtra = ''
|
||||||
|
export LESSHISTFILE="${config.xdg.dataHome}/less_history"
|
||||||
|
export CARGO_HOME="${config.xdg.cacheHome}/cargo"
|
||||||
|
'';
|
||||||
|
initExtra = ''
|
||||||
|
nix-closure-size() {
|
||||||
|
nix-store -q --size $(nix-store -qR $(${pkgs.coreutils}/bin/readlink -e $1) ) |
|
||||||
|
${pkgs.gawk}/bin/gawk '{ a+=$1 } END { print a }' |
|
||||||
|
${pkgs.coreutils}/bin/numfmt --to=iec-i
|
||||||
|
}
|
||||||
|
bindkey "$${terminfo[khome]}" beginning-of-line
|
||||||
|
bindkey "$${terminfo[kend]}" end-of-line
|
||||||
|
bindkey "$${terminfo[kdch1]}" delete-char
|
||||||
|
bindkey '\eOA' history-substring-search-up
|
||||||
|
bindkey '\eOB' history-substring-search-down
|
||||||
|
bindkey "^[[A" history-substring-search-up
|
||||||
|
bindkey "^[[B" history-substring-search-down
|
||||||
|
bindkey "$$terminfo[kcuu1]" history-substring-search-up
|
||||||
|
bindkey "$$terminfo[kcud1]" history-substring-search-down
|
||||||
|
bindkey "^[[1;5C" forward-word
|
||||||
|
bindkey "^[[1;3C" forward-word
|
||||||
|
bindkey "^[[1;5D" backward-word
|
||||||
|
bindkey "^[[1;3D" backward-word
|
||||||
|
bindkey -s "^O" 'fzf | xargs -r $VISUAL^M'
|
||||||
|
bindkey -rpM viins '^[^['
|
||||||
|
KEYTIMEOUT=1
|
||||||
|
${pkgs.any-nix-shell}/bin/any-nix-shell zsh | source /dev/stdin
|
||||||
|
'';
|
||||||
|
sessionVariables = {
|
||||||
|
RPROMPT = "";
|
||||||
|
};
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
# https://github.com/hlissner/zsh-autopair
|
||||||
|
name = "zsh-autopair";
|
||||||
|
file = "zsh-autopair.plugin.zsh";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "hlissner";
|
||||||
|
repo = "zsh-autopair";
|
||||||
|
rev = "34a8bca0c18fcf3ab1561caef9790abffc1d3d49";
|
||||||
|
sha256 = "1h0vm2dgrmb8i2pvsgis3lshc5b0ad846836m62y8h3rdb3zmpy1";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# https://github.com/zsh-users/zsh-history-substring-search
|
||||||
|
name = "zsh-history-substring-search";
|
||||||
|
file = "zsh-history-substring-search.plugin.zsh";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "zsh-users";
|
||||||
|
repo = "zsh-history-substring-search";
|
||||||
|
rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb";
|
||||||
|
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
22
users/root/default.nix
Normal file
22
users/root/default.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; {
|
||||||
|
users.users.root = {
|
||||||
|
initialHashedPassword = "$6$EBo/CaxB.dQoq2W8$lo2b5vKgJlLPdGGhEqa08q3Irf1Zd1PcFBCwJOrG8lqjwbABkn1DEhrMh1P3ezwnww2HusUBuZGDSMa4nvSQg1";
|
||||||
|
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA5Uq+CDy5Pmt3If5M6d8K/Q7HArU6sZ7sgoj3T521Wm"];
|
||||||
|
shell = pkgs.zsh;
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.root = {
|
||||||
|
imports = [
|
||||||
|
../common
|
||||||
|
];
|
||||||
|
|
||||||
|
home.username = config.users.users.root.name;
|
||||||
|
home.uid = config.users.users.root.uid;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue