Compare commits

...

141 commits
flakes ... main

Author SHA1 Message Date
Geoffrey Frogeye 48bf80f1c0
24.05 Fixed terminal, vim, lix and stuff
Also "fixed" display link, but turned out that the display cable wasn't
plugged in correctly anymore...
2024-06-02 22:30:18 +02:00
Geoffrey Frogeye 3479927d32
24.05: Fixed warnings 2024-06-01 21:32:11 +02:00
Geoffrey Frogeye 71385d9ba9
24.05: Buildable 2024-06-01 18:22:50 +02:00
Geoffrey Frogeye fe33f30bce
No more port 2278 2024-05-18 17:05:56 +02:00
Geoffrey Frogeye a95ae5f568
curacao: Reduce beesd load targets 2024-05-13 09:19:55 +02:00
Geoffrey Frogeye de187c6044 Revert "curacao: Relieve razmo of stress"
This reverts commit 2a3624af09.

With new razmo this should be fine.
2024-05-13 09:16:02 +02:00
Geoffrey Frogeye 2804086233
curacao: New razmo! 2024-05-12 20:34:22 +02:00
Geoffrey Frogeye 88e0a1eb09
Revert kernel upgrade
I need 6.2+ for DS4,
evdi doesn't work with kernel 6.6+,
all versions matching are EOL.

Probably won't game much before 24.05 release which hopefully helps
things?
2024-05-11 00:09:53 +02:00
Geoffrey Frogeye 995c115c90
🎮 DualShock 4 (or is it?) love
ddcci removed again because it still doesn't do anything and also doesn't compile
with latest kernel.
2024-05-10 23:27:45 +02:00
Geoffrey Frogeye 7c6e8adbed
Re-add itch 2024-05-10 17:31:33 +02:00
Geoffrey Frogeye 536eee36ad
remote-builds: Disable by default
It makes things slower and my server unresponsive sometimes.
Probably more work to be done but I don't feel like doing that now.
2024-05-10 14:50:02 +02:00
Geoffrey Frogeye 2a3624af09
curacao: Relieve razmo of stress
Maybe I'm pushing its limits too hard... it doesn't seem to be doing
great. Maybe because it knows I'll replace it soon.
2024-05-10 14:44:37 +02:00
Geoffrey Frogeye 4ff4e0cc99
curacao: No more archlinux ~~dataset~~ subvolume 2024-05-10 13:28:25 +02:00
Geoffrey Frogeye 6e8d8b43c2
Replace rnix with nixd 2024-05-10 11:05:48 +02:00
Geoffrey Frogeye 7c74c5e1d9
Lix: Remove substituters
Those are mostly misses, even for Lix.
2024-05-10 01:51:23 +02:00
Geoffrey Frogeye 552e1c1cf2
Upgrade 2024-05-10 01:51:16 +02:00
Geoffrey Frogeye 056e3447e4
remote-builds: Specify max jobs
Should make better use of the hardware. Otherwise it's roundtrip frenzy.
2024-05-09 23:13:08 +02:00
Geoffrey Frogeye bd84dd7fd7
remote-builds: Reduce amount of SSH connections
It seems to be doing a SSH connection for each path it has to check...
wow.
2024-05-09 23:07:51 +02:00
Geoffrey Frogeye cc46352873
Misc fixes 2024-05-08 13:24:03 +02:00
Geoffrey Frogeye c770380328
Lix! 😋🍦 2024-05-08 13:08:39 +02:00
Geoffrey Frogeye a2e15e8c33
Attempt at using nom 2024-05-08 12:56:05 +02:00
Geoffrey Frogeye bdabf30728
Add repl 2024-05-08 09:47:57 +02:00
Geoffrey Frogeye 176be4f218
Shorten flake a bit 2024-05-08 09:37:04 +02:00
Geoffrey Frogeye 82d5e8a466
remote-builds: Fix 🙈 2024-05-07 23:05:32 +02:00
Geoffrey Frogeye 7a612754f6
curacao: Ok nvidia modules brings problems, let's revert 2024-05-07 22:59:16 +02:00
Geoffrey Frogeye 0663e3755b
remote-builds: Fix SSH host keys
vivarium doesn't actually transfer the public keys, so the .pub files
are from somewhere during installation... oops.
2024-05-07 00:00:36 +02:00
Geoffrey Frogeye bd538785b8
remote-builds: Add aarch64 support 2024-05-06 22:50:01 +02:00
Geoffrey Frogeye c4bb02b16e
Attempt at using lix
Without remote builds and with my laptop setup it's not really viable
for now :(
2024-05-06 22:26:36 +02:00
Geoffrey Frogeye e68be9e665
curacao: nvidia drivers were not there? 2024-05-06 22:26:15 +02:00
Geoffrey Frogeye 836f8ee8b4
Further attempt at remote builds 2024-05-06 22:25:35 +02:00
Geoffrey Frogeye b0168f4354 gaming: Add dolphin 2024-05-05 13:32:36 +02:00
Geoffrey Frogeye 0e1d387069
Upgrade 2024-04-29 12:29:45 +02:00
Geoffrey Frogeye 7b8ff04f5d
gpg: Increase passphrase remembering timeout
Sweet relief.
2024-04-29 12:26:39 +02:00
Geoffrey Frogeye d276581d94
Add/refresh Nix-related search engines 2024-04-29 12:26:23 +02:00
Geoffrey Frogeye 5924bd59c6
Make Docker work
This tells you how much I use it 😅
2024-04-29 12:25:47 +02:00
Geoffrey Frogeye 173a231556
Add more network/hardware debug tools 2024-04-24 13:25:59 +02:00
Geoffrey Frogeye 98af492b75
curacao: Allow Wake On Lan 2024-04-23 17:57:20 +02:00
Geoffrey Frogeye 6e15aa2ea7
Upgrade 2024-04-20 09:42:53 +02:00
Geoffrey Frogeye 028cadb6ab
Update 2024-04-11 10:43:14 +02:00
Geoffrey Frogeye 8005cbfbc1
Attempt at controlling external screens brightness 2024-04-10 16:32:14 +02:00
Geoffrey Frogeye b7d8797a6d
remote-builds: WIP 2024-04-10 01:05:38 +02:00
Geoffrey Frogeye 96ddd61320 Merge remote-tracking branch 'origin' 2024-04-05 13:50:28 +02:00
Geoffrey Frogeye cbc9a87f09
Update 2024-04-04 21:15:23 +02:00
Geoffrey Frogeye ab30bdf6a8 Merge remote-tracking branch 'origin/main' 2024-04-04 20:14:09 +02:00
Geoffrey Frogeye 067cfc3d7a
aerc: Added
More of a test for now?
2024-04-04 20:12:24 +02:00
Geoffrey Frogeye 044318babc
Display changed derivations on activation 2024-04-01 14:59:07 +02:00
Geoffrey Frogeye c319ee1394
Revert "desktop: Wii pointer"
This reverts commit a3999cc9b1.

It's fun 5 minutes, but missing the I thing is a bit annoying :(
2024-04-01 12:26:37 +02:00
Geoffrey Frogeye a3999cc9b1
desktop: Wii pointer 2024-04-01 12:25:53 +02:00
Geoffrey Frogeye 1615abd814
mpd/curacao: Can be controlled remotely 2024-03-29 10:42:25 +01:00
Geoffrey Frogeye 0c59a713da
Update 2024-03-28 16:16:40 +01:00
Geoffrey Frogeye 4e68c3ccf7
dedup: Keep load under control 2024-03-27 13:09:33 +01:00
Geoffrey Frogeye 5148643a64
curacao: Add cameractrls (sorta) 2024-03-27 13:09:00 +01:00
Geoffrey Frogeye 4358f717d0
curacao: Scrub scrub scrub 2024-03-26 18:28:21 +01:00
Geoffrey Preud'homme 25c00be8fd
Ability to use unstable packages 2024-03-26 17:04:16 +01:00
Geoffrey Preud'homme fe468eebd7
Remove nixGL 2024-03-26 16:49:09 +01:00
Geoffrey Preud'homme 7973e2ccd7
Remove usernix and home-manager standalone 2024-03-26 16:47:59 +01:00
Geoffrey Preud'homme 76a594ca9f Import some dependencies where they are needed 2024-03-26 16:18:17 +01:00
Geoffrey Frogeye 8d1d15a08e
Update 2024-03-23 09:48:04 +01:00
Geoffrey Frogeye b02ec1c28c
curacao: Apply intel microcode 2024-03-23 09:46:59 +01:00
Geoffrey Frogeye ce5a099899
curacao: Add CO2 sensor 2024-03-22 20:22:23 +01:00
Geoffrey Frogeye 20dd333799
curacao: Try deduplication 2024-03-22 18:04:23 +01:00
Geoffrey Frogeye f04f8160db
Update 2024-03-21 23:23:22 +01:00
Geoffrey Frogeye 35783ea086
curacao: New screen disposition 2024-03-21 23:23:08 +01:00
Geoffrey Frogeye 440b1e0563
Fix locale 2024-03-10 19:13:57 +01:00
Geoffrey Frogeye a0d7e43a9d
account: Add support 2024-03-09 23:50:31 +01:00
Geoffrey Frogeye b3f1d95634
lock: More goodness 2024-03-09 19:09:30 +01:00
Geoffrey Frogeye 82bafb3428
i3: Use --release 2024-03-09 19:02:57 +01:00
Geoffrey Frogeye 2fa993ad2d
i3: Reduce invalid binding warnings 2024-03-09 19:01:27 +01:00
Geoffrey Frogeye 14f7199d65
xlock: Add option 2024-03-09 18:22:51 +01:00
Geoffrey Frogeye c7c2c89f15 Merge remote-tracking branch 'origin/main' 2024-03-04 16:53:10 +01:00
Geoffrey Frogeye 2b76db290c
Upgrade 2024-03-04 16:52:01 +01:00
Geoffrey Frogeye ac0724d97a
pindakaas: Fix video stuttering 2024-02-19 00:55:45 +01:00
Geoffrey Frogeye 5d4908d2e2
update-local-flakes: Fail early 2024-02-18 14:12:32 +01:00
Geoffrey Frogeye ee4e45905a
wifi: Make more user-friendly 2024-02-18 13:38:01 +01:00
Geoffrey Frogeye 097d53807d
install_os: Fix flake selection 2024-02-18 00:09:08 +01:00
Geoffrey Frogeye 833320e3fa
Fix OS scripts for flakes 2024-02-17 23:35:53 +01:00
Geoffrey Frogeye 448a154d74
Fix previous for pindakaas 2024-02-17 19:05:50 +01:00
Geoffrey Frogeye 8476bbde12
Re-add variants and reorganize things 2024-02-17 18:39:09 +01:00
Geoffrey Frogeye bf803d18a6
Update and restore white for music 2024-02-12 12:31:59 +01:00
Geoffrey Frogeye 6e176fe61b
frobar: Use frogarized (dark) colors
Wanted to refactor things first, but hmmm, no sweet consistency has
priority.
2024-02-10 13:30:11 +01:00
Geoffrey Frogeye f65f6853ee
firefox: Some settings 2024-02-09 19:10:23 +01:00
Geoffrey Frogeye 972dcaae1f
Oupdate 2024-02-07 22:12:24 +01:00
Geoffrey Frogeye 659f6ae806 Merge remote-tracking branch 'origin/main' 2024-02-04 15:01:27 +01:00
Geoffrey Frogeye e5b034781d
Add evince
For forms. Crap, I should have put that as a file comment.
2024-02-04 14:54:35 +01:00
Geoffrey Frogeye 11c1c8d9f1 Merge remote-tracking branch 'office/main' 2024-02-03 19:40:42 +01:00
Geoffrey Frogeye 21aed8114f
btdu 2024-02-03 19:40:06 +01:00
Geoffrey Preud'homme 8e6203ce7d
scripts/lip: Fix 2024-02-01 16:24:19 +01:00
Geoffrey Frogeye 16f5a0a9a5
Merge remote-tracking branch 'origin/main' 2024-01-28 12:13:58 +01:00
Geoffrey Frogeye f30abd991c
Printing support 2024-01-28 12:13:27 +01:00
Geoffrey Frogeye c936d859c7
Frogarized! 2024-01-27 14:23:26 +01:00
Geoffrey Frogeye 5bba711d3c
Plymouth!
Yeah yeah I know...
2024-01-27 00:23:38 +01:00
Geoffrey Frogeye 9c6a2f69f0
vim/git: Use gitlinker 2024-01-26 22:02:25 +01:00
Geoffrey Frogeye 85cd61d206
thefuck: Added
Mostly as an experiment for now.
2024-01-26 18:38:28 +01:00
Geoffrey Frogeye ffd871299b
Update nixpkgs 2024-01-26 18:37:56 +01:00
Geoffrey Frogeye ca2dc262b7
gpg: Fancy pinentry 2024-01-26 00:23:52 +01:00
Geoffrey Frogeye 59db464987 Merge remote-tracking branch 'office/main' 2024-01-25 23:55:55 +01:00
Geoffrey Frogeye 0bb5981f3a
vim: Fix tabline bindings 2024-01-25 23:53:59 +01:00
Geoffrey Preud'homme 5b3c887b41
git-sync: Only push when there's something to push 2024-01-25 13:03:30 +01:00
Geoffrey Frogeye dfc8d68495
vim/decoration: Small adjustments 2024-01-23 23:38:48 +01:00
Geoffrey Frogeye 09b201ca24
Change status line
Time spent on writing Nix config:
5%: Testing new shiny things
7%: Debugging issues
88%: Gettings the colors and theming juuuuuust right
Help, my sleep schedule is dying
2024-01-22 00:02:13 +01:00
Geoffrey Frogeye 7cd77af9bf
vim: Move more things to prose 2024-01-20 19:36:49 +01:00
Geoffrey Frogeye a57c6527ce
vim: Fix lsp todos 2024-01-20 19:36:47 +01:00
Geoffrey Frogeye 97a3e5f6e4
vim: Fix Reload command 2024-01-20 19:36:45 +01:00
Geoffrey Frogeye 55756e4ae7
English is a programming language, fight me 2024-01-19 22:50:01 +01:00
Geoffrey Frogeye eac22be095
No Ansible by default 2024-01-19 00:50:45 +01:00
Geoffrey Frogeye fdf6725dc9
vim: Configure fugitive-gitlab 2024-01-18 22:49:46 +01:00
Geoffrey Frogeye 46db2dd34f
stylix: Workaround for non-DE environments 2024-01-17 00:08:07 +01:00
Geoffrey Frogeye bac1813c77
nod: Fifth attempt at flakes
Also simplified a few things, nice
2024-01-16 23:48:41 +01:00
Geoffrey Frogeye e56514890d
nod: 4th attempt at flakes
Is it the time I do the joke "Xth time the charm"?
2024-01-16 23:31:54 +01:00
Geoffrey Frogeye 30f1880f29
nod: 3rd attempt at flakes 2024-01-16 23:27:15 +01:00
Geoffrey Frogeye 770697f9f3
nod: Second attempt at flakes 2024-01-16 23:07:33 +01:00
Geoffrey Frogeye 65205a2fb8
nod: Flake test 2024-01-16 22:39:29 +01:00
Geoffrey Frogeye 55641fe958
passwordFiles: Added 2024-01-16 17:04:30 +01:00
Geoffrey Frogeye 6cee16924c
firefox: Rudimentary config, tridactyl support 2024-01-15 23:12:02 +01:00
Geoffrey Frogeye 1dbfd6cf88
terminal: Split out 2024-01-15 21:36:20 +01:00
Geoffrey Frogeye fbde2f5028
i3: Compress repetitions
For workspaces it makes sense, for cardinals maybe it was a tad
overkill. Oh well, at least it's ready for 3D 🙃
2024-01-15 20:11:54 +01:00
Geoffrey Frogeye 43e7a5af46
style: Split out and fixes 2024-01-15 19:26:44 +01:00
Geoffrey Frogeye 1b008c1ae8
presentation: Split out 2024-01-15 18:54:19 +01:00
Geoffrey Frogeye c1d8bc65af
Update and more backups 2024-01-15 18:36:51 +01:00
Geoffrey Frogeye 26e70acb2f
autorandr: Split out 2024-01-15 14:50:02 +01:00
Geoffrey Frogeye e9a8d16ece
i3: Add config to easily create modes
With their associated "switch-to" keybinding.
2024-01-13 22:58:45 +01:00
Geoffrey Frogeye e4c407fb28
Move some things where they belong 2024-01-13 01:51:42 +01:00
Geoffrey Frogeye d994dfb9fb
i3/desktop: Split out 2024-01-12 23:52:53 +01:00
Geoffrey Frogeye 2ad4bee0f9
vim: Split out 2024-01-12 18:08:11 +01:00
Geoffrey Frogeye 4412180b3a
Split out hm/common
I went nuclear...
2024-01-11 23:54:03 +01:00
Geoffrey Frogeye 033f411060
git-sync: Replace with git-sync 2024-01-11 22:25:52 +01:00
Geoffrey Frogeye f83806a307
go: Separate file 2024-01-10 14:01:39 +01:00
Geoffrey Frogeye bf796d9587
script: Various fixes 2024-01-10 13:55:15 +01:00
Geoffrey Frogeye 6e4130fd26
vim: Better snippets (and split completion file) 2024-01-09 21:53:00 +01:00
Geoffrey Frogeye d325eb2d27
vim: Replace nvim-compe with nvim-cmp 2024-01-09 20:00:12 +01:00
Geoffrey Frogeye aeccc22857
vim: Replace old plugin with rainbow-delimiter
In case you're wondering
3c8a185da4?tab=readme-ov-file#rainbow-delimitersnvim-integration
is not worth the trouble...
2024-01-09 00:13:20 +01:00
Geoffrey Frogeye 8f370c5040
python: Move to separate file 2024-01-08 23:24:17 +01:00
Geoffrey Frogeye 83b38ddf61
vim: Put in correct folder 2024-01-08 23:10:50 +01:00
Geoffrey Frogeye 42bc007ed4
c: Move into own file 2024-01-08 22:59:06 +01:00
Geoffrey Frogeye 881b22c9b2
Move gpg, git, tmux/screen to separate file 2024-01-08 21:48:31 +01:00
Geoffrey Frogeye 124df42fd8
hm: Reorganize installed programs 2024-01-07 23:41:35 +01:00
Geoffrey Frogeye 5360f8ff10
i3: Separate file 2024-01-07 23:29:16 +01:00
Geoffrey Frogeye 4190299030
qutebrowser: Add nix search engines 2024-01-07 22:51:09 +01:00
Geoffrey Frogeye 66f3179d41 Merge remote-tracking branch 'origin/main' 2024-01-07 22:39:54 +01:00
Geoffrey Frogeye ecc6cb983d
qutebrowser: Own file 2024-01-07 22:38:42 +01:00
Geoffrey Frogeye e0fb3fcb22
Flake fixes for new systems 2024-01-07 19:37:06 +01:00
136 changed files with 3981 additions and 2833 deletions

5
.gitignore vendored
View file

@ -1,5 +1,2 @@
*/hm
*/system
*/vm
*/vmWithBootLoader
result
*.qcow2

View file

@ -28,7 +28,6 @@ It is built on top of the Nix ecosystem
## Scripts
They all have a `-h` flag.
Except `add_channels.sh`, which should be removed as soon as I migrate to Flakes.
## Extensions

View file

@ -1,73 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p bash nix-output-monitor
echo FIXME Not flakes ready
exit 1
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Parse arguments
function help {
echo "Usage: $0 [-h|-v|-b] profile"
echo "Build Home Manager configuration on the local machine."
echo
echo "Arguments:"
echo " profile: Home Manager profile to use"
echo
echo "Options:"
echo " -h: Display this help message."
}
while getopts "h" OPTION
do
case "$OPTION" in
h)
help
exit 0
;;
?)
help
exit 2
;;
esac
done
shift "$(($OPTIND -1))"
if [ "$#" -ne 1 ]
then
help
exit 2
fi
profile="$1"
profile_dir="${SCRIPT_DIR}/${profile}"
if [ ! -d "$profile_dir" ]
then
echo "Profile not found."
fi
home_manager_config="${profile_dir}/hm.nix"
if [ ! -f "$home_manager_config" ]
then
echo "Home Manager configuration not found."
fi
set -x
nom-build '<home-manager/home-manager/home-manager.nix>' --argstr confPath "${home_manager_config}" -o "${profile_dir}/hm"
set +x
echo 
path="$(readlink -f "${profile_dir}/hm")"
echo "Manual installation instructions:"
echo "- Transfer $path and dependencies to the destination machine (somehow)"
echo "- Run $path/activate as the destination user"
echo "- Log into the user again to make sure everything is sourced"
echo "- Transfer necessary private keys (or use ssh -A for testing)"
echo "- Run git-sync-init"
echo "- Check that the system can build itself"

View file

@ -1,17 +1,14 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p bash nix-output-monitor
echo FIXME Not flakes ready
exit 1
#! nix-shell -p nix
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Parse arguments
function help {
echo "Usage: $0 [-h|-v|-b] profile"
echo "Build NixOS configuration on the local machine."
echo "Usage: $0 [-h|-e|-b] [flake-uri#]name"
echo "Build a NixOS configuration on the local machine."
echo
echo "Arguments:"
echo " profile: OS/disk profile to use"
@ -22,7 +19,7 @@ function help {
echo " -b: Build a virtual machine with boot loader."
}
attr=system
arg=build
while getopts "hvb" OPTION
do
case "$OPTION" in
@ -31,10 +28,10 @@ do
exit 0
;;
v)
attr=vm
arg=build-vm
;;
b)
attr=vmWithBootLoader
arg=build-vm-with-bootloader
;;
?)
help
@ -42,29 +39,35 @@ do
;;
esac
done
shift "$(($OPTIND -1))"
shift "$((OPTIND -1))"
if [ "$#" -ne 1 ]
then
help
exit 2
fi
profile="$1"
profile_dir="${SCRIPT_DIR}/${profile}"
if [ ! -d "$profile_dir" ]
if [[ "$1" == *"#"* ]]
then
echo "Profile not found."
flake_uri="$(echo "$1" | cut -d'#' -f1)"
flake_uri=$( cd -- "$flake_uri" &> /dev/null && pwd )
name="$(echo "$1" | cut -d'#' -f2)"
else
flake_uri="$SCRIPT_DIR"
name="$1"
fi
nixos_config="${profile_dir}/os.nix"
if [ ! -f "$nixos_config" ]
if [ ! -f "$flake_uri/flake.nix" ]
then
echo "NixOS configuration not found."
echo "Flake not found."
fi
flake="${flake_uri}#${name}"
set -x
nom-build '<nixpkgs/nixos>' -I "nixos-config=${nixos_config}" -A "$attr" -o "${profile_dir}/${attr}"
nix --extra-experimental-features "nix-command flakes" run "${SCRIPT_DIR}#nixos-rebuild" -- "$arg" --flake "$flake"
echo 
# TODO Use update-local-flakes?

View file

