Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
bc0945228d
25 changed files with 527 additions and 137 deletions
|
@ -54,13 +54,13 @@ in
|
|||
TIME_STYLE = "+%Y-%m-%d %H:%M:%S";
|
||||
# Less colors
|
||||
LESS = "-R";
|
||||
LESS_TERMCAP_mb = "$'\E[1;31m'"; # begin blink
|
||||
LESS_TERMCAP_md = "$'\E[1;36m'"; # begin bold
|
||||
LESS_TERMCAP_me = "$'\E[0m'"; # reset bold/blink
|
||||
LESS_TERMCAP_so = "$'\E[01;44;33m'"; # begin reverse video
|
||||
LESS_TERMCAP_se = "$'\E[0m'"; # reset reverse video
|
||||
LESS_TERMCAP_us = "$'\E[1;32m'"; # begin underline
|
||||
LESS_TERMCAP_ue = "$'\E[0m'"; # reset underline
|
||||
LESS_TERMCAP_mb = "$(echo $'\\E[1;31m')"; # begin blink
|
||||
LESS_TERMCAP_md = "$(echo $'\\E[1;36m')"; # begin bold
|
||||
LESS_TERMCAP_me = "$(echo $'\\E[0m')"; # reset bold/blink
|
||||
LESS_TERMCAP_so = "$(echo $'\\E[01;44;33m')"; # begin reverse video
|
||||
LESS_TERMCAP_se = "$(echo $'\\E[0m')"; # reset reverse video
|
||||
LESS_TERMCAP_us = "$(echo $'\\E[1;32m')"; # begin underline
|
||||
LESS_TERMCAP_ue = "$(echo $'\\E[0m')"; # reset underline
|
||||
# Fzf
|
||||
FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}";
|
||||
};
|
||||
|
@ -138,7 +138,7 @@ in
|
|||
# TODO Maybe make nixpkg wrapper instead? So it also works from dmenu
|
||||
# Could also accept my fate... Home-manager doesn't necessarily make it easy to put things out of the home directory
|
||||
historySize = 100000;
|
||||
historyFile = "${config.xdg.cacheHome}/shell_history";
|
||||
historyFile = "${config.xdg.stateHome}/shell_history";
|
||||
in
|
||||
{
|
||||
|
||||
|
@ -196,7 +196,10 @@ in
|
|||
duration = "$( test -n \"$__TIMER\" && echo $(( $EPOCHREALTIME - $\{__TIMER:-EPOCHREALTIME})) || echo 0 )";
|
||||
# UPST Implement this properly in home-manager, would allow for bash support
|
||||
};
|
||||
extraUpdatePS1 = ''unset __TIMER'';
|
||||
extraUpdatePS1 = ''
|
||||
unset __TIMER
|
||||
echo -en "\033]0; $USER@$HOST $PWD\007"
|
||||
'';
|
||||
};
|
||||
gpg = {
|
||||
enable = true;
|
||||
|
@ -245,6 +248,7 @@ in
|
|||
less.enable = true;
|
||||
git = {
|
||||
enable = true;
|
||||
package = pkgs.gitFull;
|
||||
aliases = {
|
||||
"git" = "!exec git"; # In case I write one too many git
|
||||
};
|
||||
|
@ -339,9 +343,9 @@ in
|
|||
enableZshIntegration = true;
|
||||
pinentryFlavor = "gtk2"; # Falls back to curses when needed
|
||||
};
|
||||
# TODO Doesn't activate units by default. For now, we'll consider this as a safety feature.
|
||||
# TODO Syncs a bit too often, also constantly asks for passphrase, which is annoying.
|
||||
git-sync = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
repositories = {
|
||||
dotfiles = {
|
||||
path = "${config.xdg.configHome}/dotfiles";
|
||||
|
@ -408,6 +412,7 @@ in
|
|||
powerline-go
|
||||
|
||||
# terminal essentials
|
||||
file
|
||||
moreutils
|
||||
man
|
||||
unzip
|
||||
|
@ -462,7 +467,6 @@ in
|
|||
khard
|
||||
khal
|
||||
todoman
|
||||
syncthing
|
||||
|
||||
# TODO Lots of redundancy with other way things are defined here
|
||||
|
||||
|
@ -472,8 +476,8 @@ in
|
|||
];
|
||||
sessionVariables = {
|
||||
# Favourite commands
|
||||
PAGER = "${pkgs.less}/bin/less";
|
||||
EDITOR = "${pkgs.neovim}/bin/nvim";
|
||||
PAGER = "less";
|
||||
EDITOR = "nvim";
|
||||
|
||||
# Extra config
|
||||
BOOT9_PATH = "${config.xdg.dataHome}/citra-emu/sysdata/boot9.bin";
|
||||
|
@ -489,7 +493,7 @@ in
|
|||
YARN_DISABLE_SELF_UPDATE_CHECK = "true"; # This also disable the creation of a ~/.yarnrc file
|
||||
} // lib.optionalAttrs config.frogeye.desktop.xorg {
|
||||
# Favourite commands
|
||||
VISUAL = "${pkgs.neovim}/bin/nvim";
|
||||
VISUAL = "nvim";
|
||||
BROWSER = "${config.programs.qutebrowser.package}/bin/qutebrowser";
|
||||
|
||||
# Extra config
|
||||
|
@ -503,7 +507,7 @@ in
|
|||
(builtins.toString ./scripts)
|
||||
];
|
||||
file = {
|
||||
".face" = {
|
||||
".face" = { # TODO Doesn't show on NixOS. See https://wiki.archlinux.org/title/LightDM#Changing_your_avatar ?
|
||||
source = pkgs.runCommand "face.png" { } "${pkgs.inkscape}/bin/inkscape ${./face.svg} -w 1024 -o $out";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ in
|
|||
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base00; b = base01; d = base00; }; # Black or White, depending on current theme
|
||||
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow
|
||||
lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old
|
||||
lockSvg = pkgs.writeText "lock.svg" "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\" height=\"50\" width=\"50\"><path fill=\"${lockColors.a}\" d=\"M0 50h50V0H0z\"/><path d=\"M0 0l50 50H25L0 25zm50 0v25L25 0z\" fill=\"${lockColors.d}\"/></svg>";
|
||||
lockSvg = pkgs.writeText "lock.svg" "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\" height=\"50\" width=\"50\"><path fill=\"${lockColors.a}\" d=\"M0 50h50V0H0z\"/><path d=\"M0 0l50 50H25L0 25zm50 0v25L25 0z\" fill=\"${lockColors.b}\"/></svg>";
|
||||
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out";
|
||||
locker = pkgs.writeShellScript "i3-locker"
|
||||
''
|
||||
|
@ -48,6 +48,7 @@ in
|
|||
|
||||
${pkgs.lightdm}/bin/dm-tool lock
|
||||
# TODO Does that work for all DMs?
|
||||
# TODO Might want to use i3lock on NixOS configs still?
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -d ${config.xdg.cacheHome}/lockpatterns ]
|
||||
then
|
||||
|
@ -79,9 +80,13 @@ in
|
|||
mode_pres_sec = "Presentation (secondary display)";
|
||||
mode_screen = "Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default";
|
||||
mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue";
|
||||
fonts = config.stylix.fonts;
|
||||
in
|
||||
{
|
||||
modifier = "Mod4";
|
||||
fonts = {
|
||||
names = [ fonts.sansSerif.name ];
|
||||
};
|
||||
terminal = "alacritty";
|
||||
colors = let ignore = "#ff00ff"; in
|
||||
with config.lib.stylix.colors.withHashtag; lib.mkForce {
|
||||
|
@ -144,6 +149,9 @@ in
|
|||
"XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev";
|
||||
"XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle";
|
||||
"XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next";
|
||||
# Backlight
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
||||
# Misc
|
||||
"${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout"
|
||||
''
|
||||
|
@ -512,7 +520,7 @@ in
|
|||
autorandr = {
|
||||
enable = true;
|
||||
hooks.postswitch = {
|
||||
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
|
||||
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
|
||||
};
|
||||
};
|
||||
mpv = {
|
||||
|
@ -520,12 +528,18 @@ in
|
|||
config = {
|
||||
audio-display = false;
|
||||
save-position-on-quit = true;
|
||||
osc = false; # # Required by thumbnail script
|
||||
osc = false; # Required by thumbnail script
|
||||
# Hardware acceleration (from https://nixos.wiki/wiki/Accelerated_Video_Playback#MPV)
|
||||
hwdec = "auto-safe";
|
||||
vo = "gpu";
|
||||
profile = "gpu-hq";
|
||||
};
|
||||
scripts = with pkgs.mpvScripts; [ thumbnail ];
|
||||
scriptOpts = {
|
||||
mpv_thumbnail_script = {
|
||||
autogenerate = false; # TODO It creates too many processes at once, crashing the system
|
||||
cache_directory = "/tmp/mpv_thumbs_${config.home.username}";
|
||||
mpv_hwdec = "auto-safe";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -534,7 +548,7 @@ in
|
|||
xdg = {
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
associations.added = {
|
||||
defaultApplications = {
|
||||
"text/html" = "org.qutebrowser.qutebrowser.desktop";
|
||||
"x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop";
|
||||
"x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop";
|
||||
|
@ -583,6 +597,7 @@ in
|
|||
};
|
||||
};
|
||||
services = {
|
||||
blueman-applet.enable = true;
|
||||
unclutter.enable = true;
|
||||
dunst =
|
||||
{
|
||||
|
@ -625,7 +640,6 @@ in
|
|||
network = {
|
||||
listenAddress = "0.0.0.0"; # So it can be controlled from home
|
||||
# TODO ... and whoever is the Wi-Fi network I'm using, which, not great
|
||||
port = 8601; # FIXME Chose a different one for testing, should revert
|
||||
startWhenNeeded = true;
|
||||
};
|
||||
extraConfig = ''
|
||||
|
@ -637,6 +651,8 @@ in
|
|||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
pavucontrol # Because can't use Win+F1X on Pinebook 🙃
|
||||
|
||||
# remote
|
||||
tigervnc
|
||||
|
||||
|
@ -673,7 +689,6 @@ in
|
|||
xclip
|
||||
keynav
|
||||
xorg.xinit
|
||||
xorg.xbacklight
|
||||
# TODO Make this clean. Service?
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
home.packages = with pkgs; [
|
||||
# Common
|
||||
perf-tools
|
||||
git
|
||||
jq
|
||||
yq
|
||||
universal-ctags
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
# android tools
|
||||
android-tools
|
||||
|
||||
# Communication
|
||||
signal-desktop
|
||||
|
||||
# downloading
|
||||
# transmission TODO Collision if both transmissions are active?
|
||||
|
||||
|
@ -61,5 +64,8 @@
|
|||
# https://hydra.nixos.org/job/nixos/release-23.11/nixpkgs.blender.aarch64-linux
|
||||
blender
|
||||
]);
|
||||
services = {
|
||||
syncthing.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash --pure
|
||||
#! nix-shell -p bash openssh coreutils gawk gnused
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# TODO More integrated with current config
|
||||
|
||||
|
@ -44,13 +42,17 @@ then
|
|||
grep -o '^\s*[^#]*' $SCRIPT_DIR/.bsh/inputrc | sed 's/^\s\+//' > "${WORK}/i"
|
||||
grep -o '^\s*[^"]*' $SCRIPT_DIR/.bsh/vimrc | sed 's/^\s\+//' > "${WORK}/v"
|
||||
|
||||
# Crafting command
|
||||
b64="$(cd "$CACHE_DIR"; tar czf - "$FOLDER_NAME" | base64 -w 0)"
|
||||
echo "echo $b64|base64 -d|tar xzC /tmp" > "${CACHE_DIR}/cmd"
|
||||
echo "bash --rcfile ${DEST}/b" >> "${CACHE_DIR}/cmd"
|
||||
echo "rm -rf ${DEST}" >> "${CACHE_DIR}/cmd"
|
||||
# Creating entrypoint
|
||||
echo "bash --rcfile ${DEST}/b" > "${WORK}/e"
|
||||
echo "rm -rf ${DEST}" >> "${WORK}/e"
|
||||
# TODO Do not remove unless last one connected
|
||||
|
||||
# Crafting command
|
||||
b64="$(cd "$CACHE_DIR"; tar czf - --sort=name "$FOLDER_NAME" | base64 -w 0)"
|
||||
echo "echo $b64|base64 -d|tar xzC /tmp" > "${CACHE_DIR}/cmd"
|
||||
# Due to magic, if the last command executed is bash, it disappears from the list of processes
|
||||
echo "sh ${DEST}/e" >> "${CACHE_DIR}/cmd"
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$WORK"
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#! nix-shell -i python3 --pure
|
||||
#! nix-shell -p python3
|
||||
|
||||
# vim: set filetype=python :
|
||||
|
||||
import sys
|
||||
from math import inf
|
||||
|
||||
|
@ -14,11 +16,11 @@ if N < 2:
|
|||
sys.exit(1)
|
||||
|
||||
|
||||
def trajet_str(a, b):
|
||||
def trajet_str(a: int, b: int) -> str:
|
||||
return f"{gares[a]} → {gares[b]}"
|
||||
|
||||
|
||||
def chemin_str(stack):
|
||||
def chemin_str(stack: list[int]) -> str:
|
||||
return ", ".join(
|
||||
[trajet_str(stack[i], stack[i + 1]) for i in range(len(stack) - 1)]
|
||||
)
|
||||
|
@ -26,7 +28,7 @@ def chemin_str(stack):
|
|||
|
||||
# Demande des prix des trajets
|
||||
|
||||
prices = dict()
|
||||
prices: dict[int, dict[int, float]] = dict()
|
||||
|
||||
for i in range(N):
|
||||
for j in range(N - 1, i, -1):
|
||||
|
@ -50,7 +52,7 @@ maxiPrice = -inf
|
|||
maxiStack = None
|
||||
|
||||
|
||||
def register_path(stack):
|
||||
def register_path(stack: list[int]) -> None:
|
||||
price = sum([prices[stack[i]][stack[i + 1]] for i in range(len(stack) - 1)])
|
||||
|
||||
global miniPrice, maxiPrice, miniStack, maxiStack
|
||||
|
@ -72,5 +74,7 @@ while stack[0] == 0:
|
|||
else:
|
||||
stack.append(stack[-1] + 1)
|
||||
|
||||
assert miniStack
|
||||
assert maxiStack
|
||||
print(f"Prix minimum: {chemin_str(miniStack)} = {miniPrice:.2f} €")
|
||||
print(f"Prix maximum: {chemin_str(maxiStack)} = {maxiPrice:.2f} €")
|
||||
|
|
13
hm/style.nix
13
hm/style.nix
|
@ -3,7 +3,8 @@ let
|
|||
# Currently last commit in https://github.com/danth/stylix/pull/194
|
||||
stylix = builtins.fetchTarball "https://github.com/willemml/stylix/archive/2ed2b0086b41d582aca26e083c19c0e47c8991e3.tar.gz";
|
||||
polarityFile = "${config.xdg.stateHome}/theme_polarity";
|
||||
polarity = if builtins.pathExists polarityFile then lib.strings.fileContents polarityFile else "light";
|
||||
polarityFromFile = if builtins.pathExists polarityFile then lib.strings.fileContents polarityFile else "light";
|
||||
polarity = if config.frogeye.polarity == "dynamic" then polarityFromFile else config.frogeye.polarity;
|
||||
phases = [
|
||||
{ command = "jour"; polarity = "light"; }
|
||||
{ command = "crepuscule"; polarity = "dark"; }
|
||||
|
@ -47,19 +48,21 @@ in
|
|||
dconf.enable = false; # Otherwise standalone home-manager complains it can't find /etc/dbus-1/session.conf on Arch.
|
||||
# Symlinking it to /usr/share/dbus-1/session.conf goes further but not much.
|
||||
|
||||
# TODO Use xbacklight instead (pindakaas doesn't seem to support it OOTB)
|
||||
home.packages = map
|
||||
(phase: (pkgs.writeShellApplication {
|
||||
name = "${phase.command}";
|
||||
runtimeInputs = [ pkgs.brightnessctl ];
|
||||
text = (lib.optionalString cfg.enable ''
|
||||
echo ${builtins.toString (builtins.getAttr phase.command cfg)} | sudo tee /sys/class/backlight/${cfg.backlight}/brightness
|
||||
'') + ''
|
||||
brightnessctl set ${builtins.getAttr phase.command cfg}
|
||||
'') + ''
|
||||
echo ${phase.polarity} > ${polarityFile}
|
||||
if command -v home-manager
|
||||
then
|
||||
home-manager switch
|
||||
else
|
||||
sudo nixos-rebuild switch
|
||||
# In two steps to get the visual changes slightly earlier
|
||||
sudo /nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration test
|
||||
sudo /nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration boot
|
||||
fi
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue