feat: restructure and move apps into their own configs (#2)

This commit is contained in:
Uttarayan
2025-02-05 17:09:33 +05:30
committed by GitHub
parent e25f478315
commit 0a26d94f77
52 changed files with 662 additions and 482 deletions

143
home/linux/anyrun.nix Normal file
View File

@@ -0,0 +1,143 @@
{
inputs,
pkgs,
device,
# osConfig,
...
}: {
imports = [inputs.anyrun.homeManagerModules.default];
programs.anyrun = {
enable = device.hasGui;
config = {
plugins = with inputs.anyrun.packages.${pkgs.system}; [
inputs.anyrun-nixos-options.packages.${pkgs.system}.default
inputs.anyrun-hyprwin.packages.${pkgs.system}.default
inputs.anyrun-rink.packages.${pkgs.system}.default
applications
websearch
shell
translate
symbols
kidex
];
x = {fraction = 0.5;};
y = {fraction = 0.3;};
height = {absolute = 0;};
width = {absolute = 1000;};
showResultsImmediately = true;
maxEntries = 10;
layer = "overlay";
};
extraConfigFiles = {
"nixos-options.ron".text = let
# nixos-options =
# pkgs.lib.optionalString device.isNix
# osConfig.system.build.manual.optionsJSON
# + "/share/doc/nixos/options.json";
hm-options =
inputs.home-manager.packages.${pkgs.system}.docs-json
+ "/share/doc/home-manager/options.json";
# or alternatively if you wish to read any other documentation options, such as home-manager
# get the docs-json package from the home-manager flake
# hm-options = inputs.home-manager.packages.${pkgs.system}.docs-json + "/share/doc/home-manager/options.json";
# options = builtins.toJSON {
# ":nix" = [nixos-options];
# ":hm" = [hm-options];
# ":something-else" = [some-other-option];
# ":nall" = [nixos-options hm-options some-other-option];
# };
options = builtins.toJSON {
":hm" = [hm-options];
};
# // (
# if device.isNix
# then {":nix" = [nixos-options];}
# else {}
# ));
in ''
Config(
options: ${options},
max_entries: Some(10),
)
'';
"shell.ron".text = ''
Config(
prefix: "!",
shell: None,
)
'';
"websearch.ron".text =
/*
ron
*/
''
Config(
prefix: "?",
engines: [
Google,
Custom (
name: "Nix Packages",
url: "search.nixos.org/packages?query={}&channel=unstable"
),
Custom (
name: "GitHub",
url: "github.com/search?q={}"
),
Custom (
name: "docs.rs",
url: "docs.rs/releases/search?query={}"
),
Custom (
name: "NixOS options",
url: "search.nixos.org/options?query={}"
),
DuckDuckGo,
]
)
'';
"rink.ron".text = ''
Config(
currency: Some("${
builtins.toFile "currency.units" ''
!category currencies "Currencies"
usd USD
inr INR
''
}"),
)
'';
};
extraCss = ''
window {
color: #ffffff;
background-color: rgba(15, 15, 15, .2);
border-color: #000000;
}
entry {
color: #ffffff;
background-color: rgba(40, 40, 40, .98);
padding: 14px;
font-size: 30px;
border-color: #000000;
border-radius: 10px;
}
#plugin {
color: #efefef;
border-color: #000000;
border-color: #000000;
border-radius: 5px;
}
#main {
color: #efefef;
border-color: #000000;
border-color: #000000;
border-radius: 5px;
}
'';
};
}

25
home/linux/default.nix Normal file
View File

@@ -0,0 +1,25 @@
{
lib,
device,
...
}: {
imports =
[]
++ (lib.optionals device.hasGui [
./hyprland.nix
./gtk.nix
./anyrun.nix
./ironbar
./foot.nix
./mpd.nix
]);
services.kdeconnect.enable = device.hasGui;
services.kdeconnect.indicator = device.hasGui;
services.swayosd.enable = device.hasGui;
services.swaync.enable = device.hasGui;
services.nextcloud-client = {
enable = device.hasGui;
startInBackground = true;
};
}

25
home/linux/device.nix Normal file
View File

@@ -0,0 +1,25 @@
{
devices,
inputs,
overlays,
home-manager,
...
}:
builtins.listToAttrs (builtins.map (device: {
name = device.name;
value = let
pkgs = import inputs.nixpkgs {
inherit overlays;
system = device.system;
};
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit inputs;
inherit device;
};
modules = [{nixpkgs.config.allowUnfree = true;} ../common/home.nix];
};
})
devices)

43
home/linux/foot.nix Normal file
View File