@ -1,10 +1,12 @@
{ id, name, passwordFile ? "/should_not_be_needed_in_this_context", ... }:
{ pkgs, lib, config, ... }:
let
passwordFile = "/tmp/dotfiles_${config.networking.hostName}_password";
in
{
disko.devices = {
disk = {
"${name}" = {
"${config.networking.hostName}" = {
type = "disk";
device = "/dev/disk/by-id/${id}";
content = {
type = "gpt";
partitions = {
@ -25,7 +27,7 @@
size = "100%";
content = {
type = "luks";
name = "${name}";
name = "${config.networking.hostName}";
passwordFile = passwordFile;
settings = {
# Not having SSDs die fast is more important than crypto

View file

@ -0,0 +1,22 @@
{ pkgs, lib, config, ... }:
let
generator = pkgs.writers.writePython3 "frogarized"
{
libraries = [ pkgs.python3Packages.colorspacious ];
}
(builtins.readFile ./frogarized.py);
frogarized_json = polarity: pkgs.runCommand "frogarized-${polarity}.json" { } "${generator} --polarity ${polarity} --output json > $out";
frogarized_nix = polarity: builtins.fromJSON (builtins.readFile (frogarized_json polarity));
in
{
config = {
stylix = {
base16Scheme = frogarized_nix config.stylix.polarity;
# On purpose also enable without a DE because stylix complains otherwise
image = builtins.fetchurl {
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
};
};
};
}

112
common/frogarized/frogarized.py Executable file
View file

@ -0,0 +1,112 @@
import argparse
import json
import colorspacious
import numpy as np
# Original values for the Solarized color scheme,
# created by Ethan Schoonover (https://ethanschoonover.com/solarized/)
SOLARIZED_LAB = np.array(
[
[15, -12, -12],
[20, -12, -12],
[45, -7, -7],
[50, -7, -7],
[60, -6, -3],
[65, -5, -2],
[92, -0, 10],
[97, 0, 10],
[50, 65, 45],
[50, 50, 55],
[60, 10, 65],
[60, -20, 65],
[60, -35, -5],
[55, -10, -45],
[50, 15, -45],
[50, 65, -5],
]
)
# I couldn't get a perfect translation of Solarized L*a*b values into sRGB,
# so here is upstream's translation for reference
SOLARIZED_RGB = np.array(
[
[0, 43, 54],
[7, 54, 66],
[88, 110, 117],
[101, 123, 131],
[131, 148, 150],
[147, 161, 161],
[238, 232, 213],
[253, 246, 227],
[220, 50, 47],
[203, 75, 22],
[181, 137, 0],
[133, 153, 0],
[42, 161, 152],
[38, 139, 210],
[108, 113, 196],
[211, 54, 130],
]
)
# Parse arguments
parser = argparse.ArgumentParser(
description="Generate a base16-theme based derived from Solarized"
)
parser.add_argument("--source", choices=["lab", "rgb"], default="lab")
parser.add_argument("--lightness_factor", type=float, default=1.0)
parser.add_argument("--chroma-factor", type=float, default=1.0)
parser.add_argument("--hue_shift", type=float, default=-75.0)
parser.add_argument("--polarity", choices=["dark", "light"], default="dark")
parser.add_argument(
"--output", choices=["json", "truecolor"], default="truecolor"
)
args = parser.parse_args()
# Convert source to JCh color space
if args.source == "lab":
solarized_jch = colorspacious.cspace_convert(
SOLARIZED_LAB, "CIELab", "JCh"
)
elif args.source == "rgb":
solarized_jch = colorspacious.cspace_convert(
SOLARIZED_RGB, "sRGB255", "JCh"
)
# Build frogarized theme
jch_factor = [args.lightness_factor, args.chroma_factor, 1]
jch_shift = [0, 0, args.hue_shift]
frogarzied_jch = np.vstack(
[solarized_jch[:8] * jch_factor + jch_shift, solarized_jch[8:]]
)
# Convert frogarized to RGB
frogarized_srgb = colorspacious.cspace_convert(
frogarzied_jch, "JCh", "sRGB255"
)
frogarized_rgb = np.uint8(np.rint(np.clip(frogarized_srgb, 0, 255)))
if args.polarity == "light":
frogarized_rgb = np.vstack([frogarized_rgb[7::-1], frogarized_rgb[8:]])
# Output
palette = dict()
for i in range(16):
rgb = frogarized_rgb[i]
r, g, b = rgb
hex = f"#{r:02x}{g:02x}{b:02x}"
palette[f"base{i:02X}"] = hex
if args.output == "truecolor":
print(f"\033[48;2;{r};{g};{b}m{hex}\033[0m") # ]]
# treesitter is silly and will consider brackets in strings
# as indentation, hence the comment above
if args.output == "json":
scheme = palette.copy()
scheme.update(
{
"slug": f"frogarized-{args.polarity}",
"scheme": f"Frogarized {args.polarity.title()}",
"author": "Geoffrey Frogeye (with work from Ethan Schoonover)",
}
)
print(json.dumps(scheme, indent=4))

View file

@ -2,13 +2,13 @@
# MANU Snapper is not able to create the snapshot directory, so you'll need to do this after eventually running the backup script:
# sudo btrfs subvol create /mnt/razmo/$subvolume/.snapshots
let
backup_subvolumes = [ "nixos" "home.rapido" ];
backup_subvolumes = [ "nixos" "home.rapido" "home.nixos" ];
backup_app = pkgs.writeShellApplication {
name = "backup-subvolume";
runtimeInputs = with pkgs; [ coreutils btrfs-progs ];
text = builtins.readFile ./backup.sh;
};
snapper_subvolumes = [ "nixos" "home.rapido" "home.razmo" ];
snapper_subvolumes = [ "nixos" "home.rapido" "home.razmo" "home.nixos" ];
in
{
services =

View file

@ -0,0 +1,71 @@
{ pkgs, lib, config, ... }:
let
zytemp_mqtt_src = pkgs.fetchFromGitHub {
owner = "patrislav1";
repo = "zytemp_mqtt";
rev = "a6be5e3082e1e10dee435cfb9643fb13e9a71c34"; # PR that adds humidity
sha256 = "sha256-cMWDi20isnbB6jlMzut7YyYB4te4bVFYXSgCEQWQnts=";
};
zytemp_mqtt = pkgs.python3Packages.buildPythonPackage
rec {
name = "zytemp_mqtt";
src = zytemp_mqtt_src;
propagatedBuildInputs = with pkgs.python3Packages; [ hidapi paho-mqtt pyaml ];
};
usb_zytemp_udev = pkgs.stdenv.mkDerivation {
pname = "usb-zytemp-udev-rules";
version = "unstable-2023-05-24";
src = zytemp_mqtt_src;
dontConfigure = true;
dontBuild = true;
dontFixup = true;
installPhase = ''
mkdir -p $out/lib/udev/rules.d
cp udev/90-usb-zytemp-permissions.rules $out/lib/udev/rules.d/90-usb-zytemp.rules
'';
};
mqtt_host = "192.168.7.53"; # Ludwig
in
{
config = {
environment.etc."zytempmqtt/config.yaml".text = lib.generators.toYAML { } {
decrypt = true;
mqtt_host = mqtt_host;
friendly_name = "Desk sensor";
};
services.udev.packages = [ usb_zytemp_udev ];
systemd = {
services.zytemp_mqtt = {
description = "Forward zyTemp CO2 sensor to MQTT";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${zytemp_mqtt}/bin/zytempmqtt";
# Hardening (hapazardeous)
CapabilityBoundingSet = "";
DynamicUser = true;
LockPersonality = true;
MemoryDenyWriteExecute = false;
NoNewPrivileges = true;
PrivateTmp = true;
PrivateUsers = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
RemoveIPC = true;
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
SystemCallFilter = [ "@system-service" "~@privileged" "~@resouces" ];
UMask = "0077";
};
};
};
};
}

17
curacao/dedup/default.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, lib, config, ... }:
{
config = {
services.beesd.filesystems = {
razmo = {
spec = "/mnt/razmo";
hashTableSizeMB = 512; # Recommended for 1 TiB, ×2 for compression, x2 for time
extraOptions = [ "--loadavg-target" "7.5" ];
};
rapido = {
spec = "/mnt/rapido";
hashTableSizeMB = 128; # 4 times smaller disk, 4 times smaller hashtable?
extraOptions = [ "--loadavg-target" "5" ];
};
};
};
}

16
curacao/default.nix Normal file
View file

@ -0,0 +1,16 @@
{ pkgs, lib, config, ... }:
{
config = {
networking.hostName = "curacao";
};
imports = [
./backup
./co2meter
./dedup
./disko.nix
./features.nix
./hardware.nix
./homeautomation
./webcam
];
}

View file

@ -1,29 +1,41 @@
{ passwordFile ? "/should_not_be_needed_in_this_context", ... }:
{ pkgs, lib, config, ... }:
# TODO Find a way to use keys in filesystem
# TODO Not relatime everywhere, thank you
# TODO Default options
let
btrfs_args_hdd = [
btrfs_args_ssd = [
"rw"
"relatime"
"compress=zstd:3"
"space_cache"
"ssd"
];
btrfs_args_ssd = btrfs_args_hdd ++ [ "ssd" ];
passwordFile = "/tmp/dotfiles_${config.networking.hostName}_password";
in
{
disko.devices = {
disk = {
razmo = {
type = "disk";
device = "/dev/disk/by-id/ata-ST1000LM048-2E7172_WKP8925H";
device = "/dev/disk/by-id/ata-SDLF1DAR-960G-1HA1_A027C1A3";
content = {
type = "gpt";
partitions = {
ESP = {
# Needs enough to store multiple kernel generations
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
swap = {
priority = 10;
start = "2048";
size = "6G";
size = "8G";
content = {
type = "swap";
randomEncryption = true;
@ -32,81 +44,29 @@ in
# hibernation image is saved. That's what I'm doing with Arch,
# but I'm setting resume=, should test if it actually works?
# Untranslated options from /etc/crypttab: swap,cipher=aes-xts-plain64,size=256
# Untranslated options from /etc/fstab: defaults,pri=100
};
};
nixosboot = {
priority = 15;
size = "2G";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
esp = {
priority = 20;
size = "128M";
type = "EF00"; # EFI system partition
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/efi";
mountOptions = [
"rw"
"relatime"
"fmask=0022"
"dmask=0022"
"codepage=437"
"iocharset=iso8859-1"
"shortname=mixed"
"utf8"
"errors=remount-ro"
"noauto"
];
};
};
boot = {
priority = 30;
size = "128M";
content = {
type = "luks";
name = "boot";
extraFormatArgs = [ "--type luks1" ];
passwordFile = passwordFile;
settings = {
# keyFile = "/etc/keys/boot";
};
content = {
type = "filesystem";
format = "ext2";
mountpoint = "/mnt/old/boot";
mountOptions = [
"rw"
"relatime"
# "stripe=4" # For some reason doesn't work on NixOS
];
};
};
};
main = {
priority = 40;
luks = {
size = "100%";
content = {
type = "luks";
name = "razmo";
passwordFile = passwordFile;
settings = {
# keyFile = "/etc/keys/razmo";
allowDiscards = true;
};
content = {
type = "btrfs";
# extraArgs = [ "-f" ];
extraArgs = [ "-f" ];
mountpoint = "/mnt/razmo";
mountOptions = btrfs_args_hdd;
subvolumes = {
"home.razmo" = {
mountpoint = "/home.heavy";
mountOptions = btrfs_args_hdd;
mountOptions = [ "compress=zstd" "relatime" ];
};
"steam" = {
mountpoint = "/opt/steam.razmo";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
@ -158,10 +118,6 @@ in
mountpoint = "/mnt/rapido";
mountOptions = btrfs_args_ssd;
subvolumes = {
archlinux = {
mountpoint = "/mnt/old";
mountOptions = btrfs_args_ssd;
};
# Should be temporary, to make sure we can revert to Arch anytime
"home.nixos" = {
mountpoint = "/home";
@ -187,4 +143,9 @@ in
};
};
};
services.btrfs.autoScrub = {
enable = true;
fileSystems = [ "/mnt/razmo" "/mnt/rapido" ];
# TODO Should be generable from disko config, right?
};
}

13
curacao/features.nix Normal file
View file

@ -0,0 +1,13 @@
{ ... }:
{
frogeye = {
desktop = {
xorg = true;
};
dev = {
docker = true;
};
extra = true;
gaming = true;
};
}

View file

@ -1,13 +1,36 @@
{ lib, nixos-hardware, ... }:
{ pkgs, lib, config, nixos-hardware, ... }:
{
# UEFI works here, and variables can be touched
boot.loader = {
efi.canTouchEfiVariables = lib.mkDefault true;
grub = {
enable = true;
efiSupport = true;
device = "nodev"; # Don't install on MBR
# TODO Maybe we could? In case the HDD doesn't boot anymore?
config = {
# UEFI works here, and variables can be touched
boot.loader = {
efi.canTouchEfiVariables = lib.mkDefault true;
grub = {
enable = true;
efiSupport = true;
device = "nodev"; # Don't install on MBR
# TODO Maybe we could? In case the HDD doesn't boot anymore?
};
};
hardware.cpu.intel.updateMicrocode = true;
frogeye.desktop = {
x11_screens = [
"HDMI-1-3"
"DVI-I-2-1"
];
maxVideoHeight = 1440;
numlock = true;
phasesBrightness = {
enable = true;
jour = "40000";
crepuscule = "10000";
nuit = "1";
};
};
# Needs prefetched binary blobs, see https://nixos.wiki/wiki/Displaylink
services.xserver.videoDrivers = [ "displaylink" "modesetting" ];
# TODO See if nvidia and DL can work together.
};
imports = [
nixos-hardware.nixosModules.dell-g3-3779
];
}

View file

@ -0,0 +1,13 @@
{ pkgs, lib, config, ... }:
{
config = {
networking = {
# Allow mpd control from home assistant and phone
firewall.extraCommands = ''
iptables -A nixos-fw -p tcp -m tcp --dport 6600 -s 192.168.7.53 -j nixos-fw-accept
iptables -A nixos-fw -p tcp -m tcp --dport 6600 -s 192.168.7.92 -j nixos-fw-accept
'';
interfaces.enp3s0.wakeOnLan.enable = true;
};
};
}

View file

@ -1,22 +0,0 @@
{ ... }:
{
frogeye = {
desktop = {
xorg = true;
x11_screens = [ "HDMI-1-0" "eDP-1" ];
maxVideoHeight = 1440;
numlock = true;
phasesBrightness = {
enable = true;
jour = "40000";
crepuscule = "10000";
nuit = "1";
};
};
dev = {
docker = true;
};
extra = true;
gaming = true;
};
}

View file

@ -1,17 +0,0 @@
{ ... }:
{
imports = [
./options.nix
./hardware.nix
./dk.nix
./backup
];
networking.hostName = "curacao";
boot = {
initrd.luks.reusePassphrases = true;
loader = {
efi.efiSysMountPoint = "/efi";
};
};
}

13
curacao/usb.nix Normal file
View file

@ -0,0 +1,13 @@
{ pkgs, lib, config, ... }:
{
config = {
boot.loader.efi.canTouchEfiVariables = false;
disko.devices.disk."${config.networking.hostName}".device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0";
networking.hostName = "curacao-usb";
};
imports = [
../common/disko/single_uefi_btrfs.nix
./features.nix
./hardware.nix
];
}

View file

@ -0,0 +1,14 @@
{ pkgs, lib, config, ... }:
{
config = {
# TODO This should install cameractrls, but it seems like it's not easy to install.
# In the meantime, we install Flatpak and do:
# flatpak run hu.irl.cameractrls
services.flatpak.enable = true;
xdg.portal = {
config.common.default = "*";
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
};
}

View file

@ -1,59 +0,0 @@
#!/usr/bin/env bash
# Runs the command given in a Nix environment, and create it if it doesn't exist.
# Useful for environments where nix isn't installed / you do not have root access
# If you need a fresh slate:
# chmod +w .nix -R
# rm -rf .nix .nix-defexpr .nix-profile .config/nix .local/state/nix .local/share/nix .cache/nix
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ ! -d /nix ]
then
# Doesn't support architectures other than x86_64
NIX_USER_CHROOT_URL=https://github.com/nix-community/nix-user-chroot/releases/download/1.2.2/nix-user-chroot-bin-1.2.2-x86_64-unknown-linux-musl
NIX_USER_CHROOT_SHA256SUM=e11aff604bb8d3ffd1d9c0c68cd636816d7eb8da540de18ee3a41ccad7ac0972
nix_user_chroot="$HOME/.local/bin/nix-user-chroot"
mkdir -p "$(dirname "$nix_user_chroot")"
nix_directory="$HOME/.nix"
mkdir -p "$nix_directory"
if [ ! -x "$nix_user_chroot" ] || ! echo "$NIX_USER_CHROOT_SHA256SUM $nix_user_chroot" | sha256sum --check --status
then
wget "$NIX_USER_CHROOT_URL" -O "$nix_user_chroot"
echo "$NIX_USER_CHROOT_SHA256SUM $nix_user_chroot" | sha256sum --check --status
chmod +x "$nix_user_chroot"
fi
exec "$nix_user_chroot" "$nix_directory" "$0" "$@"
exit 1
fi
nix_profile_path="$HOME/.nix-profile/etc/profile.d/nix.sh"
if [ ! -f "$nix_profile_path" ]
then
NIX_INSTALLER_URL=https://releases.nixos.org/nix/nix-2.19.2/install
NIX_INSTALLER_SHA256SUM=435f0d7e11f7c7dffeeab0ec9cc55723f6d3c03352379d785633cf4ddb5caf90
nix_installer="$(mktemp)"
wget "$NIX_INSTALLER_URL" -O "$nix_installer"
echo "$NIX_INSTALLER_SHA256SUM $nix_installer" | sha256sum --check --status
chmod +x "$nix_installer"
"$nix_installer" --no-daemon --yes --no-channel-add --no-modify-profile
fi
# TODO This installs nix in nix-env, which conflicts with home-manager activation.
# Workaround is temporarily set /nix/store-xxx-nix/bin in PATH
. "$nix_profile_path"
# TODO Useful the first time, but it becomes a bit long after a while
# "${SCRIPT_DIR}/add_channels.sh"
exec "$@"

View file

@ -5,11 +5,11 @@
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1689633990,
"narHash": "sha256-iwvQg2Vx0IIDWZaKo8Xmzxlv1YPHg+Kp/QSv8dRv0RY=",
"lastModified": 1708890466,
"narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "dddf2e1c04845d43c89a8e9e37d574519649a404",
"rev": "665b3c6748534eb766c777298721cece9453fdae",
"type": "github"
},
"original": {
@ -18,22 +18,6 @@
"type": "github"
}
},
"base16-alacritty": {
"flake": false,
"locked": {
"lastModified": 1674275109,
"narHash": "sha256-Adwx9yP70I6mJrjjODOgZJjt4OPPe8gJu7UuBboXO4M=",
"owner": "aarowill",
"repo": "base16-alacritty",
"rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7",
"type": "github"
},
"original": {
"owner": "aarowill",
"repo": "base16-alacritty",
"type": "github"
}
},
"base16-fish": {
"flake": false,
"locked": {
@ -130,6 +114,28 @@
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1713532798,
"narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=",
"owner": "numtide",
"repo": "devshell",
"rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
@ -137,11 +143,11 @@
]
},
"locked": {
"lastModified": 1704318910,
"narHash": "sha256-wOIJwAsnZhM0NlFRwYJRgO4Lldh8j9viyzwQXtrbNtM=",
"lastModified": 1717177033,
"narHash": "sha256-G3CZJafCO8WDy3dyA2EhpUJEmzd5gMJ2IdItAg0Hijw=",
"owner": "nix-community",
"repo": "disko",
"rev": "aef9a509db64a081186af2dc185654d78dc8e344",
"rev": "0274af4c92531ebfba4a5bd493251a143bc51f3c",
"type": "github"
},
"original": {
@ -150,22 +156,36 @@
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1673956053,
@ -181,13 +201,52 @@
"type": "github"
}
},
"flake-utils": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"lastModified": 1715865404,
"narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-root": {
"locked": {
"lastModified": 1713493429,
"narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=",
"owner": "srid",
"repo": "flake-root",
"rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -198,7 +257,7 @@
},
"flake-utils_2": {
"inputs": {
"systems": "systems"
"systems": "systems_2"
},
"locked": {
"lastModified": 1701680307,
@ -214,24 +273,6 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"fromYaml": {
"flake": false,
"locked": {
@ -248,20 +289,47 @@
"type": "github"
}
},
"gitignore": {
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"pre-commit-hooks",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"lastModified": 1716213921,
"narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
@ -270,6 +338,23 @@
"type": "github"
}
},
"gnome-shell": {
"flake": false,
"locked": {
"lastModified": 1713702291,
"narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=",
"owner": "GNOME",
"repo": "gnome-shell",
"rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934",
"type": "github"
},
"original": {
"owner": "GNOME",
"ref": "46.1",
"repo": "gnome-shell",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -277,20 +362,41 @@
]
},
"locked": {
"lastModified": 1704099619,
"narHash": "sha256-QRVMkdxLmv+aKGjcgeEg31xtJEIsYq4i1Kbyw5EPS6g=",
"lastModified": 1716736833,
"narHash": "sha256-rNObca6dm7Qs524O4st8VJH6pZ/Xe1gxl+Rx6mcWYo0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "7e398b3d76bc1503171b1364c9d4a07ac06f3851",
"rev": "a631666f5ec18271e86a5cde998cba68c33d9ac6",
"type": "github"
},
"original": {
"id": "home-manager",
"ref": "release-23.11",
"ref": "release-24.05",
"type": "indirect"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717052710,
"narHash": "sha256-LRhOxzXmOza5SymhOgnEzA8EAQp+94kkeUYWKKpLJ/U=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "29c69d9a466e41d46fd3a7a9d0591ef9c113c2ae",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_3": {
"inputs": {
"nixpkgs": [
"stylix",
@ -298,11 +404,11 @@
]
},
"locked": {
"lastModified": 1700847865,
"narHash": "sha256-uWaOIemGl9LF813MW0AEgCBpKwFo2t1Wv3BZc6e5Frw=",
"lastModified": 1714981474,
"narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8cedd63eede4c22deb192f1721dd67e7460e1ebe",
"rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f",
"type": "github"
},
"original": {
@ -311,34 +417,84 @@
"type": "github"
}
},
"nixgl": {
"nix-darwin": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1685908677,
"narHash": "sha256-E4zUPEUFyVWjVm45zICaHRpfGepfkE9Z2OECV9HXfA4=",
"owner": "guibou",
"repo": "nixGL",
"rev": "489d6b095ab9d289fe11af0219a9ff00fe87c7c5",
"lastModified": 1716993688,
"narHash": "sha256-vo5k2wQekfeoq/2aleQkBN41dQiQHNTniZeVONWiWLs=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "c0d5b8c54d6828516c97f6be9f2d00c63a363df4",
"type": "github"
},
"original": {
"owner": "guibou",
"repo": "nixGL",
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nix-formatter-pack": {
"inputs": {
"nixpkgs": [
"nix-on-droid",
"nixpkgs"
],
"nmd": "nmd",
"nmt": "nmt"
},
"locked": {
"lastModified": 1705252799,
"narHash": "sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c=",
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"rev": "2de39dedd79aab14c01b9e2934842051a160ffa5",
"type": "github"
},
"original": {
"owner": "Gerschtli",
"repo": "nix-formatter-pack",
"type": "github"
}
},
"nix-on-droid": {
"inputs": {
"home-manager": [
"home-manager"
],
"nix-formatter-pack": "nix-formatter-pack",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-docs": "nixpkgs-docs",
"nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap",
"nmd": "nmd_2"
},
"locked": {
"lastModified": 1710434231,
"narHash": "sha256-yrWnsG28518tbIapJWiluweHORuuIwAQrA8lga0Sqlw=",
"owner": "nix-community",
"repo": "nix-on-droid",
"rev": "2d93311c4f3f300154d2085e4b4b1d550237da92",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-on-droid",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1704458188,
"narHash": "sha256-f6BYEuIqnbrs6J/9m1/1VdkJ6d63hO9kUC09kTPuOqE=",
"lastModified": 1717248095,
"narHash": "sha256-e8X2eWjAHJQT82AAN+mCI0B68cIDBJpqJ156+VRrFO0=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "172385318068519900a7d71c1024242fa6af75f0",
"rev": "7b49d3967613d9aacac5b340ef158d493906ba79",
"type": "github"
},
"original": {
@ -348,116 +504,199 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1704420045,
"narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=",
"lastModified": 1717144377,
"narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d",
"rev": "805a384895c696f802a9bf5bf4720f37385df547",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.11",
"ref": "nixos-24.05",
"type": "indirect"
}
},
"nixpkgs-stable": {
"nixpkgs-docs": {
"locked": {
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"lastModified": 1705957679,
"narHash": "sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
"rev": "9a333eaa80901efe01df07eade2c16d183761fa3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"ref": "release-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-for-bootstrap": {
"locked": {
"lastModified": 1708105575,
"narHash": "sha256-sS4AItZeUnAei6v8FqxNlm+/27MPlfoGym/TZP0rmH0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1d1817869c47682a6bee85b5b0a6537b6c0fba26",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1d1817869c47682a6bee85b5b0a6537b6c0fba26",
"type": "github"
}
},
"nixvim": {
"inputs": {
"flake-utils": "flake-utils_2",
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"flake-root": "flake-root",
"git-hooks": "git-hooks",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks"
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1702044539,
"narHash": "sha256-TNmEd6MipLxsrWromxqNfU4y17MoBr15QF7iEOagPy8=",
"lastModified": 1717255175,
"narHash": "sha256-MtsnAwzY2cmufUoFQvI/1mTzd3FKbZLCb8zF4jXkZLY=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "c96d7b46d05a78e695ed1c725d1596b65509b4f9",
"rev": "df3aa867137227bda9e44beab82a63443d700f18",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"rev": "c96d7b46d05a78e695ed1c725d1596b65509b4f9",
"type": "github"
}
},
"pre-commit-hooks": {
"nmd": {
"flake": false,
"locked": {
"lastModified": 1666190571,
"narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=",
"owner": "rycee",
"repo": "nmd",
"rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmd_2": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_3",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
"nix-on-droid",
"nixpkgs-docs"
],
"nixpkgs-stable": "nixpkgs-stable"
"scss-reset": "scss-reset"
},
"locked": {
"lastModified": 1700922917,
"narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78",
"lastModified": 1705050560,
"narHash": "sha256-x3zzcdvhJpodsmdjqB4t5mkVW22V3wqHLOun0KRBzUI=",
"owner": "~rycee",
"repo": "nmd",
"rev": "66d9334933119c36f91a78d565c152a4fdc8d3d3",
"type": "sourcehut"
},
"original": {
"owner": "~rycee",
"repo": "nmd",
"type": "sourcehut"
}
},
"nmt": {
"flake": false,
"locked": {
"lastModified": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
"nur": {
"locked": {
"lastModified": 1717249505,
"narHash": "sha256-dprfeFpLbxOl4T8Len1+oXoJdPEjPldnHTeJIf86WXU=",
"owner": "nix-community",
"repo": "NUR",
"rev": "f267ad8addc9f5dd2cce435a2200146e6efc800e",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixgl": "nixgl",
"nix-on-droid": "nix-on-droid",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"nur": "nur",
"stylix": "stylix"
}
},
"scss-reset": {
"flake": false,
"locked": {
"lastModified": 1631450058,
"narHash": "sha256-muDlZJPtXDIGevSEWkicPP0HQ6VtucbkMNygpGlBEUM=",
"owner": "andreymatin",
"repo": "scss-reset",
"rev": "0cf50e27a4e95e9bb5b1715eedf9c54dee1a5a91",
"type": "github"
},
"original": {
"owner": "andreymatin",
"repo": "scss-reset",
"type": "github"
}
},
"stylix": {
"inputs": {
"base16": "base16",
"base16-alacritty": "base16-alacritty",
"base16-fish": "base16-fish",
"base16-foot": "base16-foot",
"base16-helix": "base16-helix",
"base16-kitty": "base16-kitty",
"base16-tmux": "base16-tmux",
"base16-vim": "base16-vim",
"flake-compat": "flake-compat_2",
"home-manager": "home-manager_2",
"flake-compat": "flake-compat_3",
"gnome-shell": "gnome-shell",
"home-manager": "home-manager_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1704308480,
"narHash": "sha256-88ICCdJyYYtsolRnPhI9IF+bhUIVUyhJ7nrKcKPgf6M=",
"lastModified": 1717212835,
"narHash": "sha256-fSNsRokB3YaTmJOcSdDzKJOFWq/bQ/FCoMGpF12sF5c=",
"owner": "danth",
"repo": "stylix",
"rev": "9bc1900b6888efdda39c2e02c7c8666911b72608",
"rev": "266db7f00cad4a465e0ce43d91798fda10716212",
"type": "github"
},
"original": {
@ -495,6 +734,27 @@
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1715940852,
"narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

136
flake.nix
View file

@ -2,87 +2,129 @@
description = "Geoffrey Frogeye's base configurations";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
# Packages
nixpkgs.url = "nixpkgs/nixos-24.05";
# OS
disko = {
url = "disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "nixos-hardware";
# NOD
nix-on-droid = {
url = "github:nix-community/nix-on-droid"; # No 24.05 yet
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
# HM
home-manager = {
url = "home-manager/release-23.11";
url = "home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix";
url = "github:danth/stylix"; # No 24.05 yet
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim/c96d7b46d05a78e695ed1c725d1596b65509b4f9";
# 24.05 Anything after this commit works
inputs.nixpkgs.follows = "nixpkgs";
};
nixgl = {
url = "github:guibou/nixGL";
url = "github:nix-community/nixvim"; # No 24.05 yet
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/NUR";
# Local
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, disko, nixos-hardware, home-manager, stylix, nixvim, nixgl, ... }:
outputs = { self, nixpkgs, disko, nix-on-droid, flake-utils, ... }@attrs:
# Machine independant outputs
let
sharedOverlays = [
nixgl.overlay
];
nixpkgsConfig = {
config = {
allowUnfree = true;
};
};
homeManagerConfig = {
sharedModules = [ self.homeManagerModules.dotfiles ];
extraSpecialArgs = attrs;
};
lib = {
nixosSystem = { system, modules }: nixpkgs.lib.nixosSystem {
nixosSystem = { system, modules ? [ ] }: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs;
modules = modules ++ [
self.nixosModules.dotfiles
{
nixpkgs.overlays = sharedOverlays;
home-manager.sharedModules = [ self.homeManagerModules.dotfiles ];
nixpkgs = nixpkgsConfig;
home-manager = homeManagerConfig;
}
];
};
homeManagerConfiguration = { system, modules }: home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
overlays = sharedOverlays;
};
modules = modules ++ [ self.homeManagerModules.dotfiles ];
nixOnDroidConfiguration = { modules ? [ ] }: nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import nixpkgs (nixpkgsConfig // {
system = "aarch64-linux"; # nod doesn't support anything else
});
modules = modules ++ [
self.nixOnDroidModules.dotfiles
{
home-manager = homeManagerConfig;
}
];
};
flakeTools = { self }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
apps = {
disko = {
type = "app";
program = "${disko.packages.${system}.default}/bin/disko";
};
nixos-generate-config = {
type = "app";
program = "${pkgs.nixos-install-tools}/bin/nixos-generate-config";
};
nixos-install = {
type = "app";
program = "${pkgs.nixos-install-tools}/bin/nixos-install";
};
nixos-rebuild = {
type = "app";
program = "${pkgs.nixos-rebuild}/bin/nixos-rebuild";
};
repl = {
type = "app";
program = "${pkgs.writeShellScript "vivarium-repl" ''
${pkgs.nix}/bin/nix repl --expr 'let flake = builtins.getFlake "${self}"; in flake // flake.nixosConfigurations // rec { pkgs = import ${nixpkgs} {}; lib = pkgs.lib; }'
''}";
};
};
}
);
};
in
{
lib = lib;
nixosModules.dotfiles = {
imports = [
./os
disko.nixosModules.disko
home-manager.nixosModules.home-manager
];
};
homeManagerModules.dotfiles = {
imports = [
./hm
stylix.homeManagerModules.stylix
nixvim.homeManagerModules.nixvim
];
};
# Reusable configurations
inherit lib;
nixosModules.dotfiles.imports = [ ./os ];
nixOnDroidModules.dotfiles.imports = [ ./nod ];
homeManagerModules.dotfiles.imports = [ ./hm ];
# Actual configurations
nixosConfigurations.curacao = lib.nixosSystem {
system = "x86_64-linux";
modules = [
./curacao/os.nix
nixos-hardware.nixosModules.dell-g3-3779
];
modules = [ ./curacao ];
};
nixosConfigurations.curacao-usb = lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./curacao/usb.nix ];
};
nixosConfigurations.pindakaas = lib.nixosSystem {
system = "aarch64-linux";
modules = [
./pindakaas/os.nix
nixos-hardware.nixosModules.pine64-pinebook-pro
];
modules = [ ./pindakaas ];
};
};
}
nixosConfigurations.pindakaas-sd = lib.nixosSystem {
system = "aarch64-linux";
modules = [ ./pindakaas/sd.nix ];
};
nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { };
} // (lib.flakeTools { inherit self; });
}

108
hm/accounts/default.nix Normal file
View file

@ -0,0 +1,108 @@
{ pkgs, config, lib, ... }:
let
mkUserJs = with lib; prefs: extraPrefs: ''
// Generated by Geoffrey's dotfiles.
${concatStrings (mapAttrsToList (name: value: ''
user_pref("${name}", ${builtins.toJSON value});
'') prefs)}
${extraPrefs}
'';
toThunderbirdCalendar = account:
let
id = builtins.hashString "sha256" account.name;
thunderbird = config.frogeye.accounts.calendar.accounts.${account.name};
in
{
"calendar.registry.${id}.cache.enabled" = thunderbird.offlineSupport; # TODO Check this actually corresponds
"calendar.registry.${id}.color" = thunderbird.color;
"calendar.registry.${id}.forceEmailScheduling" = thunderbird.clientSideEmailScheduling;
"calendar.registry.${id}.imip.identity.key" = "id_${builtins.hashString "sha256" thunderbird.email}";
"calendar.registry.${id}.name" = account.name;
"calendar.registry.${id}.readOnly" = thunderbird.readOnly;
"calendar.registry.${id}.refreshInterval" = builtins.toString thunderbird.refreshInterval;
"calendar.registry.${id}.suppressAlarms" = !thunderbird.showReminders; # TODO Check this actually corresponds
"calendar.registry.${id}.type" = account.remote.type; # TODO Check and validate supported types
"calendar.registry.${id}.uri" = account.remote.url;
"calendar.registry.${id}.username" = account.remote.userName;
# Unimplemented
"calendar.registry.${id}.notifications.times" = "";
# Unknown
# "calendar.registry.${id}.calendar-main-in-composite" = true;
};
in
{
config = {
programs.aerc = {
enable = true;
extraConfig.general.unsafe-accounts-conf = true;
};
programs.thunderbird = {
enable = config.frogeye.desktop.xorg;
profiles.hm = {
isDefault = true;
withExternalGnupg = true;
extraConfig = mkUserJs
(lib.attrsets.mergeAttrsList (
# Add calendar config
(lib.mapAttrsToList (name: account: (toThunderbirdCalendar account)) config.accounts.calendar.accounts) ++
# Add config for every identity (kinda)
(lib.mapAttrsToList
(name: account: ({
# UPST Make signature be used in Thunderbird
"mail.identity.id_${builtins.hashString "sha256" account.address}.htmlSigText" = account.signature.text;
"mail.identity.id_${builtins.hashString "sha256" account.address}.compose_html" = false;
}))
config.accounts.email.accounts) ++
# General settings
[{
"mail.pane_config.dynamic" = 0;
"intl.date_time.pattern_override.date_short" = "yyyy-MM-dd";
}]
)) "";
};
};
};
# UPST Thunderbird-specific options (should be named so), to be included in HM Thunderbird module
options = {
frogeye.accounts.calendar.accounts = lib.mkOption {
default = { };
type = lib.types.attrsOf (lib.types.submodule ({ config, name, ... }: {
# TODO Set defaults as Thunderbird sets it
options = {
color = lib.mkOption {
type = lib.types.str;
default = "#5277c3";
};
refreshInterval = lib.mkOption {
type = lib.types.int;
default = 0; # 0 = Manual
};
readOnly = lib.mkOption {
type = lib.types.bool;
default = false;
};
showReminders = lib.mkOption {
type = lib.types.bool;
default = true;
};
offlineSupport = lib.mkOption {
type = lib.types.bool;
default = true;
};
email = lib.mkOption {
type = lib.types.str;
# TODO Nullable
# TODO Ensure it actually matches an email identity
};
clientSideEmailScheduling = lib.mkOption {
type = lib.types.bool;
default = false;
};
};
}));
};
};
}

36
hm/brightness/default.nix Normal file
View file

@ -0,0 +1,36 @@
# Light theme during the day, dark theme during the night (not automatic)
{ pkgs, lib, config, ... }:
let
phases = [
{ command = "jour"; polarity = "light"; }
{ command = "crepuscule"; polarity = "dark"; }
{ command = "nuit"; polarity = "dark"; }
];
phasesBrightness = config.frogeye.desktop.phasesBrightness;
in
{
config = {
home.packages = map
(phase: (pkgs.writeShellApplication {
name = "${phase.command}";
runtimeInputs = [ pkgs.brightnessctl ];
text = (lib.optionalString phasesBrightness.enable ''
brightnessctl set ${builtins.getAttr phase.command phasesBrightness}
'') + ''
switch="/nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration"
if [ -x "$switch" ]
then
# In two steps to get the visual changes slightly earlier
sudo "$switch" test
sudo "$switch" boot
fi
'';
})
)
phases;
xsession.windowManager.i3.config.keybindings = {
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
};
};
}

View file

@ -1,402 +1,134 @@
{ pkgs, config, lib, ... }:
let
direnv = {
# Environment variables making programs stay out of $HOME, but also needing we create a directory for them
CARGOHOME = "${config.xdg.cacheHome}/cargo"; # There are config in there that we can version if one want
CCACHE_DIR = "${config.xdg.cacheHome}/ccache"; # The config file alone seems to be not enough
DASHT_DOCSETS_DIR = "${config.xdg.cacheHome}/dash_docsets";
GOPATH = "${config.xdg.cacheHome}/go";
GRADLE_USER_HOME = "${config.xdg.cacheHome}/gradle";
MIX_ARCHIVES = "${config.xdg.cacheHome}/mix/archives";
MONO_GAC_PREFIX = "${config.xdg.cacheHome}/mono";
npm_config_cache = "${config.xdg.cacheHome}/npm";
PARALLEL_HOME = "${config.xdg.cacheHome}/parallel";
TERMINFO = "${config.xdg.configHome}/terminfo";
WINEPREFIX = "${config.xdg.stateHome}/wineprefix/default";
YARN_CACHE_FOLDER = "${config.xdg.cacheHome}/yarn";
# TODO Some of that stuff is not really relavant any more
};
in
{
nixpkgs.config.allowUnfree = true;
nix = {
package = lib.mkDefault pkgs.nixFlakes;
settings = {
experimental-features = [ "nix-command" "flakes" ];
warn-dirty = false;
frogeye.hooks.lock = ''
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
'';
programs = {
home-manager.enable = true;
bat = {
enable = true;
config.style = "full";
};
};
bash.shellAliases = {
# Replacement commands
# ls = "lsd"; # lsd is suuuper slow for large directories
cat = "bat -pp";
programs =
let
commonRc = lib.strings.concatLines (map (d: "mkdir -p ${d}") (builtins.attrValues direnv));
# TODO Those directory creations should probably done on home-manager activation
commonSessionVariables = {
TIME_STYLE = "+%Y-%m-%d %H:%M:%S";
# Less colors
LESS = "-R";
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}";
};
treatsHomeAsJunk = [
# Programs that think $HOME is a reasonable place to put their junk
# and don't allow the user to change those questionable choices
"adb"
"audacity"
"binwalk" # Should use .config according to the GitHub code though
"cabal" # TODO May have options but last time I tried it it crashed
"cmake"
"ddd"
"ghidra"
"itch"
"simplescreenrecorder" # Easy fix https://github.com/MaartenBaert/ssr/blob/1556ae456e833992fb6d39d40f7c7d7c337a4160/src/Main.cpp#L252
"vd"
"wpa_cli"
# TODO Maybe we can do something about node-gyp
];
commonShellAliases = {
# Completion for existing commands
ls = "lsd";
mkdir = "mkdir -v";
# cp = "cp -i"; # Disabled because conflicts with the ZSH/Bash one. This separation is confusing I swear.
mv = "mv -iv";
free = "free -h";
df = "df -h";
ffmpeg = "ffmpeg -hide_banner";
ffprobe = "ffprobe -hide_banner";
ffplay = "ffplay -hide_banner";
numbat = "numbat --intro-banner off";
insect = "numbat";
ipython = "ipython --no-confirm-exit --pdb";
# Completion for existing commands
mkdir = "mkdir -v";
# cp = "cp -i"; # Disabled because conflicts with the ZSH/Bash one. This separation is confusing I swear.
mv = "mv -iv";
free = "free -h";
df = "df -h";
ffmpeg = "ffmpeg -hide_banner";
ffprobe = "ffprobe -hide_banner";
ffplay = "ffplay -hide_banner";
numbat = "numbat --intro-banner off";
insect = "numbat";
# Frequent mistakes
sl = "ls";
al = "la";
mdkir = "mkdir";
systemclt = "systemctl";
please = "sudo";
# Frequent mistakes
sl = "ls";
al = "la";
mdkir = "mkdir";
systemclt = "systemctl";
please = "sudo";
# Shortcuts for commonly used commands
ll = "lsd -l";
la = "lsd -la";
s = "sudo -s -E";
# Shortcuts for commonly used commands
ll = "lsd -l";
la = "lsd -la";
s = "sudo -s -E";
# Give additional config to those programs, and not have them in my path
bower = "bower --config.storage.packages=${config.xdg.cacheHome}/bower/packages --config.storage.registry=${config.xdg.cacheHome}/bower/registry --config.storage.links=${config.xdg.cacheHome}/bower/links";
gdb = "gdb -x ${config.xdg.configHome}/gdbinit";
iftop = "iftop -c ${config.xdg.configHome}/iftoprc";
lmms = "lmms --config ${config.xdg.configHome}/lmmsrc.xml";
# Preference
wol = "wakeonlan"; # TODO Really, isn't wol better? Also wtf Arch aliases to pass because neither is installed anyways x)
mutt = "neomutt";
# Preference
vi = "nvim";
vim = "nvim";
wol = "wakeonlan"; # TODO Really, isn't wol better? Also wtf Arch aliases to pass because neither is installed anyways x)
mutt = "neomutt";
# Bash/Zsh only
cp = "cp -i --reflink=auto";
grep = "grep --color=auto";
dd = "dd status=progress";
rm = "rm -v --one-file-system";
# free = "free -m"; # Disabled because... no? Why?
diff = "diff --color=auto";
dmesg = "dmesg --ctime";
wget = "wget --hsts-file ${config.xdg.cacheHome}/wget-hsts";
# Bash/Zsh only
cp = "cp -i --reflink=auto";
grep = "grep --color=auto";
dd = "dd status=progress";
rm = "rm -v --one-file-system";
# free = "free -m"; # Disabled because... no? Why?
diff = "diff --color=auto";
dmesg = "dmesg --ctime";
wget = "wget --hsts-file ${config.xdg.cacheHome}/wget-hsts";
# Imported from scripts
rms = ''${pkgs.findutils}/bin/find . -name "*.sync-conflict-*" -delete''; # Remove syncthing conflict files
pw = ''${pkgs.pwgen}/bin/pwgen 32 -y''; # Generate passwords. ln((26*2+10)**32)/ln(2) ≅ 190 bits of entropy
newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail'';
oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head'';
tracefiles = ''${pkgs.strace}/bin/strace -f -t -e trace=file'';
} // lib.attrsets.mergeAttrsList (map (p: { "${p}" = "HOME=${config.xdg.cacheHome}/junkhome ${p}"; }) treatsHomeAsJunk);
# 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.stateHome}/shell_history";
in
{
home-manager.enable = true;
bash = {
enable = true;
bashrcExtra = lib.strings.concatLines [
commonRc
''
shopt -s expand_aliases
shopt -s histappend
''
];
sessionVariables = commonSessionVariables;
historySize = historySize;
historyFile = historyFile;
historyFileSize = historySize;
historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
shellAliases = commonShellAliases // config.frogeye.shellAliases;
};
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
historySubstringSearch.enable = true;
initExtra = lib.strings.concatLines [
commonRc
(builtins.readFile ./zshrc.sh)
];
defaultKeymap = "viins";
history = {
size = historySize;
save = historySize;
path = historyFile;
expireDuplicatesFirst = true;
};
sessionVariables = commonSessionVariables;
shellAliases = commonShellAliases // config.frogeye.shellAliases;
};
bat = {
enable = true;
config = {
theme = "base16";
style = "full";
};
};
lsd = {
enable = true;
settings = {
size = "short";
};
colors = { # Base16 only, so it reuses the current theme.
date = { day-old = 4; hour-old = 6; older = 5; };
git-status = { conflicted = 14; default = 13; deleted = 1; ignored = 13; modified = 3; new-in-index = 2; new-in-workdir = 2; renamed = 4; typechange = 3; unmodified = 13; };
group = 6;
inode = { invalid = 245; valid = 13; };
links = { invalid = 9; valid = 14; };
permission = { acl = 6; context = 14; exec = 1; exec-sticky = 5; no-access = 245; octal = 6; read = 2; write = 3; };
size = { large = 1; medium = 9; none = 11; small = 3; };
tree-edge = 13;
user = 2;
};
};
dircolors = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
# UPST This thing put stuff in .dircolors when it actually doesn't have to
};
powerline-go = {
enable = true;
modules = [ "user" "host" "venv" "cwd" "perms" "git" ];
modulesRight = [ "jobs" "exit" "duration" "load" ];
settings = {
colorize-hostname = true;
max-width = 25;
cwd-max-dir-size = 10;
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
echo -en "\033]0; $USER@$HOST $PWD\007"
'';
};
gpg = {
enable = true;
homedir = "${config.xdg.stateHome}/gnupg";
settings = {
# Remove fluff
no-greeting = true;
no-emit-version = true;
no-comments = true;
# Output format that I prefer
keyid-format = "0xlong";
# Show fingerprints
with-fingerprint = true;
# Make sure to show if key is invalid
# (should be default on most platform,
# but just to be sure)
list-options = "show-uid-validity";
verify-options = "show-uid-validity";
# Stronger algorithm (https://wiki.archlinux.org/title/GnuPG#Different_algorithm)
personal-digest-preferences = "SHA512";
cert-digest-algo = "SHA512";
default-preference-list = "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
personal-cipher-preferences = "TWOFISH CAMELLIA256 AES 3DES";
};
publicKeys = [{
source = builtins.fetchurl {
url = "https://keys.openpgp.org/vks/v1/by-fingerprint/4FBA930D314A03215E2CDB0A8312C8CAC1BAC289";
sha256 = "sha256:10y9xqcy1vyk2p8baay14p3vwdnlwynk0fvfbika65hz2z8yw2cm";
};
trust = "ultimate";
}];
};
fzf = {
enable = true;
enableZshIntegration = true;
defaultOptions = [ "--height 40%" "--layout=default" ];
fileWidgetOptions = [ "--preview '[[ -d {} ]] && ${pkgs.coreutils}/bin/ls -l --color=always {} || [[ \$(${pkgs.file}/bin/file --mime {}) =~ binary ]] && ${pkgs.file}/bin/file --brief {} || (${pkgs.highlight}/bin/highlight -O ansi -l {} || coderay {} || rougify {} || ${pkgs.coreutils}/bin/cat {}) 2> /dev/null | head -500'" ];
# TODO Above not working... not really used either?
# file and friends are not in PATH by default... so here we want aboslute paths, which means those won't get reloaded. Meh.
};
nix-index = {
# For non-NixOS systems
enable = false; # TODO Index is impossible to generate, should use https://github.com/nix-community/nix-index-database
# but got no luck without flakes
enableZshIntegration = true;
};
less.enable = true;
git = {
enable = true;
package = pkgs.gitFull;
aliases = {
"git" = "!exec git"; # In case I write one too many git
};
ignores = [
"*.swp"
"*.swo"
"*.ycm_extra_conf.py"
"tags"
".mypy_cache"
];
delta = {
enable = true;
options = {
line-numbers = true;
syntax-theme = "base16";
};
};
lfs.enable = true;
userEmail = lib.mkDefault "geoffrey@frogeye.fr";
userName = lib.mkDefault "Geoffrey Frogeye";
extraConfig = {
core = {
editor = "nvim";
};
push = {
default = "matching";
};
pull = {
ff = "only";
};
} // lib.optionalAttrs config.frogeye.desktop.xorg {
diff.tool = "meld";
difftool.prompt = false;
"difftool \"meld\"".cmd = "${pkgs.meld}/bin/meld \"$LOCAL\" \"$REMOTE\"";
# This escapes quotes, which isn't the case in the original, hoping this isn't an issue.
};
};
readline = {
enable = true;
variables = {
"bell-style" = "none";
"colored-completion-prefix" = true;
"colored-stats" = true;
"completion-ignore-case" = true;
"completion-query-items" = 200;
"editing-mode" = "vi";
"history-preserve-point" = true;
"history-size" = 10000;
"horizontal-scroll-mode" = false;
"mark-directories" = true;
"mark-modified-lines" = false;
"mark-symlinked-directories" = true;
"match-hidden-files" = true;
"menu-complete-display-prefix" = true;
"page-completions" = true;
"print-completions-horizontally" = false;
"revert-all-at-newline" = false;
"show-all-if-ambiguous" = true;
"show-all-if-unmodified" = true;
"show-mode-in-prompt" = true;
"skip-completed-text" = true;
"visible-stats" = false;
};
extraConfig = builtins.readFile ./inputrc;
};
tmux =
let
themepack = pkgs.tmuxPlugins.mkTmuxPlugin
rec {
pluginName = "tmux-themepack";
version = "1.1.0";
rtpFilePath = "themepack.tmux";
src = pkgs.fetchFromGitHub {
owner = "jimeh";
repo = "tmux-themepack";
rev = "${version}";
sha256 = "f6y92kYsKDFanNx5ATx4BkaB/E7UrmyIHU/5Z01otQE=";
};
};
in
{
enable = true;
mouse = false;
clock24 = true;
# TODO Vim mode?
plugins = with pkgs.tmuxPlugins; [
sensible
];
extraConfig = builtins.readFile ./tmux.conf + "source-file ${themepack}/share/tmux-plugins/tmux-themepack/powerline/default/green.tmuxtheme\n";
};
translate-shell.enable = true; # TODO Cool config?
password-store.enable = true;
# Imported from scripts
rms = ''${pkgs.findutils}/bin/find . -name "*.sync-conflict-*" -delete''; # Remove syncthing conflict files
newestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | tail'';
oldestFile = ''${pkgs.findutils}/bin/find -type f -printf '%T+ %p\n' | sort | head'';
};
services = {
gpg-agent = {
thefuck = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
git-sync = {
enable = false; # The real thing syncs too quickly and asks for passphrase, which is annoying
# So for now it's just a way to park config which will be reused by git-sync-* commands
repositories = {
dotfiles = {
path = "${config.xdg.configHome}/dotfiles";
uri = lib.mkDefault "https://git.frogeye.fr/geoffrey/dotfiles.git";
};
lsd = {
enable = true;
settings = {
size = "short";
};
colors = {
# Base16 only, so it reuses the current theme.
date = { day-old = 4; hour-old = 6; older = 5; };
git-status = { conflicted = 14; default = 13; deleted = 1; ignored = 13; modified = 3; new-in-index = 2; new-in-workdir = 2; renamed = 4; typechange = 3; unmodified = 13; };
group = 6;
inode = { invalid = 245; valid = 13; };
links = { invalid = 9; valid = 14; };
permission = { acl = 6; context = 14; exec = 1; exec-sticky = 5; no-access = 245; octal = 6; read = 2; write = 3; };
size = { large = 1; medium = 9; none = 11; small = 3; };
tree-edge = 13;
user = 2;
};
};
};
xdg = {
configFile = {
"ccache.conf" = {
text = "ccache_dir = ${config.xdg.cacheHome}/ccache";
};
"gdbinit" = {
text = ''
define hook-quit
set confirm off
end
'';
};
"iftoprc" = {
text = ''
port-resolution: no
promiscuous: no
port-display: on
link-local: yes
use-bytes: yes
show-totals: yes
log-scale: yes
'';
};
"pythonstartup.py" = {
text = (builtins.readFile ./pythonstartup.py);
};
"screenrc" = {
text = (builtins.readFile ./screenrc);
};
dircolors = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
# UPST This thing put stuff in .dircolors when it actually doesn't have to
};
git.enable = true;
gpg.enable = true;
fzf = {
enable = true;
enableZshIntegration = true;
defaultOptions = [ "--height 40%" "--layout=default" ];
fileWidgetOptions = [ "--preview '[[ -d {} ]] && ${pkgs.coreutils}/bin/ls -l --color=always {} || [[ \$(${pkgs.file}/bin/file --mime {}) =~ binary ]] && ${pkgs.file}/bin/file --brief {} || (${pkgs.highlight}/bin/highlight -O ansi -l {} || coderay {} || rougify {} || ${pkgs.coreutils}/bin/cat {}) 2> /dev/null | head -500'" ];
# TODO Above not working... not really used either?
# file and friends are not in PATH by default... so here we want aboslute paths, which means those won't get reloaded. Meh.
};
less.enable = true;
nixvim.enable = true;
readline = {
enable = true;
variables = {
"bell-style" = "none";
"colored-completion-prefix" = true;
"colored-stats" = true;
"completion-ignore-case" = true;
"completion-query-items" = 200;
"editing-mode" = "vi";
"history-preserve-point" = true;
"history-size" = 10000;
"horizontal-scroll-mode" = false;
"mark-directories" = true;
"mark-modified-lines" = false;
"mark-symlinked-directories" = true;
"match-hidden-files" = true;
"menu-complete-display-prefix" = true;
"page-completions" = true;
"print-completions-horizontally" = false;
"revert-all-at-newline" = false;
"show-all-if-ambiguous" = true;
"show-all-if-unmodified" = true;
"show-mode-in-prompt" = true;
"skip-completed-text" = true;
"visible-stats" = false;
};
extraConfig = builtins.readFile ./inputrc;
};
tmux.enable = true;
translate-shell.enable = true; # TODO Cool config?
};
home = {
activation = {
@ -409,134 +141,82 @@ in
'';
};
stateVersion = "23.11";
language = {
base = "en_US.UTF-8";
# time = "en_DK.UTF-8"; # TODO Disabled because complaints during nixos-rebuild switch
};
packages = with pkgs; [
# dotfiles dependencies
# Terminal utils
coreutils
bash
gnugrep
gnused
gnutar
openssl
wget
curl
python3Packages.pip
moreutils
rename
which
# shell
zsh-completions
nix-zsh-completions
zsh-history-substring-search
powerline-go
neofetch
# nix utils
nix-diff
nix-tree
nix-output-monitor
# terminal essentials
file
moreutils
man
# Pipe utils
gnugrep
gnused
gawk
# Extraction
gnutar
unzip
unrar
p7zip
# Documentation
man
tldr
neofetch
# remote
wget
curl
openssl
openssh
rsync
borgbackup
sshfs
# cleanup
ncdu
jdupes
duperemove
compsize
# local monitoring
htop
iotop
iftop
lsof
strace
pv
progress
speedtest-cli
btdu
# toolbox
sox
imagemagick
numbat
# password
pwgen
(pkgs.writeShellApplication {
name = "git-sync-init";
text = (lib.strings.concatLines
(map (r: ''[ -d "${r.path}" ] || ${pkgs.git}/bin/git clone "${r.uri}" "${r.path}"'')
(lib.attrsets.attrValues config.services.git-sync.repositories)
)
);
})
(pkgs.writeShellApplication {
name = "git-sync-pull";
text = (lib.strings.concatLines
(map (r: ''(cd "${r.path}"; echo "$PWD"; ${pkgs.git}/bin/git pull || true)'')
(lib.attrsets.attrValues config.services.git-sync.repositories)
)
);
})
# hardware
pciutils
usbutils
dmidecode
lshw
# Mail
isync
msmtp
notmuch
neomutt
lynx
# Locker
(pkgs.writeShellApplication {
name = "lock";
text = ''
${config.frogeye.hooks.lock}
# Organisation
vdirsyncer
khard
khal
todoman
${pkgs.vlock}/bin/vlock --all
'';
})
];
sessionVariables = {
# Favourite commands
PAGER = "less";
EDITOR = "nvim";
# Extra config
BOOT9_PATH = "${config.xdg.dataHome}/citra-emu/sysdata/boot9.bin";
CCACHE_CONFIGPATH = "${config.xdg.configHome}/ccache.conf";
# INPUTRC = "${config.xdg.configHome}/inputrc"; # UPST Will use programs.readline, but doesn't allow path setting
LESSHISTFILE = "${config.xdg.stateHome}/lesshst";
NODE_REPL_HISTORY = "${config.xdg.cacheHome}/node_repl_history";
PYTHONSTARTUP = "${config.xdg.configHome}/pythonstartup.py";
# TODO I think we're not using the urxvt daemon on purpose?
# TODO this should be desktop only, as a few things are too.
SCREENRC = "${config.xdg.configHome}/screenrc";
SQLITE_HISTFILE = "${config.xdg.stateHome}/sqlite_history";
YARN_DISABLE_SELF_UPDATE_CHECK = "true"; # This also disable the creation of a ~/.yarnrc file
} // lib.optionalAttrs config.frogeye.desktop.xorg {
# Favourite commands
VISUAL = "nvim";
BROWSER = "${config.programs.qutebrowser.package}/bin/qutebrowser";
# Extra config
RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd"; # Used to want -$HOME suffix, hopefullt this isn't needed
# XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs
} // direnv;
# TODO Session variables only get reloaded on login I think.
# Bash/ZSH only?
TIME_STYLE = "+%Y-%m-%d %H:%M:%S";
# Fzf
FZF_COMPLETION_OPTS = "${lib.strings.concatStringsSep " " config.programs.fzf.fileWidgetOptions}";
};
sessionPath = [
"${config.home.homeDirectory}/.local/bin"
"${config.home.sessionVariables.GOPATH}"
(builtins.toString ./scripts)
"${config.home.homeDirectory}/.config/dotfiles/hm/scripts" # Not Nix path otherwise it gets converted into store,
# and then every time you want to modify a script you have to rebuild and re-login...
];
# TODO Way to automatically setup an home-manager install
};
}

View file

@ -1,16 +1,29 @@
{ ... }:
{ stylix, ... }:
{
imports = [
../common/frogarized
../options.nix
./accounts
./brightness
./common.nix
./desktop.nix
./dev.nix
./desktop
./dev
./extra.nix
./gaming
./git
./gpg
./homealone.nix
./monitoring
./nix
./pager
./password
./prompt
./rebuild
./shell
./ssh.nix
./style.nix
./usernix
./vim.nix
stylix.homeManagerModules.stylix
./theme
./tmux
./vim
];
}

View file

@ -1,706 +0,0 @@
{ pkgs, config, lib, ... }:
let
nixGLIntelPrefix = "${pkgs.nixgl.nixVulkanIntel}/bin/nixVulkanIntel ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ";
wmPrefix = "${lib.optionalString config.frogeye.desktop.nixGLIntel nixGLIntelPrefix}";
in
{
imports = [
./frobar
];
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.shellAliases = {
noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise'';
beep = ''${pkgs.sox}/bin/play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null'';
# n = "$HOME/.config/i3/terminal & disown"; # Not used anymore since alacritty daemon mode doesn't preserve environment variables
x = "startx ${config.home.homeDirectory}/${config.xsession.scriptPath}; logout";
# TODO Is it possible to not start nvidia stuff on nixOS?
# nx = "nvidia-xrun ${config.xsession.scriptPath}; sudo systemctl start nvidia-xrun-pm; logout";
};
xsession = {
enable = true;
# Not using config.xdg.configHome because it needs to be $HOME-relative paths and path manipulation is hard
scriptPath = ".config/xsession";
profilePath = ".config/xprofile";
windowManager = {
command = lib.mkForce "${wmPrefix} ${config.xsession.windowManager.i3.package}/bin/i3";
i3 = {
enable = true;
config =
let
# 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.b}\"/></svg>";
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out";
locker = pkgs.writeShellScript "i3-locker"
''
# Remove SSH and GPG keys from keystores
${pkgs.openssh}/bin/ssh-add -D
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
${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
pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1)
else
pattern=${lockPng}
fi
revert() {
${pkgs.xorg.xset}/bin/xset dpms 0 0 0
}
trap revert SIGHUP SIGINT SIGTERM
${pkgs.xorg.xset}/bin/xset dpms 5 5 5
${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password
revert
fi
'';
focus = "exec ${ pkgs.writeShellScript "i3-focus-window"
''
WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus`
eval `${pkgs.xdotool}/bin/xdotool getwindowgeometry --shell $WINDOW` # this brings in variables WIDTH and HEIGHT
TX=`${pkgs.coreutils}/bin/expr $WIDTH / 2`
TY=`${pkgs.coreutils}/bin/expr $HEIGHT / 2`
${pkgs.xdotool}/bin/xdotool mousemove -window $WINDOW $TX $TY
''
}";
mode_system = "[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction";
mode_resize = "Resize";
mode_pres_main = "Presentation (main display)";
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 {
focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; };
focusedInactive = { border = base02; background = base02; text = base05; indicator = base02; childBorder = base02; };
unfocused = { border = base05; background = base04; text = base00; indicator = base04; childBorder = base00; };
urgent = { border = base0F; background = base08; text = base00; indicator = base08; childBorder = base0F; };
placeholder = { border = ignore; background = base00; text = base05; indicator = ignore; childBorder = base00; };
background = base07;
# I set the color of the active tab as the the background color of the terminal so they merge together.
};
focus.followMouse = false;
keybindings =
let
mod = config.xsession.windowManager.i3.config.modifier;
rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi";
pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS
screenshots_dir = config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR;
scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ${screenshots_dir}/ && ${pkgs.optipng}/bin/optipng ${screenshots_dir}/$f'";
in
{
# Compatibility layer for people coming from other backgrounds
"Mod1+Tab" = "${rofi} -modi window -show window";
"Mod1+F2" = "${rofi} -modi drun -show drun";
"Mod1+F4" = "kill";
# kill focused window
"${mod}+z" = "kill";
button2 = "kill";
# Rofi
"${mod}+c" = "exec --no-startup-id ${config.programs.rofi.pass.package}/bin/rofi-pass --last-used";
# TODO Try autopass.cr
# 23.11 config.programs.rofi.pass.package
"${mod}+i" = "exec --no-startup-id ${pkgs.rofimoji}/bin/rofimoji";
"${mod}+plus" = "${rofi} -modi ssh -show ssh";
"${mod}+ù" = "${rofi} -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t \"sudo -s -E\"'";
# TODO In which keyboard layout?
"${mod}+Tab" = "${rofi} -modi window -show window";
# start program launcher
"${mod}+d" = "${rofi} -modi run -show run";
"${mod}+Shift+d" = "${rofi} -modi drun -show drun";
# Start Applications
"${mod}+Return" = "exec ${
pkgs.writeShellScript "terminal" "${config.programs.alacritty.package}/bin/alacritty msg create-window -e zsh || exec ${config.programs.alacritty.package}/bin/alacritty -e zsh"
# -e zsh is for systems where I can't configure my user's shell
# TODO Is a shell script even required?
}";
"${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt";
"${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/thunar";
"${mod}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore --backend=webengine";
# TODO --backend not useful anymore
# Volume control
"XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true";
"${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset
"${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
"${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
# TODO Find pacmixer?
# Media control
"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"
''
layout=`${pkgs.xorg.setxkbmap}/bin/setxkbmap -query | ${pkgs.gnugrep}/bin/grep ^layout: | ${pkgs.gawk}/bin/awk '{ print $2 }'`
${pkgs.libgnomekbd}/bin/gkbd-keyboard-display -l $layout
''
}";
# Screenshots
"Print" = "exec ${scrot} --focused";
"${mod}+Print" = "exec ${scrot}";
"Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select";
# TODO Try using bindsym --release instead of sleep
# change focus
"${mod}+h" = "focus left; ${focus}";
"${mod}+j" = "focus down; ${focus}";
"${mod}+k" = "focus up; ${focus}";
"${mod}+l" = "focus right; ${focus}";
# move focused window
"${mod}+Shift+h" = "move left; ${focus}";
"${mod}+Shift+j" = "move down; ${focus}";
"${mod}+Shift+k" = "move up; ${focus}";
"${mod}+Shift+l" = "move right; ${focus}";
# workspace back and forth (with/without active container)
"${mod}+b" = "workspace back_and_forth; ${focus}";
"${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}";
# Change container layout
"${mod}+g" = "split h; ${focus}";
"${mod}+v" = "split v; ${focus}";
"${mod}+f" = "fullscreen toggle; ${focus}";
"${mod}+s" = "layout stacking; ${focus}";
"${mod}+w" = "layout tabbed; ${focus}";
"${mod}+e" = "layout toggle split; ${focus}";
"${mod}+Shift+space" = "floating toggle; ${focus}";
# Focus container
"${mod}+space" = "focus mode_toggle; ${focus}";
"${mod}+a" = "focus parent; ${focus}";
"${mod}+q" = "focus child; ${focus}";
# Switch to workspace
"${mod}+1" = "workspace 1; ${focus}";
"${mod}+2" = "workspace 2; ${focus}";
"${mod}+3" = "workspace 3; ${focus}";
"${mod}+4" = "workspace 4; ${focus}";
"${mod}+5" = "workspace 5; ${focus}";
"${mod}+6" = "workspace 6; ${focus}";
"${mod}+7" = "workspace 7; ${focus}";
"${mod}+8" = "workspace 8; ${focus}";
"${mod}+9" = "workspace 9; ${focus}";
"${mod}+0" = "workspace 10; ${focus}";
# TODO Prevent repetitions, see workspace assignation for example
#navigate workspaces next / previous
"${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}";
"${mod}+Ctrl+l" = "workspace next_on_output; ${focus}";
"${mod}+Ctrl+j" = "workspace prev; ${focus}";
"${mod}+Ctrl+k" = "workspace next; ${focus}";
# Move to workspace next / previous with focused container
"${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}";
"${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}";
"${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}";
"${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}";
# move focused container to workspace
"${mod}+ctrl+1" = "move container to workspace 1; ${focus}";
"${mod}+ctrl+2" = "move container to workspace 2; ${focus}";
"${mod}+ctrl+3" = "move container to workspace 3; ${focus}";
"${mod}+ctrl+4" = "move container to workspace 4; ${focus}";
"${mod}+ctrl+5" = "move container to workspace 5; ${focus}";
"${mod}+ctrl+6" = "move container to workspace 6; ${focus}";
"${mod}+ctrl+7" = "move container to workspace 7; ${focus}";
"${mod}+ctrl+8" = "move container to workspace 8; ${focus}";
"${mod}+ctrl+9" = "move container to workspace 9; ${focus}";
"${mod}+ctrl+0" = "move container to workspace 10; ${focus}";
# move to workspace with focused container
"${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}";
"${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}";
"${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}";
"${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}";
"${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}";
"${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}";
"${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}";
"${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}";
"${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}";
"${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}";
# move workspaces to screen (arrow keys)
"${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}";
"${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}";
"${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}";
"${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}";
# i3 control
"${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exit";
# Screen off commands
"${mod}+F1" = "exec --no-startup-id ${pkgs.bash}/bin/sh -c \"${pkgs.coreutils}/bin/sleep .25 && ${pkgs.xorg.xset}/bin/xset dpms force off\"";
# TODO --release?
"${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable";
"${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable";
# Modes
"${mod}+Escape" = "mode ${mode_system}";
"${mod}+r" = "mode ${mode_resize}";
"${mod}+Shift+p" = "mode ${mode_pres_main}";
"${mod}+t" = "mode ${mode_screen}";
"${mod}+y" = "mode ${mode_temp}";
};
modes = let return_bindings = {
"Return" = "mode default";
"Escape" = "mode default";
}; in
{
"${mode_system}" = {
"l" = "exec --no-startup-id exec ${locker}, mode default";
"e" = "exit, mode default";
"s" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl suspend --check-inhibitors=no, mode default";
"h" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
} // return_bindings;
"${mode_resize}" = {
"h" = "resize shrink width 10 px or 10 ppt; ${focus}";
"j" = "resize grow height 10 px or 10 ppt; ${focus}";
"k" = "resize shrink height 10 px or 10 ppt; ${focus}";
"l" = "resize grow width 10 px or 10 ppt; ${focus}";
} // return_bindings;
"${mode_pres_main}" = {
"b" = "workspace 3, workspace 4, mode ${mode_pres_sec}";
"q" = "mode default";
"Return" = "mode default";
};
"${mode_pres_sec}" = {
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
"q" = "mode default";
"Return" = "mode default";
};
"${mode_screen}" =
let
builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ];
autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu"
''
shopt -s nullglob globstar
profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')"
profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")"
[[ -n "$profile" ]] || exit
${pkgs.autorandr}/bin/autorandr ${option} "$profile"
'';
in
{
"a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default";
"l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default";
"s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default";
"r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default";
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
} // return_bindings;
"${mode_temp}" = {
"r" = "exec ${pkgs.sct}/bin/sct 1000";
"d" = "exec ${pkgs.sct}/bin/sct 2000";
"c" = "exec ${pkgs.sct}/bin/sct 4500";
"o" = "exec ${pkgs.sct}/bin/sct";
"a" = "exec ${pkgs.sct}/bin/sct 8000";
"b" = "exec ${pkgs.sct}/bin/sct 10000";
} // return_bindings;
};
window = {
hideEdgeBorders = "both";
titlebar = false; # So that single-container screens are basically almost fullscreen
commands = [
# Open specific applications in floating mode
{ criteria = { class = "Firefox"; }; command = "layout tabbed"; } # Doesn't seem to work anymore
{ criteria = { class = "qutebrowser"; }; command = "layout tabbed"; }
{ criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; }
{ criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; }
# switch to workspace with urgent window automatically
{ criteria = { urgent = "latest"; }; command = "focus"; }
];
};
floating = {
criteria = [
{ title = "pacmixer"; }
{ window_role = "pop-up"; }
{ window_role = "task_dialog"; }
];
};
startup = [
# Lock screen after 10 minutes
{ notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; }
{
notification = false;
command = "${pkgs.writeShellApplication {
name = "batteryNotify";
runtimeInputs = with pkgs; [coreutils libnotify];
text = builtins.readFile ./batteryNotify.sh;
# TODO Use batsignal instead?
# TODO Only on computers with battery
}}/bin/batteryNotify";
}
# TODO There's a services.screen-locker.xautolock but not sure it can match the above command
];
workspaceLayout = "tabbed";
focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus}
workspaceOutputAssign =
let
x11_screens = config.frogeye.desktop.x11_screens;
workspaces = map (i: { name = toString i; key = toString (lib.mod i 10); }) (lib.lists.range 1 10);
forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1));
in
forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; });
};
};
};
numlock.enable = config.frogeye.desktop.numlock;
};
programs = {
# Browser
qutebrowser = {
enable = true;
keyBindings = {
normal = {
# Match tab behaviour to i3. Not that I use them.
"H" = "tab-prev";
"J" = "back";
"K" = "forward";
"L" = "tab-next";
# "T" = null;
"af" = "spawn --userscript freshrss"; # TODO Broken?
"as" = "spawn --userscript shaarli"; # TODO I don't use shaarli anymore
# "d" = null;
"u" = "undo --window";
# TODO Unbind d and T (?)
};
};
loadAutoconfig = true;
searchEngines = rec {
DEFAULT = ecosia;
alpinep = "https://pkgs.alpinelinux.org/packages?name={}&branch=edge";
ampwhat = "http://www.amp-what.com/unicode/search/{}";
arch = "https://wiki.archlinux.org/?search={}";
archp = "https://www.archlinux.org/packages/?q={}";
aur = "https://aur.archlinux.org/packages/?K={}";
aw = ampwhat;
ddg = duckduckgo;
dockerhub = "https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q={}&starCount=0";
duckduckgo = "https://duckduckgo.com/?q={}&ia=web";
ecosia = "https://www.ecosia.org/search?q={}";
gfr = "https://www.google.fr/search?hl=fr&q={}";
g = google;
gh = github;
gi = "http://images.google.com/search?q={}";
giphy = "https://giphy.com/search/{}";
github = "https://github.com/search?q={}";
google = "https://www.google.fr/search?q={}";
invidious = "https://invidious.frogeye.fr/search?q={}";
inv = invidious;
npm = "https://www.npmjs.com/search?q={}";
q = qwant;
qwant = "https://www.qwant.com/?t=web&q={}";
wolfram = "https://www.wolframalpha.com/input/?i={}";
youtube = "https://www.youtube.com/results?search_query={}";
yt = youtube;
};
settings = {
downloads.location.prompt = false;
tabs = {
show = "never";
tabs_are_windows = true;
};
url = rec {
open_base_url = true;
start_pages = lib.mkDefault "https://geoffrey.frogeye.fr/blank.html";
default_page = start_pages;
};
content = {
# I had this setting below, not sure if it did something special
# config.set("content.cookies.accept", "no-3rdparty", "chrome://*/*")
cookies.accept = "no-3rdparty";
prefers_reduced_motion = true;
headers.accept_language = "fr-FR, fr;q=0.9, en-GB;q=0.8, en-US;q=0.7, en;q=0.6";
tls.certificate_errors = "ask-block-thirdparty";
};
editor.command = [ "${pkgs.neovide}/bin/neovide" "--" "-f" "{file}" "-c" "normal {line}G{column0}l" ];
# TODO Doesn't work on Arch. Does it even load the right profile on Nix?
# TODO spellcheck.languages = ["fr-FR" "en-GB" "en-US"];
};
};
# Terminal
alacritty = {
# TODO Emojis. Or maybe they work on NixOS?
# Arch (working) shows this with alacritty -vvv:
# [TRACE] [crossfont] Got font path="/usr/share/fonts/twemoji/twemoji.ttf", index=0
# [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: MONOCHROME | TARGET_MONO | COLOR, render_mode: "Mono", lcd_filter: 1 }
# Nix (not working) shows this:
# [TRACE] [crossfont] Got font path="/nix/store/872g3w9vcr5nh93r0m83a3yzmpvd2qrj-home-manager-path/share/fonts/truetype/TwitterColorEmoji-SVGinOT.ttf", index=0
# [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | COLOR, render_mode: "Lcd", lcd_filter: 1 }
enable = true;
settings = {
bell = {
animation = "EaseOutExpo";
color = "#000000";
command = { program = "${pkgs.sox}/bin/play"; args = [ "-n" "synth" "sine" "C5" "sine" "E4" "remix" "1-2" "fade" "0.1" "0.2" "0.1" ]; };
duration = 100;
};
cursor = { vi_mode_style = "Underline"; };
env = {
WINIT_X11_SCALE_FACTOR = "1";
# Prevents Alacritty from resizing from one monitor to another.
# Might cause issue on HiDPI screens but we'll get there when we get there
};
hints = {
enabled = [
{
binding = { mods = "Control|Alt"; key = "F"; };
command = "${pkgs.xdg-utils}/bin/xdg-open";
mouse = { enabled = true; mods = "Control"; };
post_processing = true;
regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\\\s{-}\\\\^`]+";
}
];
};
key_bindings = [
{ mode = "~Search"; mods = "Alt|Control"; key = "Space"; action = "ToggleViMode"; }
{ mode = "Vi|~Search"; mods = "Control"; key = "K"; action = "ScrollHalfPageUp"; }
{ mode = "Vi|~Search"; mods = "Control"; key = "J"; action = "ScrollHalfPageDown"; }
{ mode = "~Vi"; mods = "Control|Alt"; key = "V"; action = "Paste"; }
{ mods = "Control|Alt"; key = "C"; action = "Copy"; }
{ mode = "~Search"; mods = "Control|Alt"; key = "F"; action = "SearchForward"; }
{ mode = "~Search"; mods = "Control|Alt"; key = "B"; action = "SearchBackward"; }
{ mode = "Vi|~Search"; mods = "Control|Alt"; key = "C"; action = "ClearSelection"; }
];
window = {
dynamic_padding = false;
dynamic_title = true;
};
};
};
# Backup terminal
urxvt = {
enable = true;
package = pkgs.rxvt-unicode-emoji;
scroll = {
bar.enable = false;
};
iso14755 = false; # Disable Ctrl+Shift default bindings
keybindings = {
"Shift-Control-C" = "eval:selection_to_clipboard";
"Shift-Control-V" = "eval:paste_clipboard";
# TODO Not sure resizing works, Nix doesn't have the package (urxvt-resize-font-git on Arch)
"Control-KP_Subtract" = "resize-font:smaller";
"Control-KP_Add" = "resize-font:bigger";
};
extraConfig = {
"letterSpace" = 0;
"perl-ext-common" = "resize-font,bell-command,readline,selection";
"bell-command" = "${pkgs.sox}/bin/play -n synth sine C5 sine E4 remix 1-2 fade 0.1 0.2 0.1 &> /dev/null";
};
};
rofi = {
# TODO This theme template, that was used for Arch, looks much better:
# https://gitlab.com/jordiorlando/base16-rofi/-/blob/master/templates/default.mustache
enable = true;
pass.enable = true;
extraConfig = {
lazy-grab = false;
matching = "regex";
};
};
autorandr = {
enable = true;
hooks.postswitch = {
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
};
};
mpv = {
enable = true;
config = {
audio-display = false;
save-position-on-quit = true;
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";
};
};
};
};
xdg = {
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/about" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/unknown" = "org.qutebrowser.qutebrowser.desktop";
};
};
userDirs = {
enable = true; # TODO Which ones do we want?
createDirectories = true;
# French, because then it there's a different initial for each, making navigation easier
desktop = null;
download = "${config.home.homeDirectory}/Téléchargements";
music = "${config.home.homeDirectory}/Musiques";
pictures = "${config.home.homeDirectory}/Images";
publicShare = null;
templates = null;
videos = "${config.home.homeDirectory}/Vidéos";
extraConfig = {
XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Screenshots";
};
};
configFile = {
"pulse/client.conf" = {
text = ''cookie-file = .config/pulse/pulse-cookie'';
};
"rofimoji.rc" = {
text = ''
skin-tone = neutral
files = [emojis, math]
action = clipboard
'';
};
"vimpc/vimpcrc" = {
text = ''
map FF :browse<C-M>gg/
map à :set add next<C-M>a:set add end<C-M>
map @ :set add next<C-M>a:set add end<C-M>:next<C-M>
map ° D:browse<C-M>A:shuffle<C-M>:play<C-M>:playlist<C-M>
set songformat {%a - %b: %t}|{%f}$E$R $H[$H%l$H]$H
set libraryformat %n \| {%t}|{%f}$E$R $H[$H%l$H]$H
set ignorecase
set sort library
'';
};
};
};
services = {
blueman-applet.enable = true;
unclutter.enable = true;
dunst =
{
enable = true;
settings =
# TODO Change dmenu for rofi, so we can use context
with config.lib.stylix.colors.withHashtag; {
global = {
separator_color = lib.mkForce base05;
idle_threshold = 120;
markup = "full";
max_icon_size = 48;
# TODO Those shortcuts don't seem to work, maybe try:
# > define shortcuts inside your window manager and bind them to dunstctl(1) commands
close_all = "ctrl+mod4+n";
close = "mod4+n";
context = "mod1+mod4+n";
history = "shift+mod4+n";
};
urgency_low = {
background = lib.mkForce base01;
foreground = lib.mkForce base03;
frame_color = lib.mkForce base05;
};
urgency_normal = {
background = lib.mkForce base02;
foreground = lib.mkForce base05;
frame_color = lib.mkForce base05;
};
urgency_critical = {
background = lib.mkForce base08;
foreground = lib.mkForce base06;
frame_color = lib.mkForce base05;
};
};
};
mpd = {
enable = true;
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
startWhenNeeded = true;
};
extraConfig = ''
restore_paused "yes"
'';
};
autorandr.enable = true;
};
home = {
file = {
".face" = {
# TODO Only works on pindakaas? 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";
};
};
packages = with pkgs; [
pavucontrol # Because can't use Win+F1X on Pinebook 🙃
# remote
tigervnc
# music
mpc-cli
ashuffle
vimpc
# multimedia common
gimp
inkscape
libreoffice
# data management
freefilesync
# browsers
firefox
# fonts
dejavu_fonts
twemoji-color-font
gnome.gedit
feh
zbar
zathura
meld
python3Packages.magic
# x11-exclusive
numlockx
simplescreenrecorder
trayer
xclip
keynav
xorg.xinit
# TODO Make this clean. Service?
# organisation
pass
thunderbird
];
sessionVariables = {
MPD_PORT = "${toString config.services.mpd.network.port}";
ALSA_PLUGIN_DIR = "${pkgs.alsa-plugins}/lib/alsa-lib"; # Fixes an issue with sox (Cannot open shared library libasound_module_pcm_pulse.so)
# UPST Patch this upstream like: https://github.com/NixOS/nixpkgs/blob/216b111fb87091632d077898df647d1438fc2edb/pkgs/applications/audio/espeak-ng/default.nix#L84
};
};
};
}

View file

@ -0,0 +1,38 @@
{ pkgs, lib, config, ... }:
let
pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS
mod = config.xsession.windowManager.i3.config.modifier;
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
home = {
packages = with pkgs; [
pavucontrol # Because can't use Win+F1X on Pinebook 🙃
sox
];
sessionVariables = {
ALSA_PLUGIN_DIR = "${pkgs.alsa-plugins}/lib/alsa-lib"; # Fixes an issue with sox (Cannot open shared library libasound_module_pcm_pulse.so)
# UPST Patch this upstream like: https://github.com/NixOS/nixpkgs/blob/216b111fb87091632d077898df647d1438fc2edb/pkgs/applications/audio/espeak-ng/default.nix#L84
};
};
programs.bash.shellAliases = {
beep = ''${pkgs.sox}/bin/play -n synth sine E5 sine A4 remix 1-2 fade 0.5 1.2 0.5 2> /dev/null'';
noise = ''${pkgs.sox}/bin/play -c 2 -n synth $'' + ''{1}noise'';
};
xdg.configFile = {
"pulse/client.conf" = {
text = ''cookie-file = .config/pulse/pulse-cookie'';
};
};
xsession.windowManager.i3.config.keybindings =
{
"XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true";
"${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset
"${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
"${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
# TODO Find pacmixer?
};
};
}

View file

@ -0,0 +1,32 @@
{ pkgs, lib, config, ... }:
let
builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ];
autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu"
''
shopt -s nullglob globstar
profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')"
profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")"
[[ -n "$profile" ]] || exit
${pkgs.autorandr}/bin/autorandr ${option} "$profile"
'';
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.desktop.i3.bindmodes = {
"Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default" =
{
bindings = {
"a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default";
"l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default";
"s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default";
"r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default";
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
};
mod_enter = "t";
};
};
programs.autorandr.enable = true;
services.autorandr.enable = true;
};
}
# TODO Deterministic configs?

View file

@ -0,0 +1,9 @@
{ pkgs, config, lib, ... }:
{
config = {
# This correctly sets the background on some occasions, below does the rest
programs.autorandr.hooks.postswitch = {
background = "${pkgs.feh}/bin/feh --no-fehbg --bg-fill ${config.stylix.image}";
};
};
}

View file

@ -0,0 +1,178 @@
{ pkgs, lib, config, nur, ... }:
{
config = lib.mkIf config.frogeye.desktop.xorg {
home.sessionVariables = {
BROWSER = "qutebrowser";
};
programs = {
firefox = {
enable = true;
package = pkgs.firefox.override {
nativeMessagingHosts = [
pkgs.tridactyl-native
];
};
profiles.hm = {
extensions = with config.nur.repos.rycee.firefox-addons;
[
(buildFirefoxXpiAddon {
pname = "onetab";
version = "0.1.0";
addonId = "onetab@nated";
url = "https://addons.mozilla.org/firefox/downloads/file/4118712/one_tab_per_window-0.1.0.xpi";
sha256 = "sha256-64DeL2xgXpqz32LJWDx4jhS2Fvbld8re3z8fdwnNTw0=";
meta = with lib;
{
homepage = "https://git.sr.ht/~nated/onetab";
description = "When a new tab is opened, redirects it to a new window instead.";
license = licenses.unfree;
mozPermissions = [ "tabs" ];
platforms = platforms.all;
};
})
tridactyl
ublock-origin
];
search = {
default = "DuckDuckGo";
engines = {
# TODO Harmonize with qutebrowser search engines
"Nix Packages" = {
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"NixOS Wiki" = {
urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = [ "@nw" ];
};
"Bing".metaData.hidden = true;
"Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias
};
force = true;
};
settings = {
"browser.startup.homepage" = "https://geoffrey.frogeye.fr/home.php";
"signon.rememberSignons" = false; # Don't save passwords
"browser.newtabpage.enabled" = false; # Best would be homepage but not possible without extension?
# Europe please
"browser.search.region" = "GB";
"browser.search.isUS" = false;
"distribution.searchplugins.defaultLocale" = "en-GB";
"general.useragent.locale" = "en-GB";
};
};
};
qutebrowser = {
enable = true;
keyBindings = {
normal = {
# Match tab behaviour to i3. Not that I use tabs.
"H" = "tab-prev";
"J" = "back";
"K" = "forward";
"L" = "tab-next";
# "T" = null;
"af" = "spawn --userscript freshrss"; # TODO Broken?
"as" = "spawn --userscript shaarli"; # TODO I don't use shaarli anymore
# "d" = null;
"u" = "undo --window";
# TODO Unbind d and T (?)
};
};
loadAutoconfig = true;
searchEngines = rec {
DEFAULT = ecosia;
alpinep = "https://pkgs.alpinelinux.org/packages?name={}&branch=edge";
ampwhat = "http://www.amp-what.com/unicode/search/{}";
arch = "https://wiki.archlinux.org/?search={}";
archp = "https://www.archlinux.org/packages/?q={}";
aur = "https://aur.archlinux.org/packages/?K={}";
aw = ampwhat;
ddg = duckduckgo;
dockerhub = "https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q={}&starCount=0";
duckduckgo = "https://duckduckgo.com/?q={}&ia=web";
ecosia = "https://www.ecosia.org/search?q={}";
gfr = "https://www.google.fr/search?hl=fr&q={}";
g = google;
gh = github;
gi = "http://images.google.com/search?q={}";
giphy = "https://giphy.com/search/{}";
github = "https://github.com/search?q={}";
google = "https://www.google.fr/search?q={}";
hm = homemanager;
homemanager = "https://home-manager-options.extranix.com/?query={}&release=${config.home.version.release}";
invidious = "https://invidious.frogeye.fr/search?q={}";
inv = invidious;
nixos = "https://search.nixos.org/options?channel=${config.home.version.release}&query={}";
nixoswiki = "https://wiki.nixos.org/w/index.php?search={}";
nixpkgs = "https://search.nixos.org/packages?channel=${config.home.version.release}&query={}";
noogle = "https://noogle.dev/q?term={}";
npm = "https://www.npmjs.com/search?q={}";
nw = nixoswiki;
os = nixos;
pkgs = nixpkgs;
q = qwant;
qwant = "https://www.qwant.com/?t=web&q={}";
wolfram = "https://www.wolframalpha.com/input/?i={}";
youtube = "https://www.youtube.com/results?search_query={}";
yt = youtube;
};
settings = {
downloads.location.prompt = false;
tabs = {
show = "never";
tabs_are_windows = true;
};
url = rec {
open_base_url = true;
start_pages = lib.mkDefault "https://geoffrey.frogeye.fr/blank.html";
default_page = start_pages;
};
content = {
# I had this setting below, not sure if it did something special
# config.set("content.cookies.accept", "no-3rdparty", "chrome://*/*")
cookies.accept = "no-3rdparty";
prefers_reduced_motion = true;
headers.accept_language = "fr-FR, fr;q=0.9, en-GB;q=0.8, en-US;q=0.7, en;q=0.6";
tls.certificate_errors = "ask-block-thirdparty";
};
editor.command = [ "${pkgs.neovide}/bin/neovide" "--" "-f" "{file}" "-c" "normal {line}G{column0}l" ];
# TODO Doesn't work on Arch. Does it even load the right profile on Nix?
# TODO spellcheck.languages = ["fr-FR" "en-GB" "en-US"];
};
};
};
xdg = {
configFile."tridactyl/tridactylrc".source = ./tridactylrc; # TODO Improve that :)
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/about" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/unknown" = "org.qutebrowser.qutebrowser.desktop";
};
};
};
xsession.windowManager.i3.config.keybindings = {
"${config.xsession.windowManager.i3.config.modifier}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore";
};
};
imports = [
nur.hmModules.nur
];
}

View file

@ -79,14 +79,14 @@ set searchurls.npm https://www.npmjs.com/search?q=%s
set searchurls.pypi https://pypi.org/search/?q=%s
set searchurls.python https://docs.python.org/3/search.html?q=%s
set searchurls.qwant https://www.qwant.com/?t=web&q=%s
set searchurls.invidious https://invidious.drycat.fr/search?q=%s
set searchurls.invidious https://invidious.frogeye.fr/search?q=%s
set searchurls.id https://invidious.drycat.fr/search?q=%s
set searchurls.wa https://www.wolframalpha.com/input/?i=%s
set searchurls.yt https://www.youtube.com/results?search_query=%s
" Firefox GUI
" This can still be shown with F6!
" guiset_quiet gui none
guiset_quiet gui none
" Never autofocus
set allowautofocus false

162
hm/desktop/default.nix Normal file
View file

@ -0,0 +1,162 @@
{ pkgs, config, lib, ... }:
{
imports = [
./audio
./autorandr
./background
./browser
./frobar
./i3.nix
./lock
./mpd
./presentation
./redness
./screenshots
./terminal
];
config = lib.mkIf config.frogeye.desktop.xorg {
xsession = {
enable = true;
# Not using config.xdg.configHome because it needs to be $HOME-relative paths and path manipulation is hard
scriptPath = ".config/xsession";
profilePath = ".config/xprofile";
windowManager = {
i3.enable = true;
};
numlock.enable = config.frogeye.desktop.numlock;
};
programs = {
# Terminal
bash.shellAliases = {
x = "startx ${config.home.homeDirectory}/${config.xsession.scriptPath}; logout";
lmms = "lmms --config ${config.xdg.configHome}/lmmsrc.xml";
};
rofi = {
# TODO This theme template, that was used for Arch, looks much better:
# https://gitlab.com/jordiorlando/base16-rofi/-/blob/master/templates/default.mustache
enable = true;
pass.enable = true;
extraConfig = {
lazy-grab = false;
matching = "regex";
};
};
mpv = {
enable = true;
config = {
audio-display = false;
save-position-on-quit = true;
osc = false; # Required by thumbnail script
# Hardware acceleration (from https://nixos.wiki/wiki/Accelerated_Video_Playback#MPV, vo=gpu already default)
hwdec = "auto-safe";
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";
};
};
};
};
xdg = {
userDirs = {
enable = true; # TODO Which ones do we want?
createDirectories = true;
# French, because then it there's a different initial for each, making navigation easier
desktop = null;
download = "${config.home.homeDirectory}/Téléchargements";
pictures = "${config.home.homeDirectory}/Images";
publicShare = null;
templates = null;
videos = "${config.home.homeDirectory}/Vidéos";
};
};
services = {
blueman-applet.enable = true;
unclutter.enable = true;
dunst =
{
enable = true;
settings =
# TODO Change dmenu for rofi, so we can use context
with config.lib.stylix.colors.withHashtag; {
global = {
separator_color = lib.mkForce base05;
idle_threshold = 120;
markup = "full";
max_icon_size = 48;
# TODO Those shortcuts don't seem to work, maybe try:
# > define shortcuts inside your window manager and bind them to dunstctl(1) commands
close_all = "ctrl+mod4+n";
close = "mod4+n";
context = "mod1+mod4+n";
history = "shift+mod4+n";
};
urgency_low = {
background = lib.mkForce base01;
foreground = lib.mkForce base03;
frame_color = lib.mkForce base05;
};
urgency_normal = {
background = lib.mkForce base02;
foreground = lib.mkForce base05;
frame_color = lib.mkForce base05;
};
urgency_critical = {
background = lib.mkForce base08;
foreground = lib.mkForce base06;
frame_color = lib.mkForce base05;
};
};
};
};
home = {
file = {
".face" = {
# TODO Only works on pindakaas? 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";
};
};
packages = with pkgs; [
# remote
tigervnc
# multimedia common
gimp
inkscape
libreoffice
# data management
freefilesync
# misc
gedit
xfce.thunar
nomacs
feh
zbar
evince
zathura
meld
python3Packages.magic
# x11-exclusive
simplescreenrecorder
trayer
xclip
keynav
xorg.xinit
];
sessionVariables = {
# XAUTHORITY = "${config.xdg.configHome}/Xauthority"; # Disabled as this causes lock-ups with DMs
};
};
};
}

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> { config = { }; overlays = [ ]; }, ... }:
{ pkgs ? import <nixpkgs> { config = { }; overlays = [ ]; }, lib, config, ... }:
# Tried using pyproject.nix but mpd2 dependency wouldn't resolve,
# is called pyton-mpd2 on PyPi but mpd2 in nixpkgs.
let
@ -22,7 +22,7 @@ let
};
in
{
config = {
config = lib.mkIf config.frogeye.desktop.xorg {
xsession.windowManager.i3.config.bars = [ ];
programs.autorandr.hooks.postswitch = {
frobar = "${pkgs.systemd}/bin/systemctl --user restart frobar";

View file

@ -8,9 +8,9 @@ def run():
Bar.init()
Updater.init()
WORKSPACE_THEME = 0
FOCUS_THEME = 3
URGENT_THEME = 1
WORKSPACE_THEME = 8
FOCUS_THEME = 2
URGENT_THEME = 0
CUSTOM_SUFFIXES = "▲■"
customNames = dict()
@ -30,22 +30,22 @@ def run():
)
# TODO Middle
Bar.addSectionAll(MpdProvider(theme=7), BarGroupType.LEFT)
Bar.addSectionAll(MpdProvider(theme=9), BarGroupType.LEFT)
# Bar.addSectionAll(I3WindowTitleProvider(), BarGroupType.LEFT)
# TODO Computer modes
SYSTEM_THEME = 2
DANGER_THEME = FOCUS_THEME
CRITICAL_THEME = URGENT_THEME
SYSTEM_THEME = 3
DANGER_THEME = 1
CRITICAL_THEME = 0
Bar.addSectionAll(CpuProvider(), BarGroupType.RIGHT)
Bar.addSectionAll(RamProvider(), BarGroupType.RIGHT)
Bar.addSectionAll(TemperatureProvider(), BarGroupType.RIGHT)
Bar.addSectionAll(BatteryProvider(), BarGroupType.RIGHT)
# Peripherals
PERIPHERAL_THEME = 5
NETWORK_THEME = 4
PERIPHERAL_THEME = 6
NETWORK_THEME = 5
# TODO Disk space provider
# TODO Screen (connected, autorandr configuration, bbswitch) provider
Bar.addSectionAll(PulseaudioProvider(theme=PERIPHERAL_THEME), BarGroupType.RIGHT)
@ -53,12 +53,12 @@ def run():
Bar.addSectionAll(NetworkProvider(theme=NETWORK_THEME), BarGroupType.RIGHT)
# Personal
PERSONAL_THEME = 0
PERSONAL_THEME = 7
# Bar.addSectionAll(KeystoreProvider(theme=PERSONAL_THEME), BarGroupType.RIGHT)
# Bar.addSectionAll(NotmuchUnreadProvider(dir='~/.mail/', theme=PERSONAL_THEME), BarGroupType.RIGHT)
# Bar.addSectionAll(TodoProvider(dir='~/.vdirsyncer/currentCalendars/', theme=PERSONAL_THEME), BarGroupType.RIGHT)
TIME_THEME = 6
TIME_THEME = 4
Bar.addSectionAll(TimeProvider(theme=TIME_THEME), BarGroupType.RIGHT)
# Bar.run()

View file

@ -313,29 +313,26 @@ class SectionThread(threading.Thread):
class Section:
# TODO Update all of that to base16
# COLORS = ['#272822', '#383830', '#49483e', '#75715e', '#a59f85', '#f8f8f2',
# '#f5f4f1', '#f9f8f5', '#f92672', '#fd971f', '#f4bf75', '#a6e22e',
# '#a1efe4', '#66d9ef', '#ae81ff', '#cc6633']
COLORS = [
"#181818",
"#AB4642",
"#A1B56C",
"#F7CA88",
"#7CAFC2",
"#BA8BAF",
"#86C1B9",
"#D8D8D8",
"#585858",
"#AB4642",
"#A1B56C",
"#F7CA88",
"#7CAFC2",
"#BA8BAF",
"#86C1B9",
"#F8F8F8",
"#092c0e",
"#143718",
"#5a7058",
"#677d64",
"#89947f",
"#99a08d",
"#fae2e3",
"#fff0f1",
"#e0332e",
"#cf4b15",
"#bb8801",
"#8d9800",
"#1fa198",
"#008dd1",
"#5c73c4",
"#d43982",
]
FGCOLOR = "#F8F8F2"
BGCOLOR = "#272822"
FGCOLOR = "#fff0f1"
BGCOLOR = "#092c0e"
THEMES = list()
EMPTY = (FGCOLOR, BGCOLOR)
@ -353,6 +350,8 @@ class Section:
def init():
for t in range(8, 16):
Section.THEMES.append((Section.COLORS[0], Section.COLORS[t]))
Section.THEMES.append((Section.COLORS[0], Section.COLORS[3]))
Section.THEMES.append((Section.COLORS[0], Section.COLORS[6]))
Section.updateThread.start()

View file

@ -66,7 +66,7 @@ class AlertLevel(enum.Enum):
class AlertingSection(StatefulSection):
# TODO EASE Correct settings for themes
THEMES = {AlertLevel.NORMAL: 2, AlertLevel.WARNING: 3, AlertLevel.DANGER: 1}
THEMES = {AlertLevel.NORMAL: 3, AlertLevel.WARNING: 1, AlertLevel.DANGER: 0}
PERSISTENT = True
def getLevel(self, quantity):

219
hm/desktop/i3.nix Normal file
View file

@ -0,0 +1,219 @@
{ pkgs, lib, config, ... }:
let
# FOCUS
focus = "exec ${ pkgs.writeShellScript "i3-focus-window" ''
WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus`
eval `${pkgs.xdotool}/bin/xdotool getwindowgeometry --shell $WINDOW` # this brings in variables WIDTH and HEIGHT
TX=`${pkgs.coreutils}/bin/expr $WIDTH / 2`
TY=`${pkgs.coreutils}/bin/expr $HEIGHT / 2`
${pkgs.xdotool}/bin/xdotool mousemove -window $WINDOW $TX $TY
''
}";
# CARDINALS
cardinals = [
{ vi = "h"; arrow = "Left"; container = "left"; workspace = "prev_on_output"; output = "left"; }
{ vi = "l"; arrow = "Right"; container = "right"; workspace = "next_on_output"; output = "right"; }
{ vi = "j"; arrow = "Down"; container = "up"; workspace = "prev"; output = "below"; }
{ vi = "k"; arrow = "Up"; container = "down"; workspace = "next"; output = "above"; }
];
forEachCardinal = f: map (c: f c) cardinals;
# WORKSPACES
workspaces_keys = lib.strings.stringToCharacters "1234567890";
workspaces = map
(i: {
id = i;
name = builtins.toString (i + 1);
key = builtins.elemAt workspaces_keys i;
})
(lib.lists.range 0 ((builtins.length workspaces_keys) - 1));
forEachWorkspace = f: map (w: f w) workspaces;
# MISC
mod = config.xsession.windowManager.i3.config.modifier;
rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi";
modes = config.frogeye.desktop.i3.bindmodes;
x11_screens = config.frogeye.desktop.x11_screens;
in
{
config = lib.mkIf config.xsession.windowManager.i3.enable {
stylix.targets.i3.enable = false;
xdg.configFile = {
"rofimoji.rc" = {
text = ''
skin-tone = neutral
files = [emojis, math]
action = clipboard
'';
};
};
xsession.windowManager.i3.config = {
modifier = "Mod4";
fonts = {
names = [ config.stylix.fonts.sansSerif.name ];
};
terminal = "alacritty";
colors = let ignore = "#ff00ff"; in
with config.lib.stylix.colors.withHashtag; lib.mkForce {
focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; };
focusedInactive = { border = base02; background = base02; text = base05; indicator = base02; childBorder = base02; };
unfocused = { border = base05; background = base04; text = base00; indicator = base04; childBorder = base00; };
urgent = { border = base0F; background = base08; text = base00; indicator = base08; childBorder = base0F; };
placeholder = { border = ignore; background = base00; text = base05; indicator = ignore; childBorder = base00; };
background = base07;
# I set the color of the active tab as the the background color of the terminal so they merge together.
};
focus.followMouse = false;
keybindings =
{
# Compatibility layer for people coming from other backgrounds
"Mod1+Tab" = "${rofi} -modi window -show window";
"Mod1+F2" = "${rofi} -modi drun -show drun";
"Mod1+F4" = "kill";
# kill focused window
"${mod}+z" = "kill";
button2 = "kill";
# Rofi
"${mod}+i" = "exec --no-startup-id ${pkgs.rofimoji}/bin/rofimoji";
"${mod}+Tab" = "${rofi} -modi window -show window";
# start program launcher
"${mod}+d" = "${rofi} -modi run -show run";
"${mod}+Shift+d" = "${rofi} -modi drun -show drun";
# Start Applications
"${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/thunar";
# Misc
"${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout"
''
layout=`${pkgs.xorg.setxkbmap}/bin/setxkbmap -query | ${pkgs.gnugrep}/bin/grep ^layout: | ${pkgs.gawk}/bin/awk '{ print $2 }'`
${pkgs.libgnomekbd}/bin/gkbd-keyboard-display -l $layout
''
}";
# workspace back and forth (with/without active container)
"${mod}+b" = "workspace back_and_forth; ${focus}";
"${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}";
# Change container layout
"${mod}+g" = "split h; ${focus}";
"${mod}+v" = "split v; ${focus}";
"${mod}+f" = "fullscreen toggle; ${focus}";
"${mod}+s" = "layout stacking; ${focus}";
"${mod}+w" = "layout tabbed; ${focus}";
"${mod}+e" = "layout toggle split; ${focus}";
"${mod}+Shift+space" = "floating toggle; ${focus}";
# Focus container
"${mod}+space" = "focus mode_toggle; ${focus}";
"${mod}+a" = "focus parent; ${focus}";
"${mod}+q" = "focus child; ${focus}";
# i3 control
"${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exit";
} // lib.mapAttrs' (k: v: lib.nameValuePair v.enter "mode ${v.name}") (lib.filterAttrs (k: v: v.enter != null) modes)
// lib.attrsets.mergeAttrsList (forEachCardinal (c: {
# change focus
"${mod}+${c.vi}" = "focus ${c.container}; ${focus}";
# move focused window
"${mod}+Shift+${c.vi}" = "move ${c.container}; ${focus}";
#navigate workspaces next / previous
"${mod}+Ctrl+${c.vi}" = "workspace ${c.workspace}; ${focus}";
# Move to workspace next / previous with focused container
"${mod}+Ctrl+Shift+${c.vi}" = "move container to workspace ${c.workspace}; workspace ${c.workspace}; ${focus}";
# move workspaces to screen (arrow keys)
"${mod}+Ctrl+Shift+${c.arrow}" = "move workspace to output ${c.output}; ${focus}";
})) // lib.attrsets.mergeAttrsList (forEachWorkspace (w: {
# Switch to workspace
"${mod}+${w.key}" = "workspace ${w.name}; ${focus}";
# move focused container to workspace
"${mod}+ctrl+${w.key}" = "move container to workspace ${w.name}; ${focus}";
# move to workspace with focused container
"${mod}+shift+${w.key}" = "move container to workspace ${w.name}; workspace ${w.name}; ${focus}";
}));
modes = lib.mapAttrs'
(k: v: lib.nameValuePair v.name (v.bindings // lib.optionalAttrs v.return_bindings {
"Return" = "mode default";
"Escape" = "mode default";
}))
modes;
window = {
hideEdgeBorders = "both";
titlebar = false; # So that single-container screens are basically almost fullscreen
commands = [
# switch to workspace with urgent window automatically
{ criteria = { urgent = "latest"; }; command = "focus"; }
];
};
floating = {
criteria = [
{ window_role = "pop-up"; }
{ window_role = "task_dialog"; }
];
};
startup = [
{
notification = false;
command = "${pkgs.writeShellApplication {
name = "batteryNotify";
runtimeInputs = with pkgs; [coreutils libnotify];
text = builtins.readFile ./batteryNotify.sh;
# TODO Use batsignal instead?
# TODO Only on computers with battery
}}/bin/batteryNotify";
}
];
workspaceLayout = "tabbed";
focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus}
workspaceOutputAssign =
forEachWorkspace (w: { output = builtins.elemAt x11_screens (lib.mod w.id (builtins.length x11_screens)); workspace = w.name; });
};
frogeye.desktop.i3.bindmodes = {
"Resize" = {
bindings = {
"h" = "resize shrink width 10 px or 10 ppt; ${focus}";
"j" = "resize grow height 10 px or 10 ppt; ${focus}";
"k" = "resize shrink height 10 px or 10 ppt; ${focus}";
"l" = "resize grow width 10 px or 10 ppt; ${focus}";
};
mod_enter = "r";
};
"[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction" = {
bindings = {
"l" = "exec --no-startup-id exec xlock, mode default";
"e" = "exit, mode default";
"s" = "exec --no-startup-id exec xlock & ${pkgs.systemd}/bin/systemctl suspend --check-inhibitors=no, mode default";
"h" = "exec --no-startup-id exec xlock & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
};
mod_enter = "Escape";
};
};
};
options = {
frogeye.desktop.i3.bindmodes = lib.mkOption {
default = { };
type = lib.types.attrsOf (lib.types.submodule ({ config, name, ... }: {
options = {
name = lib.mkOption {
type = lib.types.str;
default = name;
};
bindings = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
};
enter = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = "${mod}+${config.mod_enter}";
};
mod_enter = lib.mkOption {
type = lib.types.str;
};
return_bindings = lib.mkOption {
type = lib.types.bool;
default = true;
};
};
}));
};
};
}

View file

@ -0,0 +1,56 @@
{ pkgs, lib, config, ... }:
let
# 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.b}"/>
</svg>
'';
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out";
mod = config.xsession.windowManager.i3.config.modifier;
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
home.packages = with pkgs; [
(pkgs.writeShellApplication {
name = "xlock";
text = ''
${config.frogeye.hooks.lock}
# TODO Reevaluate whether we want this or not
if ! ${pkgs.lightdm}/bin/dm-tool lock
then
if [ -d ${config.xdg.cacheHome}/lockpatterns ]
then
pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1)
else
pattern=${lockPng}
fi
revert() {
${pkgs.xorg.xset}/bin/xset dpms 0 0 0
}
trap revert SIGHUP SIGINT SIGTERM
${pkgs.xorg.xset}/bin/xset dpms 5 5 5
${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image="$pattern" --tiling --ignore-empty-password
revert
fi
'';
})
];
xsession.windowManager.i3.config = {
keybindings = {
# Screen off commands
"${mod}+F1" = "--release exec --no-startup-id ${pkgs.xorg.xset}/bin/xset dpms force off";
"${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable";
"${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable";
};
startup = [
# Stop screen after 10 minutes, 1 minutes after lock it
{ notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer xlock"; }
# services.screen-locker.xautolock is hardcoded to use systemd for -locker (doesn't even work...)
];
};
};
}

View file

@ -0,0 +1,48 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.frogeye.desktop.xorg {
home = {
packages = with pkgs; [
ashuffle
mpc-cli
vimpc
];
sessionVariables = {
MPD_PORT = "${toString config.services.mpd.network.port}";
};
};
services.mpd = {
enable = true;
network = {
listenAddress = "0.0.0.0"; # Can be controlled remotely, determined with firewall
startWhenNeeded = true;
};
extraConfig = ''
restore_paused "yes"
'';
};
xdg = {
configFile = {
"vimpc/vimpcrc" = {
text = ''
map FF :browse<C-M>gg/
map à :set add next<C-M>a:set add end<C-M>
map @ :set add next<C-M>a:set add end<C-M>:next<C-M>
map ° D:browse<C-M>A:shuffle<C-M>:play<C-M>:playlist<C-M>
set songformat {%a - %b: %t}|{%f}$E$R $H[$H%l$H]$H
set libraryformat %n \| {%t}|{%f}$E$R $H[$H%l$H]$H
set ignorecase
set sort library
'';
};
};
userDirs.music = "${config.home.homeDirectory}/Musiques";
};
xsession.windowManager.i3.config.keybindings =
{
"XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev";
"XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle";
"XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next";
};
};
}

View file

@ -0,0 +1,39 @@
# Dual-screen presenting for slideshows and stuff.
# Not tested since Nix.
# Config mentions pdfpc, although the last thing I used was Impressive, even made patches to it.
# UPST Add Impressive to nixpkgs
{ pkgs, lib, config, ... }:
let
mode_pres_main = "Presentation (main display)";
mode_pres_sec = "Presentation (secondary display)";
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.desktop.i3.bindmodes = {
"${mode_pres_main}" = {
mod_enter = "Shift+p";
bindings = {
"b" = "workspace 3, workspace 4, mode ${mode_pres_sec}";
"q" = "mode default";
"Return" = "mode default";
};
return_bindings = false;
};
"${mode_pres_sec}" = {
enter = null;
bindings = {
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
"q" = "mode default";
"Return" = "mode default";
};
return_bindings = false;
};
};
xsession.windowManager.i3.config.window.commands = [
# Open specific applications in floating mode
{ criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; }
{ criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; }
];
};
}

View file

@ -0,0 +1,28 @@
{ pkgs, lib, config, ... }:
let
# UPST
sct = pkgs.sct.overrideAttrs
(old: {
patches = (old.patches or [ ]) ++ [
./sct_aarch64.patch
];
});
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
frogeye.desktop.i3.bindmodes = {
"Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue" = {
bindings = {
"r" = "exec ${sct}/bin/sct 1000";
"d" = "exec ${sct}/bin/sct 2000";
"c" = "exec ${sct}/bin/sct 4500";
"o" = "exec ${sct}/bin/sct";
"a" = "exec ${sct}/bin/sct 8000";
"b" = "exec ${sct}/bin/sct 10000";
};
mod_enter = "y";
};
};
home.packages = [ sct ];
};
}

View file

@ -0,0 +1,16 @@
{ pkgs, lib, config, ... }:
let
dir = config.xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR;
scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ${dir}/ && ${pkgs.optipng}/bin/optipng ${dir}/$f'";
mod = config.xsession.windowManager.i3.config.modifier;
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
xdg.userDirs.extraConfig.XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Screenshots";
xsession.windowManager.i3.config.keybindings = {
"Print" = "exec ${scrot} --focused";
"${mod}+Print" = "exec ${scrot}";
"Ctrl+Print" = "--release exec ${scrot} --select";
};
};
}

View file

@ -0,0 +1,90 @@
{ pkgs, lib, config, ... }:
let
mod = config.xsession.windowManager.i3.config.modifier;
in
{
config = lib.mkIf config.frogeye.desktop.xorg {
home.sessionVariables = {
RXVT_SOCKET = "${config.xdg.stateHome}/urxvtd";
# We don't use urxvt deamon mode as we use it as a backup, but just in case, this helps keep it out of the home directory.
};
programs = {
alacritty = {
# TODO Emojis
# Arch (working) shows this with alacritty -vvv:
# [TRACE] [crossfont] Got font path="/usr/share/fonts/twemoji/twemoji.ttf", index=0
# [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: MONOCHROME | TARGET_MONO | COLOR, render_mode: "Mono", lcd_filter: 1 }
# Nix (not working) shows this:
# [TRACE] [crossfont] Got font path="/nix/store/872g3w9vcr5nh93r0m83a3yzmpvd2qrj-home-manager-path/share/fonts/truetype/TwitterColorEmoji-SVGinOT.ttf", index=0
# [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT | COLOR, render_mode: "Lcd", lcd_filter: 1 }
enable = true;
settings = {
bell = {
animation = "EaseOutExpo";
color = "#000000";
command = { program = "${pkgs.sox}/bin/play"; args = [ "-n" "synth" "sine" "C5" "sine" "E4" "remix" "1-2" "fade" "0.1" "0.2" "0.1" ]; };
duration = 100;
};
cursor = { vi_mode_style = "Underline"; };
env = {
WINIT_X11_SCALE_FACTOR = "1";
# Prevents Alacritty from resizing from one monitor to another.
# Might cause issue on HiDPI screens but we'll get there when we get there
};
hints = {
enabled = [
{
binding = { mods = "Control|Alt"; key = "F"; };
command = "${pkgs.xdg-utils}/bin/xdg-open";
mouse = { enabled = true; mods = "Control"; };
post_processing = true;
regex = "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\\\s{-}\\\\^`]+";
}
];
};
keyboard.bindings = [
{ mode = "~Search"; mods = "Alt|Control"; key = "Space"; action = "ToggleViMode"; }
{ mode = "Vi|~Search"; mods = "Control"; key = "K"; action = "ScrollHalfPageUp"; }
{ mode = "Vi|~Search"; mods = "Control"; key = "J"; action = "ScrollHalfPageDown"; }
{ mode = "~Vi"; mods = "Control|Alt"; key = "V"; action = "Paste"; }
{ mods = "Control|Alt"; key = "C"; action = "Copy"; }
{ mode = "~Search"; mods = "Control|Alt"; key = "F"; action = "SearchForward"; }
{ mode = "~Search"; mods = "Control|Alt"; key = "B"; action = "SearchBackward"; }
{ mode = "Vi|~Search"; mods = "Control|Alt"; key = "C"; action = "ClearSelection"; }
];
window = {
dynamic_padding = false;
dynamic_title = true;
};
};
};
# Backup terminal
urxvt = {
enable = true;
package = pkgs.rxvt-unicode-emoji;
scroll = {
bar.enable = false;
};
iso14755 = false; # Disable Ctrl+Shift default bindings
keybindings = {
"Shift-Control-C" = "eval:selection_to_clipboard";
"Shift-Control-V" = "eval:paste_clipboard";
# TODO Not sure resizing works, Nix doesn't have the package (urxvt-resize-font-git on Arch)
"Control-KP_Subtract" = "resize-font:smaller";
"Control-KP_Add" = "resize-font:bigger";
};
extraConfig = {
"letterSpace" = 0;
"perl-ext-common" = "resize-font,bell-command,readline,selection";
"bell-command" = "${pkgs.sox}/bin/play -n synth sine C5 sine E4 remix 1-2 fade 0.1 0.2 0.1 &> /dev/null";
};
};
};
xsession.windowManager.i3.config.keybindings = {
"${mod}+Return" = "exec ${config.programs.alacritty.package}/bin/alacritty msg create-window -e zsh || exec ${config.programs.alacritty.package}/bin/alacritty -e zsh";
# -e zsh is for systems where I can't configure my user's shell
"${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt";
};
};
}

