feat(flake)!: common home-manager settings

Automatically add the flake's overlays to `home-manager`'s `nixpkgs.overlays`
Split up `reo101-shell`
Upgdate `cheetah` to `23.05`
Some formatting
This commit is contained in:
reo101 2023-07-25 23:42:47 +03:00
parent de43011b22
commit bc81e59950
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
9 changed files with 437 additions and 327 deletions

View file

@ -9,7 +9,7 @@
# Nix on Droid
nix-on-droid = {
url = "github:t184256/nix-on-droid/release-22.11";
url = "github:t184256/nix-on-droid/release-23.05";
# url = "github:t184256/nix-on-droid/master";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";

View file

@ -7,43 +7,21 @@
stateVersion = "23.05";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Use this flake's version of nixpkgs
home.sessionVariables = {
# NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
NIX_PATH =
builtins.concatStringsSep
":"
(lib.mapAttrsToList
(name: input:
"${name}=${input.sourceInfo.outPath}")
inputs);
# Add custom overlays
nixpkgs = {
overlays = [
inputs.neovim-nightly-overlay.overlay
inputs.zig-overlay.overlays.default
];
};
# {
# _type = "flake";
# inputs = <CODE>;
# lastModified = 1686838567;
# lastModifiedDate = "20230615141607";
# narHash = "sha256-aqKCUD126dRlVSKV6vWuDCitfjFrZlkwNuvj5LtjRRU=";
# nixosModules = <CODE>;
# outPath = "/nix/store/mf3nazm479fkbh9n3v7n73yrcvr8avi6-source";
# outputs = {
# nixosModules = <CODE>;
# };
# rev = "429f232fe1dc398c5afea19a51aad6931ee0fb89";
# shortRev = "429f232";
# sourceInfo = {
# lastModified = 1686838567;
# lastModifiedDate = "20230615141607";
# narHash = "sha256-aqKCUD126dRlVSKV6vWuDCitfjFrZlkwNuvj5LtjRRU=";
# outPath = "/nix/store/mf3nazm479fkbh9n3v7n73yrcvr8avi6-source";
# rev = "429f232fe1dc398c5afea19a51aad6931ee0fb89";
# shortRev = "429f232";
# };
# }
# Set env vars
home.sessionVariables = {
EDITOR = "nvim";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.packages = with pkgs; [
# WM
@ -107,15 +85,6 @@
};
};
nixpkgs = {
overlays = lib.attrValues outputs.overlays ++ [
inputs.neovim-nightly-overlay.overlay
inputs.zig-overlay.overlays.default
];
config.allowUnfree = true;
};
programs.git = {
enable = true;
userName = "reo101";

View file

@ -7,7 +7,16 @@
username = "nix-on-droid";
# username = "reo101";
homeDirectory = "/data/data/com.termux.nix/files/home";
stateVersion = "22.11";
stateVersion = "23.05";
};
# Add custom overlays
nixpkgs = {
overlays = [
inputs.neovim-nightly-overlay.overlay
inputs.zig-overlay.overlays.default
# inputs.zls-overlay.???
];
};
# Let Home Manager install and manage itself.
@ -65,16 +74,6 @@
j
];
nixpkgs = {
overlays = [
inputs.neovim-nightly-overlay.overlay
inputs.zig-overlay.overlays.default
# inputs.zls-overlay.???
];
config.allowUnfree = true;
};
programs.neovim = {
enable = true;
package = pkgs.neovim-nightly;

View file

@ -0,0 +1,28 @@
{ inputs, outputs, ... }:
{ lib, pkgs, config, ... }:
{
imports = [ ];
options = { };
config = {
# Add flake inputs to $NIX_PATH
home.sessionVariables = {
NIX_PATH =
builtins.concatStringsSep
":"
(lib.mapAttrsToList
(name: input:
"${name}=${input.sourceInfo.outPath}")
inputs);
};
# Use flake overlays by default
nixpkgs = {
overlays = lib.attrValues outputs.overlays;
config.allowUnfree = true;
};
};
}

View file

@ -0,0 +1,79 @@
{ keyPath, ... }:
''
## where to store your database, default is your system data directory
## mac: ~/Library/Application Support/com.elliehuxtable.atuin/history.db
## linux: ~/.local/share/atuin/history.db
# db_path = "~/.history.db"
## where to store your encryption key, default is your system data directory
key_path = "${keyPath}"
## where to store your auth session token, default is your system data directory
# session_path = "~/.key"
## date format used, either "us" or "uk"
# dialect = "us"
## enable or disable automatic sync
auto_sync = true
## enable or disable automatic update checks
update_check = false
## address of the sync server
sync_address = "https://naboo.qtrp.org/atuin"
## how often to sync history. note that this is only triggered when a command
## is ran, so sync intervals may well be longer
## set it to 0 to sync after every command
sync_frequency = "1m"
## which search mode to use
## possible values: prefix, fulltext, fuzzy, skim
# search_mode = "fuzzy"
## which filter mode to use
## possible values: global, host, session, directory
filter_mode = "global"
# ## which filter mode to use when atuin is invoked from a shell up-key binding
# ## the accepted values are identical to those of "filter_mode"
# ## leave unspecified to use same mode set in "filter_mode"
# filter_mode_shell_up_keybinding = "session"
## which style to use
## possible values: auto, full, compact
# style = "auto"
## the maximum number of lines the interface should take up
## set it to 0 to always go full screen
# inline_height = 0
## enable or disable showing a preview of the selected command
## useful when the command is longer than the terminal width and is cut off
# show_preview = false
## what to do when the escape key is pressed when searching
## possible values: return-original, return-query
# exit_mode = "return-original"
## possible values: emacs, subl
# word_jump_mode = "emacs"
## characters that count as a part of a word
# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
## number of context lines to show when scrolling by pages
# scroll_context_lines = 1
## prevent commands matching any of these regexes from being written to history.
## Note that these regular expressions are unanchored, i.e. if they don't start
## with ^ or end with $, they'll match anywhere in the command.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
# history_filter = [
# "^secret-cmd",
# "^innocuous-cmd .*--secret=.+"
# ]
''

View file

@ -68,6 +68,14 @@ in
])
];
# Atuin
home.file."${config.xdg.configHome}/config.toml" = mkIf cfg.atuin {
text = import ./atuin.nix {
keyPath = "${config.xdg.dataHome}/atuin/key";
};
};
# Direnv
programs.direnv = mkIf cfg.direnv {
enable = true;
@ -76,6 +84,14 @@ in
};
};
# Starship
programs.starship = {
enable = true;
settings = import ./starship.nix { username = cfg.username; };
};
# Zsh
programs.zsh = {
enable = true;
enableCompletion = true;
@ -174,274 +190,6 @@ in
}
];
};
home.file.".config/atuin/config.toml" = mkIf cfg.atuin {
text = ''
## where to store your database, default is your system data directory
## mac: ~/Library/Application Support/com.elliehuxtable.atuin/history.db
## linux: ~/.local/share/atuin/history.db
# db_path = "~/.history.db"
## where to store your encryption key, default is your system data directory
# key_path = "~/.key"
## where to store your auth session token, default is your system data directory
# session_path = "~/.key"
## date format used, either "us" or "uk"
# dialect = "us"
## enable or disable automatic sync
auto_sync = true
## enable or disable automatic update checks
update_check = false
## address of the sync server
sync_address = "https://naboo.qtrp.org/atuin"
## how often to sync history. note that this is only triggered when a command
## is ran, so sync intervals may well be longer
## set it to 0 to sync after every command
sync_frequency = "1m"
## which search mode to use
## possible values: prefix, fulltext, fuzzy, skim
# search_mode = "fuzzy"
## which filter mode to use
## possible values: global, host, session, directory
filter_mode = "global"
# ## which filter mode to use when atuin is invoked from a shell up-key binding
# ## the accepted values are identical to those of "filter_mode"
# ## leave unspecified to use same mode set in "filter_mode"
# filter_mode_shell_up_keybinding = "session"
## which style to use
## possible values: auto, full, compact
# style = "auto"
## the maximum number of lines the interface should take up
## set it to 0 to always go full screen
# inline_height = 0
## enable or disable showing a preview of the selected command
## useful when the command is longer than the terminal width and is cut off
# show_preview = false
## what to do when the escape key is pressed when searching
## possible values: return-original, return-query
# exit_mode = "return-original"
## possible values: emacs, subl
# word_jump_mode = "emacs"
## characters that count as a part of a word
# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
## number of context lines to show when scrolling by pages
# scroll_context_lines = 1
## prevent commands matching any of these regexes from being written to history.
## Note that these regular expressions are unanchored, i.e. if they don't start
## with ^ or end with $, they'll match anywhere in the command.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
# history_filter = [
# "^secret-cmd",
# "^innocuous-cmd .*--secret=.+"
# ]
'';
};
programs.starship = {
enable = true;
settings = {
# Get editor completions based on the config schema
"$schema" = "https://starship.rs/config-schema.json";
# Use custom format
format = ''
[](bold green)[${cfg.username}](bright-white)[@](bold yellow)$hostname[>](bold green)$status$cmd_duration$git_branch$git_status$git_state$git_commit
[](bold green)$time$jobs: $directory$package
[](bold green)$character
'';
# ${custom.local}\
# ${custom.local_root}\
# ${custom.ssh}\
# ${custom.ssh_root}\
add_newline = true;
character = {
success_symbol = "[](bold green)";
error_symbol = "[](red)";
};
git_branch = {
symbol = "🌱 ";
truncation_length = 15;
truncation_symbol = ""; # …
};
git_commit = {
commit_hash_length = 6;
tag_symbol = "🔖 ";
};
git_state = {
format = "[\($state( $progress_current of $progress_total)\)]($style) ";
cherry_pick = "[🍒 PICKING](bold red)";
};
git_status = {
# conflicted = "🏳";
# ahead = "🏎💨";
# behind = "😰";
# diverged = "😵";
# untracked = "🤷‍";
# stashed = "📦";
# modified = "📝";
# staged = '[++\($count\)](green)';
# renamed = "👅";
# deleted = "🗑";
format = "[\\[$all_status$ahead_behind\\]]($style) ";
conflicted = "=[\($count\)](green) ";
ahead = "[\($count\)](green) ";
behind = "[\($count\)](green) ";
diverged = "[\($count\)](green) ";
untracked = "?[\($count\)](green) ";
stashed = "$[\($count\)](green) ";
modified = "![\($count\)](green) ";
staged = "+[\($count\)](green) ";
renamed = "»[\($count\)](green) ";
deleted = "[\($count\)](green) ";
};
status = {
style = "bg:blue fg:red";
symbol = "🔴";
format = "[\[$symbol $common_meaning$signal_name$maybe_int\]]($style) ";
map_symbol = true;
disabled = false;
};
time = {
disabled = false;
format = "🕙[$time]($style) ";
# format = '🕙[\[ $time \]]($style) ';
time_format = "%T";
utc_time_offset = "+3";
# time_range = "10:00:00-14:00:00";
};
cmd_duration = {
min_time = 2000; # miliseconds
# show_notifications = true;
min_time_to_notify = 45000; # miliseconds
format = "took [$duration](bold yellow) ";
};
hostname = {
ssh_only = false;
format = "[$hostname](bold fg:#CC59B0)";
disabled = false;
};
username = {
disabled = false;
style_user = "white bold";
style_root = "red bold";
format = "[$user]($style)[@](bold yellow)";
show_always = true;
};
directory = {
read_only = "🔒";
read_only_style = "bold white";
style = "fg:#A7F3E4";
truncate_to_repo = false;
truncation_length = 5;
truncation_symbol = "/";
home_symbol = "🏡";
format = "[$read_only]($read_only_style)[$path]($style) ";
};
directory.substitutions = {
".config" = " ";
"nvim" = "";
"emacs" = "𝓔";
"doom" = "𝓔";
"Projects" = "💻";
"FMI" = "🏫";
"Home" = "🏠";
"CPP" = "";
"Java" = "";
"Python" = "";
};
# Language Environments
package = {
style = "bold fg:#5E5E5E";
};
python = {
style = "bold fg:#5E5E5E";
symbol = "[](bold yellow) ";
};
nodejs = {
style = "bold fg:#5E5E5E";
symbol = "[](bold green) ";
};
# Custom
jobs = {
format = "[ $symbol$number ]($style)";
style = "bg:#587744 fg:bright-white";
symbol = "";
};
custom.local = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -z "$SSH_CLIENT" ] ] && [ [ `whoami` != "root" ] ] '';
format = "[$symbol$output]($style)[@](bold yellow)";
command = "whoami";
style = "fg:bright-white";
symbol = "";
};
custom.local_root = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -z "$SSH_CLIENT" ] ] && [ [ `whoami` == "root" ] ] '';
format = "[ $output ]($style)[@](bold yellow)";
command = "whoami";
style = "bg:red fg:bright-white";
};
custom.ssh = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -n "$SSH_CLIENT" ] ] && [ [ `whoami` != "root" ] ] '';
format = "[ $symbol$output ]($style)[@](bold yellow)";
command = "whoami";
style = "bg:blue fg:bright-white";
# style = "bg:#FD7208 fg:bright-white";
symbol = "";
};
custom.ssh_root = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -n "$SSH_CLIENT" ] ] && [ [ `whoami` == "root" ] ] '';
format = "[ $symbol$output ]($style)[@](bold yellow)";
command = "whoami";
style = "bg:red fg:bright-white";
symbol = "";
};
};
};
};
meta = {

View file

@ -0,0 +1,184 @@
{ username }:
{
# Get editor completions based on the config schema
"$schema" = "https://starship.rs/config-schema.json";
# Use custom format
format = ''
[](bold green)[${username}](bright-white)[@](bold yellow)$hostname[>](bold green)$status$cmd_duration$git_branch$git_status$git_state$git_commit
[](bold green)$time$jobs: $directory$package
[](bold green)$character
'';
# ${custom.local}\
# ${custom.local_root}\
# ${custom.ssh}\
# ${custom.ssh_root}\
add_newline = true;
character = {
success_symbol = "[](bold green)";
error_symbol = "[](red)";
};
git_branch = {
symbol = "🌱 ";
truncation_length = 15;
truncation_symbol = ""; # …
};
git_commit = {
commit_hash_length = 6;
tag_symbol = "🔖 ";
};
git_state = {
format = "[\($state( $progress_current of $progress_total)\)]($style) ";
cherry_pick = "[🍒 PICKING](bold red)";
};
git_status = {
# conflicted = "🏳";
# ahead = "🏎💨";
# behind = "😰";
# diverged = "😵";
# untracked = "🤷‍";
# stashed = "📦";
# modified = "📝";
# staged = '[++\($count\)](green)';
# renamed = "👅";
# deleted = "🗑";
format = "[\\[$all_status$ahead_behind\\]]($style) ";
conflicted = "=[\($count\)](green) ";
ahead = "[\($count\)](green) ";
behind = "[\($count\)](green) ";
diverged = "[\($count\)](green) ";
untracked = "?[\($count\)](green) ";
stashed = "$[\($count\)](green) ";
modified = "![\($count\)](green) ";
staged = "+[\($count\)](green) ";
renamed = "»[\($count\)](green) ";
deleted = "[\($count\)](green) ";
};
status = {
style = "bg:blue fg:red";
symbol = "🔴";
format = "[\[$symbol $common_meaning$signal_name$maybe_int\]]($style) ";
map_symbol = true;
disabled = false;
};
time = {
disabled = false;
format = "🕙[$time]($style) ";
# format = '🕙[\[ $time \]]($style) ';
time_format = "%T";
utc_time_offset = "+3";
# time_range = "10:00:00-14:00:00";
};
cmd_duration = {
min_time = 2000; # miliseconds
# show_notifications = true;
min_time_to_notify = 45000; # miliseconds
format = "took [$duration](bold yellow) ";
};
hostname = {
ssh_only = false;
format = "[$hostname](bold fg:#CC59B0)";
disabled = false;
};
username = {
disabled = false;
style_user = "white bold";
style_root = "red bold";
format = "[$user]($style)[@](bold yellow)";
show_always = true;
};
directory = {
read_only = "🔒";
read_only_style = "bold white";
style = "fg:#A7F3E4";
truncate_to_repo = false;
truncation_length = 5;
truncation_symbol = "/";
home_symbol = "🏡";
format = "[$read_only]($read_only_style)[$path]($style) ";
};
directory.substitutions = {
".config" = " ";
"nvim" = "";
"emacs" = "𝓔";
"doom" = "𝓔";
"Projects" = "💻";
"FMI" = "🏫";
"Home" = "🏠";
"CPP" = "";
"Java" = "";
"Python" = "";
};
# Language Environments
package = {
style = "bold fg:#5E5E5E";
};
python = {
style = "bold fg:#5E5E5E";
symbol = "[](bold yellow) ";
};
nodejs = {
style = "bold fg:#5E5E5E";
symbol = "[](bold green) ";
};
# Custom
jobs = {
format = "[ $symbol$number ]($style)";
style = "bg:#587744 fg:bright-white";
symbol = "";
};
custom.local = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -z "$SSH_CLIENT" ] ] && [ [ `whoami` != "root" ] ] '';
format = "[$symbol$output]($style)[@](bold yellow)";
command = "whoami";
style = "fg:bright-white";
symbol = "";
};
custom.local_root = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -z "$SSH_CLIENT" ] ] && [ [ `whoami` == "root" ] ] '';
format = "[ $output ]($style)[@](bold yellow)";
command = "whoami";
style = "bg:red fg:bright-white";
};
custom.ssh = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -n "$SSH_CLIENT" ] ] && [ [ `whoami` != "root" ] ] '';
format = "[ $symbol$output ]($style)[@](bold yellow)";
command = "whoami";
style = "bg:blue fg:bright-white";
# style = "bg:#FD7208 fg:bright-white";
symbol = "";
};
custom.ssh_root = {
shell = [ "zsh" "-d" "-f" ];
when = '' [ [ -n "$SSH_CLIENT" ] ] && [ [ `whoami` == "root" ] ] '';
format = "[ $symbol$output ]($style)[@](bold yellow)";
command = "whoami";
style = "bg:red fg:bright-white";
symbol = "";
};
}

