wip: prepare for nix

This commit is contained in:
Fabio Lenherr / DashieTM 2024-04-14 14:43:43 +02:00
parent 79ed239d07
commit 6671b54dd2
32 changed files with 1282 additions and 43 deletions

40
nix/programs/cargo.nix Normal file
View file

@ -0,0 +1,40 @@
{ inputs
, lib
, pkgs
, rustPlatform
, ...
}: {
imports = [
./config.nix
./anyrun.nix
./ironbar.nix
];
home.packages = with pkgs; [
(rustPackage {
name = "oxinoti";
version = "0.1.1";
src = fetchCrate {
inherit name version;
sha256 = lib.fakesha256;
};
})
(rustPackage {
name = "oxidash";
version = "0.1.0";
src = fetchCrate {
inherit name version;
sha256 = lib.fakesha256;
};
})
(rustPackage {
name = "oxishut";
version = "0.1.0";
src = fetchCrate {
inherit name version;
sha256 = lib.fakesha256;
};
})
];
}

20
nix/programs/coding.nix Normal file
View file

@ -0,0 +1,20 @@
{ lib
, pkgs
, ...
}:
{
home.packages = with pkgs; [
git
gcc
meson
ninja
rustup
go
nodejs_20
deno
# rustpython
neovim
typst
neovide
];
}

28
nix/programs/common.nix Normal file
View file

@ -0,0 +1,28 @@
{ lib
, pkgs
, fonts
, ...
}:
{
manual = {
html.enable = false;
json.enable = false;
manpages.enable = false;
};
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
kitty
firefox
fish
ripgrep
rm-improved
bat
fd
lsd
(pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
flatpak
gnome.gnome-software
networkmanager
];
}

15
nix/programs/default.nix Normal file
View file

@ -0,0 +1,15 @@
{pkgs, ... }:
{
imports = [
./hyprland/default.nix
./common.nix
./kitty.nix
./coding.nix
./xdg.nix
./media.nix
];
home.username = "dashie";
home.homeDirectory = "/home/dashie";
home.stateVersion = "23.05";
}

17
nix/programs/flatpak.nix Normal file
View file

@ -0,0 +1,17 @@
{...}: {
services.flatpak.remotes = {
"flathub" = "https://dl.flathub.org/repo/flathub.flatpakrepo";
};
services.flatpak.packages = [
"flathub:app/com.github.tchx84.Flatseal//stable"
"flathub:app/dev.vencord.Vesktop//stable"
"flathub:app/com.rustdesk.RustDesk//stable"
"flathub:app/io.github.Foldex.AdwSteamGtk//stable"
"flathub:app/io.github.Foldex.AdwSteamGtk//stable"
"flathub:app/org.gnome.dspy//stable"
"flathub:app/org.onlyoffice.desktopeditors//stable"
"flathub:app/org.gtk.Gtk3theme.adw-gtk3//stable"
"flathub:app/com.brave.Browser//stable"
];
}

View file

@ -0,0 +1,3 @@
{ pkgs, ... }: {
programs.home-manager.enable = true;
}

View file

@ -0,0 +1,72 @@
{ pkgs
, osConfig
, ...
}: {
programs.anyrun = {
config = {
#plugins = with inputs.anyrun.packages.${pkgs.system}; [
# applications
# rink
# shell
# websearch
# inputs.anyrun-nixos-options.packages.${pkgs.system}.default
#];
position = "center";
hideIcons = false;
width = { fraction = 0.3; };
layer = "overlay";
hidePluginInfo = true;
closeOnClick = true;
};
extraCss = ''
#window {
border-radius: 10px;
background-color: none;
}
box#main {
border-radius: 10px;
}
list#main {
border-radius: 10px;
margin: 0px 10px 10px 10px;
}
list#plugin {
border-radius: 10px;
}
list#match {
border-radius: 10px;
}
entry#entry {
border: none;
border-radius: 10px;
margin: 10px 10px 0px 10px;
}
label#match-desc {
font-size: 12px;
border-radius: 10px;
}
label#match-title {
font-size: 12px;
border-radius: 10px;
}
label#plugin {
font-size: 16px;
border-radius: 10px;
}
* {
border-radius: 10px;
}
'';
};
}

View file