View file

@ -1,67 +0,0 @@
{ pkgs, config, ... }: {
# TODO Maybe should be per-directory dotenv
# Or not, for neovim
# Always on
home.packages = with pkgs; [
# Common
perf-tools
jq
yq
universal-ctags
highlight
# Network
socat
dig
whois
nmap
tcpdump
# nix
nix
# Always on (graphical)
] ++ lib.optionals config.frogeye.desktop.xorg [
# Common
zeal-qt6 # Offline documentation
# Network
wireshark-qt
# Ansible
] ++ lib.optionals config.frogeye.dev.ansible [
ansible
ansible-lint
# C/C++
] ++ lib.optionals config.frogeye.dev.c [
cmake
clang
ccache
gdb
# Docker
] ++ lib.optionals config.frogeye.dev.docker [
docker
docker-compose
# FPGA
] ++ lib.optionals config.frogeye.dev.fpga [
verilog
] ++ lib.optionals (config.frogeye.dev.fpga && pkgs.stdenv.isx86_64) [
ghdl
# FPGA (graphical)
] ++ lib.optionals (config.frogeye.desktop.xorg && config.frogeye.dev.fpga) [
yosys
gtkwave
# Python
] ++ lib.optionals config.frogeye.dev.python [
python3Packages.ipython
];
}

