Compare commits

..

1 Commits

Author SHA1 Message Date
Oystein Kristoffer Tveit fbbd625350
WIP: home/{hyprland,waybar}: init 2024-06-30 12:32:21 +02:00
19 changed files with 566 additions and 643 deletions

View File

@ -8,11 +8,21 @@
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-local = {
url = "git+file:///home/h7x4/git/home-manager";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
dotfiles = {
url = "git+https://git.pvv.ntnu.no/oysteikt/dotfiles?ref=master";
flake = false;
};
fonts = {
url = "path:/home/h7x4/git/fonts";
flake = false;
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
@ -66,8 +76,10 @@
nixpkgs,
nixpkgs-unstable,
home-manager,
home-manager-local,
dotfiles,
fonts,
matrix-synapse-next,
maunium-stickerpicker,
minecraft,
@ -100,13 +112,6 @@
(self: super: {
inherit (nonrecursive-unstable-pkgs) atuin wstunnel;
})
# https://github.com/NixOS/nixpkgs/pull/251706
(self: super: {
mozc = self.qt6Packages.callPackage ./package-overrides/mozc.nix { };
fcitx5-mozc = self.callPackage ./package-overrides/fcitx5-mozc.nix { };
})
(self: super: {
mpv-unwrapped = super.mpv-unwrapped.override {
ffmpeg = super.ffmpeg_6-full;
@ -198,10 +203,7 @@
inputs.sops-nix.homeManagerModules.sops
];
users.h7x4.imports = [
./home/home.nix
./hosts/${name}/home
];
users.h7x4.imports = [ ./home/home.nix ];
};
})
] ++ (extraConfig.modules or [ ]);
@ -218,6 +220,7 @@
modules = [
matrix-synapse-next.nixosModules.default
osuchan.outputs.nixosModules.default
sops-nix.nixosModules.sops
vscode-server.nixosModules.default
maunium-stickerpicker.nixosModules.default

View File

@ -88,14 +88,8 @@ let
machines: pipe machines pipeline;
in
{
programs.ssh.matchBlocks = (extendedLib.attrsets.concatAttrs [
programs.ssh.matchBlocks = extendedLib.attrsets.concatAttrs [
(convertMachinesWith convertNormalMachine normalMachines)
(convertMachinesWith convertAdminMachine rootMachines)
]) // {
"pvv-git git.pvv.ntnu.no" = {
hostname = "git.pvv.ntnu.no";
user = "gitea";
port = 2222;
};
};
];
}

View File

@ -14,15 +14,13 @@ in {
./programs/direnv.nix
./programs/gdb.nix
./programs/gh.nix
./programs/git
./programs/git.nix
./programs/gpg.nix
./programs/less.nix
./programs/neovim.nix
./programs/tmux.nix
./programs/zsh
./services/git-maintenance.nix
./modules/colors.nix
./modules/shellAliases.nix
] ++ optionals graphics [
@ -31,6 +29,7 @@ in {
./programs/alacritty.nix
./programs/emacs
./programs/firefox.nix
./programs/hyprland.nix
./programs/ncmpcpp.nix
./programs/ncmpcpp.nix
./programs/newsboat
@ -38,6 +37,7 @@ in {
./programs/rofi.nix
./programs/taskwarrior.nix
./programs/vscode.nix
./programs/waybar.nix
# ./programs/xmobar
./programs/xmonad
./programs/zathura.nix
@ -45,11 +45,11 @@ in {
./services/dunst.nix
./services/fcitx5.nix
./services/mpd.nix
./services/picom.nix
./services/polybar.nix
./services/screen-locker.nix
# ./services/picom.nix
# ./services/polybar.nix
# ./services/screen-locker.nix
# ./services/stalonetray.nix
./services/sxhkd.nix
# ./services/sxhkd.nix
./services/copyq.nix
];
@ -68,6 +68,7 @@ in {
};
home = {
stateVersion = "22.05";
username = "h7x4";
homeDirectory = "/home/h7x4";

View File

@ -90,12 +90,12 @@
gnome.seahorse
google-chrome
inkscape
insomnia
# insomnia
iwgtk
# keybase-gui
kid3
koreader
krita
# krita
ktouch
libnotify
libreoffice
@ -107,7 +107,7 @@
mopidy-youtube
mpc_cli
nyxt
obsidian
# obsidian
# pcloud
pwvucontrol
# scrcpy
@ -116,7 +116,7 @@
# sublime3
# swiPrologWithGui
sxiv
tagainijisho
# tagainijisho
tenacity
thunderbird

View File

@ -1,7 +1,4 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.git;
in
{ pkgs, ... }:
{
programs.git = {
enable = true;
@ -33,6 +30,7 @@ in
graphv = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all";
forcepush = "push --force-with-lease --force-if-includes";
authors = "shortlog --summary --numbered --email";
switch-interactive = "!cat <(git branch) <(git branch -r) | grep -v '^\\*\\|HEAD ->' | ${pkgs.fzf}/bin/fzf --reverse --info=inline --preview 'echo {} | xargs git show --color' | sed 's|\\s*.*/||' | xargs git switch";
si = "switch-interactive";
rebase-author = "rebase -i -x \"git commit --amend --reset-author -CHEAD\"";
};
@ -44,8 +42,6 @@ in
editor = "nvim";
};
safe.directory = "*";
rerere.enabled = true;
branch.sort = "-committerdate";
@ -54,25 +50,9 @@ in
color.ui = "auto";
init.defaultBranch = "main";
fetch = {
prune = true;
fsckObjects = true;
};
transfer.fsckObjects = true;
receive.fsckObjects = true;
fetch.prune = true;
pull.rebase = true;
rebase = {
autoStash = true;
autoSquash = true;
abbreviateCommands = true;
updateRefs = true;
};
push = {
default = "current";
autoSetupRemote = true;
@ -92,19 +72,8 @@ in
mnemonicPrefix = true;
renames = true;
tool = "nvimdiff";
submodule = "log";
};
status = {
showUntrackedFiles = "all";
relativePaths = true;
submoduleSummary = true;
};
log.date = "iso";
submodule.recurse = true;
grep = {
break = true;
heading= true;
@ -112,25 +81,10 @@ in
extendedRegexp = true;
};
# Run autocorrected command after 3 seconds
help.autocorrect = "30";
github.user = "h7x4";
"url \"github:\"".insteadOf = [
"https://github.com/"
"ssh://git@github.com:"
"git@github.com:"
"github.com:"
];
"url \"github:\"".insteadOf = "https://github.com/";
"url \"pvv-git:\"".insteadOf = [
"https://git.pvv.org/"
"ssh://gitea@git.pvv.ntnu.no:2222/"
"gitea@git.pvv.ntnu.no:2222/"
"gitea@git.pvv.ntnu.no:"
"git.pvv.ntnu.no:"
];
web.browser = "google-chrome-stable";
@ -149,20 +103,4 @@ in
"shell.nix"
];
};
home.packages = [
(pkgs.writeShellApplication {
name = "git-tcommit";
runtimeInputs = with pkgs; [ cfg.package coreutils ];
text = lib.fileContents ./scripts/git-tcommit.sh;
})
(pkgs.writeShellApplication {
name = "git-switch-interactive";
runtimeInputs = with pkgs; [ cfg.package fzf gnused coreutils ];
text = lib.fileContents ./scripts/git-switch-interactive.sh;
excludeShellChecks = [
"SC2001" # (style): See if you can use ${variable//search/replace} instead. (sed invocation)
];
})
];
}

View File

@ -1,11 +0,0 @@
set -euo pipefail
if [ -n "${1:-}" ]; then
git switch "$1"
exit 0
fi
BRANCHES=$(cat <(git branch) <(git branch --remotes) | grep --invert-match '^\*\|HEAD ->' | sed 's|^\s*||')
CHOSEN_BRANCH=$(fzf --reverse --info=inline --preview 'git show --color {}' <<<"$BRANCHES")
CLEAN_BRANCH_NAME=$(sed 's|^\s*.*/||' <<<"$CHOSEN_BRANCH")
git switch "$CLEAN_BRANCH_NAME"

View File

@ -1,31 +0,0 @@
set -euo pipefail
HOUR_SHIFT="$1"
shift
if [[ $HOUR_SHIFT == -* ]]; then
HOUR_SHIFT="${HOUR_SHIFT#*-}"
OPERATOR="-"
else
OPERATOR="+"
fi
DATE=$(date -d "now ${OPERATOR} ${HOUR_SHIFT} hours")
while true; do
echo "Commiting with date: ${DATE} (${OPERATOR}${HOUR_SHIFT}h)"
read -rp "Do you want to proceed? (y/n) " yn
case $yn in
[yY] )
break;;
[nN] )
exit;;
* ) echo invalid response;;
esac
done
export GIT_COMMITTER_DATE="${DATE}"
export GIT_AUTHOR_DATE="${DATE}"
git commit "$@"

273
home/programs/hyprland.nix Normal file
View File

