reorganise

This commit is contained in:
tristan 2023-04-15 13:55:16 +01:00
parent 98af4d5664
commit 744f70fc87
14 changed files with 72 additions and 64 deletions

234
system/global/home.nix Normal file
View file

@ -0,0 +1,234 @@
{ config, pkgs, user, name, ... }:
# https://nix-community.github.io/home-manager/options.html
{
programs.home-manager.enable = true;
home.username = "tristan";
home.homeDirectory = "/home/tristan";
xdg.userDirs.enable = true;
xdg.mimeApps = {
enable = true;
associations.added = {
"inode/directory" = "lf.desktop;vscodium.desktop;pcmanfm.desktop";
};
defaultApplications = {
"inode/directory" = "lf.desktop";
"text/html" = "brave-browser.desktop";
"x-scheme-handler/http" = "brave-browser.desktop";
"x-scheme-handler/https" = "brave-browser.desktop";
};
};
home.packages = with pkgs; [
# script requirements
libnotify
playerctl
grim
wl-clipboard
slurp
chafa
wofi
# utils
exa
du-dust
htop
imv
libsixel
# apps
gimp
logseq
quickemu
ansible
bitwarden
nextcloud-client
godot_4
ardour
blender
musescore
];
programs.fish = {
enable = true;
};
programs.swaylock.settings = {
clock = true;
screenshots = true;
effect-scale = 0.5;
effect-blur = "10x10";
};
services.swayidle.enable = true;
services.swayidle.events = [
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; }
{ event = "lock"; command = "${pkgs.swaylock}/bin/swaylock"; }
];
programs.waybar.enable = true;
programs.waybar.settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
modules-left = [ "wlr/taskbar" "hyprland/window" ];
modules-right = [ "mpd" "pulseaudio" "clock" "tray" ];
clock = {
format = "📅 {:%a %b-%d %I:%M %p}";
};
pulseaudio = {
format-muted = "🔇 {volume}%";
format = "{icon} {volume}";
format-icons.default = ["🔈" "🔉" "🔊"];
on-click = "pavucontrol";
};
mpd = {
server = "192.168.1.2";
on-click = "foot -e ncmpcpp";
};
};
};
programs.waybar.systemd.enable = true;
services.udiskie = {
enable = true;
notify = true;
};
gtk = {
enable = true;
theme = {
name = "Materia-dark";
package = pkgs.materia-theme;
};
gtk3.bookmarks = [
"file:///home/tristan/Documents"
];
};
services.fnott = {
enable = true;
# https://codeberg.org/dnkl/fnott/src/branch/master/fnott.ini
settings = {
main = {
selection-helper = "wofi --show dmenu";
};
};
};
programs.ncmpcpp = {
enable = true;
settings.mpd_host = "music.local";
bindings = [
{ key = "j"; command = "scroll_down"; }
{ key = "k"; command = "scroll_up"; }
{ key = "J"; command = [ "select_item" "scroll_down" ]; }
{ key = "K"; command = [ "select_item" "scroll_up" ]; }
];
};
services.mpd-mpris.enable = true;
services.mpd-mpris.mpd = {
host = "music.local";
};
programs.mpv.enable = true;
programs.mpv.bindings = {
l = "seek 5";
h = "seek -5";
e = "add chapter 1";
b = "add chapter -1";
">" = "multiply speed 1.1";
"<" = "multiply speed 1/1.1";
"." = "frame-step";
"," = "frame-back-step";
"ctrl+n" = "playlist-next";
"ctrl+p" = "playlist-prev";
k = "add volume 2";
j = "add volume -2";
m = "cycle mute";
c = "cycle sub-visibility";
};
programs.foot.enable = true;
programs.foot.server.enable = true;
programs.foot.settings = {
main = {
term = "xterm-256color";
font = "mono:size=12";
};
colors = {
foreground="abb2bf";
background="282c34";
regular0="222222";
regular1="eb3a26";
regular2="7fbc59";
regular3="e9db65";
regular4="4781d1";
regular5="7d74bb";
regular6="50a2bd";
regular7="dcdccc";
bright0="666666";
bright1="e15d4e";
bright2="8fbd73";
bright3="e3d97e";
bright4="6791ce";
bright5="8f88be";
bright6="6caabf";
bright7="ffffff";
};
};
programs.vscode = {
enable = true;
package = pkgs.vscodium;
extensions = with pkgs; [
vscode-extensions.asvetliakov.vscode-neovim
vscode-extensions.jnoortheen.nix-ide
];
userSettings = {
"vscode-neovim.neovimExecutablePaths.linux" = "/run/current-system/sw/bin/nvim";
"keyboard.dispatch" = "keyCode";
};
};
services.nextcloud-client.enable = true;
services.nextcloud-client.startInBackground = true;
programs.rbw = {
enable = true;
settings = {
email = "tristan@tristans.cloud";
base_url = "https://vault.tristans.cloud";
};
};
programs.ssh.enable = true;
programs.ssh.matchBlocks = {
"git.tristans.cloud" = {
user = "git";
port = 2222;
};
};
programs.neovim.defaultEditor = true;
programs.lf.enable = true;
programs.lf.keybindings = {
D = "trash";
};
home.sessionPath = [
"$HOME/.local/scripts"
];
home.file.".local/scripts" = {
source = ./scripts;
executable = true;
recursive = true;
};
home.file.".config/wofi/config".text = ''
term=foot
'';
}

