Compare commits

...

19 Commits

11 changed files with 508 additions and 50 deletions

View File

@ -27,6 +27,36 @@ in
};
# [NETWORK]
# networking.firewall.allowedTCPPorts = [ 80 ];
# networking.firewall.allowedUDPPorts = [ ];
networking.firewall.allowedTCPPorts = [ 80 ];
networking.firewall.allowedUDPPorts = [ ];
# VM test user
users.users.test.isSystemUser = true ;
users.users.test.initialPassword = "test";
users.users.test.group = "test";
users.groups.test = {};
console = {
useXkbConfig = true;
};
services.xserver = {
xkb = {
layout = "fox,sus";
options = "ctrl:nocaps";
extraLayouts.sus = {
description = "Swedish US";
languages = [ "se" ];
symbolsFile = ../shared/sus.xkb;
};
extraLayouts.fox = {
description = "Layout suitable to be used by a fox";
languages = [ "se" ];
symbolsFile = ../shared/fox.xkb;
};
};
};
system.stateVersion = "23.11";
}

View File

@ -42,6 +42,13 @@
'';
environment.etc."pipewire/pipewire.conf".text = builtins.readFile ./pipewire.conf;
# [DESKTOP / XORG / WAYLAND]
services.xserver = {
desktopManager.plasma5.enable = true;
displayManager.startx.enable = true;
};
# [NETWORKING]

View File

@ -31,11 +31,11 @@
]
},
"locked": {
"lastModified": 1706916489,
"narHash": "sha256-x6OrQdcViKUqF8m/yuF+hIJhecTwiwVSH9T/mJa+K4k=",
"lastModified": 1712595875,
"narHash": "sha256-KaAhKeESwOQ0R0vxeAO/CDPiPimiemoARyr0uIVTQ4w=",
"owner": "isovector",
"repo": "cornelis",
"rev": "c1f926eb8a2d5bd051e84f330864ebc3857a83f4",
"rev": "9d3347e7d8589a28bcdd283001367d60bacf6b05",
"type": "github"
},
"original": {
@ -80,11 +80,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -100,11 +100,11 @@
]
},
"locked": {
"lastModified": 1700814205,
"narHash": "sha256-lWqDPKHRbQfi+zNIivf031BUeyciVOtwCwTjyrhDB5g=",
"lastModified": 1712386041,
"narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "aeb2232d7a32530d3448318790534d196bf9427a",
"rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff",
"type": "github"
},
"original": {
@ -116,11 +116,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1707091808,
"narHash": "sha256-LahKBAfGbY836gtpVNnWwBTIzN7yf/uYM/S0g393r0Y=",
"lastModified": 1712588820,
"narHash": "sha256-y31s5idk3jMJMAVE4Ud9AdI7HT3CgTAeMTJ0StqKN7Y=",
"owner": "NixOs",
"repo": "nixpkgs",
"rev": "9f2ee8c91ac42da3ae6c6a1d21555f283458247e",
"rev": "d272ca50d1f7424fbfcd1e6f1c9e01d92f6da167",
"type": "github"
},
"original": {
@ -132,11 +132,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1707268954,
"narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=",
"lastModified": 1711703276,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f8e2ebd66d097614d51a56a755450d4ae1632df1",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
"type": "github"
},
"original": {
@ -158,11 +158,11 @@
"slippi-desktop": {
"flake": false,
"locked": {
"lastModified": 1707981080,
"narHash": "sha256-Qd1jLAXWvxA5SHcafgHFRs1+XYz8yXLdQ27+qZ8MYxk=",
"lastModified": 1711346593,
"narHash": "sha256-WWgGRT58w1a4UcEe924hqa4ZVodQtsbXC44aCOEj528=",
"owner": "project-slippi",
"repo": "slippi-desktop-app",
"rev": "16ab255406f7ab86846a7786ff15e3543501397c",
"rev": "02f3f007cd03c6e2b0da57db65c90646efc04a86",
"type": "github"
},
"original": {
@ -177,11 +177,11 @@
"slippi-desktop": "slippi-desktop"
},
"locked": {
"lastModified": 1708119120,
"narHash": "sha256-SuZbD4eGwS9OYeGL0V9uPVsW2SyL7MbLXBd5rngZB4c=",
"lastModified": 1712071998,
"narHash": "sha256-k95NCkXJ61PGMFuqyMtfvP3yTLozED/7DkN+lBWK0gs=",
"owner": "lytedev",
"repo": "ssbm-nix",
"rev": "041f495ab6446e6edd22c1a5fbd48dd704c5b9a6",
"rev": "eff966a97287d1d86b189d59a14bf744d86836b0",
"type": "github"
},
"original": {

View File

@ -62,6 +62,19 @@
];
};
nixosConfigurations.cafe = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nix-config-module
./cafe/host.nix
];
virtualisation.forwardPorts = [
{ from = "host"; host.port = 80; guest.port = 8080; }
];
};
keyboardLayouts.fox = ./shared/fox.xkb;
fonts.sax2nf = import ./shared/sax2nf.nix { pkgs = nixpkgs.legacyPackages.x86_64-linux; };