@ -0,0 +1,273 @@
{ config, pkgs, lib, ... }:
let
cfg = config.wayland.windowManager.hyprland;
in
{
home.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
WLR_RENDERER_ALLOW_SOFTWARE = "1";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
GDK_BACKEND = "wayland,x11,*";
QT_QPA_PLATFORM = "wayland;xcb";
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
SDL_VIDEODRIVER = "wayland";
OZONE_PLATFORM = "wayland";
CLUTTER_BACKEND = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
# QT_QPA_PLATFORMTHEME = "qt6ct";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
LIBVA_DRIVER_NAME = "nvidia";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
wayland.windowManager.hyprland = {
enable = true;
settings = let
scratchpads = [
(rec {
title = "Floating terminal";
class = "floatingTerminal";
command = "alacritty --class ${class} -e tmux new-session -A -s f";
size = { h = 90; w = 95; };
keys = [
"$mod, RETURN"
"$mod, SPACE"
];
})
(rec {
title = "Ncmpcpp";
class = "floatingNcmpcpp";
command = "alacritty --class ${class} -e ncmpcpp";
size = { h = 95; w = 95; };
keys = [ "$mod, Q" ];
})
# "$mod, W, emacs"
# "$mod, E, filebrowser"
# "$mod, X, taskwarriortui"
];
in {
"$mod" = "SUPER";
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
bind = [
"$mod SHIFT, Q, exit"
"$mod, R, exec, ${pkgs.rofi}/bin/rofi -show drun"
"$mod, T, togglefloating"
"$mod, F, fakefullscreen"
"$mod, C, exec, hyprctl reload"
"$mod, BACKSPACE, exec, ${lib.getExe (pkgs.writeShellApplication {
name = "hyprland-kill-windows-except-scratchpads";
runtimeInputs = [ cfg.package pkgs.jq ];
text = ''
ACTIVE_WINDOW_CLASS=$(hyprctl activewindow -j | jq -r '.class')
case "$ACTIVE_WINDOW_CLASS" in
${lib.pipe scratchpads [
(map ({ class , ... }: ''
'${class}')
hyprctl dispatch togglespecialworkspace '${class}Ws'
;;
''))
(map (lib.splitString "\n"))
(lib.flatten)
(map (x: " " + x))
(lib.concatStringsSep "\n")
]}
*)
hyprctl dispatch killactive
;;
esac
'';
})}"
"$mod SHIFT, RETURN, exec, alacritty --class termTerminal -e tmux new-session -A -s term"
"$mod SHIFT, SPACE, exec, alacritty --class termTerminal -e tmux new-session -A -s term"
"$mod, j, layoutmsg,cyclenext"
"$mod, k, layoutmsg,cycleprev"
"$mod SHIFT, j, layoutmsg, swapnext"
"$mod SHIFT, k, layoutmsg, swapprev"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
# TODO: ensure this exists in env
",XF86MonBrightnessUp, exec, brightnessctl s +5%"
",XF86MonBrightnessDown, exec, brightnessctl s 5%-"
# TODO: swap out for wireplumber commands
",XF86AudioLowerVolume, exec, ${pkgs.alsaUtils}/bin/amixer set Master 2%-"
",XF86AudioRaiseVolume, exec, ${pkgs.alsaUtils}/bin/amixer set Master 2%+"
"$mod ,F7, exec, ${pkgs.alsaUtils}/bin/amixer set Master 2%-"
"$mod ,F8, exec, ${pkgs.alsaUtils}/bin/amixer set Master 2%+"
"$mod, p, exec, ${pkgs.mpc_cli}/bin/mpc toggle"
",XF86AudioPlay, exec, ${pkgs.mpc_cli}/bin/mpc toggle"
",XF86AudioPrev, exec, ${pkgs.mpc_cli}/bin/mpc prev"
",XF86AudioNext, exec, ${pkgs.mpc_cli}/bin/mpc next"
"$mod, b, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s mozc"
"$mod, n, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-no"
"$mod, m, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-us"
# TODO: ensure exists in environment
"$mod, l, exec, loginctl lock-session"
# TODO: fix
# "super + minus" = "${pkgs.xcalib}/bin/xcalib -invert -alter"
# TODO: fix
# "@Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard --select | ${pkgs.xclip}/bin/xclip -selection clipboard -target image/png -in"
# "shift + @Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png"
# TODO: Add boomer as package
# "super + @Print" = "boomer"
]
++
(lib.pipe scratchpads [
(map ({ keys, command, class, ... }:
(map (key: let
# TODO: rewrite the scratchpad logic to move windows back and forth
# from the special workspaces, rather than overlay the workspaces.
#
# TODO: don't invoke the program upon close toggling the scratchpad
#
# TODO: ensure program becomes in focus upon open toggling the scratchpad
invokeIfNotRunningAndToggleWorkspace = pkgs.writeShellApplication {
name = "hyprland-toggle-scratchpad-${class}";
runtimeInputs = [ cfg.package pkgs.jq ];
text = ''
SCRATCHPAD_EXISTS=$(hyprctl clients -j | jq -r '[.[].class]|any(. == "${class}")')
if [ "$SCRATCHPAD_EXISTS" != "true" ]; then
${command} &
fi
hyprctl dispatch togglespecialworkspace '${class}Ws'
'';
};
in "${key}, exec, ${lib.getExe invokeIfNotRunningAndToggleWorkspace}"
) keys)
))
lib.flatten
]);
windowrulev2 = [
"float,class:(Rofi)"
"workspace 2,class:(firefox)"
"workspace 2,class:(google-chrome)"
"workspace 3,class:(Emacs)"
"workspace 3,class:(Code)"
"workspace 3,class:(code-url-handler)"
"workspace 5,class:(discord)"
"workspace 5,class:(Element)"
]
++
(lib.pipe scratchpads [
(map ({ class, size, ... }: [
"workspace special:${class}Ws, class:^${class}$"
"float, class:^${class}$"
"size ${toString size.w}% ${toString size.h}%, class:^${class}$"
"move ${toString ((100 - size.w) / 2)}% ${toString ((100 - size.h) / 2)}%, class:^${class}$"
]))
lib.flatten
]);
monitor = [
"DP-6, 1920x1080@144.00Hz, 0x0, 1"
"DVI-D-1, 1920x1080@144.00Hz, 1920x0, 1"
",preferred,auto,1"
];
general = {
gaps_in = 5;
gaps_out = 15;
border_size = 2;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
resize_on_border = false;
allow_tearing = false;
layout = "master";
};
decoration = {
rounding = 10;
# Change transparency of focused and unfocused windows
active_opacity = 1.0;
inactive_opacity = 1.0;
drop_shadow = true;
shadow_range = 4;
shadow_render_power = 3;
"col.shadow" = "rgba(1a1a1aee)";
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur = {
enabled = true;
size = 3;
passes = 1;
vibrancy = 0.1696;
};
};
animations.enabled = false;
master = {
new_is_master = false;
};
misc = {
force_default_wallpaper = 0; # Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
};
input ={
kb_layout = "us";
kb_variant = "";
kb_model = "";
kb_options = "";
kb_rules = "";
follow_mouse = 1;
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
touchpad = {
natural_scroll = false;
};
};
};
};
}