View file

@ -163,7 +163,7 @@ rec {
useGlobalPkgs = false;
useUserPackages = true;
sharedModules = builtins.attrValues homeManagerModules;
extraSpecialArgs = { inherit inputs; };
extraSpecialArgs = { inherit inputs outputs; };
};
}
] ++ (builtins.attrValues nixOnDroidModules);

103
util/test.nix Normal file
View file

@ -0,0 +1,103 @@
# { lib, stdenv, darwin, fetchFromGitHub, rustPlatform, openssl, pkg-config, libxkbcommon }:
# # rustPlatform.buildRustPackage rec {
# rec {
# pname = "vim-fmi-cli";
# version = "0.2.0";
#
# src = fetchFromGitHub {
# owner = "AndrewRadev";
# repo = pname;
# rev = "v${version}";
# sha256 = "sha256-RAlvDiNvDVRNtex0aD8WESc4R/lskjda;sldfjmAr7FjWtgzHWa4ZSI=";
# };
# }
# {
# a = ''''\'''${a}''\''';
#
# src = fetchFromGitHub {
# owner = "g15ecb";
# repo = "promela-mode";
# rev = "53863e62cfedcd0466e1e19b1ca7b5786cb7a576";
# # hash = "sha256-pOVIOj5XnZcNVFNyjMV7Iv0X+R+W+mQfT1o5nay2Kww=";
# };
# }
# let
# a = "v${b}.${c}.${d}";
# b = "2";
# c = "3";
# d = "6";
# rev = a;
# in
# rec {
# src = fetchTest {
# inherit a b c rev;
# };
# rev = "aloda";
# alo = da;
# }
let
# kek
type = "256";
in
let
in
rec {
pname = "vim-fmi-cli";
version = "0.2.0";
sha = "RAlvDiNvDVRNtex0aD8WESc4R/mAr7FjWtgzHWa4ZSI=";
sha256 = "sha${type}-${sha}";
kek = let
in rec {};
src = fetchFromGitHub {
owner = "AndrewRadev";
repo = pname;
rev = "v${version}";
inherit sha256;
};
}
# let
# bb = "2";
# b = bb;
# in
# let
# # ...
# in
# fetchTest {
# a = "1";
# inherit b;
# c = "3";
# rev = "456";
# }
# let
# f = "2";
# s = "3";
# t = "4";
# a = "1";
# c = "2";
# v = "${f}.${s}.${t}";
# kek = rec {
# x = "5";
# y = x;
# };
# aloda = fetchTest rec {
# c = b;
# a = "2";
# b = a;
# rev = "v${c}";
# };
# in
# fetchTest {
# inherit a c;
# m = a;
# b = "b";
# aloda = "${a}b${c}d";
# rev = "v${v}";
# }