45
hm/dev/c.nix Normal file
View file

@ -0,0 +1,45 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.frogeye.dev.c {
frogeye = {
direnv = {
CCACHE_DIR = "${config.xdg.cacheHome}/ccache"; # The config file alone seems to be not enough
};
junkhome = [
"binwalk" # Should use .config according to the GitHub code though
"cmake"
"ddd"
"ghidra"
];
};
home = {
packages = with pkgs; [
binwalk
ccache
clang
cmake
ddd
gdb
];
sessionVariables = {
CCACHE_CONFIGPATH = "${config.xdg.configHome}/ccache.conf";
};
};
programs.bash.shellAliases = {
gdb = "gdb -x ${config.xdg.configHome}/gdbinit";
};
programs.nixvim.plugins.dap.enable = true; # Debug Adapter Protocol client
xdg.configFile = {
"ccache.conf" = {
text = "ccache_dir = ${config.xdg.cacheHome}/ccache";
};
gdbinit = {
text = ''
define hook-quit
set confirm off
end
'';
};
};
};
}

73
hm/dev/common.nix Normal file
View file

@ -0,0 +1,73 @@
{ pkgs, config, ... }: {
# TODO Maybe should be per-directory dotenv
# Or not, for neovim
config = {
# Always on
home.packages = with pkgs; [
# Common
perf-tools
jq
yq
universal-ctags
cloc
# Network
socat
dig
whois
nmap
tcpdump
mtr
traceroute
# nix
lix
# Always on (graphical)
] ++ lib.optionals config.frogeye.desktop.xorg [
# Common
zeal-qt6 # Offline documentation
# Network
wireshark-qt
# Ansible
] ++ lib.optionals config.frogeye.dev.ansible [
ansible
ansible-lint
# Docker
] ++ lib.optionals config.frogeye.dev.docker [
docker
docker-compose
# FPGA
] ++ lib.optionals config.frogeye.dev.fpga [
verilog
] ++ lib.optionals (config.frogeye.dev.fpga && pkgs.stdenv.isx86_64) [
ghdl
# FPGA (graphical)
] ++ lib.optionals (config.frogeye.desktop.xorg && config.frogeye.dev.fpga) [
yosys
gtkwave
];
programs.nixvim.plugins.lsp.servers = {
ansiblels.enable = config.frogeye.dev.ansible; # Ansible
bashls.enable = true; # Bash
jsonls.enable = true; # JSON
lua-ls.enable = true; # Lua (for Neovim debugging)
perlpls.enable = config.frogeye.dev.perl; # Perl
phpactor.enable = config.frogeye.dev.php; # PHP
nixd = {
enable = true;
settings.formatting.command = [ "nixpkgs-fmt" ];
};
# TODO Something for SQL. sqls is deprecated, sqlls is not in Nixpkgs. Probably needs a DB connection configured anyways?
yamlls.enable = true; # YAML
# TODO Check out none-ls
};
};
}