@ -0,0 +1,291 @@
{ config
, pkgs
, ...
}:
let
# scripts = "${config.home.homeDirectory}/.config/scripts";
inputs = {
hyprland ={
# Update for releavant commit, this is just bleeding edge as of 2024/04/11
url = github:hyprwm/Hyprland/ac0f3411c18497a39498b756b711e092512de9e0;
inputs.nixpkgs.follows = "nixpkgs";
};
Hyprspace = {
url = github:KZDKM/Hyprspace;
inputs.hyprland.follows = "hyprland";
};
};
in
{
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.settings = {
"$mod" = "SUPER";
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
bind = [
# screenshots
"$mod SUPER,S,exec,grim -g \"$(slurp)\" - | wl-copy"
"$mod SUPERSHIFTALT,S,exec, grim -g \"$(slurp)\" $HOME/gits/ost-5semester/Screenshots/$(date +'%Y_%m_%d_%I_%M_%S.png') && (date +'%Y_%m_%d_%I_%M_%S.png') | wl-copy"
"$mod SUPERSHIFT,S,exec,grim -g \"$(slurp)\" - | satty -f -"
"$mod SUPERCONTROLSHIFT,S,exec,grim -c -g \"2560,0 3440x1440\" - | wl-copy"
# regular programs
"$mod SUPER,F,exec,firefox"
"$mod SUPER,T,exec,kitty -1"
"$mod SUPER,E,exec,nautilus -w"
"$mod SUPER,N,exec,neovide"
"$mod SUPER,M,exec,oxidash"
"$mod SUPER,R,exec,anyrun"
"$mod SUPER,G,exec,oxicalc"
"$mod SUPER,D,exec,oxishut"
"$mod SUPER,A,exec,oxipaste"
"$mod SUPERSHIFT,L,exec, playerctl -a pause & swaylock -c 000000 & systemctl suspend"
# media keys
",XF86AudioMute,exec, $HOME/.config/scripts/audio_control.sh mute"
",XF86AudioLowerVolume,exec, $HOME/.config/scripts/audio_control.sh sink -5%"
",XF86AudioRaiseVolume,exec, $HOME/.config/scripts/audio_control.sh sink +5%"
",XF86AudioPlay,exec, playerctl play-pause"
",XF86AudioNext,exec, playerctl next"
",XF86AudioPrev,exec, playerctl previous"
",XF86MonBrightnessDown,exec, $HOME/.config/scripts/change-brightness brightness 10%-"
",XF86MonBrightnessUp,exec, $HOME/.config/scripts/change-brightness brightness +10%"
# hyprland keybinds
# misc
"$mod SUPER,V,togglefloating,"
"$mod SUPER,B,fullscreen,"
"$mod SUPER,C,togglesplit"
"$mod SUPER,Q,killactive,"
"$mod SUPERSHIFTALT,M,exit,"
"$mod SUPERSHIFT,W,togglespecialworkspace"
# move
"$mod SUPER,left,movewindow,l"
"$mod SUPER,right,movewindow,r"
"$mod SUPER,up,movewindow,u"
"$mod SUPER,down,movewindow,d"
# workspaces
"$mod SUPER,1,workspace,1"
"$mod SUPER,2,workspace,2"
"$mod SUPER,3,workspace,3"
"$mod SUPER,4,workspace,4"
"$mod SUPER,5,workspace,5"
"$mod SUPER,6,workspace,6"
"$mod SUPER,7,workspace,7"
"$mod SUPER,8,workspace,8"
"$mod SUPER,9,workspace,9"
"$mod SUPER,0,workspace,10"
# move to workspace
"$mod SUPERSHIFT,1,movetoworkspace,1"
"$mod SUPERSHIFT,2,movetoworkspace,2"
"$mod SUPERSHIFT,3,movetoworkspace,3"
"$mod SUPERSHIFT,4,movetoworkspace,4"
"$mod SUPERSHIFT,5,movetoworkspace,5"
"$mod SUPERSHIFT,6,movetoworkspace,6"
"$mod SUPERSHIFT,7,movetoworkspace,7"
"$mod SUPERSHIFT,8,movetoworkspace,8"
"$mod SUPERSHIFT,9,movetoworkspace,9"
"$mod SUPERSHIFT,0,movetoworkspace,10"
# move to workspace silent
"$mod SUPERSHIFTALT,1,movetoworkspacesilent,1"
"$mod SUPERSHIFTALT,2,movetoworkspacesilent,2"
"$mod SUPERSHIFTALT,3,movetoworkspacesilent,3"
"$mod SUPERSHIFTALT,4,movetoworkspacesilent,4"
"$mod SUPERSHIFTALT,5,movetoworkspacesilent,5"
"$mod SUPERSHIFTALT,6,movetoworkspacesilent,6"
"$mod SUPERSHIFTALT,7,movetoworkspacesilent,7"
"$mod SUPERSHIFTALT,8,movetoworkspacesilent,8"
"$mod SUPERSHIFTALT,9,movetoworkspacesilent,9"
"$mod SUPERSHIFTALT,0,movetoworkspacesilent,10"
# preselection
"$mod SUPERALT,j,layoutmsg,preselect l"
"$mod SUPERALT,k,layoutmsg,preselect d"
"$mod SUPERALT,l,layoutmsg,preselect u"
"$mod SUPERALT,semicolon,layoutmsg,preselect r"
"$mod SUPERALT,h,layoutmsg,preselect n"
];
binde = [
# hyprland keybinds
# focus
"$mod SUPER,J,movefocus,l"
"$mod SUPER,semicolon,movefocus,r"
"$mod SUPER,L,movefocus,u"
"$mod SUPER,K,movefocus,d"
# resize
"$mod SUPER,U,resizeactive,-20 0"
"$mod SUPER,P,resizeactive,20 0"
"$mod SUPER,O,resizeactive,0 -20"
"$mod SUPER,I,resizeactive,0 20"
];
general = {
gaps_out = "3,5,5,5";
border_size = 3;
col.active_border = "0xFFFF0000 0xFF00FF00 0xFF0000FF 45deg";
col.inactive_border = "0x66333333";
allow_tearing = true;
};
decoration = {
rounding = 4;
};
animations = {
bezier = "penguin,0.05,0.9,0.1,1.0";
animation = [
"windowsMove,1,4,default"
"windows,1,7,default,popin 70%"
"windowsOut,1,7,default,popin 70%"
"border,1,10,default"
"fade,1,7,default"
"workspaces,1,6,default"
"layers,1,3,default,popin"
];
};
input = {
repeat_delay = 200;
force_no_accel = true;
touchpad = {
natural_scroll = true;
tap-to-click = true;
tap-and-drag = true;
};
};
misc = {
vrr = 1;
animate_manual_resizes = 1;
enable_swallow = true;
disable_splash_rendering = true;
disable_hyprland_logo = true;
swallow_regex = "^(.*)(kitty)(.*)$";
};
env = [
"GTK_CSD,0"
"TERM,\"kitty /bin/fish\""
"XDG_CURRENT_DESKTOP=Hyprland"
"XDG_SESSION_TYPE=wayland"
"XDG_SESSION_DESKTOP=Hyprland"
"HYPRCURSOR_THEME,Bibata-Modern-Classic"
"HYPRCURSOR_SIZE,24"
"XCURSOR_THEME,Bibata-Modern-Classic"
"XCURSOR_SIZE,24"
"QT_QPA_PLATFORM,wayland"
"QT_WAYLAND_FORCE_DPI,96"
"QT_AUTO_SCREEN_SCALE_FACTOR,0"
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
"QT_SCALE_FACTOR,1"
"PKG_CONFIG_PATH,/usr/local/lib/pkgconfig"
"LD_LIBRARY_PATH,/usr/local/lib"
"EDITOR,\"neovide --novsync --nofork\""
"WLR_DRM_NO_ATOMIC,1"
"GTK_USE_PORTAL, 1"
"PATH,/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.local/bin:~/.cargo/bin:$PATH"
];
monitor = [
# default
"DP-2,2560x1440@165,0x0,1"
"DP-1,3440x1440@180,2560x0,1"
"HDMI-A-1,1920x1200@60,6000x0,1"
"HDMI-A-1,transform,1"
# all others
",highrr,auto,1"
];
workspace = [
# workspaces
# monitor middle
"2,monitor:DP-1, default:true"
"4,monitor:DP-1"
"6,monitor:DP-1"
"8,monitor:DP-1"
"9,monitor:DP-1"
"10,monitor:DP-1"
# monitor left
"1,monitor:DP-2, default:true"
"5,monitor:DP-2"
"7,monitor:DP-2"
# monitor right
"3,monitor:HDMI-A-1, default:true"
];
layerrule = [
# layer rules
# mainly to disable animations within slurp and grim
"noanim, selection"
];
windowrule = [
# window rules
"tile,^(.*)(Spotify)(.*)$"
"float,^(.*)(OxiCalc)(.*)$"
"float,^(.*)(winecfg.exe)(.*)$"
"float,^(.*)(speed.exe)(.*)$"
"float,^(.*)(copyq)(.*)$"
"center,^(.*)(swappy)(.*)$"
"float,title:^(.*)(Spirit)(.*)$"
"float,title:^(.*)(reset)(.*)$"
"workspace 10 silent,^(.*)(steam)(.*)$"
"workspace 9 silent,^(.*)(dota)(.*)$"
"workspace 9 silent,^(.*)(battlebits)(.*)$"
"workspace 9 silent,^(.*)(aoe)(.*)$"
"suppressevent fullscreen maximize,^(.*)(neovide)(.*)$"
];
windowrulev2 = [
"immediate,class:^(.*)(Pal)$"
"immediate,class:^(.*)(dota2)$"
"immediate,class:^(.*)(needforspeedheat.exe)$"
"forceinput,class:^(.*)(Pal)$"
"forceinput,class:^(.*)(Battlefield 4)$"
];
exec-once = [
# environment
"systemctl --user import-environment"
"dbus-update-activation-environment --systemd --all"
"hyprctl setcursor Bibata-Modern-Classic 24"
# other programs
"hyprpaper"
"ironbar"
"firefox"
"streamdeck -n"
"oxipaste_daemon"
"/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
"nextcloud --background"
"oxinoti"
];
plugin = {
hyprspace = {
bind = [
"SUPER, W, overview:toggle, toggle"
];
};
};
};
wayland.windowManager.hyprland.plugins = [
# ... whatever
inputs.Hyprspace.packages.${pkgs.system}.Hyprspace
];
}