View File

@ -0,0 +1,6 @@
#!/bin/sh
berryc resize_button 3
berryc resize_mask mod4
berryc set_font "SAX2 Nerd Font"
berryc edge_gap 0 40 0 0

10
home/light.sh 100644
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
msgTag="lightdunst"
brightnessctl set "$1"
light="$(brightnessctl -m | cut -d, -f4)"
dunstify -a "changeLight" -u low \
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:"$light" "Brightness: $light"

97
home/polybar.ini 100644
View File

@ -0,0 +1,97 @@
[bar/bar]
modules-right = tray pulseaudio battery date
modules-left = ewmh
modules-center = polywin
padding-right = 15px
padding-left = 10px
bottom = true
height = 40px
background = #99000000
font-0 = "SAX2 Nerd Font:size=16;3"
enable-ipc = true
[module/date]
type = internal/date
date = %Y-%m-%d
time = %H:%M
label = %date% %time%
label-padding-left = 5px
[module/ewmh]
type = internal/xworkspaces
backgound-color = #999999
pin-workspaces = true
enable-click = true
icon-0 = 0; ◉
icon-1 = 1; ◉
icon-2 = 2; ◉
icon-3 = 3; ◉
icon-default =
label-active = %icon%
label-occupied = %icon%
label-empty = %icon%
label-active-padding = 0.7
label-occupied-padding = 0.7
label-empty-padding = 0.7
label-active-foreground = #fff
label-occupied-foreground = #999
label-empty-foreground = #999
[module/battery]
type = internal/battery
full-at = 99
low-at = 10
battery = BAT0
adapter = AC
poll-interval = 5
format-full = <ramp-capacity>
format-charging = <ramp-capacity>
format-discharging = <ramp-capacity>
format-full-padding = 15px
format-charging-padding = 15px
format-discharging-padding = 15px
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =
[module/pulseaudio]
type = internal/pulseaudio
use-ui-max = false
format-volume = <ramp-volume>
label-muted = 󰖁
; Only applies if <ramp-volume> is used
ramp-volume-0 = 󰕿
ramp-volume-1 = 󰖀
ramp-volume-2 = 󰕾
[module/tray]
type = internal/tray
format-margin = 8px
tray-spacing = 8px
[module/polywin]
type = custom/script
exec = ~/.config/polybar/scripts/polywin.sh
format = <label>
label = %output%
label-padding = 1
interval = 1

View File