@@ -0,0 +1,43 @@
{
pkgs,
device,
...
}: {
programs.foot = {
enable = device.hasGui;
server.enable = true;
settings = {
main = {
shell = "${pkgs.fish.outPath}/bin/fish";
# font = "Hasklug Nerd Font Mono:size=13";
font = "Monaspace Krypton:size=13";
initial-window-size-pixels = "1440x800";
};
colors = {
foreground = "f8f8f2";
background = "000000";
alpha = 0.8;
"136" = "af8700";
regular0 = "21222c";
regular1 = "ff5555";
regular2 = "50fa7b";
regular3 = "f1fa8c";
regular4 = "bd93f9";
regular5 = "ff79c6";
regular6 = "8be9fd";
regular7 = "f8f8f2";
bright0 = "6272a4";
bright1 = "ff6e6e";
bright2 = "69ff94";
bright3 = "ffffa5";
bright4 = "d6acff";
bright5 = "ff92df";
bright6 = "a4ffff";
bright7 = "ffffff";
};
};
};
}

35
home/linux/gtk.nix Normal file
View File

@@ -0,0 +1,35 @@
{
pkgs,
device,
...
}: {
gtk = {
enable = device.hasGui;
theme = {
name = "catppuccin-mocha-mauve-standard+normal";
package = pkgs.adwaita-icon-theme;
# package = pkgs.catppuccin-gtk.override {
# variant = "mocha";
# size = "standard";
# accents = ["mauve"];
# tweaks = ["normal"];
# };
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.catppuccin-papirus-folders.override {
accent = "mauve";
flavor = "mocha";
};
};
cursorTheme = {
name = "Vanillay-DMZ";
package = pkgs.vanilla-dmz;
};
gtk3.extraConfig = {gtk-application-prefer-dark-theme = 1;};
gtk4.extraConfig = {gtk-application-prefer-dark-theme = 1;};
};
}

248
home/linux/hyprland.nix Normal file
View File