10
hm/dev/default.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, config, ... }: {
imports = [
./c.nix
./common.nix
./go.nix
./node.nix
./prose.nix
./python.nix
];
}

19
hm/dev/go.nix Normal file
View file

@ -0,0 +1,19 @@
# Untested post-nix
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.frogeye.dev.go {
frogeye = {
direnv = {
GOPATH = "${config.xdg.cacheHome}/go";
};
};
home = {
packages = with pkgs; [
go
];
sessionPath = [
"${config.home.sessionVariables.GOPATH}"
];
};
};
}

21
hm/dev/node.nix Normal file
View file

@ -0,0 +1,21 @@
# Untested post-nix
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.frogeye.dev.node {
frogeye = {
direnv = {
npm_config_cache = "${config.xdg.cacheHome}/npm";
YARN_CACHE_FOLDER = "${config.xdg.cacheHome}/yarn";
};
};
home = {
sessionVariables = {
NODE_REPL_HISTORY = "${config.xdg.cacheHome}/node_repl_history";
YARN_DISABLE_SELF_UPDATE_CHECK = "true"; # This also disable the creation of a ~/.yarnrc file
};
};
programs.bash.shellAliases = {
bower = "bower --config.storage.packages=${config.xdg.cacheHome}/bower/packages --config.storage.registry=${config.xdg.cacheHome}/bower/registry --config.storage.links=${config.xdg.cacheHome}/bower/links";
};
};
}