View file

@ -0,0 +1,25 @@
{
lib
, pkgs
, ...
}: {
imports = [
#./anyrun.nix
];
home.packages = with pkgs; [
hyprland
xorg.xprop
grim
slurp
swappy
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
hyprpaper
ironbar
copyq
gnome.nautilus
gnome.sushi
];
}

63
nix/programs/kitty.nix Normal file
View file

@ -0,0 +1,63 @@
{ default, ... }: {
programs.kitty = {
enable = true;
settings = {
enable_audio_bell = "no";
window_alert_on_bell = "no";
background_opacity = "0.8";
cursor_blink_interval = "0";
window_padding_width = "1";
shell_integration = "yes";
sync_with_monitor = "no";
font_family = "JetBrainsMono Nerd Font Mono";
bold_font = "JetBrainsMono Nerd Font Mono Extra Bold";
italic_font = "JetBrainsMono Nerd Font Mono Extra Italic";
bold_italic_font = "JetBrainsMono Nerd Font Mono Extra Bold Italic";
background = "#1a1b25";
foreground = "#c5c8c6";
selection_background = "#b2ceee";
selection_foreground = "#080808";
url_color = "#73daca";
cursor = "#c0caf5";
cursor_text_color = "#1a1b25";
active_tab_background = "#7aa2f7";
active_tab_foreground = "#16161e";
inactive_tab_background = "#292e42";
inactive_tab_foreground = "#545c7e";
active_border_color = "#7aa2f7";
inactive_border_color = "#292e42";
color0 = "#15161e";
color1 = "#c94448";
color2 = "#9ece6a";
color3 = "#e0af68";
color4 = "#7aa2f7";
color5 = "#bb9af7";
color6 = "#7dcfff";
color7 = "#a9b1d6";
color8 = "#414868";
color9 = "#f2201f";
color10 = "#9ece6a";
color11 = "#e0af68";
color12 = "#7aa2f7";
color13 = "#bb9af7";
color14 = "#7dcfff";
color15 = "#c0caf5";
color16 = "#ff9e64";
color17 = "#db4b4b";
shell = "fish";
};
theme = "Catppuccin-Mocha";
};
}