@@ -0,0 +1,248 @@
{
pkgs,
device,
...
}: {
imports = [
../../modules/hyprpaper.nix
];
programs.hyprpaper = let
wallpapers = import ../../utils/wallhaven.nix {inherit pkgs;};
in {
enable = device.hasGui;
# enable = true;
systemd.enable = true;
systemd.target = "hyprland-session.target";
settings.preload = wallpapers.all;
settings.wallpapers = {
"${device.monitors.primary}" = wallpapers.skull;
"${device.monitors.secondary}" = wallpapers.frieren_3;
"${device.monitors.tertiary}" = wallpapers.cloud;
};
};
programs.hyprlock = {
enable = device.hasGui;
};
wayland.windowManager.hyprland = {
enable = device.hasGui;
settings = {
source = "${pkgs.catppuccinThemes.hyprland}/themes/mocha.conf";
"render:explicit_sync" = true;
monitor = [
"${device.monitors.primary}, 2560x1440@360, 0x0, 1, transform, 0"
"${device.monitors.secondary}, 2560x1440@170, -1440x-1120, 1, transform, 1"
"${device.monitors.tertiary}, 2560x1440@170, 2560x-1120, 1, transform, 3"
];
input = {
kb_layout = "us";
# kb_variant = "";
# kb_model = "";
kb_options = "ctrl:nocaps";
# kb_rules = "";
follow_mouse = 2;
touchpad = {
natural_scroll = true;
tap-to-click = true;
disable_while_typing = true;
};
};
general = {
gaps_in = 5;
gaps_out = 20;
border_size = 2;
"col.active_border" = "$mauve $mauve 45deg";
"col.inactive_border" = "$crust";
};
decoration = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10;
# drop_shadow = true;
# shadow_range = 4;
# shadow_render_power = 3;
# col.shadow = "rgba(1a1a1aee)";
blur = {
enabled = true;
size = 3;
passes = 1;
};
};
animations = {
enabled = true;
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
animation = [
"windows, 1, 7, myBezier"
"windowsOut, 1, 7, default, popin 80%"
"border, 1, 10, default"
"borderangle, 1, 8, default"
"fade, 1, 7, default"
"workspaces, 1, 6, default"
];
};
dwindle = {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile =
true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true; # you probably want this
};
master = {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_status = "master";
};
gestures = {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = false;
};
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
# "device:epic-mouse-v1" = { sensitivity = -0.5; };
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrulev2 = [
# "float, title:^(Steam)$"
"float, title:^(Archetype.*)$"
"float, class:(.*nextcloud.*)"
"float, class:org.kde.kdeconnect.app"
];
# "misc:vfr" = true;
env = [
"XCURSOR_SIZE,24"
"XDG_SESSION_TYPE,wayland"
"MOZ_ENABLE_WAYLAND,1"
"QT_QPA_PLATFORM,wayland"
];
exec-once = [
# "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"
"${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1"
# "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
# "${pkgs.swww}/bin/swww init; swww img ~/.local/share/dotfiles/images/wallpaper.jpg"
"${pkgs.ironbar}/bin/ironbar"
# "${pkgs.swayosd}/bin/swayosd-server"
"${pkgs.nextcloud-client}/bin/nextcloud --background"
];
"$mainMod" = "SUPER";
"$mainModShift" = "SUPER_SHIFT";
binde = [
",xf86audioraisevolume, exec, ${pkgs.swayosd}/bin/swayosd-client --output-volume raise"
",xf86audiolowervolume, exec, ${pkgs.swayosd}/bin/swayosd-client --output-volume lower"
];
bind = [
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
"$mainMod, Return, exec, ${pkgs.kitty}/bin/kitty"
"$mainModShift, Return, exec, ${pkgs.foot}/bin/foot"
"$mainModShift, Q, killactive,"
"$mainModShift, s, exec, ${pkgs.hyprshot}/bin/hyprshot -m region"
# "$mainMod, M, exit,"
"$mainMod, t, togglefloating,"
"$mainMod, f, fullscreen,"
"$mainMod, d, exec, ${pkgs.anyrun}/bin/anyrun"
"$mainMod, Space, exec, ${pkgs.anyrun}/bin/anyrun"
"$mainMod, p, pseudo, # dwindle"
"$mainMod, v, togglesplit,"
# "$mainMod, a, exec, swaync-client -t"
"$mainMod, Tab, cyclenext"
# Audio
",xf86audiomute, exec, ${pkgs.swayosd}/bin/swayosd-client --output-volume mute-toggle"
# ",xf86audioprev, exec, /home/fs0c131y/.cargo/bin/mctl prev"
# ",xf86audionext, exec, /home/fs0c131y/.cargo/bin/mctl next"
# ",xf86audioplay, exec, /home/fs0c131y/.cargo/bin/mctl toggle"
# Screenshot
# "$mainMod,Print, exec, grim"
# "$mainModShift,Print, exec, grim -g "$(slurp)""
"$mainModShift,s, exec, ${pkgs.watershot}/bin/watershot"
# Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
"$mainMod, h, movefocus, l"
"$mainMod, j, movefocus, d"
"$mainMod, k, movefocus, u"
"$mainMod, l, movefocus, r"
"$mainModShift, h, movewindow, l"
"$mainModShift, j, movewindow, d"
"$mainModShift, k, movewindow, u"
"$mainModShift, l, movewindow, r"
# Switch workspaces with mainMod + [0-9]
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
# Move active window to a workspace with mainMod + SHIFT + [0-9]
"$mainMod SHIFT, 1, movetoworkspace, 1"
"$mainMod SHIFT, 2, movetoworkspace, 2"
"$mainMod SHIFT, 3, movetoworkspace, 3"
"$mainMod SHIFT, 4, movetoworkspace, 4"
"$mainMod SHIFT, 5, movetoworkspace, 5"
"$mainMod SHIFT, 6, movetoworkspace, 6"
"$mainMod SHIFT, 7, movetoworkspace, 7"
"$mainMod SHIFT, 8, movetoworkspace, 8"
"$mainMod SHIFT, 9, movetoworkspace, 9"
"$mainMod SHIFT, 0, movetoworkspace, 10"
# Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
"$mainMod, Tab, cyclenext, bind = ALT, Tab, bringactivetotop,"
];
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
workspace = [
"1, monitor:${device.monitors.primary}"
"2, monitor:${device.monitors.primary}"
"3, monitor:${device.monitors.primary}"
"4, monitor:${device.monitors.primary}"
"5, monitor:${device.monitors.secondary}"
"6, monitor:${device.monitors.secondary}"
"7, monitor:${device.monitors.secondary}"
"8, monitor:${device.monitors.tertiary}"
"9, monitor:${device.monitors.tertiary}"
"10, monitor:${device.monitors.tertiary}"
];
};
};
}

View File