38
hm/dev/prose.nix Normal file
View file

@ -0,0 +1,38 @@
# Prose is a programming language, fight me
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.frogeye.dev.prose {
home = {
packages = with pkgs; [
hunspell
hunspellDicts.en_GB-ize
hunspellDicts.en_US
hunspellDicts.fr-moderne
hunspellDicts.nl_NL
# TODO libreoffice-extension-languagetool or libreoffice-extension-grammalecte-fr
];
};
programs.nixvim = {
autoCmd = [
# vim-easy-align: Align Markdown tables with |
{ event = "FileType"; pattern = "markdown"; command = "vmap <Bar> :EasyAlign*<Bar><Enter>"; }
];
extraPlugins = with pkgs.vimPlugins; lib.optionals config.programs.pandoc.enable [
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
vim-pandoc-syntax
];
extraConfigVim = lib.optionalString config.programs.pandoc.enable ''
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#spell#enabled = 0
let g:pandoc#syntax#conceal#use = 0
'';
plugins.none-ls = {
enable = true;
sources = {
# LanguageTool
diagnostics.ltrs.enable = true;
};
};
};
};
}

54
hm/dev/python.nix Normal file
View file

@ -0,0 +1,54 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.frogeye.dev.python {
home = {
packages = with pkgs; [
python3
python3Packages.ipython
];
sessionVariables = {
PYTHONSTARTUP = "${config.xdg.configHome}/pythonstartup.py";
};
};
programs.bash.shellAliases = {
ipython = "ipython --no-confirm-exit --pdb";
};
programs.nixvim.plugins.lsp.servers.pylsp = {
# Python
enable = config.frogeye.dev.python;
settings.plugins = {
black.enabled = true;
flake8 = {
enabled = true;
maxLineLength = 88; # Compatibility with Black
};
isort.enabled = true;
mccabe.enabled = true;
pycodestyle = {
enabled = true;
maxLineLength = 88; # Compatibility with Black
};
pyflakes.enabled = true;
pylint.enabled = true;
pylsp_mypy = {
enabled = true;
overrides = [
"--cache-dir=${config.xdg.cacheHome}/mypy"
"--ignore-missing-imports"
"--disallow-untyped-defs"
"--disallow-untyped-calls"
"--disallow-incomplete-defs"
"--disallow-untyped-decorators"
true
];
};
# TODO Could add some, could also remove some
};
};
xdg.configFile = {
"pythonstartup.py" = {
text = (builtins.readFile ./pythonstartup.py);
};
};
};
}

View file

@ -34,12 +34,9 @@
# TODO Convert existing LaTeX documents into using Nix build system
# texlive is big and not that much used, sooo
pdftk
hunspell
hunspellDicts.en_GB-ize
hunspellDicts.en_US
hunspellDicts.fr-moderne
hunspellDicts.nl_NL
# TODO libreoffice-extension-languagetool or libreoffice-extension-grammalecte-fr
# Misc
haskellPackages.dice
] ++ lib.optionals config.frogeye.desktop.xorg [

View file

@ -3,13 +3,28 @@
config = lib.mkIf config.frogeye.gaming {
# Using config.nixpkgs.<something> creates an infinite recursion,
# but the above might not be correct in case of cross-compiling?
home.packages = with pkgs; [
# gaming
yuzu-mainline
minecraft
# TODO factorio
home = {
packages = with pkgs; [
# gaming
dolphin-emu
ryujinx
prismlauncher
# TODO factorio
steam # Common pitfall: https://github.com/NixOS/nixpkgs/issues/86506#issuecomment-623746883
];
steam # Common pitfall: https://github.com/NixOS/nixpkgs/issues/86506#issuecomment-623746883
# itch # butler-15.21.0 is broken
(pkgs.python3Packages.ds4drv.overrideAttrs (old: {
src = fetchFromGitHub {
owner = "TheDrHax";
repo = "ds4drv-cemuhook";
rev = "a58f63b70f8d8efa33e5e82a8888a1e08754aeed";
sha256 = "sha256-oMvHw5zeO0skoiqLU+EdjUabTvkipeBh+m8RHJcWZP8=";
};
}))
];
sessionVariables = {
BOOT9_PATH = "${config.xdg.dataHome}/citra-emu/sysdata/boot9.bin";
};
};
};
}

83
hm/git/default.nix Normal file
View file

@ -0,0 +1,83 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.programs.git.enable {
home.packages = [
(pkgs.writeShellApplication {
name = "git-sync";
text = (lib.strings.concatLines
(map
(r: ''
echo "===== ${r.path}"
if [ ! -d "${r.path}" ]
then
${pkgs.git}/bin/git clone "${r.uri}" "${r.path}"
else
(
cd "${r.path}"
${pkgs.git}/bin/git --no-optional-locks diff --quiet || echo "Repository is dirty!"
${pkgs.git}/bin/git pull || true
# Only push if there's something to push. Also prevents from trying to push on repos where we don't have rights.
(${pkgs.git}/bin/git --no-optional-locks status --porcelain -b --ignore-submodules | grep ' \[ahead [0-9]\+\]' && ${pkgs.git}/bin/git push) || true
)
fi
'')
(lib.attrsets.attrValues config.services.git-sync.repositories)
)
);
})
];
programs.git = {
package = pkgs.gitFull;
aliases = {
"git" = "!exec git"; # In case I write one too many git
};
ignores = [
"*.swp"
"*.swo"
"*.ycm_extra_conf.py"
"tags"
".mypy_cache"
];
delta = {
enable = true;
options = {
line-numbers = true;
syntax-theme = "base16";
};
};
# Also tried difftastic, and while I like the default theme it's a bit
# less configurable
lfs.enable = true;
userEmail = lib.mkDefault "geoffrey@frogeye.fr";
userName = lib.mkDefault "Geoffrey Frogeye";
extraConfig = {
core = {
editor = "nvim";
};
push = {
default = "matching";
};
pull = {
ff = "only";
};
} // lib.optionalAttrs config.frogeye.desktop.xorg {
diff.tool = "meld";
difftool.prompt = false;
"difftool \"meld\"".cmd = "${pkgs.meld}/bin/meld \"$LOCAL\" \"$REMOTE\"";
# This escapes quotes, which isn't the case in the original, hoping this isn't an issue.
};
};
services = {
git-sync = {
enable = false; # The real thing syncs too quickly and asks for passphrase, which is annoying
# So for now it's just a way to park config which will be reused by git-sync-* commands
repositories = {
dotfiles = {
path = "${config.xdg.configHome}/dotfiles";
uri = lib.mkDefault "https://git.frogeye.fr/geoffrey/dotfiles.git";
};
};
};
};
};
}

50
hm/gpg/default.nix Normal file
View file

