restructure
- users/rin/default.nix -> users/rin.nix - users/rin/home.nix +-> users/rin.nix - users/rin/*.nix -> modules/user/*.nix - users/rin/scripts/ -> scripts/ - hosts/winter/default.nix -> hosts/winter.nix - hosts/winter/*.nix -> modules/system/*.nix - modules are dynamically imported as sets for system and user
This commit is contained in:
parent
84f08a3a1c
commit
c86be50084
30 changed files with 178 additions and 157 deletions
107
modules/system/audio.nix
Normal file
107
modules/system/audio.nix
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
{ config, ... }:
|
||||
let
|
||||
int = {
|
||||
quantum = {
|
||||
min = 512;
|
||||
def = 1024;
|
||||
max = 2048;
|
||||
};
|
||||
rate = 48000;
|
||||
};
|
||||
str = {
|
||||
quantum = {
|
||||
min = toString int.quantum.min;
|
||||
def = toString int.quantum.def;
|
||||
max = toString int.quantum.max;
|
||||
};
|
||||
rate = toString int.rate;
|
||||
};
|
||||
in {
|
||||
sound.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
|
||||
config.pipewire = {
|
||||
"context.properties" = {
|
||||
"link.max-buffers" = 16;
|
||||
"default.clock.rate" = int.rate;
|
||||
"default.clock.quantum" = int.quantum.def;
|
||||
"default.clock.min-quantum" = int.quantum.min;
|
||||
"default.clock.max-quantum" = int.quantum.max;
|
||||
"core.daemon" = true;
|
||||
"core.name" = "pipewire-0";
|
||||
};
|
||||
|
||||
"context.modules" = [
|
||||
{
|
||||
name = "libpipewire-module-rtkit";
|
||||
args = {
|
||||
"nice.level" = -15;
|
||||
"rt.prio" = 88;
|
||||
"rt.time.soft" = 200000;
|
||||
"rt.time.hard" = 200000;
|
||||
};
|
||||
flags = [ "ifexists" "nofail" ];
|
||||
}
|
||||
{ name = "libpipewire-module-protocol-native"; }
|
||||
{ name = "libpipewire-module-profiler"; }
|
||||
{ name = "libpipewire-module-metadata"; }
|
||||
{ name = "libpipewire-module-spa-device-factory"; }
|
||||
{ name = "libpipewire-module-spa-node-factory"; }
|
||||
{ name = "libpipewire-module-client-node"; }
|
||||
{ name = "libpipewire-module-client-device"; }
|
||||
{
|
||||
name = "libpipewire-module-portal";
|
||||
flags = [ "ifexists" "nofail" ];
|
||||
}
|
||||
{ name = "libpipewire-module-access"; args = {}; }
|
||||
{ name = "libpipewire-module-adapter"; }
|
||||
{ name = "libpipewire-module-link-factory"; }
|
||||
{ name = "libpipewire-module-session-manager"; }
|
||||
];
|
||||
"stream.properties" = {
|
||||
"node.latency" = "${str.quantum.min}/${str.rate}";
|
||||
"resample.quality" = 1;
|
||||
};
|
||||
};
|
||||
config.pipewire-pulse = {
|
||||
"context.modules" = [
|
||||
{
|
||||
name = "libpipewire-module-rtkit";
|
||||
args = {
|
||||
"nice.level" = -15;
|
||||
"rt.prio" = 88;
|
||||
"rt.time.soft" = 200000;
|
||||
"rt.time.hard" = 200000;
|
||||
};
|
||||
flags = [ "ifexists" "nofail" ];
|
||||
}
|
||||
{ name = "libpipewire-module-protocol-native"; }
|
||||
{ name = "libpipewire-module-client-node"; }
|
||||
{ name = "libpipewire-module-adapter"; }
|
||||
{ name = "libpipewire-module-metadata"; }
|
||||
{
|
||||
name = "libpipewire-module-protocol-pulse";
|
||||
args = {
|
||||
"pulse.min.req" = "${str.quantum.min}/${str.rate}";
|
||||
"pulse.default.req" = "${str.quantum.def}/${str.rate}";
|
||||
"pulse.max.req" = "${str.quantum.max}/${str.rate}";
|
||||
"pulse.min.quantum" = "${str.quantum.min}/${str.rate}";
|
||||
"pulse.max.quantum" = "${str.quantum.max}/${str.rate}";
|
||||
"server.address" = [ "unix:native" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
"stream.properties" = {
|
||||
"node.latency" = "${str.quantum.min}/${str.rate}";
|
||||
"resample.quality" = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
46
modules/system/gui.nix
Normal file
46
modules/system/gui.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{ config, lib, pkgs, ... }: {
|
||||
fonts = {
|
||||
enableDefaultFonts = true;
|
||||
fontconfig = {
|
||||
defaultFonts = {
|
||||
serif = ["NotoSerif"];
|
||||
sansSerif = ["NotoSans"];
|
||||
monospace = ["CascadiaCode"];
|
||||
};
|
||||
};
|
||||
fonts = with pkgs; [
|
||||
cascadia-code
|
||||
font-awesome-ttf
|
||||
font-awesome_4
|
||||
hanazono
|
||||
material-icons
|
||||
noto-fonts
|
||||
noto-fonts-cjk
|
||||
noto-fonts-extra
|
||||
open-sans
|
||||
twemoji-color-font
|
||||
unifont
|
||||
];
|
||||
};
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
autorun = false;
|
||||
displayManager = {
|
||||
lightdm.enable = lib.mkForce false;
|
||||
startx.enable = true;
|
||||
xserverArgs = [
|
||||
"-ardelay 250"
|
||||
"-arinterval 15"
|
||||
];
|
||||
};
|
||||
desktopManager.xterm.enable = false;
|
||||
libinput = {
|
||||
enable = true;
|
||||
mouse = {
|
||||
accelSpeed = "0";
|
||||
accelProfile = "flat";
|
||||
};
|
||||
};
|
||||
xkbOptions = "caps:escape";
|
||||
};
|
||||
}
|
||||
69
modules/system/hardware-configuration.nix
Normal file
69
modules/system/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "rootfs";
|
||||
fsType = "tmpfs";
|
||||
options = [ "defaults" "size=4G" "mode=755" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/E8E8-E570";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/butter" =
|
||||
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
|
||||
fsType = "btrfs";
|
||||
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=5" ];
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
|
||||
fsType = "btrfs";
|
||||
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=258" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
|
||||
fsType = "btrfs";
|
||||
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=260" ];
|
||||
};
|
||||
|
||||
fileSystems."/home/.snapshots" =
|
||||
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
|
||||
fsType = "btrfs";
|
||||
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=319" ];
|
||||
};
|
||||
|
||||
fileSystems."/root" =
|
||||
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
|
||||
fsType = "btrfs";
|
||||
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=261" ];
|
||||
};
|
||||
|
||||
fileSystems."/var" =
|
||||
{ device = "/dev/disk/by-uuid/8f0ba28e-5dff-4a4e-8db0-aa72cc90cb5d";
|
||||
fsType = "btrfs";
|
||||
options = [ "autodefrag" "compress=zstd:3" "nossd" "nossd_spread" "relatime" "subvolid=259" ];
|
||||
};
|
||||
|
||||
fileSystems."/mnt/hdd" =
|
||||
{ device = "/dev/disk/by-uuid/d5e3cfe5-c73a-4695-b81b-fc0215d4cefe";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
}
|
||||
32
modules/system/kernel.nix
Normal file
32
modules/system/kernel.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ config, pkgs, ... }: {
|
||||
powerManagement.cpuFreqGovernor = "ondemand";
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
grub = {
|
||||
enable = true;
|
||||
efiSupport = true;
|
||||
device = "nodev";
|
||||
};
|
||||
};
|
||||
blacklistedKernelModules = ["uvcvideo"];
|
||||
initrd = {
|
||||
includeDefaultModules = false;
|
||||
kernelModules = [ "i915" ];
|
||||
};
|
||||
kernel.sysctl = {
|
||||
"kernel.core_pattern" = "|/bin/false";
|
||||
"kernel.sysrq" = 1;
|
||||
};
|
||||
kernelParams = [
|
||||
"amdgpu.gpu_recovery=1"
|
||||
"amdgpu.si_support=1"
|
||||
"radeon.si_support=0"
|
||||
"intel_pstate=passive"
|
||||
"msr.allow_writes=on"
|
||||
];
|
||||
kernelPackages = pkgs.lib.mkForce (pkgs.linuxPackagesFor pkgs.linux-lava);
|
||||
};
|
||||
zramSwap.enable = true;
|
||||
}
|
||||
21
modules/system/networking.nix
Normal file
21
modules/system/networking.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ config, ... }: {
|
||||
networking.wireless = {
|
||||
enable = true;
|
||||
interfaces = [ "wlp3s0" ];
|
||||
};
|
||||
|
||||
networking.useDHCP = false;
|
||||
networking.interfaces.eno1.useDHCP = false;
|
||||
networking.interfaces.wlp3s0.useDHCP = false;
|
||||
|
||||
networking.interfaces.eno1.ipv4.addresses = [{
|
||||
address = "10.0.0.2";
|
||||
prefixLength = 24;
|
||||
}];
|
||||
networking.interfaces.wlp3s0.ipv4.addresses = [{
|
||||
address = "192.168.100.13";
|
||||
prefixLength = 24;
|
||||
}];
|
||||
networking.defaultGateway = "192.168.100.1";
|
||||
networking.nameservers = ["192.168.100.11"];
|
||||
}
|
||||
33
modules/system/packages.nix
Normal file
33
modules/system/packages.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ config, pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
efibootmgr
|
||||
git
|
||||
gparted
|
||||
htop
|
||||
libarchive
|
||||
lf
|
||||
msr-tools
|
||||
ncdu
|
||||
neovim
|
||||
rsync
|
||||
wget
|
||||
|
||||
gnome3.nautilus
|
||||
];
|
||||
environment.variables.EDITOR = "nvim";
|
||||
|
||||
hardware.opengl.extraPackages = with pkgs; [
|
||||
vaapiIntel
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
intel-ocl
|
||||
rocm-opencl-icd
|
||||
rocm-opencl-runtime
|
||||
];
|
||||
programs.light.enable = true;
|
||||
hardware.opentabletdriver.enable = true;
|
||||
programs.steam.enable = true;
|
||||
services.dbus.packages = [ pkgs.gnome3.dconf pkgs.gcr ];
|
||||
services.gnome.sushi.enable = true;
|
||||
# services.ipfs.enable = true;
|
||||
}
|
||||
24
modules/system/security.nix
Normal file
24
modules/system/security.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ config, pkgs, ... }: {
|
||||
networking.firewall.enable = false;
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
permitRootLogin = "no";
|
||||
passwordAuthentication = false;
|
||||
};
|
||||
|
||||
security = {
|
||||
polkit.enable = true;
|
||||
sudo.enable = false;
|
||||
doas = {
|
||||
enable = true;
|
||||
extraRules = [
|
||||
{
|
||||
groups = ["wheel"];
|
||||
keepEnv = true;
|
||||
persist = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
19
modules/system/snapper.nix
Normal file
19
modules/system/snapper.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{ config, lib, ... }: {
|
||||
services.snapper = {
|
||||
cleanupInterval = "1h";
|
||||
configs.home = {
|
||||
fstype = "btrfs";
|
||||
subvolume = "/home";
|
||||
extraConfig = lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k}=${v}") {
|
||||
TIMELINE_CLEANUP = "yes";
|
||||
TIMELINE_CREATE = "yes";
|
||||
TIMELINE_MIN_AGE = "1800";
|
||||
TIMELINE_LIMIT_HOURLY = "5";
|
||||
TIMELINE_LIMIT_DAILY = "7";
|
||||
TIMELINE_LIMIT_WEEKLY = "0";
|
||||
TIMELINE_LIMIT_MONTHLY = "0";
|
||||
TIMELINE_LIMIT_YEARLY = "0";
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
16
modules/user/bspwm.nix
Normal file
16
modules/user/bspwm.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ config, ... }: {
|
||||
xsession.windowManager.bspwm = {
|
||||
enable = true;
|
||||
monitors = { eDP-1 = [ "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "XI" "X" ]; };
|
||||
settings = {
|
||||
window_gap = 10;
|
||||
border_width = 0;
|
||||
split_ratio = 0.5;
|
||||
top_padding = 25;
|
||||
};
|
||||
extraConfig = ''
|
||||
feh --no-fehbg --bg-fill ${config.xdg.configHome}/xorg/wallpaper.png
|
||||
systemctl --user restart polybar # home-manager loads this too early
|
||||
'';
|
||||
};
|
||||
}
|
||||
68
modules/user/dunst.nix
Normal file
68
modules/user/dunst.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
# TODO: i've literally never configured dunst ever since i first installed it (the rc was copypasted from somewhere i forgot im sorry), should play around with it later
|
||||
{ config, ... }: {
|
||||
services.dunst = {
|
||||
enable = true;
|
||||
settings = {
|
||||
global = {
|
||||
monitor = 0;
|
||||
follow = "mouse";
|
||||
#geometry = "250x50-24+24";
|
||||
geometry = "600x50-24+24";
|
||||
indicate_hidden = true;
|
||||
shrink = true;
|
||||
separator_height = 0;
|
||||
padding = 16;
|
||||
horizontal_padding = 24;
|
||||
frame_width = 2;
|
||||
sort = false;
|
||||
idle_threshold = 120;
|
||||
font = "Open Sans 8";
|
||||
line_height = 4;
|
||||
markup = "full";
|
||||
format = "<b>%s</b>\\n%b";
|
||||
alignment = "left";
|
||||
show_age_threshold = 60;
|
||||
word_wrap = true;
|
||||
ignore_newline = false;
|
||||
stack_duplicates = false;
|
||||
hide_duplicate_count = true;
|
||||
show_indicators = false;
|
||||
icon_position = "left";
|
||||
max_icon_size = 32;
|
||||
sticky_history = true;
|
||||
history_length = 20;
|
||||
browser = "/run/current-system/sw/bin/firefox -new-tab";
|
||||
always_run_script = true;
|
||||
title = "Dunst";
|
||||
class = "Dunst";
|
||||
corner_radius = 5;
|
||||
};
|
||||
|
||||
shortcuts = {
|
||||
close = "ctrl+space";
|
||||
close_all = "ctrl+shift+space";
|
||||
history = "ctrl+grave";
|
||||
context = "ctrl+shift+period";
|
||||
};
|
||||
|
||||
urgency_low = {
|
||||
background = "#2f343f";
|
||||
foreground = "#d8dee8";
|
||||
timeout = 2;
|
||||
};
|
||||
|
||||
urgency_normal = {
|
||||
background = "#2f343f";
|
||||
foreground = "#d8dee8";
|
||||
timeout = 4;
|
||||
};
|
||||
|
||||
urgency_critical = {
|
||||
background = "#2f343f";
|
||||
foreground = "#d8dee8";
|
||||
frame_color = "#bf616a";
|
||||
timeout = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
18
modules/user/kitty.nix
Normal file
18
modules/user/kitty.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, ... }: {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font = {
|
||||
package = pkgs.cascadia-code;
|
||||
name = "Cascadia Code PL";
|
||||
size = 13;
|
||||
};
|
||||
settings = {
|
||||
font_features = "-ss01 +ss19";
|
||||
enable_audio_bell = false;
|
||||
};
|
||||
extraConfig = builtins.readFile (builtins.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/folke/tokyonight.nvim/main/extras/kitty_tokyonight_night.conf";
|
||||
sha256 = "0mgjkmn4grr7rrxc5rrs1n0cghf03gp0v55hf3phll6czjavjldf";
|
||||
});
|
||||
};
|
||||
}
|
||||
9
modules/user/mpv.nix
Normal file
9
modules/user/mpv.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ config, pkgs, ... }: {
|
||||
programs.mpv = {
|
||||
enable = true;
|
||||
package = pkgs.wrapMpv pkgs.mpv-unwrapped {
|
||||
youtubeSupport = true;
|
||||
scripts = [ pkgs.mpvScripts.mpris ];
|
||||
};
|
||||
};
|
||||
}
|
||||
107
modules/user/neovim.nix
Normal file
107
modules/user/neovim.nix
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
{ config, pkgs, ... }: {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
package = pkgs.neovim-nightly;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
coc-nvim
|
||||
coc-eslint
|
||||
coc-json
|
||||
coc-rust-analyzer
|
||||
coc-tsserver
|
||||
|
||||
ctrlp-vim
|
||||
lualine-nvim
|
||||
nerdtree
|
||||
tokyonight-nvim
|
||||
vim-nix
|
||||
vim-repeat
|
||||
vim-surround
|
||||
|
||||
(nvim-treesitter.withPlugins (p: with p; [
|
||||
tree-sitter-javascript
|
||||
tree-sitter-nix
|
||||
tree-sitter-rust
|
||||
tree-sitter-toml
|
||||
tree-sitter-typescript
|
||||
tree-sitter-yaml
|
||||
]))
|
||||
];
|
||||
withNodeJs = true;
|
||||
|
||||
extraConfig = ''
|
||||
" configuration
|
||||
syntax enable
|
||||
set relativenumber number
|
||||
set cursorline
|
||||
set noswapfile
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set incsearch
|
||||
set title
|
||||
set clipboard^=unnamed
|
||||
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
|
||||
set expandtab
|
||||
let g:yaml_recommended_style=0
|
||||
|
||||
" theming
|
||||
let g:tokyonight_style='night'
|
||||
colorscheme tokyonight
|
||||
|
||||
" using tab for trigger completion
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~ '\s'
|
||||
endfunction
|
||||
|
||||
inoremap <silent><expr> <Tab>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" various aliases
|
||||
nnoremap <c-h> :NERDTreeToggle
|
||||
nnoremap <leader>rs :source $MYVIMRC<CR>
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
command! -nargs=0 Sw w !doas tee % > /dev/null
|
||||
|
||||
" disable read-only warning
|
||||
au BufEnter * set noro
|
||||
|
||||
" disable empty line tildes
|
||||
set fcs=eob:\
|
||||
|
||||
lua <<EOF
|
||||
require('nvim-treesitter.configs').setup {
|
||||
highlight = { enable = true }
|
||||
}
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'tokyonight'
|
||||
}
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
xdg.configFile."nvim/coc-settings.json".text = builtins.toJSON {
|
||||
languageserver = {
|
||||
nix = {
|
||||
command = "rnix-lsp";
|
||||
filetypes = [ "nix" ];
|
||||
};
|
||||
};
|
||||
"eslint.enable" = true;
|
||||
"eslint.options" = {
|
||||
configFile = "./.eslintrc.json";
|
||||
};
|
||||
"rust-analyzer.lens.enable" = false;
|
||||
"rust-analyzer.inlayHints.enable" = false;
|
||||
"rust-analyzer.serverPath" = pkgs.rust-analyzer + "/bin/rust-analyzer";
|
||||
};
|
||||
}
|
||||
7
modules/user/npm.nix
Normal file
7
modules/user/npm.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ config, pkgs, ... }: {
|
||||
xdg.configFile."npm/npmrc".text = ''
|
||||
cache=${config.xdg.dataHome}/npm/cache
|
||||
prefix=${config.xdg.dataHome}/npm
|
||||
store-dir=${config.xdg.dataHome}/npm/pnpm-store
|
||||
'';
|
||||
}
|
||||
43
modules/user/picom.nix
Normal file
43
modules/user/picom.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ config, ... }: {
|
||||
services.picom = {
|
||||
enable = true;
|
||||
experimentalBackends = true;
|
||||
|
||||
blur = true;
|
||||
blurExclude = [
|
||||
(builtins.concatStringsSep " && " [
|
||||
"class_g != 'Alacritty'"
|
||||
"class_g != 'kitty'"
|
||||
#"class_g != 'Polybar'"
|
||||
"class_g != 'URxvt'"
|
||||
])
|
||||
];
|
||||
fade = true;
|
||||
fadeDelta = 5;
|
||||
fadeSteps = [ "0.05" "0.05" ];
|
||||
|
||||
opacityRule = [
|
||||
"80:class_g = 'Alacritty' && !focused"
|
||||
"95:class_g = 'kitty' && !focused"
|
||||
];
|
||||
vSync = true;
|
||||
|
||||
extraOptions = ''
|
||||
glx-no-stencil = true;
|
||||
glx-copy-from-front = false;
|
||||
glx-no-rebind-pixmap = true;
|
||||
use-damage = true;
|
||||
|
||||
blur-method = "dual_kawase";
|
||||
blur-strength = 15;
|
||||
|
||||
detect-transient = true;
|
||||
detect-client-leader = true;
|
||||
detect-client-opacity = true;
|
||||
detect-rounded-corners = true;
|
||||
use-ewmh-active-win = true;
|
||||
mark-wmwin-focused = true;
|
||||
mark-ovredir-focused = true;
|
||||
'';
|
||||
};
|
||||
}
|
||||
97
modules/user/polybar.nix
Normal file
97
modules/user/polybar.nix
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
{ config, ... }: {
|
||||
services.polybar = {
|
||||
enable = true;
|
||||
script = builtins.readFile ../../scripts/polybar.sh;
|
||||
settings = {
|
||||
"bar/top" = {
|
||||
monitor = "eDP-1";
|
||||
width = "100%";
|
||||
height = 35;
|
||||
#background = "#64506c";
|
||||
background = "#00000000";
|
||||
foreground = "#fff";
|
||||
|
||||
spacing = 2;
|
||||
padding = {
|
||||
left = 5;
|
||||
right = 5;
|
||||
bottom = 5;
|
||||
};
|
||||
override-redirect = true;
|
||||
wm-restack = "bspwm";
|
||||
|
||||
font = [
|
||||
"NotoSans:style=SemiBold:size=11:antialias=true;2"
|
||||
"NotoSans:size=11:antialias=true;2"
|
||||
"MaterialIcons:size=17:antialias=true;6"
|
||||
|
||||
"HanaMinA:size=9.8;1"
|
||||
"HanaMinB:size=9.8;1"
|
||||
];
|
||||
|
||||
modules = {
|
||||
left = "workspaces";
|
||||
center = "title";
|
||||
right = "datetime";
|
||||
};
|
||||
|
||||
enable-ipc = true;
|
||||
scroll = {
|
||||
up = "#workspaces.prev";
|
||||
down = "#workspaces.next";
|
||||
};
|
||||
};
|
||||
|
||||
"module/workspaces" = {
|
||||
type = "internal/bspwm";
|
||||
|
||||
pin-workspaces = true;
|
||||
enable-click = true;
|
||||
enable-scroll = false;
|
||||
reverse-scroll = false;
|
||||
|
||||
#ws-icon.default = "%{T3}"; # ef4a
|
||||
label = {
|
||||
monitor = "";
|
||||
focused = "%{T3}"; # ef4a
|
||||
occupied = {
|
||||
text = "%{T3}"; # e837
|
||||
foreground = "#80FFFFFF";
|
||||
};
|
||||
empty = {
|
||||
text = "%{T3}"; # ef4a
|
||||
foreground = "#80FFFFFF";
|
||||
};
|
||||
urgent = {
|
||||
text = "%{T3}"; # e837
|
||||
foreground = "#EE1012";
|
||||
};
|
||||
|
||||
separator = {
|
||||
text = " ";
|
||||
padding = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
"module/title" = {
|
||||
type = "internal/xwindow";
|
||||
format = {
|
||||
text = "%{T1}<label>";
|
||||
padding = 4;
|
||||
};
|
||||
};
|
||||
|
||||
"module/datetime" = {
|
||||
type = "internal/date";
|
||||
date = {
|
||||
text = "%{T1}%%{F#fff}%H:%M%%{F-}";
|
||||
alt = "%{T2}%%{F#ccc}%A, %d %B %Y %{T1}%%{F#fff}%H:%M%%{F#666}:%{T2}%%{F#ccc}%S%%{F-}";
|
||||
};
|
||||
format = {
|
||||
padding = 4;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
9
modules/user/rofi.nix
Normal file
9
modules/user/rofi.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ config, ... }: {
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
font = "Open Sans 10";
|
||||
scrollbar = false;
|
||||
terminal = "kitty";
|
||||
#theme = builtins.fetchUrl {};
|
||||
};
|
||||
}
|
||||
57
modules/user/sxhkd.nix
Normal file
57
modules/user/sxhkd.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
super = "Mod4";
|
||||
alt = "Mod1";
|
||||
in {
|
||||
services.sxhkd = {
|
||||
enable = true;
|
||||
keybindings = {
|
||||
# Rofi (App launcher)
|
||||
"super + Return" = "rofi -lines 12 -padding 18 -width 60 -location 0 -show drun -sidebar-mode -columns 3 -font 'Noto Sans 8'";
|
||||
|
||||
# Printscreen
|
||||
"Print" = "maim -us | tee ~/Pictures/Screenshots/$(date +%s)c.png | xclip -selection clipboard -t image/png";
|
||||
"shift + Print" = "maim -u | tee ~/Pictures/Screenshots/$(date +%s).png | xclip -selection clipboard -t image/png";
|
||||
|
||||
# Quick-kill picom
|
||||
"super + p" = "systemctl --user stop picom";
|
||||
"super + shift + p" = "systemctl --user restart picom";
|
||||
|
||||
# Volume
|
||||
"XF86Audio{RaiseVolume,LowerVolume,Mute}" = "pamixer -{i 5,d 5,t}";
|
||||
|
||||
# Brightness
|
||||
"XF86MonBrightness{Up,Down}" = "light -{A,U} 10";
|
||||
"shift + XF86MonBrightness{Up,Down}" = "light -{A,U} 1";
|
||||
|
||||
# Gamma
|
||||
"ctrl + XF86MonBrightness{Up,Down}" = "xgamma -gamma {1.3,1}";
|
||||
|
||||
# Kill focused window
|
||||
"super + {_,shift + }c" = "bspc node -{c,k}";
|
||||
|
||||
# Change focus
|
||||
"super + {h,j,k,l}" = "bspc node -f {west,south,north,east}";
|
||||
"super + {Left,Down,Up,Right}" = "bspc node -f {west,south,north,east}";
|
||||
|
||||
# Switch windows
|
||||
"super + shift + {h,j,k,l}" = "bspc node -s {west,south,north,east}";
|
||||
"super + shift + {Left,Down,Up,Right}" = "bspc node -s {west,south,north,east}";
|
||||
|
||||
# Move focused window
|
||||
"super + shift + {1-9,0}" = "bspc node -d ^{1-9,10}";
|
||||
|
||||
# Toggle tiled/fullscreen/floating
|
||||
"super + {t,f,space}" = "bspc node -t '~{tiled,fullscreen,floating}'";
|
||||
|
||||
# Exit / Restart bspwm
|
||||
"super + shift + {q,r}" = "bspc {quit,wm -r}";
|
||||
|
||||
# Restart sxhkd
|
||||
"super + shift + s" = "pkill -USR1 -x sxhkd";
|
||||
|
||||
# Workspace switching
|
||||
"super + {1-9,0}" = "bspc desktop -f ^{1-9,10}";
|
||||
};
|
||||
};
|
||||
}
|
||||
25
modules/user/theming.nix
Normal file
25
modules/user/theming.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ config, pkgs, ... }: {
|
||||
gtk = {
|
||||
enable = true;
|
||||
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
|
||||
font = {
|
||||
package = pkgs.open-sans;
|
||||
name = "Open Sans";
|
||||
size = 11;
|
||||
};
|
||||
iconTheme = {
|
||||
package = pkgs.yaru-theme;
|
||||
name = "Yaru";
|
||||
};
|
||||
theme = {
|
||||
name = "Materia-dark";
|
||||
package = pkgs.materia-theme;
|
||||
};
|
||||
};
|
||||
|
||||
xsession.pointerCursor = {
|
||||
package = pkgs.yaru-theme;
|
||||
name = "Yaru";
|
||||
size = 16;
|
||||
};
|
||||
}
|
||||
40
modules/user/xdg.nix
Normal file
40
modules/user/xdg.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ config, ... }:
|
||||
let
|
||||
genMimes = mimeTypes: builtins.listToAttrs (builtins.map (mimeType: {
|
||||
name = mimeType;
|
||||
value = "brave-browser.desktop";
|
||||
}) mimeTypes);
|
||||
|
||||
mimes = genMimes [
|
||||
"x-scheme-handler/http"
|
||||
"x-scheme-handler/https"
|
||||
"x-scheme-handler/chrome"
|
||||
"text/html"
|
||||
"application/x-extension-htm"
|
||||
"application/x-extension-html"
|
||||
"application/x-extension-shtml"
|
||||
"application/xhtml+xml"
|
||||
"application/x-extension-xhtml"
|
||||
"application/x-extension-xht"
|
||||
] // {
|
||||
"x-scheme-handler/tg" = "userapp-Kotatogram Desktop-CHJI40.desktop";
|
||||
"image/png" = "feh.desktop";
|
||||
"image/jpeg" = "feh.desktop";
|
||||
};
|
||||
in {
|
||||
xdg = {
|
||||
enable = true;
|
||||
mime.enable = true;
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
|
||||
associations.added = mimes;
|
||||
defaultApplications = mimes;
|
||||
};
|
||||
};
|
||||
|
||||
# XXX: might need to be moved
|
||||
xdg.configFile."wgetrc".text = ''
|
||||
hsts-file = ${config.xdg.cacheHome}/wget-hsts
|
||||
'';
|
||||
}
|
||||
52
modules/user/xorg.nix
Normal file
52
modules/user/xorg.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{ config, ... }: {
|
||||
|
||||
xsession = {
|
||||
enable = true;
|
||||
profilePath = ".config/xorg/xprofile";
|
||||
scriptPath = ".config/xorg/xsession";
|
||||
};
|
||||
|
||||
xdg.configFile."xorg/xinitrc".source = ../../scripts/xinitrc;
|
||||
xdg.configFile."xorg/wallpaper.png".source = ../../res/wallpaper.png;
|
||||
xresources = {
|
||||
path = "${config.xdg.configHome}/xorg/xresources";
|
||||
properties = {
|
||||
# special
|
||||
"*.foreground" = "#c5c8c6";
|
||||
"*.background" = "#1d1f21";
|
||||
"*.cursorColor" = "#c5c8c6";
|
||||
|
||||
# black
|
||||
"*.color0" = "#1d1f21";
|
||||
"*.color8" = "#969896";
|
||||
|
||||
# red
|
||||
"*.color1" = "#cc342b";
|
||||
"*.color9" = "#cc342b";
|
||||
|
||||
# green
|
||||
"*.color2" = "#198844";
|
||||
"*.color10" = "#198844";
|
||||
|
||||
# yellow
|
||||
"*.color3" = "#fba922";
|
||||
"*.color11" = "#fba922";
|
||||
|
||||
# blue
|
||||
"*.color4" = "#3971ed";
|
||||
"*.color12" = "#3971ed";
|
||||
|
||||
# magenta
|
||||
"*.color5" = "#a36ac7";
|
||||
"*.color13" = "#a36ac7";
|
||||
|
||||
# cyan
|
||||
"*.color6" = "#3971ed";
|
||||
"*.color14" = "#3971ed";
|
||||
|
||||
# white
|
||||
"*.color7" = "#c5c8c6";
|
||||
"*.color15" = "#ffffff";
|
||||
};
|
||||
};
|
||||
}
|
||||
155
modules/user/zsh.nix
Normal file
155
modules/user/zsh.nix
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
# vim: ft=nix
|
||||
{ config, inputs, pkgs, ... }:
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
|
||||
pluginFromInput = name: {
|
||||
inherit name;
|
||||
src = inputs.${name};
|
||||
};
|
||||
|
||||
abbrs = {
|
||||
e = "$EDITOR";
|
||||
rs = "source ~/.config/zsh/.zshrc";
|
||||
|
||||
ll = "ls -al";
|
||||
q = "exit";
|
||||
|
||||
peach = "ssh lava@peach";
|
||||
bunny = "ssh bunny@peach";
|
||||
|
||||
fa = "grep -Inr";
|
||||
fai = "grep -Iinr";
|
||||
|
||||
g1 = "xgamma -gamma 1";
|
||||
g3 = "xgamma -gamma 1.3";
|
||||
|
||||
bat = "echo 'battery' | doas tee /sys/class/drm/card1/device/power_dpm_state";
|
||||
bal = "echo 'balanced' | doas tee /sys/class/drm/card1/device/power_dpm_state";
|
||||
sclk = "doas setclock 50000 70000 800";
|
||||
|
||||
sysu = "doas systemctl restart";
|
||||
sysd = "doas systemctl stop";
|
||||
syss = "doas systemctl status";
|
||||
usysu = "systemctl --user restart";
|
||||
usysd = "systemctl --user stop";
|
||||
usyss = "systemctl --user status";
|
||||
j = "doas journalctl -b";
|
||||
jf = "doas journalctl -f";
|
||||
|
||||
fl = "cd ~/Projects/flakes";
|
||||
nr = "doas nixos-rebuild switch --flake .#winter -v";
|
||||
|
||||
gs = "git status";
|
||||
ga = "git add";
|
||||
gaa = "git add .";
|
||||
gc = "git commit";
|
||||
gac = "git add .; git commit";
|
||||
gcm = "git commit -m";
|
||||
gco = "git checkout";
|
||||
gd = "git diff";
|
||||
gds = "git diff --staged";
|
||||
gf = "git commit --amend --no-edit";
|
||||
gl = "git log";
|
||||
gr = "git rebase -i";
|
||||
};
|
||||
|
||||
genAbbrs = lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "abbr add -S --quiet ${k}=${lib.escapeShellArg v}") abbrs);
|
||||
cursorShape = ''
|
||||
function zle-keymap-select {
|
||||
if [[ $KEYMAP == vicmd ]] ||
|
||||
[[ $1 = 'block' ]]; then
|
||||
echo -ne '\e[1 q'
|
||||
elif [[ $KEYMAP == main ]] ||
|
||||
[[ $KEYMAP == viins ]] ||
|
||||
[[ $KEYMAP = "" ]] ||
|
||||
[[ $1 = 'beam' ]]; then
|
||||
echo -ne '\e[5 q'
|
||||
fi
|
||||
}
|
||||
zle -N zle-keymap-select
|
||||
zle-line-init() {
|
||||
zle -K viins
|
||||
echo -ne "\e[5 q"
|
||||
}
|
||||
zle -N zle-line-init
|
||||
echo -ne '\e[5 q'
|
||||
preexec() { echo -ne '\e[5 q' ;}
|
||||
'';
|
||||
direnv = ''
|
||||
eval "$(direnv hook zsh)"
|
||||
'';
|
||||
pure = ''
|
||||
autoload -U promptinit; promptinit
|
||||
prompt pure
|
||||
'';
|
||||
viExtraNav = ''
|
||||
bindkey -M menuselect 'h' vi-backward-char
|
||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
||||
bindkey -M menuselect 'l' vi-forward-char
|
||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||
|
||||
bindkey -v '^?' backward-delete-char
|
||||
bindkey -v '^R' history-incremental-pattern-search-backward
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
'';
|
||||
in {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
enableAutosuggestions = true;
|
||||
autocd = true;
|
||||
defaultKeymap = "viins";
|
||||
|
||||
history = {
|
||||
extended = true;
|
||||
path = "${config.xdg.dataHome}/zsh/history";
|
||||
save = 10000000;
|
||||
size = 10000000;
|
||||
};
|
||||
|
||||
enableCompletion = true;
|
||||
initExtraBeforeCompInit = ''
|
||||
fpath+=(/run/current-system/sw/share/zsh/site-functions)
|
||||
zstyle ':completion:*' completer _complete
|
||||
zstyle ':completion:*' matcher-list "" 'm:{[:lower:][:upper:]-_}={[:upper:][:lower:]_-}' '+l:|=* r:|=*'
|
||||
zstyle ':completion:*' menu select
|
||||
_comp_options+=(globdots)
|
||||
zmodload zsh/complist
|
||||
'';
|
||||
|
||||
localVariables = {
|
||||
KEYTIMEOUT = "1";
|
||||
#PS1 = "%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b ";
|
||||
ZSH_AUTOSUGGEST_STRATEGY = ["completion"];
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC = true;
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE = 40;
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
ls = "ls --color=auto --group-directories-first -v";
|
||||
diff = "diff -Naur --color=auto";
|
||||
};
|
||||
initExtraFirst = ''
|
||||
autoload -U colors && colors
|
||||
'';
|
||||
initExtra = lib.concatStringsSep "\n" [
|
||||
pure
|
||||
cursorShape
|
||||
direnv
|
||||
genAbbrs
|
||||
viExtraNav
|
||||
];
|
||||
|
||||
plugins = builtins.map (e: pluginFromInput e) [
|
||||
"zsh-abbr"
|
||||
"zsh-history-substring-search"
|
||||
"fast-syntax-highlighting"
|
||||
"pure"
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue