🧹 Organizing

Moved code to separate files.

Rofi config in home-manager.

Moved home.nix to /home.

Scripts to format and rebuild
This commit is contained in:
2024-12-29 00:34:39 +01:00
parent 8e91b0ca78
commit f60462a770
18 changed files with 386 additions and 209 deletions

53
home/default.nix Normal file
View File

@ -0,0 +1,53 @@
{
pkgs,
inputs,
...
}:
{
imports = [
inputs.nixvim.homeManagerModules.nixvim
./nixvim
./rofi
./wlogout
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home = {
username = "martin";
homeDirectory = "/home/martin";
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
stateVersion = "24.11";
};
programs = {
git = {
enable = true;
userName = "Martin Berg Alstad";
userEmail = "git@martials.no";
};
# Let Home Manager install and manage itself.
home-manager.enable = true;
kitty.enable = true;
starship = {
enable = true;
settings = (with builtins; fromTOML (readFile ./starship.toml)) // { };
};
# Lock desktop
swaylock.enable = true;
};
services = {
gpg-agent = {
enable = true;
pinentryPackage = pkgs.pinentry-curses;
};
};
}

58
home/nixvim/default.nix Normal file
View File

@ -0,0 +1,58 @@
# Neovim configuration for Nix
{ ... }:
{
programs.nixvim = {
enable = true;
clipboard.providers.wl-copy.enable = true;
opts = {
number = true; # Show line numbers
relativenumber = true; # Show relative line numbers
shiftwidth = 2; # Tab width should be 2
};
plugins = {
bufferline.enable = true;
# Formatters
conform-nvim = {
enable = true;
# TODO use nix fmt on save
settings = { };
};
lsp = {
enable = true;
servers = {
nixd.enable = true;
};
};
lualine.enable = true;
luasnip.enable = true;
# Completions
cmp = {
enable = true;
autoEnableSources = true;
# TODO complete on <tab>
settings = {
sources = [
{ name = "nvim-lsp"; }
{ name = "path"; }
{ name = "buffer"; }
];
};
};
treesitter.enable = true;
web-devicons.enable = true;
};
};
}

View File

@ -0,0 +1,111 @@
* {
bg-col: #1e1e2e;
bg-col-light: #1e1e2e;
border-col: #1e1e2e;
selected-col: #1e1e2e;
blue: #89b4fa;
fg-col: #cdd6f4;
fg-col2: #f38ba8;
grey: #6c7086;
width: 600;
font: "JetBrainsMono Nerd Font 14";
}
element-text, element-icon , mode-switcher {
background-color: inherit;
text-color: inherit;
}
window {
height: 360px;
border: 3px;
border-color: @border-col;
background-color: @bg-col;
}
mainbox {
background-color: @bg-col;
}
inputbar {
children: [prompt,entry];
background-color: @bg-col;
border-radius: 5px;
padding: 2px;
}
prompt {
background-color: @blue;
padding: 6px;
text-color: @bg-col;
border-radius: 3px;
margin: 20px 0px 0px 20px;
}
textbox-prompt-colon {
expand: false;
str: ":";
}
entry {
padding: 6px;
margin: 20px 0px 0px 10px;
text-color: @fg-col;
background-color: @bg-col;
}
listview {
border: 0px 0px 0px;
padding: 6px 0px 0px;
margin: 10px 0px 0px 20px;
columns: 2;
lines: 5;
background-color: @bg-col;
}
element {
padding: 5px;
background-color: @bg-col;
text-color: @fg-col ;
}
element-icon {
size: 25px;
}
element selected {
background-color: @selected-col ;
text-color: @fg-col2 ;
}
mode-switcher {
spacing: 0;
}
button {
padding: 10px;
background-color: @bg-col-light;
text-color: @grey;
vertical-align: 0.5;
horizontal-align: 0.5;
}
button selected {
background-color: @bg-col;
text-color: @blue;
}
message {
background-color: @bg-col-light;
margin: 2px;
padding: 2px;
border-radius: 5px;
}
textbox {
padding: 6px;
margin: 20px 0px 0px 20px;
text-color: @blue;
background-color: @bg-col-light;
}

24
home/rofi/default.nix Normal file
View File

@ -0,0 +1,24 @@
# App runner
{ ... }:
{
programs.rofi = {
enable = true;
# TODO get theme to work
# theme = lib.mkDefault ./catppuccin-mocha.rasi;
extraConfig = {
modi = "run,drun,window";
icon-theme = "Oranchelo";
show-icons = true;
terminal = "kitty";
drun-display-format = "{icon} {name}";
disable-history = false;
hide-scrollbar = true;
display-drun = " Apps ";
display-run = " Run ";
display-window = " 󰕰 Window";
display-Network = " 󰤨 Network";
sidebar-mode = true;
};
};
}

174
home/starship.toml Normal file
View File

@ -0,0 +1,174 @@
"$schema" = 'https://starship.rs/config-schema.json'
palette = "catppuccin_mocha"
format = """
[](mantle)\
$os\
$username\
[](bg:lavender fg:mantle)\
$directory\
[](fg:lavender bg:blue)\
$git_branch\
$git_status\
[](fg:blue bg:#86BBD8)\
$c\
$elixir\
$elm\
$golang\
$gradle\
$haskell\
$java\
$julia\
$nodejs\
$nim\
$rust\
$scala\
[](fg:#86BBD8 bg:#06969A)\
$docker_context\
[](fg:#06969A bg:#33658A)\
$time\
[ ](fg:#33658A)\
"""
# Disable the blank line at the start of the prompt
# add_newline = false
[palettes.catppuccin_mocha]
rosewater = "#f5e0dc"
flamingo = "#f2cdcd"
pink = "#f5c2e7"
mauve = "#cba6f7"
red = "#f38ba8"
maroon = "#eba0ac"
peach = "#fab387"
yellow = "#f9e2af"
green = "#a6e3a1"
teal = "#94e2d5"
sky = "#89dceb"
sapphire = "#74c7ec"
blue = "#89b4fa"
lavender = "#b4befe"
text = "#cdd6f4"
subtext1 = "#bac2de"
subtext0 = "#a6adc8"
overlay2 = "#9399b2"
overlay1 = "#7f849c"
overlay0 = "#6c7086"
surface2 = "#585b70"
surface1 = "#45475a"
surface0 = "#313244"
base = "#1e1e2e"
mantle = "#181825"
crust = "#11111b"
# You can also replace your username with a neat symbol like  or disable this
# and use the os module below
[username]
show_always = false
style_user = "bg:crust"
style_root = "bg:mantle"
format = "[$user]($style) in "
disabled = false
[os]
style = "bg:mantle"
disabled = false
[directory]
style = "bg:lavender fg:base"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
[directory.substitutions]
"Documents" = "󰈙 "
"Downloads" = " "
"Music" = " "
"Pictures" = " "
# Keep in mind that the order matters. For example:
# "Important Documents" = " 󰈙 "
# will not be replaced, because "Documents" was already substituted before.
# So either put "Important Documents" before "Documents" or use the substituted version:
# "Important 󰈙 " = " 󰈙 "
[c]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[docker_context]
symbol = " "
style = "bg:#06969A"
format = '[ $symbol $context ]($style)'
[elixir]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[elm]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[git_branch]
symbol = " "
style = "bg:blue fg:base"
format = '[ $symbol $branch ]($style)'
[git_status]
style = "bg:blue fg:base"
format = '[$all_status$ahead_behind ]($style)'
[golang]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[gradle]
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[haskell]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[java]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[julia]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[nodejs]
symbol = ""
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[nim]
symbol = "󰆥 "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[rust]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[scala]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[time]
disabled = false
time_format = "%R" # Hour:Minute Format
style = "bg:#33658A"
format = '[ $time ]($style)'

56
home/wlogout/default.nix Normal file
View File

@ -0,0 +1,56 @@
# Log out and shutdown menu
{ ... }:
{
home.file = {
".config/wlogout/hibernate.svg".source = ./hibernate.svg;
".config/wlogout/lock.svg".source = ./lock.svg;
".config/wlogout/logout.svg".source = ./logout.svg;
".config/wlogout/reboot.svg".source = ./reboot.svg;
".config/wlogout/shutdown.svg".source = ./shutdown.svg;
".config/wlogout/suspend.svg".source = ./suspend.svg;
};
programs.wlogout = {
enable = true;
layout = [
{
label = "lock";
action = "sh -c '(sleep 0.5s; swaylock)' & disown";
text = "Lock";
keybind = "l";
}
{
label = "hibernate";
action = "systemctl hibernate";
text = "Hibernate";
keybind = "h";
}
{
label = "logout";
action = "loginctl terminate-user $USER";
text = "Logout";
keybind = "e";
}
{
label = "shutdown";
action = "systemctl poweroff";
text = "Shutdown";
keybind = "s";
}
{
label = "suspend";
action = "systemctl suspend";
text = "Suspend";
keybind = "u";
}
{
label = "reboot";
action = "systemctl reboot";
text = "Reboot";
keybind = "r";
}
];
style = ./style.css;
};
}