29
nix/programs/media.nix Normal file
View file

@ -0,0 +1,29 @@
{ pkgs
, config
, ...
}:
{
home.packages = with pkgs; [
# base audio
pipewire
wireplumber
# audio control
playerctl
# images
imv
# videos
mpv
# pdf
zathura
# spotify
ncspot
# video editing
kdenlive
# image creation
inkscape
gimp
krita
# recording
obs-studio
];
}

14
nix/programs/utils.nix Normal file
View file

@ -0,0 +1,14 @@
{ lib
, pkgs
, ...
}:
{
home.packages = with pkgs; [
rustdesk
keepassxc
nheko
kdeconnect
nextcloud-client
xournalpp
];
}

48
nix/programs/xdg.nix Normal file
View file

@ -0,0 +1,48 @@
{ config, ... }:
let
browser = [ "firefox.desktop" ];
# XDG MIME types
associations = {
"application/x-extension-htm" = browser;
"application/x-extension-html" = browser;
"application/x-extension-shtml" = browser;
"application/x-extension-xht" = browser;
"application/x-extension-xhtml" = browser;
"application/xhtml+xml" = browser;
"text/html" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/chrome" = [ "brave.desktop" ];
"x-scheme-handler/ftp" = browser;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/unknown" = browser;
"audio/*" = [ "mpv.desktop" ];
"video/*" = [ "mpv.dekstop" ];
"image/*" = [ "imv.desktop" ];
"application/json" = browser;
"application/pdf" = [ "org.pwmt.zathura.desktop.desktop" ];
# "x-scheme-handler/discord" = [ "discordcanary.desktop" ];
# "x-scheme-handler/spotify" = [ "spotify.desktop" ];
};
in
{
xdg = {
enable = true;
cacheHome = config.home.homeDirectory + "/.local/cache";
mimeApps = {
enable = true;
defaultApplications = associations;
};
userDirs = {
enable = true;
createDirectories = true;
extraConfig = {
XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
};
};
};
}