13
system/global/scripts/autostart Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
nextcloud &
waybar &
swaybg \
-o eDP-1 -i ~/Pictures/backgrounds/nix-wallpaper-waterfall.png \
-o DP-1 -i ~/Pictures/backgrounds/demonslayer.jpg \
-o HDMI-A-1 -i ~/Pictures/backgrounds/nier.jpg &
swayidle -w \
timeout 600 'swaylock &' &

3
system/global/scripts/bwmenu Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
rbw list | wofi --show dmenu | xargs -I_ rbw get _ | wl-copy

View file

@ -0,0 +1,11 @@
#!/bin/sh
if [ "$(playerctl --list-all | wc -l)" -lt 2 ]
then
playerctl play-pause
else
playerctl --list-all | \
xargs -I _ playerctl --player _ metadata --format '_ - {{title}}' | \
wofi --dmenu | awk '{print $1}' | \
xargs -I _ playerctl --player _ play-pause
fi

View file

@ -0,0 +1,9 @@
#!/bin/sh
OUT_DIR=${GRIM_DEFAULT_DIR:-~/Pictures/Screenshots/}
mkdir -p "$OUT_DIR"
grim -g "$(slurp -o)" - | wl-copy
notify-send "Screenshot Taken" "to the clipboard"
wl-paste > $OUT_DIR/$(date +"%Y-%m-%dT%H:%M:%SZ").png

149
system/global/system.nix Normal file
View file

@ -0,0 +1,149 @@
# https://search.nixos.org/options
{ config, pkgs, ... }:
{
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
};
nix.settings.trusted-users = [ "root" "tristan" ];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.networkmanager.enable = true;
time.timeZone = "Europe/London";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true;
};
# use pipewire
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
security.pam.services.swaylock = {};
security.doas.enable = true;
i18n.defaultLocale = "en_GB.UTF-8";
# Configure graphical stuff
services.xserver = {
enable = true;
layout = "gb";
libinput.enable = true;
# the only display manager that works?
displayManager.gdm.enable = true;
displayManager.autoLogin = {
enable = true;
user = "tristan";
};
};
qt.enable = true;
qt.platformTheme = "gtk2";
qt.style = "gtk2";
services.printing.enable = true;
# services.flatpak.enable = true;
xdg.portal.enable = true;
users.users.tristan = {
isNormalUser = true;
extraGroups = [ "wheel" "video" ];
initialPassword = "pass";
shell = pkgs.fish;
};
programs.fish.enable = true;
environment.variables = {
EDITOR = "nvim";
VISUAL = "nvim";
TERMINAL = "foot";
};
environment.systemPackages = with pkgs; [
foot
brave
tealdeer
alsa-utils
wofi
waybar
swaylock-effects
swayidle
swaybg
pcmanfm
pavucontrol
trash-cli
(neovim.override {
vimAlias = true;
configure = {
packages.myPlugins = with pkgs.vimPlugins; {
start = [ vim-surround vim-commentary vim-nix ];
opt = [];
};
customRC = ''
vnoremap * y/\V<C-R>=escape(@",'/\')<CR><CR>
vnoremap <C-R> "ry:%s/<C-R>=escape(@r,'/\')<CR>
vnoremap A :norm A
set number
set rnu
set ignorecase
set smartcase
set mouse=a
set path=.,**
let g:netrw_banner=0
let g:netrw_liststyle=3
set undofile
set undodir=~/.local/share/nvim/undo
'';
};
})
];
services.dbus.enable = true;
programs.light.enable = true;
programs.dconf.enable = true;
programs.hyprland.enable = true;
programs.tmux.enable = true;
programs.tmux.extraConfig = ''
set escape-time 0
set -g default-terminal screen
bind -n M-s split-window -v
bind -n M-v split-window -h
bind -n M-Enter split-window -h
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
bind -n M-q kill-pane
bind -n M-< resize-pane -L 10
bind -n M-> resize-pane -R 10
bind -n M-- resize-pane -D 10
bind -n M-+ resize-pane -U 10
bind -n M-u copy-mode
bind -n M-p paste-buffer
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
'';
}

View file

@ -0,0 +1,123 @@
exec-once= ~/.local/scripts/autostart
monitor=,preferred,auto,1
input {
kb_file=
kb_layout=gb
kb_variant=dvorak
kb_model=
kb_options=caps:escape
kb_rules=
follow_mouse=1
touchpad {
natural_scroll=yes
}
sensitivity=0
accel_profile=flat
}
general {
gaps_in=5
gaps_out=20
border_size=2
col.active_border=0x66ee1111
col.inactive_border=0x66333333
apply_sens_to_raw=0
layout = master
}
decoration {
rounding=5
blur=0
blur_size=3 # minimum 1
blur_passes=1 # minimum 1
blur_new_optimizations=1
}
bezier=overshot, 0.05, 0.9, 0.1, 1.1
animations {
enabled=1
animation=windows,1,5,default
animation=border,1,5,default
animation=fade,1,10,default
animation=workspaces,1,3,overshot
}
dwindle {
pseudotile=0 # enable pseudotiling on dwindle
}
gestures {
workspace_swipe=yes
}
bindm=SUPER,mouse:272,movewindow
bindm=SUPER,mouse:273,resizewindow
bind=SUPER,RETURN,exec,foot
bind=SUPER_SHIFT,Q,killactive,
bind=SUPER,M,exec,foot -e ncmpcpp
bind=SUPER,E,exec,foot -e neomutt
bind=SUPER,O,exec,pcmanfm
bind=SUPER,y,exec,foot -e ytui
bind=SUPER,Z,exec,swaylock -f
bind=SUPER,T,exec,notify-send "$(date)"
bind=SUPER_SHIFT,S,exec,~/.local/scripts/screenshot
bind=SUPERCTRL_SHIFT,S,exec,qrcode.sh
bind=SUPER,p,exec,hyprpicker | wl-copy; wl-paste | xargs notify-send Copied
bind=SUPER,slash,exec,brave
bind=SUPER,V,togglefloating,
bind=SUPER,F,fullscreen,
bind=SUPER,d,exec,wofi --show drun
bind=SUPER_SHIFT,P,exec,~/.local/scripts/bwmenu
bind=SUPER,apostrophe,exec,notify-send -i mpv "$(playerctl metadata --format '{{title}}')" "$(playerctl metadata --format '{{album}}')" -t 3000
bind=SUPER_SHIFT,E,exit,
bind=,XF86AudioRaiseVolume,exec,amixer -D pulse sset Master 5%+ && amixer sset Master unmute
bind=,XF86AudioLowerVolume,exec,amixer -D pulse sset Master 5%-
bind=,XF86AudioPlay,exec,~/.local/scripts/play-pause
bind=,XF86AudioNext,exec,playerctl next
bind=,XF86AudioPrev,exec,playerctl previous
bind=SUPER,h,movefocus,l
bind=SUPER,l,movefocus,r
bind=SUPER,j,layoutmsg,cyclenext
bind=SUPER,k,layoutmsg,cycleprev
bind=SUPER,space,layoutmsg,swapwithmaster
master {
new_is_master= true
new_on_top= true
}
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
bind=SUPER_SHIFT,1,movetoworkspace,1
bind=SUPER_SHIFT,2,movetoworkspace,2
bind=SUPER_SHIFT,3,movetoworkspace,3
bind=SUPER_SHIFT,4,movetoworkspace,4
bind=SUPER_SHIFT,5,movetoworkspace,5
bind=SUPER_SHIFT,6,movetoworkspace,6
bind=SUPER_SHIFT,7,movetoworkspace,7
bind=SUPER_SHIFT,8,movetoworkspace,8
bind=SUPER_SHIFT,9,movetoworkspace,9
bind=SUPER_SHIFT,0,movetoworkspace,10
bind=SUPER,mouse_down,workspace,e+1
bind=SUPER,mouse_up,workspace,e-1