@ -8,8 +8,9 @@ let username = "rachel";
exec ${hpkgs.haskell-language-server}/bin/haskell-language-server-wrapper "$@"
'';
rzk = hpkgs.rzk;
in
{
vol = pkgs.writeScript "vol" (builtins.readFile ./vol.sh);
light = pkgs.writeScript "light" (builtins.readFile ./light.sh);
in rec {
home = {
username = username;
homeDirectory = homeDir;
@ -85,7 +86,39 @@ in
whalebird
lean4
slippi-netplay
xwallpaper
blueberry
pulseaudio
brightnessctl
maim
];
file.".config/berry/autostart" = {
source = ./berry_config;
};
file.".config/polybar/scripts/polywin.sh" = {
source = pkgs.writeScript "polywin.sh" ''
PATH="$PATH:${pkgs.lib.makeBinPath [
pkgs.wmctrl
pkgs.gawk
pkgs.coreutils-full
]}"
current_display=$(wmctrl -d 2>/dev/null |awk '/*/ {print $1}')
out=$(
wmctrl -lx 2>/dev/null |
awk -v current_display="$current_display" '{
if ($2==current_display) {
split($3,window_title,".")
printf "%s ", "["tolower(window_title[2])"]"
}
}'
)
# workaround for clearing on empty output
printf '%s\n' "$out"
'';
executable = true;
};
stateVersion = "23.11";
};
@ -124,6 +157,29 @@ in
initExtra = ''
source ~/.profile
set -o vi
norm_name() {
ret="$1"
[ "$ret" = "''${ret#*\#}" ] && ret="nixpkgs#$ret"
printf '%s\n' "$ret"
}
run() {
prog="$1"
shift
nix run "$(norm_name $prog)" "$@"
}
shell() {
i=0
while [ $i -lt $# ]; do
prog="$1"
shift
set -- "$@" "$(norm_name $prog)"
: $(( i++ ))
done
nix shell "$@"
}
'';
};
@ -182,11 +238,15 @@ in
}
}
})
lspcfg.clangd.setup({
cmd = { '${pkgs.clang-tools}/bin/clangd' },
})
lspcfg.ocamllsp.setup({})
require('orgmode').setup_ts_grammar()
require('nvim-treesitter.configs').setup({
highlight = {
enable = true,
disable = { "c" },
disable = { "c", "lua" },
additional_vim_regex_highlighting = {'org'},
},
})
@ -194,6 +254,43 @@ in
require('lean').setup({
mappings = true,
})
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'gruvbox',
component_separators = { left = "", right = ""},
section_separators = { left = "", right = ""},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = { {
'diagnostics',
always_visible = true,
on_click = function(n,b,m)
vim.diagnostic.goto_next()
end
} },
lualine_c = {'filename'},
lualine_x = {'encoding', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
}
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
@ -201,6 +298,12 @@ in
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<localleader>r', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<localleader>a', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<localleader>gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', '<localleader>gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<localleader>gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<localleader>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '<localleader>n', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<localleader>N', vim.diagnostic.goto_prev, opts)
vim.keymap.set('i', '<C-n>', vim.lsp.omnifunc, opts)
end,
})
@ -241,7 +344,6 @@ in
set signcolumn=no
set linebreak
let g:cornelis_use_global_binary = 1
let g:lightline = { 'colorscheme': 'gruvbox' }
set conceallevel=2 concealcursor=nc
colorscheme gruvbox
hi Normal guibg=NONE ctermbg=NONE
@ -278,32 +380,30 @@ in
endfunction
'';
plugins = let
bqn-vim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-vim";
src = "${pkgs.fetchFromGitHub {
owner = "mlochbaum";
repo = "BQN";
rev = "f4b09b675386c789c8296c96874871916a3abdcf";
hash = "sha256-rvsageS5sYF9QvWuoRutjx5i0ngrfhGvIPRO834pwwM=";
}}/editors/vim";
};
bqn-nvim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-nvim";
src = pkgs.fetchFromSourcehut {
owner = "~detegr";
repo = "nvim-bqn";
rev = "52d8b49f3ebc32d340e2e2b8dba1f6bbd1873b78";
hash = "sha256-5wITedTuUn9BKLqmQtPWeFNOa8dXfPIRpUvPSkNJcas=";
bqn-vim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-vim";
src = "${pkgs.fetchFromGitHub {
owner = "mlochbaum";
repo = "BQN";
rev = "f4b09b675386c789c8296c96874871916a3abdcf";
hash = "sha256-rvsageS5sYF9QvWuoRutjx5i0ngrfhGvIPRO834pwwM=";
}}/editors/vim";
};
bqn-nvim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-nvim";
src = pkgs.fetchFromSourcehut {
owner = "~detegr";
repo = "nvim-bqn";
rev = "52d8b49f3ebc32d340e2e2b8dba1f6bbd1873b78";
hash = "sha256-5wITedTuUn9BKLqmQtPWeFNOa8dXfPIRpUvPSkNJcas=";
};
};
};
in
with pkgs.vimPlugins; [
nvim-surround
comment-nvim
vimtex
gruvbox-nvim
lightline-vim
lightline-gruvbox-vim
tmux-nvim
cornelis-vim
nvim-lspconfig
@ -318,6 +418,7 @@ in
lean-nvim
bqn-vim
bqn-nvim
lualine-nvim
];
};
@ -411,7 +512,7 @@ in
scrolling.history = 0;
font = {
normal.family = "SAX2 Nerd Font";
size = 11;
size = 8;
};
colors = {
background = "#1d1f21";
@ -453,6 +554,16 @@ in
};
};
};
autorandr = {
enable = true;
hooks.postswitch = {
wall = "xwallpaper --zoom \"$HOME\"/img/wallpaper";
bar = "systemctl restart --user polybar";
};
profiles = {
};
};
};
services = {
@ -460,5 +571,131 @@ in
enable = true;
pinentryFlavor = "qt";
};
sxhkd = {
enable = true;
package = pkgs.sxhkd;
extraOptions = [ "-m 1" ];
keybindings = {
"super + Return" = "alacritty";
"super + BackSpace" = "firefox";
"super + r" = "rofi -show drun";
"super + p" = "cpypsk";
"super + l" = "betterlockscreen -l";
"super + q" = "berryc window_close";
"super + Left" = "berryc snap_left";
"super + Right" = "berryc snap_right";
"super + m" = "berryc window_monocle";
"super + {1,2,3,4}" = "berryc switch_workspace {0,1,2,3}";
"super + shift + {1,2,3,4}" = "berryc send_to_workspace {0,1,2,3}";
"super + f" = "berryc fullscreen_state";
"alt + Tab" = "berryc cycle_focus";
"~button1" = "berryc pointer_focus";
"~button2" = "berryc pointer_focus";
"~button3" = "berryc pointer_focus";
"~Escape" = "dunstctl close-all";
"Print" = "maim -s ~/img/scrot/$(date +%s).png";
"XF86AudioMute" = "${vol} mute";
"XF86AudioRaiseVolume" = "${vol} +5%";
"XF86AudioLowerVolume" = "${vol} -5%";
"XF86MonBrightnessUp" = "${light} 5%+";
"XF86MonBrightnessDown" = "${light} 5%-";
};
};
polybar = {
enable = true;
config = ./polybar.ini;
script = "polybar bar &";
package = pkgs.polybarFull;
};
picom = {
enable = true;
};
dunst = {
enable = true;
settings = {
volume = {
appname = "changeVolume";
history_ignore = "yes";
};
light = {
appname = "changeLight";
history_ignore = "yes";
};
};
};
redshift = {
enable = true;
latitude = "57.70";
longitude = "11.97";
};
network-manager-applet.enable = true;
blueman-applet.enable = true;
betterlockscreen.enable = true;
gnome-keyring.enable = true;
autorandr.enable = true;
};
xsession = {
enable = true;
initExtra = ''
xwallpaper --zoom "$HOME"/img/wallpaper
'';
scriptPath = "bin/xinitrc";
windowManager.command = "${pkgs.berry}/bin/berry";
};
systemd.user= {
timers = {
battery-check = {
Unit.Description = "Warn at low battery levels";
Timer = {
OnBootSec = "1min";
OnUnitActiveSec = "30s";
Unit = "battery-check.service";
};
Install.WantedBy = [ "graphical-session.target" ];
};
};
services = {
battery-check = {
Unit.Description = "Warn at low battery levels";
Service = let batMon = pkgs.writeShellScript "batMon" ''
PATH="$PATH:${pkgs.lib.makeBinPath [
pkgs.acpi
pkgs.dunst
pkgs.gnugrep
pkgs.gawk
pkgs.systemd
]}"
acpi -b | grep "Battery 0" | awk -F'[,:%]' '{print $2, $3}' | {
read -r status capacity
if [ "$status" = Discharging -a "$capacity" -le 2 ]; then
dunstify -u critical -a batMon \
-h string:x-dunst-stack-tag:batMon \
-h int:value:"$capacity" "Battery Critical: ''${capacity}%
Hibernating"
sleep 5
systemctl hibernate
elif [ "$status" = Discharging -a "$capacity" -le 5 ]; then
dunstify -u critical -a batMon \
-h string:x-dunst-stack-tag:batMon \
-h int:value:"$capacity" "Battery Critical: ''${capacity}%"
fi
}
'';
in {
ExecStart = "${batMon}";
};
};
};
};
}