230
home/programs/waybar.nix Normal file
View File

@ -0,0 +1,230 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.waybar;
cfgs = cfg.settings.mainBar;
in
{
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
# TODO: configure this per machine
output = [ "DP-6" ];
modules-left = [ "hyprland/workspaces" ];
modules-center = [ "clock" ];
modules-right = [ "mpd" "cpu" "memory" "wireplumber" "pulseaudio/slider" "tray" ];
"hyprland/workspaces" = {
all-outputs = true;
disable-scroll = true;
persistent-workspaces = {
${lib.head cfgs.output} = [ 1 2 3 4 5 6 7 8 ];
};
};
"mpd" = {
format = "{filename}";
};
"memory" = {
format = "{used}/{total}Gb";
};
"pulseaudio/slider" = {
orientation = "horizontal";
};
"tray" = {
icon-size = 20;
spacing = 8;
};
};
};
style = let
c = config.colors.defaultColorSet;
in ''
* {
font-family: FiraCode, FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: ${c.background};
color: ${c.foreground};
}
#pulseaudio-slider trough {
min-height: 10px;
min-width: 100px;
}
/**** DEFAULT ****/
window#waybar.hidden {
opacity: 0.2;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.empty {
color: ${c.yellow};
}
#workspaces button {
padding: 0 5px;
color: ${c.magenta};
background-color: transparent;
}
#workspaces button.visible {
color: ${c.green};
}
#workspaces button.urgent {
background-color: ${c.red};
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#mode {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: ${c.foreground};
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#cpu {
background-color: ${c.cyan};
color: #000000;
}
#memory {
background-color: ${c.yellow};
color: #000000;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
'';
# background-color: rgba(0,0,0,0);
# border-bottom: 3px solid rgba(100, 114, 125, 0.5);
#style = ''
#'';
};
}

View File