@ -0,0 +1,50 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.programs.gpg.enable {
frogeye.hooks.lock = ''
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent
'';
programs.gpg = {
homedir = "${config.xdg.stateHome}/gnupg";
settings = {
# Remove fluff
no-greeting = true;
no-emit-version = true;
no-comments = true;
# Output format that I prefer
keyid-format = "0xlong";
# Show fingerprints
with-fingerprint = true;
# Make sure to show if key is invalid
# (should be default on most platform,
# but just to be sure)
list-options = "show-uid-validity";
verify-options = "show-uid-validity";
# Stronger algorithm (https://wiki.archlinux.org/title/GnuPG#Different_algorithm)
personal-digest-preferences = "SHA512";
cert-digest-algo = "SHA512";
default-preference-list = "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed";
personal-cipher-preferences = "TWOFISH CAMELLIA256 AES 3DES";
};
publicKeys = [{
source = builtins.fetchurl {
url = "https://keys.openpgp.org/vks/v1/by-fingerprint/4FBA930D314A03215E2CDB0A8312C8CAC1BAC289";
sha256 = "sha256:10y9xqcy1vyk2p8baay14p3vwdnlwynk0fvfbika65hz2z8yw2cm";
};
trust = "ultimate";
}];
};
services.gpg-agent = rec {
enableBashIntegration = true;
enableZshIntegration = true;
pinentryPackage = pkgs.pinentry-gnome3;
# gnome3 is nicer, but requires gcr as a dbus package.
# Which is in my NixOS config, and on non-NixOS too.
# It will fall back to ncurses when running in non-graphics mode.
defaultCacheTtl = 3600;
defaultCacheTtlSsh = defaultCacheTtl;
maxCacheTtl = 3*3600;
maxCacheTtlSsh = maxCacheTtl;
};
};
}

61
hm/homealone.nix Normal file
View file

@ -0,0 +1,61 @@
{ lib, config, ... }:
{
config = {
frogeye = {
# TODO Move to relevant config file. Rest can probably removed.
direnv = {
CARGOHOME = "${config.xdg.cacheHome}/cargo"; # There are config in there that we can version if one want
DASHT_DOCSETS_DIR = "${config.xdg.cacheHome}/dash_docsets";
GRADLE_USER_HOME = "${config.xdg.cacheHome}/gradle";
MIX_ARCHIVES = "${config.xdg.cacheHome}/mix/archives";
MONO_GAC_PREFIX = "${config.xdg.cacheHome}/mono";
PARALLEL_HOME = "${config.xdg.cacheHome}/parallel";
TERMINFO = "${config.xdg.configHome}/terminfo";
WINEPREFIX = "${config.xdg.stateHome}/wineprefix/default";
};
junkhome = [
"adb"
"audacity"
"cabal" # TODO May have options but last time I tried it it crashed
"itch"
"simplescreenrecorder" # Easy fix https://github.com/MaartenBaert/ssr/blob/1556ae456e833992fb6d39d40f7c7d7c337a4160/src/Main.cpp#L252
"vd"
"wpa_cli"
# TODO Maybe we can do something about node-gyp
];
};
home = {
activation.createDirenvFolders = lib.hm.dag.entryAfter [ "writeBoundary" ]
(lib.strings.concatLines (map (d: "mkdir -p ${d}") (
(builtins.attrValues config.frogeye.direnv) ++ [ "${config.xdg.cacheHome}/junkhome" ]
)));
sessionVariables = config.frogeye.direnv;
};
programs.bash.shellAliases = lib.attrsets.mergeAttrsList (map (p: { "${p}" = "HOME=${config.xdg.cacheHome}/junkhome ${p}"; }) config.frogeye.junkhome);
};
options.frogeye = {
direnv = lib.mkOption {
default = { };
example = lib.literalExpression ''
{
DASHT_DOCSETS_DIR = "''${config.xdg.cacheHome}/dash_docsets";
}
'';
description = ''
Environment variables for which the value is a folder that will be automatically created.
Useful for keeping programs data out of $HOME for programs that won't create the directory themselves.
'';
type = lib.types.attrsOf lib.types.str;
};
junkhome = lib.mkOption {
default = [ ];
description = ''
Program names that will be run with a different HOME so they don't clutter the real one.
Useful for programs that don't follow the XDG specification and tend to advertise themselves.
'';
type = lib.types.listOf lib.types.str;
};
# TODO Should make a nix package wrapper instead, so it also works from dmenu
};
}

35
hm/monitoring/default.nix Normal file
View file

@ -0,0 +1,35 @@
{ pkgs, lib, config, ... }:
{
config = {
home.packages = with pkgs; [
htop
iftop
iotop
lsof
progress
pv
speedtest-cli
strace
];
programs.bash.shellAliases = {
iftop = "iftop -c ${config.xdg.configHome}/iftoprc";
tracefiles = ''${pkgs.strace}/bin/strace -f -t -e trace=file'';
};
xdg = {
configFile = {
"iftoprc" = {
text = ''
port-resolution: no
promiscuous: no
port-display: on
link-local: yes
use-bytes: yes
show-totals: yes
log-scale: yes
'';
};
};
};
};
}

24
hm/nix/default.nix Normal file
View file

@ -0,0 +1,24 @@
{ pkgs, lib, config, ... }:
{
config = {
home.packages = with pkgs; [
nvd
nix-diff
nix-tree
nix-output-monitor
];
programs.nix-index = {
# For non-NixOS systems
enable = false; # TODO Index is impossible to generate, should use https://github.com/nix-community/nix-index-database
# but got no luck without flakes
enableZshIntegration = true;
};
nix = {
package = lib.mkDefault pkgs.lix;
settings = {
experimental-features = [ "nix-command" "flakes" ];
warn-dirty = false;
};
};
};
}

19
hm/pager/default.nix Normal file
View file

@ -0,0 +1,19 @@
{ pkgs, lib, config, ... }:
{
config = {
home = {
sessionVariables = {
PAGER = "less";
LESSHISTFILE = "${config.xdg.stateHome}/lesshst";
LESS = "-R";
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_se = "$(echo $'\\E[0m')"; # reset reverse video
LESS_TERMCAP_so = "$(echo $'\\E[01;44;33m')"; # begin reverse video
LESS_TERMCAP_ue = "$(echo $'\\E[0m')"; # reset underline
LESS_TERMCAP_us = "$(echo $'\\E[1;32m')"; # begin underline
};
};
};
}

112
hm/password/default.nix Normal file
View file