23
home/vol.sh 100644
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
msgTag="voldunst"
case "$1" in
mute)
pactl set-sink-mute @DEFAULT_SINK@ toggle > /dev/null
;;
*)
pactl set-sink-volume @DEFAULT_SINK@ "$1" > /dev/null
;;
esac
volume="$(pactl get-sink-volume @DEFAULT_SINK@ | head -1 | awk '{ print $5 }')"
mute="$(pactl get-sink-mute @DEFAULT_SINK@ | cut -d' ' -f2)"
if [[ $volume == "0%" || "$mute" == "yes" ]]; then
dunstify -a "changeVolume" -u low \
-h string:x-dunst-stack-tag:$msgTag "Volume muted"
else
dunstify -a "changeVolume" -u low \
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:"$volume" "Volume: ${volume}"
fi

View File

@ -19,6 +19,7 @@
];
};
hardware.bluetooth.enable = true;
services.blueman.enable = true;
services.logind = {
lidSwitch = "hibernate";
lidSwitchDocked = "ignore";
@ -27,6 +28,34 @@
services.udev.extraRules = ''
KERNEL=="0000:00:14.0", SUBSYSTEM=="pci", ATTR{power/wakeup}="disabled"
'';
services.tlp = {
enable = true;
settings = {
TLP_DEFAULT_MODE = "BAT";
DISK_IDLE_SECS_ON_AC = 0;
DISK_IDLE_SECS_ON_BAT = 5;
MAX_LOST_WORK_SECS_ON_AC = 15;
MAX_LOST_WORK_SECS_ON_BAT = 120;
CPU_SCALING_GOVERNOR_ON_AC = "auto";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_SCALING_MIN_FREQ_ON_AC = 400000;
CPU_SCALING_MAX_FREQ_ON_AC = 4700000;
CPU_SCALING_MIN_FREQ_ON_BAT = 400000;
CPU_SCALING_MAX_FREQ_ON_BAT = 2700000;
CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 30;
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
SCHED_POWERSAVE_ON_AC = 0;
SCHED_POWERSAVE_ON_BAT = 1;
NMI_WATCHDOG = 0;
DISK_DEVICES = "nvme0n1";
};
};
# [BOOT / DISK ENCRYPTION]
boot.loader.efi.canTouchEfiVariables = true;
@ -51,6 +80,7 @@
};
};
};
boot.kernelParams = [ "i915.enable_dpcd_backlight=1" ];
# [NETWORKING]
networking.hostName = "lambda";
@ -61,5 +91,12 @@
wifi.macAddress = "random";
};
# [DESKTOP / XORG / WAYLAND]
services.xserver = {
windowManager.berry.enable = true;
displayManager.startx.enable = true;
dpi = 144;
};
system.stateVersion = "23.11";
}

View File

@ -23,7 +23,7 @@
# [NIX]
nix = {
settings = {
bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n\\040";
bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n\\040";
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
@ -54,8 +54,6 @@
# [DESKTOP / XORG / WAYLAND]
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager.startx.enable = true;
xkb = {
layout = "fox,sus";
options = "ctrl:nocaps";