added starship

This commit is contained in:
Charlie Root 2024-07-06 22:13:28 +02:00
commit f4f1c5bba7
15 changed files with 553 additions and 71 deletions

View file

@ -1,8 +1,13 @@
# nichts # nichts
My personal collection of NixOS configuration files My personal collection of NixOS configuration files
# License
No Idea at this point # License
# Flake structure:
No Idea at this point
# Flake structure:
``` ```
. .
├── assets ├── assets
@ -12,8 +17,8 @@ No Idea at this point
├── hosts # My different hosts ├── hosts # My different hosts
│   ├── default.nix # Where the different hosts are specified │   ├── default.nix # Where the different hosts are specified
│   └── vali │   └── vali
│   └── mars # My main computer │   └── mars # My main computer
│   ├── configuration.nix # Main configuration file │   ├── configuration.nix # Main configuration file
│   ├── default.nix │   ├── default.nix
│   ├── hardware-configuration.nix # Hardware config for my system │   ├── hardware-configuration.nix # Hardware config for my system
│   ├── profile.nix # importing different system options │   ├── profile.nix # importing different system options
@ -30,7 +35,7 @@ No Idea at this point
│   │   └── nh.nix # nix helper config │   │   └── nh.nix # nix helper config
│   ├── default.nix │   ├── default.nix
│   ├── editors # My different editors │   ├── editors # My different editors
│   │   ├── default.nix │   │   ├── default.nix
│   │   ├── emacs.nix # Emacs config │   │   ├── emacs.nix # Emacs config
│   │   ├── helix.nix # Helix config │   │   ├── helix.nix # Helix config
│   │   ├── kakoune.nix # Kakoune config │   │   ├── kakoune.nix # Kakoune config
@ -87,7 +92,7 @@ No Idea at this point
│   │   │   └── default.nix │   │   │   └── default.nix
│   │   ├── services.nix # Enabled services I need in wayland │   │   ├── services.nix # Enabled services I need in wayland
│   │   └── variables.nix # Wayland system variables │   │   └── variables.nix # Wayland system variables
│   └── x # My X window managers │   └── x # My X window managers
│   ├── awesome # Awesome window manager │   ├── awesome # Awesome window manager
│   │   ├── awesome.nix # Awesome config │   │   ├── awesome.nix # Awesome config
│   │   └── rc.lua # Awesome config file │   │   └── rc.lua # Awesome config file
@ -109,12 +114,14 @@ No Idea at this point
├── overlay.nix # Overlays ├── overlay.nix # Overlays
└── README.md # This file # This file └── README.md # This file # This file
``` ```
# credits # credits
``` ```
*heavily* inspired by https://git.jacekpoz.pl/jacekpoz/niksos.git ! *heavily* inspired by https://git.jacekpoz.pl/jacekpoz/niksos.git !
Sioodmy: https://github.com/sioodmy/dotfiles Sioodmy: https://github.com/sioodmy/dotfiles
Heinrik Lissner: https://github.com/hlissner/dotfiles/ Heinrik Lissner: https://github.com/hlissner/dotfiles/
Lokasku: https://github.com/lokasku/nix-config Lokasku: https://github.com/lokasku/nix-config
NotaShelf: https://github.com/notashelf/Nyx NotAShelf: https://github.com/notashelf/Nyx
Wallpapers: https://github.com/zhichaoh/catppuccin-wallpapers?tab=readme-ov-file Wallpapers: https://github.com/zhichaoh/catppuccin-wallpapers?tab=readme-ov-file
``` ```

View file