@ -0,0 +1,112 @@
{ pkgs, lib, config, ... }:
let
mod = config.xsession.windowManager.i3.config.modifier;
in
{
config = {
home.packages = with pkgs; [
pwgen
(pkgs.writeShellApplication {
name = "install-passwords";
runtimeInputs = [ yq gawk moreutils ];
text = (lib.strings.concatLines (map
(file: ''
(
echo "===== Preparing to write ${file.path}"
temp="$(mktemp --tmpdir="${builtins.dirOf file.path}")"
cat "${file.template}" > "$temp"
'' + (lib.strings.concatLines (map
(password: (if password.selector == null then ''
echo "Reading ${password.path} for substituting ${password.variable}"
value="$(pass "${password.path}" | head -n1)"
'' else ''
echo "Reading ${password.path} -> ${password.selector} for substituting ${password.variable}"
value="$(pass "${password.path}" | tail -n +2 | yq -r '.${password.selector}')"
'') + ''
key="${password.variable}"
K="$key" V="$value" awk '{ gsub (ENVIRON["K"], ENVIRON["V"]); print }' "$temp" | sponge "$temp"
'')
(lib.attrsets.attrValues file.passwords))) + ''
echo "Moving the file in place"
chown "${file.owner}" "$temp"
chmod u=r "$temp"
mv -f "$temp" "${file.path}"
)
'')
config.frogeye.passwordFiles)
);
})
];
programs = {
bash.shellAliases = {
pw = ''${pkgs.pwgen}/bin/pwgen 32 -y''; # Generate passwords. ln((26*2+10)**32)/ln(2) ≅ 190 bits of entropy
};
password-store.enable = true;
};
xsession.windowManager.i3.config.keybindings."${mod}+c" = "exec --no-startup-id ${config.programs.rofi.pass.package}/bin/rofi-pass --last-used";
# TODO Try autopass.cr
};
options = {
frogeye.passwordFiles =
let
defaultvar = "@PASSWORD@";
pwtype = { name, ... }: {
options = {
variable = lib.mkOption {
type = lib.types.str;
default = name;
description = "String in the template that will be substituted by the actual password";
};
path = lib.mkOption {
type = lib.types.str;
description = "Path to the password store entry";
};
selector = lib.mkOption {
type = lib.types.str;
default = null;
description = "If set, will parse the password metadata as YML and use selector (yq) instead of the password.";
};
};
};
mainConfig = config;
in
lib.mkOption {
default = [ ];
type = lib.types.listOf (lib.types.submodule ({ config, ... }: {
options = {
path = lib.mkOption {
type = lib.types.str;
description = "Where to place the file.";
};
owner = lib.mkOption {
type = lib.types.str;
default = mainConfig.home.username;
description = "Who will own the file.";
};
template = lib.mkOption {
type = lib.types.path;
default = pkgs.writeTextFile {
name = "pwfile-template";
text = config.text;
};
description = "Path to the template used to make the file. Exclusive with `text`.";
};
text = lib.mkOption {
type = lib.types.str;
default = defaultvar;
description = "Content of the template used to make the file. Exclusive with `template`.";
};
passwords = lib.mkOption {
default = lib.optionalAttrs (config.password != null) { ${defaultvar} = config.password; };
type = lib.types.attrsOf (lib.types.submodule pwtype);
description = "Paths to passwords that will substitute the variables in the template. Exclusive with `password`";
};
password = lib.mkOption {
type = lib.types.submodule ({ ... }@args: pwtype (args // { name = defaultvar; }));
description = "Path to password that will substitute '@PASSWORD@' in the template. Exclusive with `passwords`.";
};
};
}));
};
};
}

21
hm/prompt/default.nix Normal file
View file

@ -0,0 +1,21 @@
{ pkgs, lib, config, ... }:
{
config = lib.mkIf config.programs.less.enable {
programs.powerline-go = {
enable = true;
modules = [ "user" "host" "venv" "cwd" "perms" "git" ];
modulesRight = [ "jobs" "exit" "duration" "load" ];
settings = {
colorize-hostname = true;
max-width = 25;
cwd-max-dir-size = 10;
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
echo -en "\033]0; $USER@$HOST $PWD\007"
'';
};
};
}

View file

@ -7,7 +7,6 @@ in
home.packages = [
(pkgs.writeShellApplication {
name = "rb";
runtimeInputs = [ pkgs.brightnessctl ];
text = ''
verb="switch"
if [ "$#" -ge 1 ]
@ -19,6 +18,7 @@ in
if [ -f "$nixos_flake" ]
then
sudo ${ulf} "$nixos_flake"
# ${pkgs.nix-output-monitor}/bin/nom build "$(dirname "$nixos_flake")#nixosConfigurations.$HOSTNAME.config.system.build.toplevel"
if [ "$verb" = "switch" ] || [ "$verb" = "test" ]
then
sudo nixos-rebuild "$verb" --specialisation ${config.frogeye.polarity} "$@"
@ -32,7 +32,14 @@ in
${ulf} "$hm_flake"
home-manager "$verb" "$@"
fi
nod_flake="${config.xdg.configHome}/nix-on-droid/flake.nix"
if [ -f "$nod_flake" ]
then
${ulf} "$nod_flake"
nix-on-droid "$verb" --flake "$(dirname "$nod_flake")" "$@"
fi
'';
})
];
}
# TODO make it a flake application, optional nom (is slow), test then boot, flags to confirm each, nvd diff here

View file

@ -26,7 +26,8 @@ def process_flake(flake: str) -> None:
dep_url = dep["url"]
# if not local path, continue
if not (
dep_url.startswith("path:") or dep_url.startswith("git+file:")
dep_url.startswith("path:")
or dep_url.startswith("git+file:")
):
continue
if dep.get("flake", True):
@ -39,8 +40,18 @@ def process_flake(flake: str) -> None:
# call this function with the flake file
process_flake(dep_flake)
# update lockfile
cmd = ["nix", "flake", "lock", "--update-input", dep_name]
subprocess.run(cmd, cwd=dir)
cmd = [
"nix",
"--extra-experimental-features",
"nix-command",
"--extra-experimental-features",
"flakes",
"flake",
"update",
dep_name,
]
p = subprocess.run(cmd, cwd=dir)
p.check_returncode()
if __name__ == "__main__":

View file

@ -1,8 +1,8 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p bash jq curl findutils coreutils
#! nix-shell -p bash jq curl cacert findutils coreutils
set -euo pipefail
set -euxo pipefail
url="https://ip.frogeye.fr/json"
cachedir="$HOME/.cache/lip"
@ -16,7 +16,6 @@ then
jq_sel="$@"
fi
if [ -n "$ip" ]
then
cachefile="$cachedir/$ip"

View file

@ -158,8 +158,7 @@ do
echo Processing $music
temp=$(mktemp --suffix .flac)
cp "$music" "$temp"
ffmpeg -8 -o "$temp"
ffmpeg -y -i "$music" -compression_level 8 "$temp"
echo "→ Optimize done"
replace "$temp" "$music"

View file

@ -1,8 +1,9 @@
#!/usr/bin/env nix-shell
#! nix-shell -i python3 --pure
#! nix-shell -p python3 python3Packages.coloredlogs python3Packages.r128gain
#! nix-shell -p python3 python3Packages.coloredlogs r128gain
# TODO r128gain is not maintainted anymore
# 24.05 rsgain replaces it, does the same job as I do with albums
# Normalisation is done at the default of each program,
# which is usually -89.0 dB

View file

@ -1,6 +1,6 @@
#!/usr/bin/env nix-shell
#! nix-shell -i python3 --pure
#! nix-shell -p python3 python3Packages.coloredlogs python3Packages.progresbar2 ffmpeg
#! nix-shell -p python3 python3Packages.coloredlogs python3Packages.progressbar2 ffmpeg
# pylint: disable=C0103
import logging

38
hm/shell/default.nix Normal file
View file

@ -0,0 +1,38 @@
{ pkgs, lib, config, ... }:
let
cfg = config.programs.bash;
in
{
config = {
programs = {
bash = {
enable = true;
bashrcExtra = ''
shopt -s expand_aliases
shopt -s histappend
'';
historySize = 100000;
historyFile = "${config.xdg.stateHome}/shell_history";
historyFileSize = 100000;
# TODO Check out Atuin
historyControl = [ "erasedups" "ignoredups" "ignorespace" ];
};
zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
historySubstringSearch.enable = true;
initExtra = builtins.readFile ./zshrc.sh;
defaultKeymap = "viins";
history = {
size = cfg.historySize;
save = cfg.historyFileSize;
path = cfg.historyFile;
expireDuplicatesFirst = true;
};
shellAliases = cfg.shellAliases;
};
};
};
}

View file

@ -1,6 +1,9 @@
{ ... }:
{ pkgs, lib, config, ... }:
{
config = {
frogeye.hooks.lock = ''
${pkgs.openssh}/bin/ssh-add -D
'';
programs.ssh = {
enable = true;
controlMaster = "auto";

View file

@ -1,60 +0,0 @@
{ pkgs, config, lib, ... }:
let
# Currently last commit in https://github.com/danth/stylix/pull/194
phases = [
{ command = "jour"; polarity = "light"; }
{ command = "crepuscule"; polarity = "dark"; }
{ command = "nuit"; polarity = "dark"; }
];
cfg = config.frogeye.desktop.phasesBrightness;
in
{
stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/solarized-${config.frogeye.polarity}.yaml";
image = builtins.fetchurl {
url = "https://get.wallhere.com/photo/sunlight-abstract-minimalism-green-simple-circle-light-leaf-wave-material-line-wing-computer-wallpaper-font-close-up-macro-photography-124350.png";
sha256 = "sha256:1zfq3f3v34i45mi72pkfqphm8kbhczsg260xjfl6dbydy91d7y93";
};
# The background is set on some occasions, autorandr + feh do the rest
fonts = {
monospace = {
package = pkgs.nerdfonts.override {
fonts = [ "DejaVuSansMono" ]; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix
};
name = "DejaVuSansM Nerd Font";
};
};
targets = {
i3.enable = false; # I prefer my own styles
tmux.enable = false; # Using another theme
};
};
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
# home.packages = [ pkgs.dconf ];
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.
home.packages = map
(phase: (pkgs.writeShellApplication {
name = "${phase.command}";
runtimeInputs = [ pkgs.brightnessctl ];
text = (lib.optionalString cfg.enable ''
brightnessctl set ${builtins.getAttr phase.command cfg}
'') + ''
switch="/nix/var/nix/profiles/system/specialisation/${phase.polarity}/bin/switch-to-configuration"
if [ -x "$switch" ]
then
# In two steps to get the visual changes slightly earlier
sudo "$switch" test
sudo "$switch" boot
fi
'';
})
)
phases;
}

16
hm/theme/default.nix Normal file
View file

@ -0,0 +1,16 @@
{ pkgs, config, lib, ... }:
{
config = {
stylix = {
polarity = config.frogeye.polarity;
fonts = {
monospace = {
package = pkgs.nerdfonts.override {
fonts = [ "DejaVuSansMono" ]; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix
};
name = "DejaVuSansM Nerd Font";
};
};
};
};
}

34
hm/tmux/default.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs, lib, config, ... }:
let
themepack = pkgs.tmuxPlugins.mkTmuxPlugin
rec {
pluginName = "tmux-themepack";
version = "1.1.0";
rtpFilePath = "themepack.tmux";
src = pkgs.fetchFromGitHub {
owner = "jimeh";
repo = "tmux-themepack";
rev = "${version}";
sha256 = "f6y92kYsKDFanNx5ATx4BkaB/E7UrmyIHU/5Z01otQE=";
};
};
in
{
config = lib.mkIf config.programs.tmux.enable {
home = {
packages = [ pkgs.screen ];
sessionVariables.SCREENRC = "${config.xdg.configHome}/screenrc";
};
programs.tmux = {
mouse = false;
clock24 = true;
# TODO Vim mode?
plugins = with pkgs.tmuxPlugins; [
sensible
];
extraConfig = builtins.readFile ./tmux.conf + "source-file ${themepack}/share/tmux-plugins/tmux-themepack/powerline/default/green.tmuxtheme\n";
};
stylix.targets.tmux.enable = false;
xdg.configFile.screenrc.text = (builtins.readFile ./screenrc);
};
}

View file

@ -1,88 +0,0 @@
{ pkgs, lib, config, ... }:
let
ensureNixPath = "${config.xdg.configHome}/dotfiles/ensure_nix.sh";
# TODO Can we maybe use a lighter version of this?
in
{
config = lib.mkIf config.frogeye.userNix {
home.activation = {
# When Nix is installed in the user directory via a proot, systemd --user
# is started outside of it, so it cannot access /nix. So we need to:
# - Ensure files systemd access aren't via /nix.
# Sometimes there's multiple layers of redirection, so easiest way is
# to copy the file outside the store.
# - Wrap services entrypoints into a proot wrapper
prootSystemd = lib.hm.dag.entryBetween [ "reloadSystemd" ] [ "linkGeneration" ] ''
cd ${config.xdg.configHome}/systemd/user
${pkgs.findutils}/bin/find . -maxdepth 1 -type l | while read path
do
temp="$(mktemp -p "$PWD")"
${pkgs.gnused}/bin/sed 's|^Exec\S\+=|\0${ensureNixPath} |' "$path" > "$temp"
$DRY_RUN_CMD mv $VERBOSE_ARG "$temp" "$path"
rm -f "$temp"
done
# Targets (need to be symlinks to original)
${pkgs.findutils}/bin/find . -mindepth 2 -maxdepth 2 -type l | while read path
do
$DRY_RUN_CMD rm $VERBOSE_ARG "$path"
$DRY_RUN_CMD ln $VERBOSE_ARG -s "../$(basename "$path")" "$path"
done
'';
# Unless files were created by HM, it will complain that something is in the way, so we delete them.
# This is very ugly, as you're not supposed to write things before writeBoundary, but hey
prootSystemdClean = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
$DRY_RUN_CMD rm $VERBOSE_ARG -rf ${config.xdg.configHome}/systemd/user
'';
# I wonder if it's possible to do this in a slightly more Nix way, without causing infinite recursion
# Create a graphical entrypoint by overriding one of the OS programs
graphicalEntrypoints =
let
graphicalBin = "${config.home.homeDirectory}/.local/bin";
graphicalProfile = pkgs.writeTextFile {
name = "graphical-profile";
text = ''
export PATH="${graphicalBin}:$PATH"
'';
};
graphicalEntrypoint = pkgs.writeTextFile {
name = "graphical-entrypoint";
text = ''
#!/bin/sh
exec ${ensureNixPath} ${config.xsession.scriptPath}
'';
executable = true;
};
in
# lib.mkIf config.frogeye.desktop.xorg # TODO Removed because wrong ordering or something?
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
$DRY_RUN_CMD cp $VERBOSE_ARG -L -f ${graphicalProfile} ${config.home.homeDirectory}/.xprofile
$DRY_RUN_CMD cp $VERBOSE_ARG -L -f ${graphicalEntrypoint} ${graphicalBin}/cinnamon-session-cinnamon
'';
};
# Ubuntu gives you this for some reason, but it just makes warnings
xsession.initExtra = ''
unset LD_PRELOAD
'';
# Some systemd options don't work if you're running a proot inside, so they need to be relaxed
systemd.user = {
services = {
mpd.Service = {
# This tries to override PATH for some reason, which makes ensure_nix not work
Environment = lib.mkForce [ ];
# Since we're wrapping in ensure_nix, notifications for Type=notify
# will come from a process lower
NotifyAccess = "all";
};
# Below might be applicable on all services that use those options, but none is to test right now
syncthing.Service = {
PrivateUsers = lib.mkForce [ ];
RestrictNamespaces = lib.mkForce [ ];
SystemCallFilter = lib.mkForce [ ];
};
};
};
};
}

View file

@ -1,400 +0,0 @@
{ pkgs, lib, config, ... }:
let
vim-shot-f = pkgs.vimUtils.buildVimPlugin {
pname = "vim-shot-f";
version = "2016-02-05";
src = pkgs.fetchFromGitHub {
owner = "deris";
repo = "vim-shot-f";
rev = "eea71d2a1038aa87fe175de9150b39dc155e5e7f";
sha256 = "iAPvIs/lhW+w5kFTZKaY97D/kfCGtqKrJVFvZ8cHu+c=";
};
meta.homepage = "https://github.com/deris/vim-shot-f";
};
quick-scope = pkgs.vimUtils.buildVimPlugin rec {
pname = "quick-scope";
version = "2.6.1";
src = pkgs.fetchFromGitHub {
owner = "unblevable";
repo = "quick-scope";
rev = "v${version}";
sha256 = "TcA4jZIdnQd06V+JrXGiCMr0Yhm9gB6OMiTSdzMt/Qw=";
};
meta.homepage = "https://github.com/unblevable/quick-scope";
};
in
{
programs.nixvim = {
enable = true;
# Setting a custom base16 theme via nixvim is required so feline works, and
# because stylix makes a config that otherwise only works with dark
# polarity.
colorschemes.base16.colorscheme = "solarized-${config.frogeye.polarity}";
options = {
# From https://www.hillelwayne.com/post/intermediate-vim/
title = true;
number = true;
relativenumber = true;
scrolloff = 10;
lazyredraw = true; # Do not redraw screen in the middle of a macro. Makes them complete faster.
cursorcolumn = true;
ignorecase = true;
smartcase = true;
gdefault = true;
tabstop = 4;
shiftwidth = 4;
expandtab = true;
splitbelow = true;
visualbell = true;
updatetime = 250;
undofile = true;
# From http://stackoverflow.com/a/5004785/2766106
list = true;
listchars = "tab:,trail:·,extends:,precedes:,nbsp:_";
showbreak = "";
wildmode = "longest:full,full";
wildmenu = true;
};
globals = {
netrw_fastbrowse = 0; # Close the file explorer once you select a file
};
plugins = {
# Catches attention when cursor changed position
# TODO Unmapped, do I still want to use it?
specs = {
enable = true;
min_jump = 5;
fader = { builtin = "pulse_fader"; };
resizer = { builtin = "shrink_resizer"; };
};
# Tabline
barbar.enable = true;
# Go to whatever
telescope = {
enable = true;
keymaps = {
gF = "find_files";
gf = "git_files";
gB = "buffers";
gl = "current_buffer_fuzzy_find";
gL = "live_grep";
gT = "tags";
gt = "treesitter";
gm = "marks";
gh = "oldfiles";
gH = "command_history";
gS = "search_history";
gC = "commands";
gr = "lsp_references";
ge = "diagnostics";
# ga = "lsp_code_actions";
# gE = "lsp_workspace_diagnostics";
# TODO Above makes nvim crash on startup, action is not provided
gd = "lsp_definitions";
gs = "lsp_document_symbols";
};
defaults = {
vimgrep_arguments = [
"${pkgs.ripgrep}/bin/rg"
"--color=never"
"--no-heading"
"--with-filename"
"--line-number"
"--column"
"--smart-case"
];
};
extensions.fzf-native = {
enable = true;
caseMode = "smart_case";
fuzzy = true;
overrideFileSorter = true;
overrideGenericSorter = true;
};
};
# Surrounding pairs
surround.enable = true; # Change surrounding pairs (e.g. brackets, quotes)
# Language Server
lsp = {
enable = true;
keymaps = {
silent = true;
diagnostic = {
"<Space>e" = "open_float";
"[e" = "goto_prev";
"]e" = "goto_next";
};
lspBuf = {
"gD" = "declaration";
"K" = "hover";
"gi" = "implementation";
"<C-S-k>" = "signature_help";
"<space>wa" = "add_workspace_folder";
"<space>wr" = "remove_workspace_folder";
# "<space>wl" = "list_workspace_folder";
# TODO Full thing was function() print(vim.inspect(vim.lsp.buf.list_workspace_folder())) end but not sure I'm ever really using this
# Also makes nvim crash like this, so uncommented
"<space>D" = "type_definition";
"<space>rn" = "rename";
"<space>f" = "format";
# TODO Full thing was function() vim.lsp.buf.format { async = true } end, so async while this isn't
# Maybe replace this with lsp-format?
};
};
servers = {
ansiblels.enable = config.frogeye.dev.ansible; # Ansible
bashls.enable = true; # Bash
jsonls.enable = true; # JSON
lua-ls.enable = true; # Lua (for Neovim debugging)
perlpls.enable = config.frogeye.dev.perl; # Perl
pylsp = {
# Python
enable = config.frogeye.dev.python;
settings.plugins = {
black.enabled = true;
flake8 = {
enabled = true;
maxLineLength = 88; # Compatibility with Black
};
isort.enabled = true;
mccabe.enabled = true;
pycodestyle = {
enabled = true;
maxLineLength = 88; # Compatibility with Black
};
pyflakes.enabled = true;
pylint.enabled = true;
pylsp_mypy = {
enabled = true;
overrides = [
"--cache-dir=${config.xdg.cacheHome}/mypy"
"--ignore-missing-imports"
"--disallow-untyped-defs"
"--disallow-untyped-calls"
"--disallow-incomplete-defs"
"--disallow-untyped-decorators"
true
];
};
# TODO Could add some, could also remove some
};
};
phpactor.enable = config.frogeye.dev.php; # PHP
rnix-lsp.enable = true; # Nix
# TODO Something for SQL. sqls is deprecated, sqlls is not in Nixpkgs. Probably needs a DB connection configured anyways?
yamlls.enable = true; # YAML
# TODO Check out none-ls
};
onAttach = ''
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
''; # Seems needed for auto-completion with nvim-compe
};
nvim-lightbulb = {
# Shows a lightbulb whenever a codeAction is available under the cursor
enable = true;
autocmd.enabled = true;
};
lspkind.enable = true; # Add icons to LSP completions
# Treesitter
treesitter = {
# Allows for better syntax highlighting
enable = true;
incrementalSelection = {
enable = true;
};
# indent = true; # Not very working last time I tried apparently
};
# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects
indent-blankline.enable = true; # TODO integrate with rainbow-delimiters and use more of the options
undotree.enable = true; # Navigate edition history
# Git
fugitive.enable = true; # Git basics
gitsigns.enable = true; # Show changed lines in the gutter
# Language-specific
# dap.enable = true; # Debug Adapter Protocol client # 23.11
nvim-colorizer.enable = true; # Display colors of color-codes
};
extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview # Scroll bar
# Status line
feline-nvim # Customizable status line.
# TODO Abandonned. Maybe use lualine?
# Search/replace
vim-abolish # Regex for words, with case in mind
vim-easy-align # Aligning lines around a certain character
# Surrounding pairs
targets-vim # Better interaction with surrounding pairs
# f/F mode
vim-shot-f # Highlight relevant characters for f/F/t/T modes
quick-scope # Highlight relevant characters for f/F modes one per word but always
# Registers
registers-nvim # Show register content when pressing "
# TODO Doesn't work. Didn't work on Arch either
# Tags
vim-gutentags # Generate tags
symbols-outline-nvim # Show a symbol panel on the right
# TODO Fails on startup. Same on Arch. Config issue?
# Language server
lsp_signature-nvim # Show argument definition when typing a function
# Treesitter
nvim-ts-rainbow # Randomly color parenthesis pairs
# TODO Replace with plugins.rainbow-delimiters
# Snippets
vim-vsnip
vim-vsnip-integ
friendly-snippets
# Auto-completion
nvim-compe
# TODO Archived. Maybe use nvim-cmp and plugins instead?
# Git
fugitive-gitlab-vim # Open files in GitLab
# TODO Connect it!
# Language-specific
tcomment_vim # Language-aware (un)commenting
] ++ lib.optionals config.frogeye.extra [
vim-LanguageTool # Check grammar for human languages
] ++ lib.optionals config.programs.pandoc.enable [
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
vim-pandoc-syntax
] ++ lib.optionals config.frogeye.dev.c [
nvim-dap # Debug Adapter Protocol client
] ++ lib.optionals config.frogeye.dev.ansible [
ansible-vim # TODO Doesn't have snippets
];
extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [
./vim/feline.lua
./vim/symbols-outline-nvim.lua
./vim/lsp_signature-nvim.lua
./vim/nvim-ts-rainbow.lua
./vim/nvim-compe.lua
];
extraConfigVim = ''
" GENERAL
" Avoid showing message extra message when using completion
set shortmess+=c
command Reload source $MYVIMRC
" PLUGINS
" vim-gutentags
let g:gutentags_cache_dir = expand('~/.cache/nvim/tags')
" nvim-compe
" Copy-pasted because I couldn't be bothered
set completeopt=menuone,noselect
inoremap <silent><expr> <C-Space> compe#complete()
inoremap <silent><expr> <CR> compe#confirm('<CR>')
inoremap <silent><expr> <C-e> compe#close('<C-e>')
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
'' + lib.optionalString config.frogeye.extra ''
" languagetool
let g:languagetool_cmd = "${pkgs.languagetool}/bin/languagetool-commandline"
" TODO Doesn't work
'' + lib.optionalString config.programs.pandoc.enable ''
" vim-pandox
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#spell#enabled = 0
let g:pandoc#syntax#conceal#use = 0
'';
autoCmd = [
# Turn off relativenumber only for insert mode
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
# Additional extensions
{ event = "BufRead"; pattern = "*.jinja"; command = "set filetype=jinja2"; } # TODO Probably GH-specific?
{ event = "BufNewFile"; pattern = "*.jinja"; command = "set filetype=jinja2"; }
# vim-easy-align: Align Markdown tables
{ event = "FileType"; pattern = "markdown"; command = "vmap <Bar> :EasyAlign*<Bar><Enter>"; }
];
userCommands = {
# Reload = { command = "source $MYVIRMC"; };
# TODO Is not working, options is set to nil even though it shouldn't
};
keymaps = [
# GENERAL
# Allow saving of files as sudo when I forgot to start vim using sudo.
# From https://stackoverflow.com/a/7078429
{ mode = "c"; key = "w!!"; action = "w !sudo tee > /dev/null %"; }
{ mode = "i"; key = "jk"; action = "<Esc>"; }
{ mode = "v"; key = "<Enter>"; action = "<Esc>"; }
{ key = "<Enter>"; action = "o<Esc>"; }
# { key = "<C-H>"; action = ":bp<CR>"; }
# { key = "<C-L>"; action = ":bn<CR>"; }
{ key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
{ key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
# \s to replace globally the word under the cursor
{ key = "<Leader>s"; action = ":%s/\\<<C-r><C-w>\\>/"; }
# PLUGINS
# barbar
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
# TODO gotos don't work
{ key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
{ key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
{ key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
{ key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
{ key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
{ key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
{ key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
{ key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
{ key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
# TODO Other useful options?
# symbols-outline-nvim
{ key = "<Space>s"; action = "<Cmd>SymbolsOutline<CR>"; options = { silent = true; }; }
# undotree
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
];
};
}

77
hm/vim/code.nix Normal file
View file

@ -0,0 +1,77 @@
{ pkgs, lib, config, ... }:
let
# UPST
vim-shot-f = pkgs.vimUtils.buildVimPlugin {
pname = "vim-shot-f";
version = "2016-02-05";
src = pkgs.fetchFromGitHub {
owner = "deris";
repo = "vim-shot-f";
rev = "eea71d2a1038aa87fe175de9150b39dc155e5e7f";
sha256 = "iAPvIs/lhW+w5kFTZKaY97D/kfCGtqKrJVFvZ8cHu+c=";
};
meta.homepage = "https://github.com/deris/vim-shot-f";
};
quick-scope = pkgs.vimUtils.buildVimPlugin rec {
pname = "quick-scope";
version = "2.6.1";
src = pkgs.fetchFromGitHub {
owner = "unblevable";
repo = "quick-scope";
rev = "v${version}";
sha256 = "TcA4jZIdnQd06V+JrXGiCMr0Yhm9gB6OMiTSdzMt/Qw=";
};
meta.homepage = "https://github.com/unblevable/quick-scope";
};
in
{
config = {
programs.nixvim = {
extraPlugins = with pkgs.vimPlugins; [
# f/F mode
vim-shot-f # Highlight relevant characters for f/F/t/T modes
quick-scope # Highlight relevant characters for f/F modes one per word but always
];
opts = {
# From https://www.hillelwayne.com/post/intermediate-vim/
scrolloff = 10;
lazyredraw = true; # Do not redraw screen in the middle of a macro. Makes them complete faster.
cursorcolumn = true;
# From http://stackoverflow.com/a/5004785/2766106
list = true;
listchars = "tab:,trail:·,extends:,precedes:,nbsp:_";
showbreak = "";
};
plugins = {
# Underline all instances of the underlined word
cursorline = {
enable = true;
cursorline.enable = false;
};
# Catches attention when cursor changed position
specs = {
enable = true;
min_jump = 5;
fader = { builtin = "pulse_fader"; };
resizer = { builtin = "shrink_resizer"; };
};
# Treesitter
treesitter = {
# Allows for better syntax highlighting
enable = true;
incrementalSelection = {
enable = true;
};
# indent = true; # Not very working last time I tried apparently
};
indent-blankline.enable = true; # Show indent guides
rainbow-delimiters.enable = true; # Randomly colore paired brackets
nvim-colorizer.enable = true; # Display colors of color-codes
};
};
};
}

50
hm/vim/completion.nix Normal file
View file

@ -0,0 +1,50 @@
{ pkgs, lib, config, ... }:
{
config = {
# Completion
programs.nixvim = {
extraConfigLuaPre = builtins.readFile ./completion_pre.lua;
plugins = {
# Snippets
# UltiSnips should be the better snippet engine, but:
# - Not built-in into Nixvim yet (UPST?)
# - Couldn't manage to make it work with friendly-snippets, which seems to give better snippets for Python at least
# - Tab switching between fields seems hard to configure
luasnip = {
enable = true;
fromVscode = [
{ paths = "${pkgs.vimPlugins.friendly-snippets}"; }
# { paths = "${pkgs.vimPlugins.vim-snippets}"; } # UPST Needs snipmate support
];
};
# Completion
cmp = {
enable = true;
settings = {
mapping = {
# Proposed example, since there's no default
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
};
sources = [
# Respective plugins will get installed automatically
{ name = "buffer"; }
{ name = "calc"; }
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "luasnip"; }
];
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
};
};
lspkind.enable = true; # Add icons to LSP completions
};
};
};
}

32
hm/vim/completion_pre.lua Normal file
View file

@ -0,0 +1,32 @@
-- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
local nvim_cmp_tab = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end
local nvim_cmp_stab = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end

160
hm/vim/decoration.nix Normal file
View file

@ -0,0 +1,160 @@
{ pkgs, lib, config, ... }:
{
config = {
programs = {
# https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
alacritty.settings.keyboard.bindings = [
{ key = "H"; mods = "Control|Shift"; chars = "\\u001b[72;5u"; }
{ key = "L"; mods = "Control|Shift"; chars = "\\u001b[76;5u"; }
] ++ (map
(n: { key = "Key${builtins.toString n}"; mods = "Control"; chars = "\\u001b[${builtins.toString (48+n)};5u"; })
(lib.lists.range 0 9));
# Ctrl+<number> doesn't get interpreted, but Ctrl+Shift+<number> does, so let's use that
nixvim = {
autoCmd = [
# Turn off relativenumber only for insert mode
{ event = "InsertEnter"; pattern = "*"; command = "set norelativenumber"; }
{ event = "InsertLeave"; pattern = "*"; command = "set relativenumber"; }
];
extraPlugins = with pkgs.vimPlugins; [
nvim-scrollview # Scroll bar
];
keymaps =
let
options = { silent = true; };
in
[
# barbar
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; inherit options; }
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; inherit options; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; inherit options; }
{ key = "<C-S-H>"; action = "<Cmd>BufferMovePrevious<CR>"; inherit options; }
{ key = "<C-S-L>"; action = "<Cmd>BufferMoveNext<CR>"; inherit options; }
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; inherit options; }
] ++ (map
(n: { key = "<C-${builtins.toString n}>"; action = "<Cmd>BufferGoto ${builtins.toString n}<CR>"; inherit options; })
(lib.lists.range 1 9));
opts = {
showmode = false;
number = true;
relativenumber = true;
title = true;
};
plugins = {
# Tabline
barbar.enable = true;
# TODO Reload make it use the preset colorscheme
# Status line
lualine = with config.lib.stylix.colors.withHashtag; let
normal = { fg = base05; bg = base01; };
inverted = { fg = base00; bg = base03; };
normal_ina = { fg = base02; bg = base01; };
inverted_ina = { fg = base00; bg = base02; };
in
rec {
enable = true;
inactiveSections = sections;
sections = {
lualine_a = [{
name = ''string.format('%d', vim.fn.line('$'))'';
}];
lualine_b = [
"mode"
];
lualine_c = [{
name = "filename";
color = {
__raw = ''
function(section)
return { fg = vim.bo.modified and '${base08}' or '${normal.fg}' }
end
'';
};
extraConfig = {
path = 1; # Relative path
symbols = {
modified = "";
newfile = "󰻭";
readonly = "󰏯";
unnamed = "󱀶";
};
};
}
"location"];
lualine_x = [{
name = ''(next(vim.lsp.buf_get_clients()) == nil) and "󰒲 " or ""'';
extraConfig.separator = { left = ""; right = ""; };
}] ++ (lib.mapAttrsToList
(diag_name: diag_color: {
name = "diagnostics";
extraConfig = {
color.bg = diag_color;
colored = false;
separator = { left = ""; right = ""; };
sections = [ diag_name ];
};
})
{
error = base08;
warn = base0A;
hint = base0C;
info = base0B;
});
lualine_y = [{
name = "diff";
extraConfig = {
diff_color = {
added.fg = base0B;
modified.fg = base0A;
removed.fg = base08;
};
symbols = {
added = " ";
modified = " ";
removed = " ";
};
};
}
"branch"];
lualine_z = [
"filetype"
"fileformat"
"encoding"
];
};
theme = (lib.mapAttrs
(mode_name: mode_color: {
a = inverted;
b = inverted // { bg = mode_color; gui = "bold"; };
c = normal;
x = inverted;
y = normal;
z = inverted // { bg = mode_color; };
})
{
normal = base0D;
insert = base0B;
visual = base0F;
replace = base08;
command = base0E;
}) // {
inactive = {
a = inverted_ina;
b = normal_ina // { bg = base00; gui = "bold"; };
c = normal_ina;
x = inverted_ina;
y = normal_ina;
z = normal_ina // { bg = base00; };
};
};
};
# Show context on top if scrolled out
treesitter-context = {
enable = true;
settings.max_lines = 5;
};
};
};
};
};
}

153
hm/vim/default.nix Normal file
View file

@ -0,0 +1,153 @@
{ pkgs, lib, config, nixvim, ... }:
{
# config = lib.mkIf config.programs.nixvim.enable { # Somehow this is infinite recursion?
config = {
home.sessionVariables = {
EDITOR = "nvim";
} // lib.optionalAttrs config.frogeye.desktop.xorg {
VISUAL = "nvim";
};
programs.bash.shellAliases = {
vi = "nvim";
vim = "nvim";
};
programs.nixvim = {
colorschemes.base16.setUpBar = false; # We want the custom theme for lualine, probably
opts = {
ignorecase = true;
smartcase = true;
gdefault = true;
tabstop = 4;
shiftwidth = 4;
expandtab = true;
splitbelow = true;
visualbell = true;
updatetime = 250;
undofile = true;
wildmode = "longest:full,full";
wildmenu = true;
};
globals = {
netrw_fastbrowse = 0; # Close the file explorer once you select a file
};
plugins = {
# Go to whatever
telescope = {
enable = true;
keymaps = {
gF = "find_files";
gf = "git_files";
gB = "buffers";
gl = "current_buffer_fuzzy_find";
gL = "live_grep";
gT = "tags";
gt = "treesitter";
gm = "marks";
gh = "oldfiles";
gH = "command_history";
gS = "search_history";
gC = "commands";
};
settings = {
defaults = {
vimgrep_arguments = [
"${pkgs.ripgrep}/bin/rg"
"--color=never"
"--no-heading"
"--with-filename"
"--line-number"
"--column"
"--smart-case"
];
};
};
extensions.fzf-native = {
enable = true;
settings = {
case_mode = "smart_case";
fuzzy = true;
override_file_sorter = true;
override_generic_sorter = true;
};
};
};
# TODO Go to any symbol in the current working directory, for when LSP doesn't support it.
# Or at least something to live_grep the curent word.
# Surrounding pairs
surround.enable = true; # Change surrounding pairs (e.g. brackets, quotes)
undotree.enable = true; # Navigate edition history
};
extraPlugins = with pkgs.vimPlugins; [
# Search/replace
vim-abolish # Regex for words, with case in mind
vim-easy-align # Aligning lines around a certain character
# Surrounding pairs
targets-vim # Better interaction with surrounding pairs
# Language-specific
tcomment_vim # Language-aware (un)commenting
] ++ lib.optionals config.frogeye.dev.ansible [
ansible-vim
# Doesn't generate snippets, but those are for UltiSnip anyways
];
extraConfigLuaPre = lib.mkBefore ''
-- If terminal is detected to be light, background will be changed after base16 theme is applied.
-- Setting manually early to prevent hightlights having weird colors.
-- https://github.com/RRethy/base16-nvim/issues/77
vim.opt.background = "${config.stylix.polarity}";
'';
extraConfigVim = ''
" Avoid showing message extra message when using completion
set shortmess+=c
'';
userCommands = {
Reload = { command = "source ${config.xdg.configHome}/nvim/init.lua"; force = false; };
# 24.05 force=false was for https://github.com/nix-community/nixvim/issues/954
};
keymaps = [
# GENERAL
# Allow saving of files as sudo when I forgot to start vim using sudo.
# From https://stackoverflow.com/a/7078429
{ mode = "c"; key = "w!!"; action = "w !sudo tee > /dev/null %"; }
{ mode = "i"; key = "jk"; action = "<Esc>"; }
{ mode = "v"; key = "<Enter>"; action = "<Esc>"; }
{ key = "<Enter>"; action = "o<Esc>"; }
# { key = "<C-H>"; action = ":bp<CR>"; }
# { key = "<C-L>"; action = ":bn<CR>"; }
{ key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
{ key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
# \s to replace globally the word under the cursor
{ key = "<Leader>s"; action = ":%s/\\<<C-r><C-w>\\>/"; }
# PLUGINS
# undotree
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
];
};
};
imports = [
nixvim.homeManagerModules.nixvim
./code.nix
./completion.nix
./decoration.nix
./git.nix
./lsp.nix
];
}

View file

@ -1,165 +0,0 @@
vim.cmd([[
set noshowmode
set laststatus=2
]])
local base16_colors = require('base16-colorscheme').colors
local vi_mode_utils = require('feline.providers.vi_mode')
local lsp = require('feline.providers.lsp')
require('feline').setup({
default_bg = 'base01',
default_fg = 'base04',
theme = {
base00 = base16_colors.base00,
base01 = base16_colors.base01,
base02 = base16_colors.base02,
base03 = base16_colors.base03,
base04 = base16_colors.base04,
base05 = base16_colors.base05,
base06 = base16_colors.base06,
base07 = base16_colors.base07,
base08 = base16_colors.base08,
base09 = base16_colors.base09,
base0A = base16_colors.base0A,
base0B = base16_colors.base0B,
base0C = base16_colors.base0C,
base0D = base16_colors.base0D,
base0E = base16_colors.base0E,
base0F = base16_colors.base0F,
},
components = {
active = {
{
{
provider = function() return string.format(' %d ', vim.fn.line('$')) end,
-- If you can, make it depend on the actual bar size
left_sep = {
{str = 'block', fg = 'base05'}
},
hl = {
fg = 'base01',
bg = 'base04',
},
},
{
provider = 'vi_mode',
hl = function()
return {
name = vi_mode_utils.get_mode_highlight_name(),
bg = vi_mode_utils.get_mode_color(),
fg = 'white',
style = 'bold',
}
end,
left_sep = {''},
right_sep = {''},
},
{
provider='',
hl = function()
return {
bg = vi_mode_utils.get_mode_color(),
fg = (vim.bo.modified and 'base09') or 'base0D',
}
end,
},
{
provider = 'file_info',
type = 'relative',
hl = function()
return {
fg = 'base06',
bg = (vim.bo.modified and 'base09') or 'base0D',
style = 'bold',
}
end,
left_sep = {''},
right_sep = {''},
},
{
provider='',
hl = function()
return {
bg = 'base02',
fg = (vim.bo.modified and 'base09') or 'base0D',
}
end,
},
{
provider = 'position',
hl = { fg = 'base05', bg = 'base02' },
right_sep = {''},
},
-- If it miraculously became easy to do, add LSP position here
{
provider='',
hl = { bg = 'base01', fg = 'base02' },
},
},
{
{
provider='',
hl = { bg = 'base03', fg = 'base01', },
},
{
provider='z',
enabled = function() return next(vim.lsp.buf_get_clients()) == nil end,
hl = { bg = 'base03', fg = 'base01', },
left_sep = '',
},
{
provider = 'diagnostic_errors',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) end,
hl = { fg = 'red', bg = 'base03', },
left_sep = '',
},
{
provider = 'diagnostic_warnings',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) end,
hl = { fg = 'yellow', bg = 'base03', },
left_sep = '',
},
{
provider = 'diagnostic_hints',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) end,
hl = { fg = 'cyan', bg = 'base03', },
left_sep = '',
},
{
provider = 'diagnostic_info',
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) end,
hl = { fg = 'skyblue', bg = 'base03', },
left_sep = '',
},
{
provider='█',
hl = { bg = 'base02', fg = 'base03', },
},
{
provider = 'git_diff_added',
hl = { fg = 'green', bg = 'base02', },
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
{
provider = 'git_diff_changed',
hl = { fg = 'orange', bg = 'base02', },
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
{
provider = 'git_diff_removed',
hl = { fg = 'red', bg = 'base02', },
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
{
provider = 'git_branch',
hl = { fg = 'base05', bg = 'base02', style = 'bold', },
right_sep = '',
left_sep = '',
enabled = function() return vim.b.gitsigns_status_dict end,
},
}
},
}
})

View file

@ -1,9 +0,0 @@
source ~/.config/vim/plug.vim
call plug#begin('~/.cache/nvim/plugged')
Plug 'RRethy/nvim-base16'
call plug#end()
colorscheme base16-solarized-dark
lua << EOF
a = require('base16-colorscheme').colors.base00
EOF

31
hm/vim/git.nix Normal file
View file

@ -0,0 +1,31 @@
{ pkgs, lib, config, ... }:
{
config = {
programs.nixvim = {
keymaps = [
{
mode = [ "n" ];
key = "gG";
action = ''<cmd>lua require"gitlinker".get_buf_range_url("n")<cr>'';
}
{
mode = [ "v" ];
key = "gG";
action = ''<cmd>lua require"gitlinker".get_buf_range_url("v")<cr>'';
}
];
plugins = {
fugitive.enable = true; # Git basics
gitsigns.enable = true; # Show changed lines in the gutter
gitlinker = {
enable = true; # Copy URL of forge corresponding to cursor
callbacks = {
"code.techinc.nl" = "get_gitea_type_url";
"git.frogeye.fr" = "get_gitea_type_url";
};
mappings = null; # This option doesn't work, hence manual mappings
};
};
};
};
}

74
hm/vim/lsp.nix Normal file
View file

@ -0,0 +1,74 @@
{ pkgs, lib, config, ... }:
{
config = {
programs.nixvim = {
extraConfigLua = ''
require'lsp_signature'.on_attach({
hint_enable = false,
})
'';
extraPlugins = with pkgs.vimPlugins; [
# Language server
lsp_signature-nvim # Show argument definition when typing a function
];
keymaps = [
{
mode = "n";
key = "<space>wl";
action.__raw = ''
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end
'';
options.silent = true;
}
{
mode = "n";
key = "<space>f";
action.__raw = ''
function()
vim.lsp.buf.format { async = true }
end
'';
options.silent = true;
}
];
plugins = {
# Language Server
lsp = {
enable = true;
keymaps = {
silent = true;
diagnostic = {
"<Space>e" = "open_float";
"[e" = "goto_prev";
"]e" = "goto_next";
};
lspBuf = {
"gD" = "declaration";
"K" = "hover";
"gi" = "implementation";
"<C-S-k>" = "signature_help";
"<space>wa" = "add_workspace_folder";
"<space>wr" = "remove_workspace_folder";
"<space>D" = "type_definition";
"<space>rn" = "rename";
"<space>ca" = "code_action"; # Reference has a binding for visual mode, but it doesn't work
};
};
};
telescope.keymaps = {
gr = "lsp_references";
ge = "diagnostics";
gd = "lsp_definitions";
gs = "lsp_document_symbols";
};
nvim-lightbulb = {
# Shows a lightbulb whenever a codeAction is available under the cursor
enable = true;
settings.autocmd.enabled = true;
};
};
};
};
}

View file

@ -1,3 +0,0 @@
require'lsp_signature'.on_attach({
hint_enable = false,
})

Some files were not shown because too many files have changed in this diff Show more