48
system/work/hardware.nix Normal file
View file

@ -0,0 +1,48 @@
# 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 = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7";
fsType = "btrfs";
options = [ "subvol=@" "compress=zstd" "autodefrag" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/570cc51f-bd5c-4bee-a18f-f6aabaf60881";
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/48a07e82-1090-448c-a751-3a410afba0f7";
fsType = "btrfs";
options = [ "subvol=@home" "compress=zstd" "autodefrag" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/EED9-A165";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp53s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp54s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

56
system/work/home.nix Normal file
View file

@ -0,0 +1,56 @@
{ config, pkgs, user, name, ... }:
# https://nix-community.github.io/home-manager/options.html
{
# don't change
home.stateVersion = "22.05";
home.packages = with pkgs; [
];
programs.git = {
enable = true;
userName = "tristan";
userEmail = "tristan@tristans.cloud";
aliases = {
graph = "log --oneline --all --graph";
amend = "commit --amend --no-edit";
};
};
accounts.email.accounts."tristan@tristans.cloud" = {
notmuch.enable = true;
neomutt.enable = true;
mbsync.enable = true;
mbsync.create = "maildir";
userName = "tristan@tristans.cloud";
realName = "Tristan";
address = "tristan@tristans.cloud";
primary = true;
passwordCommand = "rbw get privateemail";
smtp = {
host = "mail.privateemail.com";
port = 465;
tls.enable = true;
};
imap = {
host = "mail.privateemail.com";
port = 993;
tls.enable = true;
};
};
programs.notmuch.enable = true;
programs.neomutt = {
enable = true;
vimKeys = true;
sort = "reverse-date";
sidebar.enable = true;
};
programs.mbsync.enable = true;
services.mbsync.enable = true;
home.file.".config/hypr/hyprland.conf" = {
source = ./config/hypr.conf;
};
}

View file

@ -5,10 +5,6 @@
networking.hostName = "FCS-Tristan-Nixbook";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true;
};
services.xserver = {
layout = "gb";
xkbVariant = "dvorak";

48
system/zenix/hardware.nix Normal file
View file

@ -0,0 +1,48 @@
# 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909";
fsType = "btrfs";
options = [ "subvol=@" "compress=zstd" "autodefrag" ];
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/cc0617df-8cbf-4618-abbc-df64c96de151";
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/2dad5ed6-44cc-4d9d-9392-32afaa7b3909";
fsType = "btrfs";
options = [ "subvol=@home" "compress=zstd" "autodefrag" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FE7E-0DE3";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/da57b489-ab77-4830-b710-9f96cf43d053"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -5,8 +5,9 @@
networking.hostName = "zenix";
console = {
font = "Lat2-Terminus16";
services.xserver = {
layout = "gb";
xkbOptions = "caps:escape";
};
services.openssh.enable = true;