@ -1,21 +1,5 @@
{ pkgs, lib, config, ... }:
let
cfg = config.programs.zsh;
in
{
home.file."${cfg.dotDir}/.zshrc".onChange = ''
${lib.getExe (pkgs.writeTextFile {
name = "zsh-compinit-oneshot.zsh";
executable = true;
destination = "/bin/zsh-compinit-oneshot.zsh";
text = ''
#!${lib.getExe cfg.package}
autoload -Uz compinit && compinit -C -d "${config.xdg.cacheHome}/zsh/zcompdump-$ZSH_VERSION"
'';
})}
'';
programs.zsh = {
enable = true;
@ -28,7 +12,10 @@ in
fpath+=(${pkgs.zsh-completions}/share/zsh/site-functions)
'';
completionInit = "";
# TODO: Regenerate zcompdump with a systemd timer
completionInit = ''
autoload -Uz compinit && compinit -C -d "${config.xdg.cacheHome}/zsh/zcompdump-$ZSH_VERSION"
'';
history = {
extended = true;

View File

@ -13,9 +13,9 @@
class = "Dunst";
browser = "${pkgs.xdg-utils}/bin/xdg-open";
offset = let
status-bar-height = config.services.polybar.settings."bar/top".height;
in "15x${toString (status-bar-height + 10)}";
# offset = let
# status-bar-height = config.services.polybar.settings."bar/top".height;
# in "15x${toString (status-bar-height + 10)}";
corner_radius = 0;
font = "Droid Sans 9";

View File

@ -1,77 +0,0 @@
{ config, pkgs, lib, ... }:
{
systemd.user.services."git-maintenance@" = {
Unit = {
Description = "Optimize Git repositories data";
Documentation = [ "man:git-maintenance(1)" ];
};
Service = {
Type = "oneshot";
ExecStart = "${lib.getExe pkgs.git} for-each-repo --config=maintenance.repo maintenance run --schedule=%i";
LockPersonality = "yes";
MemoryDenyWriteExecute = "yes";
NoNewPrivileges = "yes";
RestrictAddressFamilies = [
"AF_UNIX"
"AF_INET"
"AF_INET6"
"AF_VSOCK"
];
RestrictNamespaces = "yes";
RestrictRealtime = "yes";
RestrictSUIDSGID = "yes";
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
};
};
systemd.user.timers."git-maintenance@hourly" = {
Unit = {
Description = "Optimize Git repositories data";
Documentation = [ "man:git-maintenance(1)" ];
};
Timer = {
OnCalendar = "*-*-* 1..23:05:00";
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
systemd.user.timers."git-maintenance@daily" = {
Unit = {
Description = "Optimize Git repositories data";
Documentation = [ "man:git-maintenance(1)" ];
};
Timer = {
OnCalendar = "Tue..Sun *-*-* 0:05:00";
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
systemd.user.timers."git-maintenance@weekly" = {
Unit = {
Description = "Optimize Git repositories data";
Documentation = [ "man:git-maintenance(1)" ];
};
Timer = {
OnCalendar = "Mon 0:05:00";
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
}

View File

@ -167,13 +167,14 @@ in {
enableDefaultPackages = true;
packages = with pkgs; [
ark-pixel-font
cm_unicode
corefonts
dejavu_fonts
fira-code
fira-code-symbols
powerline-fonts
iosevka
symbola
corefonts
ipaexfont
ipafont
liberation_ttf
@ -184,15 +185,12 @@ in {
noto-fonts-emoji
ocr-a
open-sans
powerline-fonts
source-han-sans
source-sans
symbola
texlivePackages.asana-math
ubuntu_font_family
victor-mono
yasashisa-gothic
(nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
inputs.fonts
];
fontconfig = {
@ -267,7 +265,14 @@ in {
touchpad.disableWhileTyping = true;
};
displayManager.defaultSession = "none+xmonad";
displayManager = {
enable = true;
defaultSession = "none+xmonad";
sddm = {
enable = !config.machineVars.headless;
wayland.enable = true;
};
};
xserver = {
enable = !config.machineVars.headless;
@ -277,12 +282,12 @@ in {
options = "caps:escape";
};
desktopManager = {
xterm.enable = false;
xfce.enable = !config.machineVars.headless;
};
# desktopManager = {
# xterm.enable = false;
# xfce.enable = !config.machineVars.headless;
# };
displayManager.lightdm.enable = !config.machineVars.headless;
# displayManager.lightdm.enable = !config.machineVars.headless;
windowManager.xmonad = {
enable = true;
@ -292,9 +297,7 @@ in {
dbus
];
};
};
};
programs = {
@ -303,6 +306,8 @@ in {
tmux.enable = true;
zsh.enable = true;
hyprland.enable = true;
gnupg.agent.enable = true;
gnupg.agent.pinentryPackage = pkgs.pinentry-curses;

View File

@ -1,4 +0,0 @@
{ ... }:
{
home.stateVersion = "24.05";
}

View File

@ -73,7 +73,7 @@
services = {
openssh = {
enable = true;
settings.X11Forwarding = true;
# settings.X11Forwarding = true;
};
xserver.videoDrivers = [ "nvidia" ];
tailscale.enable = true;
@ -97,7 +97,7 @@
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelModules = [ "kvm-amd" ];
blacklistedKernelModules = [ "nouveau" ];
kernelParams = [ "nomodeset" ];
# kernelParams = [ "nomodeset" ];
supportedFilesystems = [ "zfs" ];
loader = {
@ -150,6 +150,9 @@
nvidia = {
modesetting.enable = true;
nvidiaSettings = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
};
};
}

View File

@ -1,12 +0,0 @@
{ config, ... }:
{
home.stateVersion = "24.05";
programs.git.extraConfig.maintenance.repo = let
home = config.home.homeDirectory;
in [
"${home}/nix"
"${home}/nixpkgs"
"${home}/pvv/nix"
];
}

View File

@ -1,4 +0,0 @@
{ ... }:
{
home.stateVersion = "24.05";
}

View File

@ -1,131 +0,0 @@
{ bazel
, buildBazelPackage
, fcitx5
, fetchFromGitHub
, gettext
, lib
, mozc
, nixosTests
, pkg-config
, python3
, unzip
}:
buildBazelPackage {
pname = "fcitx5-mozc";
version = "unstable-2024-02-09";
src = fetchFromGitHub {
owner = "fcitx";
repo = "mozc";
fetchSubmodules = true;
rev = "c687b82fccd443917359a5c2a7b9b1c5fd3737c9";
hash = "sha256-lXEW7F7ctI7kNdKEjdeYHbyeF8hf6C5AohoWVIfDbjM=";
};
sourceRoot = "source/src";
nativeBuildInputs = [
gettext
pkg-config
python3
unzip
];
buildInputs = [
mozc
fcitx5
];
postPatch = ''
sed -i -e 's|^\(LINUX_MOZC_SERVER_DIR = \).\+|\1"${mozc}/lib/mozc"|' config.bzl
'';
inherit bazel;
removeRulesCC = false;
dontAddBazelOpts = true;
bazelFlags = [
"--config"
"oss_linux"
"--compilation_mode"
"opt"
];
bazelTargets = [
"unix/fcitx5:fcitx5-mozc.so"
"unix/icons"
];
fetchAttrs = {
preInstall = ''
rm -rf $bazelOut/external/fcitx5
'';
sha256 = "sha256-OrS5/3Zasd2WXsA+kg0pzvgaKZs7DG/aKfqekxCmAL8=";
};
buildAttrs = {
installPhase = ''
runHook preInstall
install -Dm444 ../LICENSE $out/share/licenses/fcitx5-mozc/LICENSE
install -Dm444 data/installer/credits_en.html $out/share/licenses/fcitx5-mozc/Submodules
install -Dm555 bazel-bin/unix/fcitx5/fcitx5-mozc.so $out/lib/fcitx5/fcitx5-mozc.so
install -Dm444 unix/fcitx5/mozc-addon.conf $out/share/fcitx5/addon/mozc.conf
install -Dm444 unix/fcitx5/mozc.conf $out/share/fcitx5/inputmethod/mozc.conf
for pofile in unix/fcitx5/po/*.po; do
filename=$(basename $pofile)
lang=''${filename/.po/}
mofile=''${pofile/.po/.mo}
msgfmt $pofile -o $mofile
install -Dm444 $mofile $out/share/locale/$lang/LC_MESSAGES/fcitx5-mozc.mo
done
msgfmt --xml -d unix/fcitx5/po/ --template unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in -o unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml
install -Dm444 unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml $out/share/metainfo/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml
cd bazel-bin/unix
unzip -o icons.zip
# These are relative symlinks, they will always resolve to files within $out
install -Dm444 mozc.png $out/share/icons/hicolor/128x128/apps/org.fcitx.Fcitx5.fcitx-mozc.png
ln -s org.fcitx.Fcitx5.fcitx-mozc.png $out/share/icons/hicolor/128x128/apps/fcitx-mozc.png
rm {mozc,dictionary,properties,tool}.svg
for svg in *.svg outlined/*.svg; do
name=$(basename -- ''${svg//_/-})
path=$out/share/icons/hicolor/scalable/apps
prefix=org.fcitx.Fcitx5.fcitx-mozc
install -Dm444 $svg $path/$prefix-$name
ln -s $prefix-$name $path/fcitx-mozc-$name
done
runHook postInstall
'';
};
passthru.tests = {
inherit (nixosTests) fcitx5;
};
meta = with lib; {
description = "Mozc - a Japanese Input Method Editor designed for multi-platform";
homepage = "https://github.com/fcitx/mozc";
license = with licenses; [
asl20 # abseil-cpp
bsd3 # mozc, breakpad, gtest, gyp, japanese-usage-dictionary, protobuf
mit # wil
# naist-2003 # IPAdic
publicDomain # src/data/test/stress_test, Okinawa dictionary
# unicode-30 # src/data/unicode, breakpad
];
maintainers = with maintainers; [ berberman govanify ];
platforms = platforms.linux;
};
}

View File

@ -1,241 +0,0 @@
{ bazel
, buildBazelPackage
, fetchFromGitHub
, fetchurl
, glibcLocales
, lib
, pkg-config
, python3
, qtbase
, qtwayland
, ruby
, wrapQtAppsHook
, dictionaries ? [
"alt-cannadic"
"edict2"
"jawiki"
"neologd"
"personal-names"
"place-names"
"skk-jisyo"
"sudachidict"
]
}:
buildBazelPackage {
pname = "mozc";
version = "unstable-2024-02-09";
srcs = [
(fetchFromGitHub rec {
owner = "google";
repo = "mozc";
name = repo;
fetchSubmodules = true;
rev = "c2fcbf6515c5884437977de46187c16a8cb7bb50";
hash = "sha256-AcIN5sWPBe4JotAUYv1fytgQw+mJzdFhKuVPLR48soA=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "merge-ut-dictionaries";
name = repo;
rev = "a3d6fc4005aff2092657ebca98b9de226e1c617f";
hash = "sha256-UK29ACZUK9zGfzW7C85uMw2aF5Gk+0aDeUdNV71PY+0=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-alt-cannadic";
name = repo;
rev = "4e548e6356b874c76e8db438bf4d8a0b452f2435";
hash = "sha256-4gzqVoCIhC0k3mh0qbEr8yYttz9YR0fItkFNlu7cYOY=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-edict2";
name = repo;
rev = "b2eec665b81214082d61acee1c5a1b5b115baf1a";
hash = "sha256-LIpGt6xB8dLUnazbJHZk6EH1/ZyAHMIn1m6Qpr2dsHs=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-jawiki";
name = repo;
rev = "6e08b8c823f3d2d09064ad2080e7a16552a7b473";
hash = "sha256-0YwAinlcI6yojCdW1MpLgMZfyYV7gk9Q+Wlu4lR3Hrg=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-neologd";
name = repo;
rev = "bf9d0d217107f2fb2e7d1a26648ef429d9fdcd27";
hash = "sha256-e0iM5fohwpNNhPl9CjkD753/Rgatg7GdwN0NSvlN94c=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-personal-names";
name = repo;
rev = "8a500f82c553936cbdd33b85955120e731069d44";
hash = "sha256-pMyYvl5S0+U++MO5m9rmbtxDzAmO4Xs8sFewOUGqgUA=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-place-names";
name = repo;
rev = "a847a02e0137ab9e2fdbbaaf120826f870408ca6";
hash = "sha256-B0kW8Wa/nCT4KEYl2Rz6gQcj0Po3GxU6i42unHhgZeU=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-skk-jisyo";
name = repo;
rev = "ee94f6546ce52edfeec0fd203030f52d4d99656f";
hash = "sha256-RXxO878ZBkxenrdo7cFom5NjM0m7CdYQk0dFu/HPp/Y=";
})
(fetchFromGitHub rec {
owner = "utuhiro78";
repo = "mozcdic-ut-sudachidict";
name = repo;
rev = "55f61c3fca81dec661c36c73eb29b2631c8ed618";
hash = "sha256-gNnBcuVU1M7rllfZXIrLg7WYUhKqPJsUjR8Scnq3Fw8=";
})
(fetchurl rec {
name = "jawiki";
url = "https://dumps.wikimedia.org/${name}/20240620/${name}-20240620-all-titles-in-ns0.gz";
recursiveHash = true;
hash = "sha256-p1LP8mHYknUPEB9u9CLCP1/uUjCVfb/mdpnOPawGcqQ=";
downloadToTemp = true;
postFetch = ''
mkdir -p "$out"
install -Dm444 "$downloadedFile" "$out/${name}.gz"
'';
})
(fetchFromGitHub rec {
owner = "musjj";
repo = "jp-zip-codes";
name = repo;
rev = "cfbb54655223d8e2cea6fedbaef202919d8d62fe";
hash = "sha256-ZvZL/6yTE6JrBu4ja7HvyBUKWUAIL0jULii5Im+zmLQ=";
})
];
sourceRoot = ".";
nativeBuildInputs = [
glibcLocales
pkg-config
python3
ruby
wrapQtAppsHook
];
buildInputs = [ qtbase qtwayland ];
preBuild = ''
cd mozc/src
'';
# Required so that the ruby scripts can work
env.LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive";
env.LC_ALL = "en_US.UTF-8";
inherit bazel;
removeRulesCC = false;
dontAddBazelOpts = true;
bazelFlags = [
"--config"
"oss_linux"
"--compilation_mode"
"opt"
];
bazelTargets = [
"server:mozc_server"
"gui/tool:mozc_tool"
];
fetchAttrs = {
postPatch = ''
substituteInPlace mozc/src/WORKSPACE.bazel \
--replace \
'url = "https://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip"' \
"url = \"file://$PWD/jp-zip-codes/ken_all.zip\"" \
--replace \
'url = "https://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip"' \
"url = \"file://$PWD/jp-zip-codes/jigyosyo.zip\""
'';
preInstall = ''
rm -rf $bazelOut/external/qt_linux
'';
sha256 = "sha256-KTBdQte6eokKBnVlLWUOzGzwgwTVEq4qyICJhl8czJs=";
};
buildAttrs = {
postPatch = ''
sed -ri -e "s|^(LINUX_MOZC_SERVER_DIR = ).+|\1\"$out/lib/mozc\"|" mozc/src/config.bzl
(
cd merge-ut-dictionaries/src
sed -i -e "s|https://raw.githubusercontent.com/google/mozc/master|../../mozc|" remove_duplicate_ut_entries.rb
sed -i -e '/wget/d' count_word_hits.rb
sed -i -e "s|^filename = \"jawiki-.*|filename = \"../../jawiki/jawiki.gz\"|" count_word_hits.rb
[[ -e mozcdic-ut.txt ]] && rm mozcdic-ut.txt
dictionaries=(
${lib.escapeShellArgs dictionaries}
)
for name in "''${dictionaries[@]}"; do
tar -xf ../../mozcdic-ut-$name/mozcdic-ut-$name.txt.tar.bz2
cat mozcdic-ut-$name.txt >>mozcdic-ut.txt
done
ruby remove_duplicate_ut_entries.rb mozcdic-ut.txt
ruby count_word_hits.rb
ruby apply_word_hits.rb mozcdic-ut.txt
cat mozcdic-ut.txt >>../../mozc/src/data/dictionary_oss/dictionary00.txt
)
'';
installPhase = ''
runHook preInstall
install -Dm444 -t $out/share/licenses/mozc ../LICENSE
install -Dm444 -t $out/share/licenses/mozc/Submodules data/installer/credits_en.html
install -Dm555 -t $out/lib/mozc bazel-bin/server/mozc_server
install -Dm555 -t $out/lib/mozc bazel-bin/gui/tool/mozc_tool
runHook postInstall
'';
};
meta = with lib; {
description = "The Open Source edition of Google Japanese Input bundled with the UT dictionary";
homepage = "https://github.com/google/mozc";
license = with licenses; [
asl20 # abseil-cpp, merge-ut-dictionaries, mozcdic-ut-alt-cannadic,
# mozcdic-ut-edict2, mozcdic-ut-jawiki, mozcdic-ut-neologd,
# mecab-ipadic-neologd, mozcdic-ut-personal-names,
# mozcdic-ut-place-names, mozcdic-ut-skk-jisyo,
# mozcdic-ut-sudachidict
bsd2 # japanese-usage-dictionary
bsd3 # mozc, breakpad, gtest, gyp, japanese-usage-dictionary, protobuf, id.def
cc-by-sa-30 # jawiki-latest-all-titles, mozcdic-ut-jawiki.txt, jawiki
cc-by-sa-40 # mozcdic-ut-edict2.txt
gpl2Only # mozcdic-ut-alt-cannadic.txt
gpl2Plus # mozcdic-ut-skk-jisyo.txt
mit # wil
# naist-2003 # IPAdic
publicDomain # src/data/test/stress_test, mozcdic-ut-place-names.txt, jp-zip-codes, Okinawa dictionary
# unicode-30 # src/data/unicode, breakpad
];
maintainers = with maintainers; [ musjj ];
platforms = platforms.linux;
};
}