@ -69,6 +69,7 @@
spicetify.enable = true; spicetify.enable = true;
schizofox.enable = true; schizofox.enable = true;
anyrun.enable = true; anyrun.enable = true;
ags.enable = true;
}; };
editors = { editors = {
emacs = { emacs = {

View file

@ -4,7 +4,7 @@ _: {
../../../options/common/bluetooth.nix ../../../options/common/bluetooth.nix
../../../options/desktop/fonts.nix ../../../options/desktop/fonts.nix
../../../options/common/networking.nix ../../../options/common/networking.nix
../../../options/common/gpu/nvidia.nix # ../../../options/common/gpu/nvidia.nix
../../../options/desktop/monitors.nix ../../../options/desktop/monitors.nix
../../../overlay.nix ../../../overlay.nix
]; ];

View file

@ -3,7 +3,6 @@
pkgs, pkgs,
... ...
}: let }: let
fenix = inputs.fenix.packages.${pkgs.system};
nixpkgs-wayland = inputs.nixpkgs-wayland.packages.${pkgs.system}; nixpkgs-wayland = inputs.nixpkgs-wayland.packages.${pkgs.system};
in { in {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -14,6 +13,7 @@ in {
blueman blueman
bluetuith bluetuith
bluez bluez
bun
cmake cmake
difftastic difftastic
dig dig
@ -87,6 +87,7 @@ in {
ventoy-full ventoy-full
vlc vlc
weechat weechat
wezterm
wget wget
wireguard-tools wireguard-tools
wl-clipboard wl-clipboard

View file

@ -62,6 +62,7 @@ in {
kys = "shutdown now"; kys = "shutdown now";
lg = "lazygit"; lg = "lazygit";
cd = "z"; cd = "z";
"..." = "cd ../..";
v = "nvim"; v = "nvim";
h = "hx"; h = "hx";
k = "kak"; k = "kak";

103
modules/cli/starship.nix Normal file
View file

@ -0,0 +1,103 @@
{
config,
lib,
...
}: let
inherit (builtins) map;
inherit (lib.strings) concatStrings;
in {
home = {
sessionVariables = {
STARSHIP_CACHE = "${config.xdg.cacheHome}/starship";
};
};
programs.starship = let
elemsConcatted = concatStrings (
map (s: "\$${s}") [
"hostname"
"username"
"directory"
"shell"
"nix_shell"
"git_branch"
"git_commit"
"git_state"
"git_status"
"jobs"
"cmd_duration"
]
);
in {
enable = true;
settings = {
scan_timeout = 2;
command_timeout = 2000; # nixpkgs makes starship implode with lower values
add_newline = false;
line_break.disabled = false;
format = "${elemsConcatted}\n$character";
hostname = {
ssh_only = true;
disabled = false;
format = "@[$hostname](bold blue) "; # the whitespace at the end is actually important
};
# configure specific elements
character = {
error_symbol = "[](bold red)";
success_symbol = "[](bold green)";
vicmd_symbol = "[](bold yellow)";
format = "$symbol [|](bold bright-black) ";
};
username = {
format = "[$user]($style) in ";
};
directory = {
truncation_length = 2;
# removes the read_only symbol from the format, it doesn't play nicely with my folder icon
format = "[ ](bold green) [$path]($style) ";
# the following removes tildes from the path, and substitutes some folders with shorter names
substitutions = {
"~/Dev" = "Dev";
"~/Documents" = "Docs";
};
};
# git
git_commit.commit_hash_length = 7;
git_branch.style = "bold purple";
git_status = {
style = "red";
ahead = " ";
behind = " ";
conflicted = " ";
renamed = "»";
deleted = " ";
diverged = " ";
modified = "!";
stashed = "";
staged = "+";
untracked = "?";
};
# language configurations
# the whitespaces at the end *are* necessary for proper formatting
lua.symbol = "[ ](blue) ";
python.symbol = "[ ](blue) ";
rust.symbol = "[ ](red) ";
nix_shell.symbol = "[󱄅 ](blue) ";
golang.symbol = "[󰟓 ](blue)";
c.symbol = "[ ](black)";
nodejs.symbol = "[󰎙 ](yellow)";
package.symbol = "📦 ";
};
};
}

View file

@ -4,7 +4,7 @@
# General # General
"<leader>fd".action = ":lua vim.g.formatsave = not vim.g.formatsave<CR>"; "<leader>fd".action = ":lua vim.g.formatsave = not vim.g.formatsave<CR>";
"<leader>zt".action = ":<C-U>let g:default_terminal = v:count1<CR>"; "<leader>zt".action = ":<C-U>let g:default_terminal = v:count1<CR>";
"<leader>e".action = ":<leader>tf"; "<leader>e".action = ":NvimTreeToggle<CR>";
"<leader>ld".action = ":lua vim.diagnostic.setqflist({open = true})<CR>"; "<leader>ld".action = ":lua vim.diagnostic.setqflist({open = true})<CR>";
"<leader>lf".action = ":lua vim.lsp.buf.format()<CR>"; "<leader>lf".action = ":lua vim.lsp.buf.format()<CR>";
"<leader>li".action = ":lua vim.lsp.buf.implementation()<CR>"; "<leader>li".action = ":lua vim.lsp.buf.implementation()<CR>";

Binary file not shown.

View file

@ -99,12 +99,35 @@ in {
]; ];
}; };
extensions = { extensions = {
# simplefox.enable = true; simplefox.enable = true;
darkreader.enable = true; darkreader.enable = true;
# vimium.enable = true; extraExtensions = let
extraExtensions = { mkUrl = name: "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi";
"webextension@vimium".install_url = "https://addons.mozilla.org/firefox/downloads/file/4259790/vimium_ff-2.1.2.xpi"; extensions = [
}; {
id = "1018e4d6-728f-4b20-ad56-37578a4de76";
name = "flagfox";
}
{
id = "{c2c003ee-bd69-42a2-b0e9-6f34222cb046}";
name = "auto-tab-discard";
}
{
id = "{a4c4eda4-fb84-4a84-b4a1-f7c1cbf2a1ad}";
name = "refined-github-";
}
{
id = "sponsorBlocker@ajay.app";
name = "sponsorblock";
}
{
id = "uBlock0@raymondhill.net";
name = "UBlock Origin";
}
];
extraExtensions = builtins.foldl' (acc: ext: acc // {ext.id = {install_url = mkUrl ext.name;};}) {} extensions;
in
extraExtensions;
}; };
security = { security = {
sanitizeOnShutdown = false; sanitizeOnShutdown = false;

View file

@ -1 +1,31 @@
_: {} {
inputs,
lib,
config,
pkgs,
...
}
: let
inherit (config.modules.other.system) username;
inherit (lib) mkIf mkEnableOption;
cfg = config.modules.programs.ags;
in {
options.modules.programs.ags.enable = mkEnableOption "ags";
config = mkIf cfg.enable {
home-manager.users.${username} = {
imports = [inputs.ags.homeManagerModules.default];
programs.ags = {
enable = true;
configDir = ./config;
extraPackages = with pkgs; [
ags
bun
gtksourceview
webkitgtk
accountsservice
];
};
};
};
}

View file

@ -0,0 +1,21 @@
const main = "/tmp/ags/main.js";
try {
await Utils.execAsync([
"bun",
"build",
`${App.configDir}/main.ts`,
"--outfile",
main,
"--external",
"resource://*",
"--external",
"gi://*",
"--external",
"file://*",
]);
await import(`file://${main}`);
} catch (error) {
console.error(error);
App.quit();
}

View file

@ -0,0 +1,219 @@
const hyprland = await Service.import("hyprland")
const notifications = await Service.import("notifications")
const mpris = await Service.import("mpris")
const audio = await Service.import("audio")
const battery = await Service.import("battery")
const systemtray = await Service.import("systemtray")
const date = Variable("", {
poll: [1000, 'date "+%H:%M:%S %b %e."'],
})
// widgets can be only assigned as a child in one container
// so to make a reuseable widget, make it a function
// then you can simply instantiate one by calling it
function Workspaces() {
const activeId = hyprland.active.workspace.bind("id")
const workspaces = hyprland.bind("workspaces")
.as(ws => ws.map(({ id }) => Widget.Button({
on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`),
class_name: activeId.as(i => `${i === id ? "focused" : ""}`),
})))
return Widget.Box({
class_name: "workspaces",
children: workspaces,
})
}
function ClientTitle() {
return Widget.Label({
class_name: "client-title",
label: hyprland.active.client.bind("title"),
})
}
function Clock() {
return Widget.Label({
class_name: "clock",
label: date.bind(),
})
}
// we don't need dunst or any other notification daemon
// because the Notifications module is a notification daemon itself
function Notification() {
const popups = notifications.bind("popups")
return Widget.Box({
class_name: "notification",
visible: popups.as(p => p.length > 0),
children: [
Widget.Icon({
icon: "preferences-system-notifications-symbolic",
}),
Widget.Label({
label: popups.as(p => p[0]?.summary || ""),
}),
],
})
}
function Media() {
const label = Utils.watch("", mpris, "player-changed", () => {
if (mpris.players[0]) {
const { track_artists, track_title } = mpris.players[0]
return `${track_artists.join(", ")} - ${track_title}`
} else {
return "Nothing is playing"
}
})
return Widget.Button({
class_name: "media",
on_primary_click: () => mpris.getPlayer("")?.playPause(),
on_scroll_up: () => mpris.getPlayer("")?.next(),
on_scroll_down: () => mpris.getPlayer("")?.previous(),
child: Widget.Label({ label }),
})
}
function Volume() {
const icons = {
101: "overamplified",
67: "high",
34: "medium",
1: "low",
0: "muted",
}
function getIcon() {
const icon = audio.speaker.is_muted ? 0 : [101, 67, 34, 1, 0].find(
threshold => threshold <= audio.speaker.volume * 100)
return `audio-volume-${icons[icon]}-symbolic`
}
const icon = Widget.Icon({
icon: Utils.watch(getIcon(), audio.speaker, getIcon),
})
const slider = Widget.Slider({
hexpand: true,
draw_value: false,
on_change: ({ value }) => audio.speaker.volume = value,
setup: self => self.hook(audio.speaker, () => {
self.value = audio.speaker.volume || 0
}),
})
return Widget.Box({
class_name: "volume",
css: "min-width: 180px",
children: [icon, slider],
})
}
function BatteryLabel() {
const value = battery.bind("percent").as(p => p > 0 ? p / 100 : 0)
const icon = battery.bind("percent").as(p =>
`battery-level-${Math.floor(p / 10) * 10}-symbolic`)
return Widget.Box({
class_name: "battery",
visible: battery.bind("available"),
children: [
Widget.Icon({ icon }),
Widget.LevelBar({
widthRequest: 140,
vpack: "center",
value,
}),
],
})
}
function SysTray() {
const items = systemtray.bind("items")
.as(items => items.map(item => Widget.Button({
child: Widget.Icon({ icon: item.bind("icon") }),
on_primary_click: (_, event) => item.activate(event),
on_secondary_click: (_, event) => item.openMenu(event),
tooltip_markup: item.bind("tooltip_markup"),
})))
return Widget.Box({
children: items,
})
}
// layout of the bar
function Left() {
return Widget.Box({
spacing: 8,
children: [
Workspaces(),
ClientTitle(),
],
})
}
function Center() {
return Widget.Box({
spacing: 8,
children: [
Media(),
Notification(),
],
})
}
function Right() {
return Widget.Box({
hpack: "end",
spacing: 8,
children: [
Volume(),
BatteryLabel(),
Clock(),
SysTray(),
],
})
}
function Bar(monitor = 0) {
return Widget.Window({
name: `bar-${monitor}`, // name has to be unique
class_name: "bar",
monitor,
anchor: ["top", "left", "right"],
exclusivity: "exclusive",
child: Widget.CenterBox({
start_widget: Left(),
center_widget: Center(),
end_widget: Right(),
}),
})
}
App.config({
style: "./style.css",
windows: [
Bar(),
// you can call it, for each monitor
// Bar(0),
// Bar(1)
],
})
export { }

View file

@ -0,0 +1,40 @@
window.bar {
background-color: @theme_bg_color;
color: @theme_fg_color;
}
button {
min-width: 0;
padding-top: 0;
padding-bottom: 0;
background-color: transparent;
}
button:active {
background-color: @theme_selected_bg_color;
}
button:hover {
border-bottom: 3px solid @theme_fg_color;
}
label {
font-weight: bold;
}
.workspaces button.focused {
border-bottom: 3px solid @theme_selected_bg_color;
}
.client-title {
color: @theme_selected_bg_color;
}
.notification {
color: yellow;
}
levelbar block,
highlight {
min-height: 10px;
}

View file

@ -53,46 +53,58 @@ in {
# Monitor config # Monitor config
monitor = [ monitor = [
"DP-2,1920x1080,0x0,1" "eDP-1,1920x1080,0x0,1"
"HDMI-A-2,1920x1080,1920x0,1" # "DP-2,1920x1080,0x0,1"
"HDMI-A-1,1920x1080,3840x0,1" # "HDMI-A-2,1920x1080,1920x0,1"
# "HDMI-A-1,1920x1080,3840x0,1"
# Had the shadow monitor bug, so had to disable all unknown monitors. # Had the shadow monitor bug, so had to disable all unknown monitors.
"Unknown-1,disable" "Unknown-1,disable"
]; ];
# Workspace config # Workspace config
workspace = [ workspace = [
"1,monitor:HDMI-A-1, default:true" "1,monitor:eDP-1, default:true"
"2,monitor:HDMI-A-1" "2,monitor:eDP-1"
"3,monitor:HDMI-A-1" "3,monitor:eDP-1"
"4,monitor:HDMI-A-1" "4,monitor:eDP-1"
"5,monitor:HDMI-A-1" "5,monitor:eDP-1"
"6,monitor:HDMI-A-1" "6,monitor:eDP-1"
"7,monitor:HDMI-A-1" "7,monitor:eDP-1"
"8,monitor:HDMI-A-1" "8,monitor:eDP-1"
"9,monitor:HDMI-A-1" "9,monitor:eDP-1"
"10,monitor:HDMI-A-1" "10,monitor:eDP-1"
"11, monitor:HDMI-A-2, default:true" # "1,monitor:HDMI-A-1, default:true"
"12, monitor:HDMI-A-2" # "2,monitor:HDMI-A-1"
"13, monitor:HDMI-A-2" # "3,monitor:HDMI-A-1"
"14, monitor:HDMI-A-2" # "4,monitor:HDMI-A-1"
"15, monitor:HDMI-A-2" # "5,monitor:HDMI-A-1"
"16, monitor:HDMI-A-2" # "6,monitor:HDMI-A-1"
"17, monitor:HDMI-A-2" # "7,monitor:HDMI-A-1"
"18, monitor:HDMI-A-2" # "8,monitor:HDMI-A-1"
"19, monitor:HDMI-A-2" # "9,monitor:HDMI-A-1"
"20, monitor:HDMI-A-2" # "10,monitor:HDMI-A-1"
"21, monitor:DP-2, default:true" #"11, monitor:HDMI-A-2, default:true"
"22, monitor:DP-2" #"12, monitor:HDMI-A-2"
"23, monitor:DP-2" #"13, monitor:HDMI-A-2"
"24, monitor:DP-2" #"14, monitor:HDMI-A-2"
"25, monitor:DP-2" #"15, monitor:HDMI-A-2"
"26, monitor:DP-2" #"16, monitor:HDMI-A-2"
"27, monitor:DP-2" #"17, monitor:HDMI-A-2"
"28, monitor:DP-2" #"18, monitor:HDMI-A-2"
"29, monitor:DP-2" #"19, monitor:HDMI-A-2"
"30, monitor:DP-2" #"20, monitor:HDMI-A-2"
#
#"21, monitor:DP-2, default:true"
#"22, monitor:DP-2"
#"23, monitor:DP-2"
#"24, monitor:DP-2"
#"25, monitor:DP-2"
#"26, monitor:DP-2"
#"27, monitor:DP-2"
#"28, monitor:DP-2"
#"29, monitor:DP-2"
#"30, monitor:DP-2"
# scratchpads # scratchpads
"special:btop, decorate:false" "special:btop, decorate:false"
@ -189,26 +201,48 @@ in {
"$mainMod, O, exec, obsidian --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu" "$mainMod, O, exec, obsidian --ozone-platform=wayland --enable-features=UseOzonePlatform --enable-features=WaylandWindowDecorations --enable-features=WebRTCPipeWireCpaturer --disable-gpu"
# workspaces # workspaces
# split-workspace is because of the split-workspace plugin # split-workspace is because of the split-workspace plugin
"$mainMod, 1, split-workspace, 1" "$mainMod, 1, workspace, 1"
"$mainMod, 2, split-workspace, 2" "$mainMod, 2, workspace, 2"
"$mainMod, 3, split-workspace, 3" "$mainMod, 3, workspace, 3"
"$mainMod, 4, split-workspace, 4" "$mainMod, 4, workspace, 4"
"$mainMod, 5, split-workspace, 5" "$mainMod, 5, workspace, 5"
"$mainMod, 6, split-workspace, 6" "$mainMod, 6, workspace, 6"
"$mainMod, 7, split-workspace, 7" "$mainMod, 7, workspace, 7"
"$mainMod, 8, split-workspace, 8" "$mainMod, 8, workspace, 8"
"$mainMod, 9, split-workspace, 9" "$mainMod, 9, workspace, 9"
"$mainMod, 0, split-workspace, 10" "$mainMod, 0, workspace, 10"
"$mainMod SHIFT, 1, split-movetoworkspacesilent, 1" "$mainMod SHIFT, 1, movetoworkspacesilent, 1"
"$mainMod SHIFT, 2, split-movetoworkspacesilent, 2" "$mainMod SHIFT, 2, movetoworkspacesilent, 2"
"$mainMod SHIFT, 3, split-movetoworkspacesilent, 3" "$mainMod SHIFT, 3, movetoworkspacesilent, 3"
"$mainMod SHIFT, 4, split-movetoworkspacesilent, 4" "$mainMod SHIFT, 4, movetoworkspacesilent, 4"
"$mainMod SHIFT, 5, split-movetoworkspacesilent, 5" "$mainMod SHIFT, 5, movetoworkspacesilent, 5"
"$mainMod SHIFT, 6, split-movetoworkspacesilent, 6" "$mainMod SHIFT, 6, movetoworkspacesilent, 6"
"$mainMod SHIFT, 7, split-movetoworkspacesilent, 7" "$mainMod SHIFT, 7, movetoworkspacesilent, 7"
"$mainMod SHIFT, 8, split-movetoworkspacesilent, 8" "$mainMod SHIFT, 8, movetoworkspacesilent, 8"
"$mainMod SHIFT, 9, split-movetoworkspacesilent, 9" "$mainMod SHIFT, 9, movetoworkspacesilent, 9"
"$mainMod SHIFT, 0, split-movetoworkspacesilent, 10" "$mainMod SHIFT, 0, movetoworkspacesilent, 10"
# split-workspace is because of the split-workspace plugin
# "$mainMod, 1, split-workspace, 1"
# "$mainMod, 2, split-workspace, 2"
# "$mainMod, 3, split-workspace, 3"
# "$mainMod, 4, split-workspace, 4"
# "$mainMod, 5, split-workspace, 5"
# "$mainMod, 6, split-workspace, 6"
# "$mainMod, 7, split-workspace, 7"
# "$mainMod, 8, split-workspace, 8"
# "$mainMod, 9, split-workspace, 9"
# "$mainMod, 0, split-workspace, 10"
# "$mainMod SHIFT, 1, split-movetoworkspacesilent, 1"
# "$mainMod SHIFT, 2, split-movetoworkspacesilent, 2"
# "$mainMod SHIFT, 3, split-movetoworkspacesilent, 3"
# "$mainMod SHIFT, 4, split-movetoworkspacesilent, 4"
# "$mainMod SHIFT, 5, split-movetoworkspacesilent, 5"
# "$mainMod SHIFT, 6, split-movetoworkspacesilent, 6"
# "$mainMod SHIFT, 7, split-movetoworkspacesilent, 7"
# "$mainMod SHIFT, 8, split-movetoworkspacesilent, 8"
# "$mainMod SHIFT, 9, split-movetoworkspacesilent, 9"
# "$mainMod SHIFT, 0, split-movetoworkspacesilent, 10"
# Move Windows # Move Windows
"$mainMod SHIFT, H, movewindow, l" "$mainMod SHIFT, H, movewindow, l"

View file

@ -7,7 +7,9 @@
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
package = pkgs.mesa.drivers; package = pkgs.mesa.drivers;
# driSupport32Bit = true; extraPackages = with pkgs; [
vpl-gpu-rt
];
}; };
hardware.nvidia = { hardware.nvidia = {
modesetting.enable = true; modesetting.enable = true;