@@ -0,0 +1,103 @@
{
inputs,
pkgs,
device,
...
}: {
imports = [inputs.ironbar.homeManagerModules.default];
programs.ironbar = {
enable = device.hasGui;
config.monitors = {
"${device.monitors.secondary}" = {
position = "bottom";
start = [
{
type = "launcher";
favourites = ["firefox" "discord"];
show_names = false;
show_icons = true;
}
{type = "focused";}
];
end = [
{
type = "clipboard";
max_items = 3;
truncate.length = 50;
truncate.mode = "end";
}
{
type = "music";
player_type = "mpris";
}
{type = "clock";}
];
};
"${device.monitors.primary}" = {
position = "bottom";
icon_theme = "Papirus-Dark";
end = [
{
type = "sys_info";
format = [
" CPU {cpu_percent}% | {temp_c:coretemp-Package-id-0}°C"
" RAM {memory_used}GB/{memory_total}GB"
];
interval = {
cpu = 1;
temps = 5;
memory = 30;
# disks= 300;
# networks= 3;
};
}
{type = "tray";}
];
start = [
{
type = "workspaces";
name_map = {
"1" = "icon:foot";
"2" = "icon:code";
"3" = "icon:firefox";
"4" = "icon:slack";
"5" = "icon:steam";
"6" = "icon:misc";
"7" = "icon:misc";
"8" = "icon:firefox";
"9" = "icon:discord";
"10" = "icon:spotify";
};
favorites = ["1" "2" "3" "4" "5" "6" "7" "8" "9" "10"];
all_monitors = true;
}
];
};
"${device.monitors.tertiary}" = {
position = "bottom";
icon_theme = "Papirus-Dark";
start = [
{
type = "launcher";
show_names = false;
show_icons = true;
}
{type = "focused";}
];
end = [
{type = "clock";}
];
};
};
style = let
catppuccin = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "waybar";
rev = "v1.0";
sha256 = "sha256-vfwfBE3iqIN1cGoItSssR7h0z6tuJAhNarkziGFlNBw";
};
mocha = builtins.readFile "${catppuccin}/mocha.css";
in
mocha + builtins.readFile ./ironbar.css;
};
}

View File

@@ -0,0 +1,207 @@
@define-color color_bg @base;
@define-color color_bg_dark @mantle;
@define-color color_border @crust;
@define-color color_border_active @mauve;
@define-color color_text #ffffff;
@define-color color_urgent @lavender;
/* -- base styles -- */
* {
font-family: Noto Sans Nerd Font, sans-serif;
font-size: 16px;
border: none;
border-radius: 0;
}
box, menubar, button {
background-color: @color_bg;
background-image: none;
}
button, label {
color: @color_text;
}
button:hover {
background-color: @color_bg_dark;
}
#bar {
border-top: 1px solid @color_border;
}
.popup {
border: 1px solid @color_border;
padding: 1em;
}
/* -- clipboard -- */
.clipboard {
margin-left: 5px;
font-size: 1.1em;
}
.popup-clipboard .item {
padding-bottom: 0.3em;
border-bottom: 1px solid @color_border;
}
/* -- clock -- */
.clock {
font-weight: bold;
margin-left: 5px;
}
.popup-clock .calendar-clock {
color: @color_text;
font-size: 2.5em;
padding-bottom: 0.1em;
}
.popup-clock .calendar {
background-color: @color_bg;
color: @color_text;
}
.popup-clock .calendar .header {
padding-top: 1em;
border-top: 1px solid @color_border;
font-size: 1.5em;
}
.popup-clock .calendar:selected {
background-color: @color_border_active;
}
/* -- launcher -- */
.launcher .item {
margin-right: 4px;
}
.launcher .item:not(.focused):hover {
background-color: @color_bg_dark;
}
.launcher .open {
border-bottom: 1px solid @color_text;
}
.launcher .focused {
border-bottom: 2px solid @color_border_active;
}
.launcher .urgent {
border-bottom-color: @color_urgent;
}
.popup-launcher {
padding: 0;
}
.popup-launcher .popup-item:not(:first-child) {
border-top: 1px solid @color_border;
}
/* -- music -- */
.music:hover * {
background-color: @color_bg_dark;
}
.popup-music .album-art {
margin-right: 1em;
}
.popup-music .icon-box {
margin-right: 0.4em;
}
.popup-music .title .icon, .popup-music .title .label {
font-size: 1.7em;
}
.popup-music .controls *:disabled {
color: @color_border;
}
.slider slider {
color: @color_urgent;
background-color: @color_urgent;
}
.popup-music .volume .slider slider {
border-radius: 100%;
}
.popup-music .volume .icon {
margin-left: 4px;
}
.popup-music .progress .slider slider {
border-radius: 100%;
}
/* -- script -- */
.script {
padding-left: 10px;
}
/* -- sys_info -- */
.sysinfo {
margin-left: 10px;
}
.sysinfo .item {
margin-left: 5px;
}
/* -- tray -- */
.tray {
margin-left: 10px;
}
/* -- workspaces -- */
.workspaces .item.focused {
box-shadow: inset 0 -3px;
background-color: @color_bg_dark;
}
.workspaces .item:hover {
box-shadow: inset 0 -3px;
}
/* -- custom: power menu -- */
.popup-power-menu #header {
font-size: 1.4em;
padding-bottom: 0.4em;
margin-bottom: 0.6em;
border-bottom: 1px solid @color_border;
}
.popup-power-menu .power-btn {
border: 1px solid @color_border;
padding: 0.6em 1em;
}
.popup-power-menu #buttons > *:nth-child(1) .power-btn {
margin-right: 1em;
}

5
home/linux/mpd.nix Normal file
View File

@@ -0,0 +1,5 @@
{...}: {
services.mpd = {
enable = true;
};
}