diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ce548ea9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +secrets.nix +result diff --git a/config/emacs/aliases.zsh b/config/emacs/aliases.zsh index 8be11334..8c4f00a9 100644 --- a/config/emacs/aliases.zsh +++ b/config/emacs/aliases.zsh @@ -1,17 +1,4 @@ #!/usr/bin/env zsh -if [[ $OSTYPE == darwin* ]]; then - alias emacs='emacs -nw' - - e() { # Emacs version of v - if pgrep Emacs 2>&1 >/dev/null; then - emacsclient -n $@ - else - /Applications/Emacs.app/Contents/MacOS/Emacs $@ & - fi - } -else - alias e='emacsclient -n' -fi - +alias e='emacsclient -n' ediff() { e --eval "(ediff-files \"$1\" \"$2\")"; } diff --git a/config/emacs/env.zsh b/config/emacs/env.zsh deleted file mode 100644 index 17a45046..00000000 --- a/config/emacs/env.zsh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env zsh - -export PATH="$HOME/.emacs.d/bin:$PATH" diff --git a/config/ncmpcpp/env.zsh b/config/ncmpcpp/env.zsh deleted file mode 100644 index 6d19b3c6..00000000 --- a/config/ncmpcpp/env.zsh +++ /dev/null @@ -1,2 +0,0 @@ -export MPD_HOME="$XDG_CONFIG_HOME/mpd" -export NCMPCPP_HOME="$XDG_CONFIG_HOME/ncmpcpp" diff --git a/config/rust/aliases.zsh b/config/rust/aliases.zsh deleted file mode 100644 index 8fd46945..00000000 --- a/config/rust/aliases.zsh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env zsh - -alias rs=rustc -alias rsp=rustup -alias ca=cargo diff --git a/config/rust/env.zsh b/config/rust/env.zsh deleted file mode 100644 index 6b9e6bcc..00000000 --- a/config/rust/env.zsh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env zsh - -export CARGO_HOME="$XDG_DATA_HOME/cargo" -export RUSTUP_HOME="$XDG_DATA_HOME/rustup" -export PATH="$CARGO_HOME/bin:$PATH" diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index d8455d16..aedf8f1b 100644 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -12,10 +12,10 @@ super + apostrophe # focus/swap the node in the given direction super + {_,ctrl +}{h,j,k,l} - ~/.config/bspwm/bin/bspc-focus {_,-m }{west,south,north,east} + bspc-focus {_,-m }{west,south,north,east} super + shift + {_,ctrl +}{h,j,k,l} - ~/.config/bspwm/bin/bspc-swap {_,-m }{west,south,north,east} + bspc-swap {_,-m }{west,south,north,east} super + {_,shift +}{1-9,0} bspc {desktop -f,node -d} {1-9,10} @@ -30,13 +30,13 @@ super + shift + grave emacsclient -e '(open-scratch-frame)' super + space - ~/.config/rofi/bin/rofi-appmenu + rofi-appmenu super + Tab - ~/.config/rofi/bin/rofi-windowmenu + rofi-windowmenu super + backslash - ~/.config/rofi/bin/rofi-passmenu + rofi-passmenu super + Escape pkill -USR1 -x sxhkd @@ -56,11 +56,14 @@ super + {_,ctrl + }f # ## Media keys -Print # screenshot region +# screenshot region +Print scrcap -super + Print # screencast region to mp4 +# screencast region to mp4 +super + Print scrrec -s ~/recordings/$(date +%F-%T).mp4 -super + ctrl + Print # screencast region to gif +# screencast region to gif +super + ctrl + Print scrrec -s ~/recordings/$(date +%F-%T).gif XF86MonBrightnessUp diff --git a/config/zsh/.zshenv b/config/zsh/.zshenv index c08f2c07..f2edf311 100644 --- a/config/zsh/.zshenv +++ b/config/zsh/.zshenv @@ -1,13 +1,8 @@ export ZGEN_DIR="$XDG_CACHE_HOME/zgen" export ZGEN_SOURCE="$ZGEN_DIR/zgen.zsh" -for dir in $XDG_CONFIG_HOME/*/bin(N); do - export PATH="$dir:$PATH" -done - -for file in $XDG_CONFIG_HOME/zsh/rc.d/env.*.zsh(N); do - source $file -done +## TODO +source $ZDOTDIR/extra.zshenv # If you have host-local configuration, this is where you'd put it -[ -f ~/.config/zsh/env ] && source ~/.config/zsh/env +[ -f ~/.zshenv ] && source ~/.zshenv diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc index 1849c4bf..259a4afe 100644 --- a/config/zsh/.zshrc +++ b/config/zsh/.zshrc @@ -1,6 +1,5 @@ -if [[ ! -d "$ZGEN_DIR" ]]; then +[ -d "$ZGEN_DIR" ] || \ git clone https://github.com/tarjoilija/zgen "$ZGEN_DIR" -fi source $ZGEN_SOURCE if ! zgen saved; then @@ -12,7 +11,7 @@ if ! zgen saved; then zgen load zsh-users/zsh-completions src zgen load junegunn/fzf shell - if [[ -z $SSH_CONNECTION ]]; then + if [ -z "$SSH_CONNECTION" ]; then zgen load zdharma/fast-syntax-highlighting fi @@ -25,9 +24,6 @@ if [[ $TERM != dumb ]]; then source $ZDOTDIR/keybinds.zsh source $ZDOTDIR/completion.zsh source $ZDOTDIR/aliases.zsh - for file in $XDG_CONFIG_HOME/zsh/rc.d/aliases.*.zsh(N); do - source $file - done ## function _cache { @@ -49,16 +45,15 @@ if [[ $TERM != dumb ]]; then export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_ALT_C_COMMAND="fd -t d . $HOME" fi - _cache fasd --init posix-alias zsh-{hook,{c,w}comp{,-install}} - _cache direnv hook zsh + ## TODO + source $ZDOTDIR/extra.zshrc ## autoload -Uz compinit && compinit -u -d $ZSH_CACHE/zcompdump autopair-init - # If you have host-local configuration, this is where you'd put it - [ -f ~/.config/zsh/rc ] && source ~/.config/zsh/rc + [ -f ~/.zshrc ] && source ~/.zshrc fi diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh index 9588e8d6..07a9fed5 100644 --- a/config/zsh/aliases.zsh +++ b/config/zsh/aliases.zsh @@ -13,13 +13,6 @@ alias mv='mv -i' alias mkdir='mkdir -p' alias wget='wget -c' -alias rg='noglob rg' -alias bc='bc -lq' - -alias grep='grep --color=auto' -alias fgrep='fgrep --color=auto' -alias egrep='egrep --color=auto' - if command -v exa >/dev/null; then alias exa='exa --group-directories-first' alias l='exa -1' diff --git a/config/zsh/config.zsh b/config/zsh/config.zsh index a34771e6..06f08452 100644 --- a/config/zsh/config.zsh +++ b/config/zsh/config.zsh @@ -1,8 +1,6 @@ # Stop TRAMP (in Emacs) from hanging or term/shell from echoing back commands if [[ $TERM == dumb || -n $INSIDE_EMACS ]]; then - unsetopt zle - unsetopt prompt_cr - unsetopt prompt_subst + unsetopt zle prompt_cr prompt_subst whence -w precmd >/dev/null && unfunction precmd whence -w preexec >/dev/null && unfunction preexec PS1='$ ' diff --git a/configuration.ao.nix b/configuration.ao.nix deleted file mode 100644 index 113ceedb..00000000 --- a/configuration.ao.nix +++ /dev/null @@ -1,119 +0,0 @@ -# Ao -- my home development server - -{ config, ... }: - -{ - imports = [ - ./. # import common settings - - ./modules/services/ssh.nix - ./modules/services/nginx.nix - ./modules/services/gitea.nix - ./modules/services/syncthing.nix - - ./modules/shell/git.nix - ./modules/shell/zsh.nix - ]; - - time.timeZone = "America/Toronto"; - - networking.hostName = "ao"; - networking.networkmanager.enable = true; - - # syncthing - services.syncthing.guiAddress = "192.168.1.10:8384"; - networking.firewall.allowedTCPPorts = [ 8384 ]; - - # nginx hosts - services.nginx = { - user = "hlissner"; - virtualHosts = { - "v0.io" = { - default = true; - enableACME = true; - forceSSL = true; - root = "/var/www/v0.io"; - }; - "dl.v0.io" = { - enableACME = true; - addSSL = true; - root = "/var/www/dl.v0.io"; - locations."~* \.(?:ico|css|js|gif|jpe?g|png|mp4)$".extraConfig = '' - expires 30d; - add_header Pragma public; - add_header Cache-Control public; - ''; - }; - "git.v0.io" = { - enableACME = true; - forceSSL = true; - locations."/".proxyPass = http://127.0.0.1:3000; - }; - "plex.v0.io" = { - http2 = true; # more performant for streaming - enableACME = true; - forceSSL = true; - extraConfig = '' - # Some players don't reopen a socket and playback stops totally - # instead of resuming after an extended pause - send_timeout 100m; - - # Intentionally not hardened for security for player support and - # encryption video streams has a lot of overhead with something like - # AES-256-GCM-SHA384. - ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; - - # Forward real ip and host to Plex - proxy_set_header Referer $server_addr; - proxy_set_header Origin $server_addr; - - # Nginx default client_max_body_size is 1MB, which breaks Camera - # Upload feature from the phones. Increasing the limit fixes the - # issue. Anyhow, if 4K videos are expected to be uploaded, the size - # might need to be increased even more - client_max_body_size 100M; - - # Plex headers - proxy_set_header X-Plex-Client-Identifier $http_x_plex_client_identifier; - proxy_set_header X-Plex-Device $http_x_plex_device; - proxy_set_header X-Plex-Device-Name $http_x_plex_device_name; - proxy_set_header X-Plex-Platform $http_x_plex_platform; - proxy_set_header X-Plex-Platform-Version $http_x_plex_platform_version; - proxy_set_header X-Plex-Product $http_x_plex_product; - proxy_set_header X-Plex-Token $http_x_plex_token; - proxy_set_header X-Plex-Version $http_x_plex_version; - proxy_set_header X-Plex-Nocache $http_x_plex_nocache; - proxy_set_header X-Plex-Provides $http_x_plex_provides; - proxy_set_header X-Plex-Device-Vendor $http_x_plex_device_vendor; - proxy_set_header X-Plex-Model $http_x_plex_model; - - # Buffering off send to the client as soon as the data is received - # from Plex. - proxy_buffering off; - ''; - locations."= /".return = "302 https://plex.v0.io/web/index.html"; - locations."/" = { - proxyWebsockets = true; - proxyPass = "http://192.168.1.13:32400"; - }; - }; - }; - }; - - security.acme.certs = { - "v0.io".email = "henrik@lissner.net"; - "dl.v0.io".email = "henrik@lissner.net"; - "git.v0.io".email = "henrik@lissner.net"; - "plex.v0.io".email = "henrik@lissner.net"; - }; - - services.gitea = { - appName = "V-NOUGHT"; - domain = "v0.io"; - rootUrl = "https://git.v0.io/"; - extraConfig = '' - [server] - SSH_DOMAIN = v0.io - ''; - }; -} diff --git a/configuration.kuro.nix b/configuration.kuro.nix deleted file mode 100644 index 53c3f0f8..00000000 --- a/configuration.kuro.nix +++ /dev/null @@ -1,50 +0,0 @@ -# Kuro -- my desktop - -{ config, pkgs, ... }: - -{ - imports = [ - ./. # import common settings - - ./modules/desktop/bspwm.nix - - ./modules/audio/audacity.nix - ./modules/audio/lmms.nix - ./modules/audio/spotify.nix - ./modules/browser/firefox.nix - ./modules/dev - ./modules/dev/rust.nix - ./modules/editors/emacs.nix - ./modules/editors/vim.nix - ./modules/gaming/steam.nix - ./modules/graphics/aseprite.nix - # ./modules/graphics/blender.nix - ./modules/graphics/gimp.nix - ./modules/misc/virtualbox.nix - ./modules/shell/direnv.nix - ./modules/shell/git.nix - ./modules/shell/gnupg.nix - ./modules/shell/pass.nix - ./modules/shell/zsh.nix - # ./modules/video/kdenlive.nix - # ./modules/video/obs.nix - - # Services - ./modules/services/syncthing.nix - - # Themes - ./themes/aquanaut - ]; - - networking.hostName = "kuro"; - networking.networkmanager.enable = true; - - time.timeZone = "America/Toronto"; - services.xserver.videoDrivers = [ "nvidia" ]; - - # For ergodox ez - environment = { - systemPackages = [ pkgs.teensy-loader-cli ]; - shellAliases.teensyload = "sudo teensy-loader-cli -w -v --mcu=atmega32u4"; - }; -} diff --git a/configuration.shiro.nix b/configuration.shiro.nix deleted file mode 100644 index 36dd46f4..00000000 --- a/configuration.shiro.nix +++ /dev/null @@ -1,62 +0,0 @@ -# Shiro -- my laptop - -{ config, lib, pkgs, ... }: - -let nixos-hardware = builtins.fetchTarball https://github.com/NixOS/nixos-hardware/archive/master.tar.gz; -in { - imports = [ - ./. # import common settings - - # Hardware specific - "${nixos-hardware}/dell/xps/13-9370" - - ./modules/desktop/bspwm.nix - - ./modules/audio/spotify.nix - ./modules/browser/firefox.nix - ./modules/dev - ./modules/graphics/aseprite.nix - ./modules/graphics/gimp.nix - ./modules/editors/emacs.nix - ./modules/editors/vim.nix - ./modules/shell/direnv.nix - ./modules/shell/git.nix - ./modules/shell/gnupg.nix - ./modules/shell/pass.nix - ./modules/shell/zsh.nix - # ./modules/video/obs.nix - - # - ./modules/services/syncthing.nix - - # Themes - ./themes/aquanaut - ]; - - time.timeZone = "America/Toronto"; - # time.timeZone = "Europe/Copenhagen"; - - networking.hostName = "shiro"; - networking.wireless.enable = true; - - # Optimize power use - environment.systemPackages = [ pkgs.acpi ]; - services.tlp.enable = true; - powerManagement = { - powertop.enable = true; - cpuFreqGovernor = "ondemand"; - }; - - # Monitor backlight control - programs.light.enable = true; - - # Encrypted /home - boot.initrd.luks.devices = [ - { - name = "home"; - device = "/dev/nvme0n1p8"; - preLVM = true; - allowDiscards = true; - } - ]; -} diff --git a/default.nix b/default.nix index 1d0c6fbe..d84e2f4d 100644 --- a/default.nix +++ b/default.nix @@ -1,26 +1,31 @@ -# Common configuration across systems. This should be required by -# configuration.$HOSTNAME.nix files. - -{ pkgs, options, config, ... }: +# ... +device: +{ pkgs, options, lib, config, ... }: { imports = [ - ./settings.nix + /etc/nixos/hardware-configuration.nix + + ./options/my.nix + ./options/secrets.nix + ./secrets.nix + "${./machines}/${device}.nix" ]; + ### nix = { nixPath = options.nix.nixPath.default ++ [ - "config=/etc/dotfiles/config" - "packages=/etc/dotfiles/packages" + "my=/etc/dotfiles" ]; autoOptimiseStore = true; - trustedUsers = [ "root" "@wheel" ]; + trustedUsers = [ "root" ]; }; - nixpkgs.config = { - # Forgive me Stallman senpai - allowUnfree = true; + nixpkgs.config = { + allowUnfree = true; # forgive me Stallman senpai + # Occasionally, "stable" packages are broken or incomplete, so access to the + # bleeding edge is necessary, as a last resort. packageOverrides = pkgs: { unstable = import { config = config.nixpkgs.config; @@ -28,61 +33,6 @@ }; }; - # Nothing in /tmp should survive a reboot - boot.cleanTmpDir = true; - # Use simple bootloader; I prefer the on-demand BIOs boot menu - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - environment = { - systemPackages = with pkgs; [ - # Just the bear necessities~ - libqalculate - coreutils - git - killall - unzip - vim - wget - # Support for extra filesystems - sshfs - exfat - ntfs3g - hfsprogs - ]; - # These are the defaults, but some applications are buggy when these lack - # explicit values. - variables = { - XDG_CONFIG_HOME = "$HOME/.config"; - XDG_CACHE_HOME = "$HOME/.cache"; - XDG_DATA_HOME = "$HOME/.local/share"; - XDG_BIN_HOME = "$HOME/.local/bin"; - }; - }; - - location = (if config.time.timeZone == "America/Toronto" then { - latitude = 43.70011; - longitude = -79.4163; - } else if config.time.timeZone == "Europe/Copenhagen" then { - latitude = 55.88; - longitude = 12.5; - } else {}); - - # Set up hlissner user account - users.users.hlissner = { - isNormalUser = true; - uid = 1000; - extraGroups = [ "wheel" "video" "networkmanager" "vboxusers" ]; - shell = pkgs.zsh; - }; - - home = { - xdg.enable = true; - home.file."bin" = { source = ./bin; recursive = true; }; - }; - - networking.firewall.enable = true; - # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you diff --git a/configuration.aka.nix b/machines/aka.nix similarity index 67% rename from configuration.aka.nix rename to machines/aka.nix index 7303a172..69336d42 100644 --- a/configuration.aka.nix +++ b/machines/aka.nix @@ -2,18 +2,18 @@ # access to my work files from anywhere. { config, ... }: - { imports = [ ./. # import common settings - ./modules/services/ssh.nix - ./modules/services/plex.nix - ./modules/shell/zsh.nix + + # ./modules/services/plex.nix + + ]; - time.timeZone = "America/Toronto"; - networking.hostName = "aka"; networking.networkmanager.enable = true; + + time.timeZone = "America/Toronto"; } diff --git a/machines/ao.nix b/machines/ao.nix new file mode 100644 index 00000000..ac50654f --- /dev/null +++ b/machines/ao.nix @@ -0,0 +1,158 @@ +# Ao -- my home development server + +{ config, ... }: +{ + imports = [ + ./. # import common settings + + + + + + + + + ]; + + networking.hostName = "ao"; + networking.networkmanager.enable = true; + time.timeZone = "America/Toronto"; + + # syncthing + services.syncthing.guiAddress = "192.168.1.10:8384"; + networking.firewall.allowedTCPPorts = [ 8384 ]; + + # nginx hosts + services.nginx = { + user = config.my.username; + virtualHosts = { + "v0.io" = { + default = true; + enableACME = true; + forceSSL = true; + root = "/var/www/v0.io"; + }; + "dl.v0.io" = { + enableACME = true; + addSSL = true; + root = "/var/www/dl.v0.io"; + locations."~* \.(?:ico|css|js|gif|jpe?g|png|mp4)$".extraConfig = '' + expires 30d; + add_header Pragma public; + add_header Cache-Control public; + ''; + }; + "git.v0.io" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = http://127.0.0.1:3000; + }; + "tv.v0.io" = { + http2 = true; # more performant for streaming + enableACME = true; + forceSSL = true; + extraConfig = '' + add_header Content-Security-Policy "default-src https: data: blob:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' https://www.gstatic.com/cv/js/sender/v1/cast_sender.js; worker-src 'self' blob:; connect-src 'self'; object-src 'none'; frame-ancestors 'self'"; + + # Some players don't reopen a socket and playback stops totally + # instead of resuming after an extended pause + send_timeout 100m; + + # Intentionally not hardened for security for player support and + # encryption video streams has a lot of overhead with something like + # AES-256-GCM-SHA384. + ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; + + ssl_stapling on; + ssl_stapling_verify on; + + # Forward real ip and host to Plex + proxy_set_header Referer $server_addr; + proxy_set_header Origin $server_addr; + + # Security / XSS Mitigation Headers + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options "nosniff"; + ''; + # locations."= /".return = "302 https://tv.v0.io/web/index.html"; + locations."/socket" = { + proxyPass = "http://192.168.1.13:8096"; + proxyHttpVersion = "1.1"; + # Buffering off send to the client as soon as the data is received + # from JellyFin. + proxyBuffering = "off"; + }; + locations."/" = { + proxyWebsockets = true; + proxyPass = "http://192.168.1.13:8096"; + }; + }; + # "plex.v0.io" = { + # http2 = true; # more performant for streaming + # enableACME = true; + # forceSSL = true; + # extraConfig = '' + # # Some players don't reopen a socket and playback stops totally + # # instead of resuming after an extended pause + # send_timeout 100m; + + # # Intentionally not hardened for security for player support and + # # encryption video streams has a lot of overhead with something like + # # AES-256-GCM-SHA384. + # ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; + + # # Forward real ip and host to Plex + # proxy_set_header Referer $server_addr; + # proxy_set_header Origin $server_addr; + + # # Nginx default client_max_body_size is 1MB, which breaks Camera + # # Upload feature from the phones. Increasing the limit fixes the + # # issue. Anyhow, if 4K videos are expected to be uploaded, the size + # # might need to be increased even more + # client_max_body_size 100M; + + # # Plex headers + # proxy_set_header X-Plex-Client-Identifier $http_x_plex_client_identifier; + # proxy_set_header X-Plex-Device $http_x_plex_device; + # proxy_set_header X-Plex-Device-Name $http_x_plex_device_name; + # proxy_set_header X-Plex-Platform $http_x_plex_platform; + # proxy_set_header X-Plex-Platform-Version $http_x_plex_platform_version; + # proxy_set_header X-Plex-Product $http_x_plex_product; + # proxy_set_header X-Plex-Token $http_x_plex_token; + # proxy_set_header X-Plex-Version $http_x_plex_version; + # proxy_set_header X-Plex-Nocache $http_x_plex_nocache; + # proxy_set_header X-Plex-Provides $http_x_plex_provides; + # proxy_set_header X-Plex-Device-Vendor $http_x_plex_device_vendor; + # proxy_set_header X-Plex-Model $http_x_plex_model; + + # # Buffering off send to the client as soon as the data is received + # # from Plex. + # proxy_buffering off; + # ''; + # locations."= /".return = "302 https://plex.v0.io/web/index.html"; + # locations."/" = { + # proxyWebsockets = true; + # proxyPass = "http://192.168.1.13:32400"; + # }; + # }; + }; + }; + + security.acme.certs = { + "v0.io".email = "henrik@lissner.net"; + "dl.v0.io".email = "henrik@lissner.net"; + "git.v0.io".email = "henrik@lissner.net"; + "plex.v0.io".email = "henrik@lissner.net"; + }; + + services.gitea = { + appName = "V-NOUGHT"; + domain = "v0.io"; + rootUrl = "https://git.v0.io/"; + extraConfig = '' + [server] + SSH_DOMAIN = v0.io + ''; + }; +} diff --git a/machines/default.nix b/machines/default.nix new file mode 100644 index 00000000..c997c98b --- /dev/null +++ b/machines/default.nix @@ -0,0 +1,57 @@ +# ... + +{ config, lib, pkgs, ... }: +{ + # Nothing in /tmp should survive a reboot + boot.cleanTmpDir = true; + # Use simple bootloader; I prefer the on-demand BIOs boot menu + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Just the bear necessities~ + environment.systemPackages = with pkgs; [ + coreutils + git + killall + unzip + vim + wget + # Support for extra filesystems + sshfs + exfat + ntfs3g + hfsprogs + # cached-nix-shell, for instant nix-shell scripts + (callPackage + (builtins.fetchTarball + https://github.com/xzfc/cached-nix-shell/archive/master.tar.gz) {}) + ]; + + ### + # My user settings + my = { + username = "hlissner"; + env.PATH = [ ]; + user = { + isNormalUser = true; + uid = 1000; + extraGroups = [ "wheel" "video" "networkmanager" ]; + shell = pkgs.zsh; + }; + }; + + # Obey XDG conventions; a tidy $HOME is a tidy mind. + my.home.xdg.enable = true; + environment.variables = { + # These are the defaults, but some applications are buggy when these lack + # explicit values. + XDG_CONFIG_HOME = "$HOME/.config"; + XDG_CACHE_HOME = "$HOME/.cache"; + XDG_DATA_HOME = "$HOME/.local/share"; + XDG_BIN_HOME = "$HOME/.local/bin"; + }; + nix.trustedUsers = [ config.my.username ]; + + ### Universal defaults + networking.firewall.enable = true; +} diff --git a/machines/kuro.nix b/machines/kuro.nix new file mode 100644 index 00000000..752686b7 --- /dev/null +++ b/machines/kuro.nix @@ -0,0 +1,54 @@ +# Kuro -- my desktop + +{ config, lib, utils, pkgs, ... }: +{ + imports = [ + ./. # import common settings + + + + # discord, mainly + # recording video & audio + # making music + # playing music + # art & design + # virtualbox for testing + + + + + + + + + + + + + + # Services + + + # Themes + + ]; + + networking.hostName = "kuro"; + networking.networkmanager.enable = true; + time.timeZone = "America/Toronto"; + + ## Hardware + # GPU + services.xserver.videoDrivers = [ "nvidia" ]; + # For ergodox ez + my.packages = [ pkgs.teensy-loader-cli ]; + my.alias.teensyload = "sudo teensy-loader-cli -w -v --mcu=atmega32u4"; + # For my intuos4 pro. My cintiq doesn't work on Linux though :( + services.xserver.wacom.enable = true; + my.init = '' + # lock tablet to main display + xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen eraser") DVI-I-1 + xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen cursor") DVI-I-1 + xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen stylus") DVI-I-1 + ''; +} diff --git a/machines/shiro.nix b/machines/shiro.nix new file mode 100644 index 00000000..292f9dc5 --- /dev/null +++ b/machines/shiro.nix @@ -0,0 +1,60 @@ +# Shiro -- my laptop + +{ config, lib, pkgs, ... }: + +let nixos-hardware = builtins.fetchTarball https://github.com/NixOS/nixos-hardware/archive/master.tar.gz; +in { + imports = [ + ./. # import common settings + + # Hardware specific + "${nixos-hardware}/dell/xps/13-9370" + + + + # discord, mainly + # recording video & audio + # making music + # playing music + # art & design + # # virtualbox for testing + + + + + + + + + + + + # Services + + + # Themes + + ]; + + theme.wallpaper = ; + networking.hostName = "shiro"; + networking.wireless.enable = true; + + time.timeZone = "America/Toronto"; + # time.timeZone = "Europe/Copenhagen"; + + # Optimize power use + environment.systemPackages = [ pkgs.acpi ]; + powerManagement.powertop.enable = true; + # Monitor backlight control + programs.light.enable = true; + # Encrypted /home + boot.initrd.luks.devices = [ + { + name = "home"; + device = "/dev/nvme0n1p8"; + preLVM = true; + allowDiscards = true; + } + ]; +} diff --git a/modules/browser/firefox.nix b/modules/browser/firefox.nix index 24eed202..76abb13b 100644 --- a/modules/browser/firefox.nix +++ b/modules/browser/firefox.nix @@ -1,25 +1,21 @@ { config, lib, pkgs, ... }: { - environment = { - systemPackages = with pkgs; [ - firefox-bin - (pkgs.writeScriptBin "firefox-private" '' - #! ${pkgs.bash}/bin/bash - firefox --private-window "$@" - '') - (makeDesktopItem { - name = "firefox-private"; - desktopName = "Firefox (Private)"; - genericName = "Open a private Firefox window"; - icon = "firefox"; - exec = "${firefox-bin}/bin/firefox --private-window"; - categories = "Network"; - }) - ]; - variables = { - BROWSER = "firefox"; - XDG_DESKTOP_DIR = "$HOME"; # prevent firefox creating ~/Desktop - }; - }; + my.packages = with pkgs; [ + firefox-bin (pkgs.writeScriptBin "firefox-private" '' + #! ${pkgs.bash}/bin/bash + firefox --private-window "$@" + '') + (makeDesktopItem { + name = "firefox-private"; + desktopName = "Firefox (Private)"; + genericName = "Open a private Firefox window"; + icon = "firefox"; + exec = "${firefox-bin}/bin/firefox --private-window"; + categories = "Network"; + }) + ]; + + my.env.BROWSER = "firefox"; + my.env.XDG_DESKTOP_DIR = "$HOME"; # prevent firefox creating ~/Desktop } diff --git a/modules/browser/qutebrowser.nix b/modules/browser/qutebrowser.nix index 46d2c372..a09307f4 100644 --- a/modules/browser/qutebrowser.nix +++ b/modules/browser/qutebrowser.nix @@ -1,19 +1,14 @@ { config, lib, pkgs, ... }: { - environment = { - systemPackages = with pkgs; [ - qutebrowser - ]; - variables.BROWSER = "qutebrowser"; - }; - - home.xdg = { + my.packages = [ pkgs.qutebrowser ]; + my.env.BROWSER = "qutebrowser"; + my.home.xdg = { configFile."qutebrowser" = { - source = ; + source = ; recursive = true; }; dataFile."qutebrowser/greasemonkey" = { - source = ; + source = ; recursive = true; }; }; diff --git a/modules/chat.nix b/modules/chat.nix new file mode 100644 index 00000000..4c8622c3 --- /dev/null +++ b/modules/chat.nix @@ -0,0 +1,10 @@ +# Even neckbeards have a social life. Not that I have one. A neckbeard, I mean. +# But when I do have either, then discord and weechat (or Emacs) are my go-to. + +{ config, lib, pkgs, ... }: +{ + my.packages = with pkgs; [ + # weechat # TODO For the real neckbeards + discord # For everyone else + ]; +} diff --git a/modules/daw.nix b/modules/daw.nix index 7f09520f..00bbbd66 100644 --- a/modules/daw.nix +++ b/modules/daw.nix @@ -5,7 +5,7 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ + my.packages = with pkgs; [ audacity # for recording and remastering audio # lmms # for making music sunvox # for making music (where LMMS is overkill) @@ -13,6 +13,6 @@ # Build our own LMMS because the built-in nixpkg is broken, due to a 'Could # not find the Qt platform plugin "xcb" in ""' error on startup: # https://github.com/NixOS/nixpkgs/issues/76074 - (callPackage {}) + (callPackage {}) ]; } diff --git a/modules/desktop/bspwm.nix b/modules/desktop/bspwm.nix index 07a8c9d9..d9b4b2ea 100644 --- a/modules/desktop/bspwm.nix +++ b/modules/desktop/bspwm.nix @@ -12,68 +12,62 @@ ./thunar.nix ]; - environment = { - systemPackages = with pkgs; [ - lightdm - bspwm - dunst - libnotify - (polybar.override { - pulseSupport = true; - nlSupport = true; - }) + environment.systemPackages = with pkgs; [ + lightdm + bspwm + dunst + libnotify + (polybar.override { + pulseSupport = true; + nlSupport = true; + }) - xst # st + nice-to-have extensions - (makeDesktopItem { - name = "xst"; - desktopName = "Suckless Terminal"; - genericName = "Default terminal"; - icon = "utilities-terminal"; - exec = "${xst}/bin/xst"; - categories = "Development;System;Utility"; - }) + xst # st + nice-to-have extensions + (makeDesktopItem { + name = "xst"; + desktopName = "Suckless Terminal"; + genericName = "Default terminal"; + icon = "utilities-terminal"; + exec = "${xst}/bin/xst"; + categories = "Development;System;Utility"; + }) - (writeScriptBin "st-scratch" '' - #!${stdenv.shell} - SCRID=st-scratch - focused=$(xdotool getactivewindow) - scratch=$(xdotool search --onlyvisible --classname $SCRID) - if [[ -n $scratch ]]; then - if [[ $focused == $scratch ]]; then - xdotool windowkill $scratch - else - xdotool windowactivate $scratch - fi + (writeScriptBin "st-scratch" '' + #!${stdenv.shell} + SCRID=st-scratch + focused=$(xdotool getactivewindow) + scratch=$(xdotool search --onlyvisible --classname $SCRID) + if [[ -n $scratch ]]; then + if [[ $focused == $scratch ]]; then + xdotool windowkill $scratch else - xst -t $SCRID -n $SCRID -c $SCRID \ - -f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \ - -g 100x26 \ - -e $SHELL + xdotool windowactivate $scratch fi - '') - (writeScriptBin "st-calc" '' - #!${stdenv.shell} - SCRID=st-calc - scratch=$(xdotool search --onlyvisible --classname $SCRID) - [ -n "$scratch" ] && xdotool windowkill $scratch + else xst -t $SCRID -n $SCRID -c $SCRID \ -f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \ - -g 80x12 \ - -e $SHELL -c qalc - '') - (makeDesktopItem { - name = "st-calc"; - desktopName = "Calculator"; - icon = "calc"; - exec = "st-calc"; - categories = "Development"; - }) - ]; - }; - - fonts.fonts = [ pkgs.siji ]; - - programs.zsh.interactiveShellInit = "export TERM=xterm-256color"; + -g 100x26 \ + -e $SHELL + fi + '') + (writeScriptBin "st-calc" '' + #!${stdenv.shell} + SCRID=st-calc + scratch=$(xdotool search --onlyvisible --classname $SCRID) + [ -n "$scratch" ] && xdotool windowkill $scratch + xst -t $SCRID -n $SCRID -c $SCRID \ + -f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \ + -g 80x12 \ + -e $SHELL -c qalc + '') + (makeDesktopItem { + name = "st-calc"; + desktopName = "Calculator"; + icon = "calc"; + exec = "st-calc"; + categories = "Development"; + }) + ]; services = { xserver = { @@ -83,7 +77,7 @@ enable = true; greeters.mini = { enable = true; - user = "hlissner"; + user = config.my.username; }; }; }; @@ -92,13 +86,34 @@ enable = true; backend = "glx"; vSync = true; + opacityRules = [ + "100:class_g = 'Firefox'" + "100:class_g = 'VirtualBox Machine'" + # Art/image programs where we need fidelity + "100:class_g = 'Gimp'" + "100:class_g = 'Inkscape'" + "100:class_g = 'aseprite'" + "100:class_g = 'krita'" + "100:class_g = 'feh'" + "100:class_g = 'mpv'" + ]; + settings.blur-background-exclude = [ + "window_type = 'dock'" + "window_type = 'desktop'" + "_GTK_FRAME_EXTENTS@:c" + ]; }; }; - home.xdg.configFile = { - "sxhkd".source = ; + # For polybar + fonts.fonts = [ pkgs.siji ]; - # link recursively so other modules can link files in their folders - "bspwm" = { source = ; recursive = true; }; + my = { + env.PATH = [ ]; + home.xdg.configFile = { + "sxhkd".source = ; + # link recursively so other modules can link files in their folders + "bspwm" = { source = ; recursive = true; }; + }; }; } diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 1bd2e152..f881edeb 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,15 +1,12 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - redshift + my.packages = with pkgs; [ + libqalculate xclip xdotool - ffmpeg mpv # video player feh # image viewer - maim - slop # Useful apps evince # pdf reader @@ -23,6 +20,15 @@ redshift.enable = true; }; + # For redshift + location = (if config.time.timeZone == "America/Toronto" then { + latitude = 43.70011; + longitude = -79.4163; + } else if config.time.timeZone == "Europe/Copenhagen" then { + latitude = 55.88; + longitude = 12.5; + } else {}); + fonts = { enableFontDir = true; enableGhostscriptFonts = true; diff --git a/modules/desktop/rofi.nix b/modules/desktop/rofi.nix index 650a6312..ec073673 100644 --- a/modules/desktop/rofi.nix +++ b/modules/desktop/rofi.nix @@ -1,32 +1,38 @@ { config, lib, pkgs, ... }: { - environment = { - systemPackages = with pkgs; [ + my = { + env.PATH = [ ]; + # link recursively so other modules can link files in its folder + home.xdg.configFile."rofi" = { + source = ; + recursive = true; + }; + + packages = with pkgs; [ (writeScriptBin "rofi" '' #!${stdenv.shell} exec ${rofi}/bin/rofi -terminal xst -m -1 "$@" '') - rofi # Fake rofi dmenu entries (makeDesktopItem { name = "rofi-browsermenu"; desktopName = "Open Bookmark in Firefox"; icon = "bookmark-new-symbolic"; - exec = "${}/bin/rofi-browsermenu"; + exec = "${}/bin/rofi-browsermenu"; }) (makeDesktopItem { name = "rofi-filemenu"; desktopName = "Open Directory in Terminal"; icon = "folder"; - exec = "${}/bin/rofi-filemenu"; + exec = "${}/bin/rofi-filemenu"; }) (makeDesktopItem { name = "rofi-filemenu-scratch"; desktopName = "Open Directory in Scratch Terminal"; icon = "folder"; - exec = "${}/bin/rofi-filemenu -x"; + exec = "${}/bin/rofi-filemenu -x"; }) (makeDesktopItem { @@ -49,12 +55,4 @@ }) ]; }; - - home.xdg.configFile = { - # link recursively so other modules can link files in its folder - "rofi" = { - source = ; - recursive = true; - }; - }; } diff --git a/modules/desktop/thunar.nix b/modules/desktop/thunar.nix index 5155a005..1ac3a42e 100644 --- a/modules/desktop/thunar.nix +++ b/modules/desktop/thunar.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ + my.packages = with pkgs; [ xfce.thunar xfce.tumbler # for thumbnails ]; diff --git a/modules/dev/cpp.nix b/modules/dev/cpp.nix index 4a75f233..870741a4 100644 --- a/modules/dev/cpp.nix +++ b/modules/dev/cpp.nix @@ -3,9 +3,10 @@ { imports = [ ./. ]; - environment.systemPackages = with pkgs; [ + my.packages = with pkgs; [ clang gcc cmake + llvmPackages.libcxx ]; } diff --git a/modules/dev/default.nix b/modules/dev/default.nix index fe62fa9e..a437701e 100644 --- a/modules/dev/default.nix +++ b/modules/dev/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ + my.packages = with pkgs; [ gnumake ]; } diff --git a/modules/dev/rust.nix b/modules/dev/rust.nix index f7013b63..d43a7400 100644 --- a/modules/dev/rust.nix +++ b/modules/dev/rust.nix @@ -1,12 +1,10 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - rustup - ]; - - home.xdg.configFile = { - "zsh/rc.d/aliases.rust.zsh".source = ; - "zsh/rc.d/env.rust.zsh".source = ; + my = { + packages = with pkgs; [ rustup ]; + env.CARGO_HOME = "$XDG_DATA_HOME/cargo"; + env.RUSTUP_HOME = "$XDG_DATA_HOME/rustup"; + env.PATH = [ "$CARGO_HOME/bin" ]; }; } diff --git a/modules/dev/unity.nix b/modules/dev/unity.nix index 12d1999c..bde6f961 100644 --- a/modules/dev/unity.nix +++ b/modules/dev/unity.nix @@ -1,3 +1,6 @@ +# I don't often use unity except for team projects. On my own, I prefer rolling +# my own (or godot). + { config, lib, pkgs, ... }: { diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 587263b2..edadb061 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -1,37 +1,37 @@ # Emacs is my main driver. I'm the author of Doom Emacs -# . This module sets it up to meed my +# https://github.com/hlissner/doom-emacs. This module sets it up to meet my # particular Doomy needs. { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - # Doom dependencies - emacs - git - (ripgrep.override {withPCRE2 = true;}) - # Optional dependencies - editorconfig-core-c # per-project style config - fd # faster projectile indexing - imagemagick # for image-dired - gnutls # for TLS connectivity - (lib.mkIf (config.programs.gnupg.agent.enable) - pinentry_emacs) # in-emacs gnupg prompts - zstd # for undo-tree compression - ffmpeg # for screen recording emacs - # Module dependencies - sqlite # :tools (lookup +docsets) - texlive.combined.scheme-medium # :lang org -- for latex previews - ccls # :lang (cc +lsp) - nodePackages.javascript-typescript-langserver # :lang (javascript +lsp) - rls # :lang (rust +lsp) - ]; + my = { + packages = with pkgs; [ + # Doom dependencies + emacs + git + (ripgrep.override {withPCRE2 = true;}) + # Optional dependencies + editorconfig-core-c # per-project style config + fd # faster projectile indexing + imagemagick # for image-dired + gnutls # for TLS connectivity + (lib.mkIf (config.programs.gnupg.agent.enable) + pinentry_emacs) # in-emacs gnupg prompts + zstd # for undo-tree compression + ffmpeg # for screen recording emacs + # Module dependencies + sqlite # :tools (lookup +docsets) + texlive.combined.scheme-medium # :lang org -- for latex previews + ccls # :lang (cc +lsp) + nodePackages.javascript-typescript-langserver # :lang (javascript +lsp) + rls + ]; + + env.PATH = [ "$HOME/.emacs.d/bin" ]; + zsh.rc = lib.readFile ; + }; fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ]; - - home.xdg.configFile = { - "zsh/rc.d/aliases.emacs.zsh".source = ; - "zsh/rc.d/env.emacs.zsh".source = ; - }; } diff --git a/modules/editors/vim.nix b/modules/editors/vim.nix index cc9d84ec..c598d33c 100644 --- a/modules/editors/vim.nix +++ b/modules/editors/vim.nix @@ -1,15 +1,14 @@ +# When I'm stuck in the terminal or don't have access to Emacs, (neo)vim is my +# go-to. I am a vimmer at heart, after all. + { config, lib, pkgs, ... }: - { - environment = { - sessionVariables = { - EDITOR = "nvim"; - VIMINIT = "let \\$MYVIMRC='\\$XDG_CONFIG_HOME/nvim/init.vim' | source \\$MYVIMRC"; - }; - - systemPackages = with pkgs; [ + my = { + packages = with pkgs; [ editorconfig-core-c neovim ]; + env.EDITOR = "nvim"; + env.VIMINIT = "let \\$MYVIMRC='\\$XDG_CONFIG_HOME/nvim/init.vim' | source \\$MYVIMRC"; }; } diff --git a/modules/gaming/steam.nix b/modules/gaming/steam.nix index 0b0ddcd3..8af8fed2 100644 --- a/modules/gaming/steam.nix +++ b/modules/gaming/steam.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ + my.packages = with pkgs; [ steam steam-run-native # for GOG or humblebundle games ]; diff --git a/modules/graphics.nix b/modules/graphics.nix new file mode 100644 index 00000000..f0e86d43 --- /dev/null +++ b/modules/graphics.nix @@ -0,0 +1,22 @@ +# It's difficult to be an artist/designer on Linux. I miss adobe and my tablets +# don't work without a lot of heart-ache. I set up a second computer just for +# adobe work (and gaming) to address this, so why do I install these programs on +# linux? Because sometimes I need to do some quick work right there and then. + +{ config, lib, pkgs, ... }: +{ + my.packages = with pkgs; [ + font-manager # so many damned fonts... + + imagemagick # for image manipulation from the shell + aseprite-unfree # pixel art + inkscape # illustrator & indesign + krita # replaces photoshop + gimp # replaces photoshop + gimpPlugins.resynthesizer2 # content-aware scaling in gimp + ]; + + my.home.xdg.configFile = { + "GIMP/2.10" = { source = ; recursive = true; }; + }; +} diff --git a/modules/graphics/aseprite.nix b/modules/graphics/aseprite.nix deleted file mode 100644 index 7de4c35f..00000000 --- a/modules/graphics/aseprite.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - environment.systemPackages = [ - pkgs.aseprite-unfree - ]; -} diff --git a/modules/graphics/blender.nix b/modules/graphics/blender.nix deleted file mode 100644 index cac09a05..00000000 --- a/modules/graphics/blender.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - blender - ]; -} diff --git a/modules/graphics/gimp.nix b/modules/graphics/gimp.nix deleted file mode 100644 index f7aa5937..00000000 --- a/modules/graphics/gimp.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - gimp - gimpPlugins.resynthesizer2 - ]; - - home-manager.users.hlissner.xdg.configFile = { - "GIMP/2.10" = { source = ; recursive = true; }; - }; -} diff --git a/modules/misc/docker.nix b/modules/misc/docker.nix deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/misc/weechat.nix b/modules/misc/weechat.nix deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/music.nix b/modules/music.nix new file mode 100644 index 00000000..6ceef19d --- /dev/null +++ b/modules/music.nix @@ -0,0 +1,39 @@ +# I use spotify for my music needs. Gone are the days where I'd manage 200gb+ of +# local music; most of which I haven't heard or don't even like. + +{ config, lib, pkgs, ... }: +{ + # services.spotifyd doesn't work so we'll have to roll our own spotifyd + + # spotify-tui solution. The dbus interface doesn't work, though, so we have to + # wait for spotify-tui to implement CLI command for controlling spotify + # playback. See https://github.com/Rigellute/spotify-tui/issues/147 or for + # spotifyd to get fixed. + my.packages = with pkgs; [ + unstable.spotifyd + (writeScriptBin "spt" '' + #!${stdenv.shell} + if ! systemctl --user is-active spotifyd >/dev/null; then + systemctl --user start spotifyd + fi + ${unstable.spotify-tui}/bin/spt + '') + + # spotify-tui is fine for selecting and playing music, but incomplete. We + # occasionally still need the official client for more sophisticated search + # and the "made for you" playlists. + spotify + ]; + + systemd.user.services.spotifyd.serviceConfig = + let spotifydConf = pkgs.writeText "spotifyd.conf" '' + [global] + username = g2qwjcs6334oacg1zg9wrihnn + password_cmd = ${pkgs.pass}/bin/pass www/spotify.com | head -n1 + backend = pulseaudio + ''; + in { + ExecStart = "${pkgs.unstable.spotifyd}/bin/spotifyd --no-daemon --cache-path /tmp/spotifyd --config-path ${spotifydConf}"; + Restart = "always"; + RestartSec = 6; + }; +} diff --git a/modules/recording.nix b/modules/recording.nix index a0ecb4d7..7866fff0 100644 --- a/modules/recording.nix +++ b/modules/recording.nix @@ -9,9 +9,7 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - slop # for selecting arbitrary regions on screen - ffmpeg # for recording gifs/mp4s quickly + my.packages = with pkgs; [ audacity # for recording and remastering audio obs-studio # for streaming to twitch/recording for youtube handbrake # for encoding footage diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 723f3558..0986e3c4 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -4,7 +4,7 @@ services.syncthing = { enable = true; openDefaultPorts = true; - user = "hlissner"; + user = config.my.username; configDir = "/home/hlissner/.config/syncthing"; dataDir = "/home/hlissner/sync"; }; diff --git a/modules/shell/direnv.nix b/modules/shell/direnv.nix index 498b4fb4..97dbf08c 100644 --- a/modules/shell/direnv.nix +++ b/modules/shell/direnv.nix @@ -1,8 +1,10 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - direnv - (import {}).lorri - ]; + services.lorri.enable = true; + + my = { + packages = [ pkgs.direnv ]; + zsh.rc = "_cache direnv hook zsh"; + }; } diff --git a/modules/shell/git.nix b/modules/shell/git.nix index ac4a9f67..54ac3824 100644 --- a/modules/shell/git.nix +++ b/modules/shell/git.nix @@ -1,14 +1,16 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - gitAndTools.hub - gitAndTools.diff-so-fancy - ]; - - home.xdg.configFile = { - "git/config".source = ; - "git/ignore".source = ; - "zsh/rc.d/aliases.git.zsh".source = ; + my = { + packages = with pkgs; [ + gitAndTools.hub + gitAndTools.diff-so-fancy + ]; + zsh.rc = lib.readFile ; + # Do recursively, in case git stores files in this folder + home.xdg.configFile = { + "git/config".source = ; + "git/ignore".source = ; + }; }; } diff --git a/modules/shell/gnupg.nix b/modules/shell/gnupg.nix index f9fafe49..e8332052 100644 --- a/modules/shell/gnupg.nix +++ b/modules/shell/gnupg.nix @@ -1,16 +1,13 @@ { config, lib, pkgs, ... }: { - environment = { - extraInit = '' - export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" - mkdir -p "$GNUPGHOME" -m 700 - ''; - - systemPackages = with pkgs; [ + my = { + packages = with pkgs; [ gnupg pinentry ]; + env.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg"; + init = "mkdir -p \"$GNUPGHOME\" -m 700"; }; programs.gnupg.agent = { @@ -23,7 +20,7 @@ ${pkgs.gnupg}/bin/gpg-agent \ --supervised \ --allow-emacs-pinentry \ - --default-cache-ttl 1200 \ + --default-cache-ttl 1800 \ --pinentry-program ${pkgs.pinentry}/bin/pinentry-gtk-2 '' ]; diff --git a/modules/shell/ncmpcpp.nix b/modules/shell/ncmpcpp.nix index 20c811e1..d6f901ba 100644 --- a/modules/shell/ncmpcpp.nix +++ b/modules/shell/ncmpcpp.nix @@ -1,14 +1,19 @@ { config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ + my.packages = with pkgs; [ (ncmpcpp.override { visualizerSupport = true; }) ]; - home.xdg.configFile = { - "zsh/rc.d/aliases.ncmpcpp.zsh".source = ; - "zsh/rc.d/env.ncmpcpp.zsh".source = ; - "ncmpcpp/config".source = ; - "ncmpcpp/bindings".source = ; + my.env.MPD_HOME = "$XDG_CONFIG_HOME/mpd"; + my.env.NCMPCPP_HOME = "$XDG_CONFIG_HOME/ncmpcpp"; + + my.alias.rate = "mpd-rate"; + my.alias.mpcs = "mpc search any"; + my.alias.mpcsp = "mpc searchplay any"; + + my.home.xdg.configFile = { + "ncmpcpp/config".source = ; + "ncmpcpp/bindings".source = ; }; } diff --git a/modules/shell/pass.nix b/modules/shell/pass.nix index c9a309bd..0e2121e4 100644 --- a/modules/shell/pass.nix +++ b/modules/shell/pass.nix @@ -1,14 +1,13 @@ { config, pkgs, lib, ... }: { - environment = { - systemPackages = with pkgs; [ + my = { + packages = with pkgs; [ (pass.withExtensions (exts: [ exts.pass-otp exts.pass-genphrase ])) ]; - - variables.PASSWORD_STORE_DIR = "$HOME/.secrets/password-store"; + env.PASSWORD_STORE_DIR = "$HOME/.secrets/password-store"; }; } diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix index fa3b3d90..b86c941b 100644 --- a/modules/shell/zsh.nix +++ b/modules/shell/zsh.nix @@ -1,24 +1,23 @@ { config, pkgs, libs, ... }: { - environment = { - systemPackages = with pkgs; [ + my = { + packages = with pkgs; [ zsh nix-zsh-completions - fasd bat exa + fasd fd fzf - tmux htop - tree tldr + tree ]; - variables = { - ZDOTDIR = "$XDG_CONFIG_HOME/zsh"; - ZSH_CACHE = "$XDG_CACHE_HOME/zsh"; - }; + env.ZDOTDIR = "$XDG_CONFIG_HOME/zsh"; + env.ZSH_CACHE = "$XDG_CACHE_HOME/zsh"; + + home.xdg.configFile."zsh" = { source = ; recursive = true; }; }; programs.zsh = { @@ -27,13 +26,4 @@ enableGlobalCompInit = false; # I'll do it myself promptInit = ""; }; - - home.xdg.configFile = { - # link recursively so other modules can link files in this folder, - # particularly in zsh/rc.d/*.zsh - "zsh" = { - source = ; - recursive = true; - }; - }; } diff --git a/themes/aquanaut/README.md b/modules/themes/aquanaut/README.md similarity index 100% rename from themes/aquanaut/README.md rename to modules/themes/aquanaut/README.md diff --git a/themes/aquanaut/Xresources b/modules/themes/aquanaut/Xresources similarity index 100% rename from themes/aquanaut/Xresources rename to modules/themes/aquanaut/Xresources diff --git a/themes/aquanaut/bspwmrc b/modules/themes/aquanaut/bspwmrc similarity index 100% rename from themes/aquanaut/bspwmrc rename to modules/themes/aquanaut/bspwmrc diff --git a/modules/themes/aquanaut/default.nix b/modules/themes/aquanaut/default.nix new file mode 100644 index 00000000..65f624d0 --- /dev/null +++ b/modules/themes/aquanaut/default.nix @@ -0,0 +1,82 @@ +# We trained for this. The waves shudder and glare at me through its bright +# tapestry. The clouds see me off as gravity lures me in lazily. How long have I +# been down here? I imagined Jenny leading the team back on a rescue mission and +# it upsets me. It was not worth the risk. We knew what we signed up for. +# +# I hear glass crack. The sea depths hold my waist in a vice. Its strength +# squeezing between the kelvar pockets of my suit. It's hard to breathe. If I +# cut off the oxygen supply perhaps it'd be a nicer way to go. +# +# When did I get so creative? +# +# I can't see further than three feet. Snowflake fractures creep along my visor. +# Would Jorgen be relieved to have a dorm bunk to himself? HQ packs us into our +# subs like sardines. I'll miss his snoring. Maybe I'll catch up on all that +# missed sleep. + +{ config, pkgs, ... }: +{ + imports = [ ../. ]; # Load framework for themes + + theme.wallpaper = ./wallpaper.jpg; + + services.compton = { + activeOpacity = "0.96"; + inactiveOpacity = "0.75"; + settings = { + blur-background = true; + blur-background-frame = true; + blur-background-fixed = true; + blur-kern = "7x7box"; + blur-strength = 340; + }; + }; + + services.xserver.displayManager.lightdm = { + greeters.mini.extraConfig = '' + text-color = "#bbc2cf" + password-background-color = "#29323d" + window-color = "#0b1117" + border-color = "#0b1117" + ''; + }; + + fonts.fonts = [ pkgs.nerdfonts ]; + my.packages = with pkgs; [ + nordic + paper-icon-theme # for rofi + ]; + my.home.xdg.configFile = { + "bspwm/rc.d/polybar".source = ./polybar/run.sh; + "bspwm/rc.d/theme".source = ./bspwmrc; + "dunst/dunstrc".source = ./dunstrc; + "polybar" = { source = ./polybar; recursive = true; }; + "rofi/theme".source = ./rofi; + "tmux/theme".source = ./tmux.conf; + "xtheme/90-theme".source = ./Xresources; + "zsh/prompt.zsh".source = ./zsh/prompt.zsh; + # GTK + "gtk-3.0/settings.ini".text = '' + [Settings] + gtk-theme-name=Nordic-blue + gtk-icon-theme-name=Paper + gtk-fallback-icon-theme=gnome + gtk-application-prefer-dark-theme=true + gtk-cursor-theme-name=Paper + gtk-xft-hinting=1 + gtk-xft-hintstyle=hintfull + gtk-xft-rgba=none + ''; + # GTK2 global theme (widget and icon theme) + "gtk-2.0/gtkrc".text = '' + gtk-theme-name="Nordic-blue" + gtk-icon-theme-name="Paper-Mono-Dark" + gtk-font-name="Sans 10" + ''; + # QT4/5 global theme + "Trolltech.conf".text = '' + [Qt] + style=Nordic-blue + ''; + }; +} diff --git a/themes/aquanaut/dunstrc b/modules/themes/aquanaut/dunstrc similarity index 100% rename from themes/aquanaut/dunstrc rename to modules/themes/aquanaut/dunstrc diff --git a/themes/aquanaut/polybar/config b/modules/themes/aquanaut/polybar/config similarity index 100% rename from themes/aquanaut/polybar/config rename to modules/themes/aquanaut/polybar/config diff --git a/themes/aquanaut/polybar/modules/redshift b/modules/themes/aquanaut/polybar/modules/redshift similarity index 100% rename from themes/aquanaut/polybar/modules/redshift rename to modules/themes/aquanaut/polybar/modules/redshift diff --git a/themes/aquanaut/polybar/run.sh b/modules/themes/aquanaut/polybar/run.sh similarity index 100% rename from themes/aquanaut/polybar/run.sh rename to modules/themes/aquanaut/polybar/run.sh diff --git a/themes/aquanaut/rofi/appmenu.rasi b/modules/themes/aquanaut/rofi/appmenu.rasi similarity index 100% rename from themes/aquanaut/rofi/appmenu.rasi rename to modules/themes/aquanaut/rofi/appmenu.rasi diff --git a/themes/aquanaut/rofi/browsermenu.rasi b/modules/themes/aquanaut/rofi/browsermenu.rasi similarity index 100% rename from themes/aquanaut/rofi/browsermenu.rasi rename to modules/themes/aquanaut/rofi/browsermenu.rasi diff --git a/themes/aquanaut/rofi/config.rasi b/modules/themes/aquanaut/rofi/config.rasi similarity index 100% rename from themes/aquanaut/rofi/config.rasi rename to modules/themes/aquanaut/rofi/config.rasi diff --git a/modules/themes/aquanaut/rofi/filemenu.rasi b/modules/themes/aquanaut/rofi/filemenu.rasi new file mode 100644 index 00000000..129e8262 --- /dev/null +++ b/modules/themes/aquanaut/rofi/filemenu.rasi @@ -0,0 +1,3 @@ +/* -*- mode: css; -*- */ + +@import "appmenu.rasi" diff --git a/themes/aquanaut/rofi/passmenu.rasi b/modules/themes/aquanaut/rofi/passmenu.rasi similarity index 100% rename from themes/aquanaut/rofi/passmenu.rasi rename to modules/themes/aquanaut/rofi/passmenu.rasi diff --git a/modules/themes/aquanaut/rofi/powermenu.rasi b/modules/themes/aquanaut/rofi/powermenu.rasi new file mode 100644 index 00000000..697904e4 --- /dev/null +++ b/modules/themes/aquanaut/rofi/powermenu.rasi @@ -0,0 +1,28 @@ +/** -*- mode: css; -*- + * This theme is intended for a 5 items wide menu on a 1920x1080 pixels resolution. + * You may have to tweak values such as the window padding if you have a different resolution. + */ +@import "appmenu.rasi" + +#element { + padding: 30px; + background-color: @background-light; +} +#element.selected { + background-color: @accent; + text-color: @background; +} +#window { + /* padding: @option-5-window-padding; */ +} +#listview { + /* spacing: @option-5-listview-spacing; */ + /* lines: 5; */ + columns: 1; +} +#window { + children: [ horibox ]; +} +#horibox { + children: [ listview ]; +} diff --git a/themes/aquanaut/rofi/windowmenu.rasi b/modules/themes/aquanaut/rofi/windowmenu.rasi similarity index 100% rename from themes/aquanaut/rofi/windowmenu.rasi rename to modules/themes/aquanaut/rofi/windowmenu.rasi diff --git a/modules/themes/aquanaut/tmux.conf b/modules/themes/aquanaut/tmux.conf new file mode 100644 index 00000000..28e1b90d --- /dev/null +++ b/modules/themes/aquanaut/tmux.conf @@ -0,0 +1,60 @@ +# -- THEME ------------------------------- + +# The statusbar +set -g status-position bottom +set -g status-justify centre +set -g status-bg default +set -g status-fg colour15 +set -g status-interval 10 +set -g status-attr dim +# set -g status-left '#[fg=colour236]_________________________' +set -g status-left '#[fg=colour236]―――――――――――――――――――――――――' +# set -g status-right "#[fg=colour236]#{prefix_highlight} #[fg=colour5] #S #[fg=colour236]──" +# set -g status-right '#[fg=colour236]_________________________' +set -g status-right '#[fg=colour236]―――――――――――――――――――――――――' +set -g status-right-length 12 +set -g status-left-length 12 + +# The messages +set -g message-fg colour4 +set -g message-bg colour237 +set -g message-command-fg blue +set -g message-command-bg black + +# loud or quiet? +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity on +set-option -g bell-action none + +# The modes +setw -g clock-mode-colour colour135 +setw -g mode-attr bold +setw -g mode-fg colour196 +setw -g mode-bg colour238 + +# The panes +set -g pane-border-fg colour235 +# set -g pane-border-bg default +set -g pane-active-border-fg colour5 +# set -g pane-active-border-bg default + +setw -g window-status-current-fg colour2 +setw -g window-status-current-bg default +# setw -g window-status-current-attr none +setw -g window-status-current-format ' #W ' + +setw -g window-status-fg colour236 +setw -g window-status-bg default +setw -g window-status-attr none +# setw -g window-status-format '#[fg=colour8] #I #[fg=default]#W ' +setw -g window-status-format ' #W ' + +setw -g window-status-activity-bg default +setw -g window-status-activity-fg colour240 +setw -g window-status-activity-attr none + +setw -g window-status-bell-attr bold +setw -g window-status-bell-fg colour255 +setw -g window-status-bell-bg colour1 diff --git a/themes/aquanaut/wallpaper.jpg b/modules/themes/aquanaut/wallpaper.jpg similarity index 100% rename from themes/aquanaut/wallpaper.jpg rename to modules/themes/aquanaut/wallpaper.jpg diff --git a/themes/aquanaut/zsh/prompt.zsh b/modules/themes/aquanaut/zsh/prompt.zsh similarity index 100% rename from themes/aquanaut/zsh/prompt.zsh rename to modules/themes/aquanaut/zsh/prompt.zsh diff --git a/themes/default.nix b/modules/themes/default.nix similarity index 78% rename from themes/default.nix rename to modules/themes/default.nix index 886fc56d..b715bbd8 100644 --- a/themes/default.nix +++ b/modules/themes/default.nix @@ -1,16 +1,17 @@ { config, lib, pkgs, ... }: { - environment.variables = { + imports = [ ]; + + # Try really hard to get QT to respect my GTK theme. + my.env = { GTK_DATA_PREFIX = [ "${config.system.path}" ]; QT_QPA_PLATFORMTHEME = "gtk2"; }; - qt5 = { style = "gtk2"; platformTheme = "gtk2"; }; - services.xserver.displayManager.sessionCommands = '' export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" source "$XDG_CONFIG_HOME"/xsession/*.sh diff --git a/modules/misc/virtualbox.nix b/modules/vm.nix similarity index 55% rename from modules/misc/virtualbox.nix rename to modules/vm.nix index f54e3692..47200d11 100644 --- a/modules/misc/virtualbox.nix +++ b/modules/vm.nix @@ -1,8 +1,11 @@ -{ config, lib, pkgs, ... }: +# For testing software or building my games for other OSes +{ config, lib, pkgs, ... }: { virtualisation.virtualbox.host = { enable = true; enableExtensionPack = true; }; + + my.user.extraGroups = [ "vboxusers" ]; } diff --git a/modules/graphics/krita.nix b/options/linode.nix similarity index 100% rename from modules/graphics/krita.nix rename to options/linode.nix diff --git a/options/my.nix b/options/my.nix new file mode 100644 index 00000000..7f020ca8 --- /dev/null +++ b/options/my.nix @@ -0,0 +1,84 @@ +{ config, options, lib, utils, pkgs, ... }: + +with lib; +{ + imports = [ ]; + + options.my = { + username = mkOption { + type = types.str; + default = "hlissner"; + }; + + home = mkOption { + type = options.home-manager.users.type.functor.wrapped; + default = {}; + }; + + user = mkOption { + type = types.submodule; + default = {}; + description = "My users.users.NAME submodule"; + }; + + env = mkOption { + type = with types; attrsOf (either (either str path) (listOf (either str path))); + default = {}; + description = "..."; + apply = mapAttrs + (n: v: if isList v + then concatMapStringsSep ":" (x: toString x) v + else (toString v)); + }; + + alias = mkOption { + type = with types; nullOr (attrsOf (nullOr (either str path))); + default = {}; + description = "..."; + }; + + packages = mkOption { + type = types.listOf types.package; + default = []; + description = "The set of packages to appear in the user environment."; + }; + + init = mkOption { + type = types.lines; + default = ""; + description = "..."; + }; + + zsh = { + rc = mkOption { + type = types.lines; + default = ""; + description = "..."; + }; + env = mkOption { + type = types.lines; + default = ""; + description = "..."; + }; + }; + }; + + config = { + users.users.${config.my.username} = mkAliasDefinitions options.my.user; + home-manager.users.${config.my.username} = mkAliasDefinitions options.my.home; + + my.user.packages = config.my.packages; + my.env.PATH = [ "$PATH" ]; + + environment.shellAliases = config.my.alias; + environment.extraInit = + let exportLines = mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.my.env; + in '' + ${concatStringsSep "\n" exportLines} + ${config.my.init} + ''; + + my.home.xdg.configFile."zsh/extra.zshrc".text = config.my.zsh.rc; + my.home.xdg.configFile."zsh/extra.zshenv".text = config.my.zsh.env; + }; +} diff --git a/options/theme.nix b/options/theme.nix new file mode 100644 index 00000000..36228f9a --- /dev/null +++ b/options/theme.nix @@ -0,0 +1,29 @@ +{ config, options, lib, pkgs, ... }: + +with lib; +{ + options.theme = { + wallpaper = mkOption { + type = with types; nullOr (either str path); + default = null; + description = "The wallpaper to use"; + }; + + # TODO Colors? + }; + + config = { + # Set up wallpaper and blur/darken it for lock/login screen + my.home.home.file.".background-image".source = config.theme.wallpaper; + services.xserver.displayManager.lightdm.background = + let blurredWallpaper = + with pkgs; runCommand "blurWallpaper" + { buildInputs = [ imagemagick ]; } '' + mkdir "$out" + convert -gaussian-blur 0x2 -modulate 70 -level 5% \ + ${config.theme.wallpaper} $out/wallpaper.blurred.png + ''; + in mkIf (config.theme.wallpaper != null) + "${blurredWallpaper}/wallpaper.blurred.png"; + }; +} diff --git a/secrets.nix.gpg b/secrets.nix.gpg new file mode 100644 index 00000000..9b0f3649 Binary files /dev/null and b/secrets.nix.gpg differ diff --git a/settings.nix b/settings.nix deleted file mode 100644 index a1ce6be5..00000000 --- a/settings.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ config, options, lib, utils, pkgs, ... }: - -with lib; -{ - imports = [ - - ]; - - options = { - username = mkOption { - type = types.str; - default = "hlissner"; - description = "My username"; - }; - - home = mkOption { - type = options.home-manager.users.type.functor.wrapped; - default = {}; - description = "Home-manager configuration for my user"; - }; - - # TODO - # paths = mkOption { - # type = types.listOf types.path; - # default = []; - # description = "Custom PATH entries"; - # }; - - my = mkOption { - type = types.listOf types.functor; - default = []; - description = "Nix config helpers"; - }; - }; - - config = { - home-manager.users = { - ${config.username} = mkAliasDefinitions options.home; - }; - - # environment.extraInit = '' - # export PATH="${lib.concatStringsSep ":" (map builtins.toString config.paths)}:$PATH" - # ''; - }; -} diff --git a/themes/aquanaut/default.nix b/themes/aquanaut/default.nix deleted file mode 100644 index 401c54cd..00000000 --- a/themes/aquanaut/default.nix +++ /dev/null @@ -1,91 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ ../. ]; # Load framework for themes - - environment.systemPackages = with pkgs; [ - nordic - paper-icon-theme # for rofi - ]; - - fonts.fonts = [ pkgs.nerdfonts ]; - - services.compton = { - backend = "glx"; - activeOpacity = "0.96"; - inactiveOpacity = "0.75"; - opacityRules = [ - "100:class_g = 'Firefox'" - "100:class_g = 'Gimp'" - "100:class_g = 'inkscape'" - "100:class_g = 'aseprite'" - "100:class_g = 'krita'" - "100:class_g = 'Peek'" - "100:class_g = 'feh'" - "100:class_g = 'mpv'" - ]; - settings = { - blur-background = true; - blur-background-frame = true; - blur-background-fixed = true; - blur-kern = "7x7box"; - blur-strength = 340; - blur-background-exclude = [ - "window_type = 'dock'" - "window_type = 'desktop'" - "class_g = 'Peek'" - "_GTK_FRAME_EXTENTS@:c" - ]; - }; - }; - - services.xserver.displayManager.lightdm = { - background = "${./wallpaper.blurred.jpg}"; - greeters.mini.extraConfig = '' - text-color = "#bbc2cf" - password-background-color = "#29323d" - window-color = "#0b1117" - border-color = "#0b1117" - ''; - }; - - home = { - home.file.".background-image".source = ./wallpaper.jpg; - - xdg.configFile = { - "xtheme/90-theme".source = ./Xresources; - "dunst/dunstrc".source = ./dunstrc; - "bspwm/rc.d/theme".source = ./bspwmrc; - "bspwm/rc.d/polybar".source = ./polybar/run.sh; - "polybar" = { source = ./polybar; recursive = true; }; - "rofi/theme" = { source = ./rofi; recursive = true; }; - "zsh/prompt.zsh".source = ./zsh/prompt.zsh; - - # GTK - "gtk-3.0/settings.ini".text = '' - [Settings] - gtk-theme-name=Nordic-blue - gtk-icon-theme-name=Paper - gtk-fallback-icon-theme=gnome - gtk-application-prefer-dark-theme=true - gtk-cursor-theme-name=Paper - gtk-xft-hinting=1 - gtk-xft-hintstyle=hintfull - gtk-xft-rgba=none - ''; - - # GTK2 global theme (widget and icon theme) - "gtk-2.0/gtkrc".text = '' - gtk-theme-name="Nordic-blue" - gtk-icon-theme-name="Paper-Mono-Dark" - gtk-font-name="Sans 10" - ''; - - # QT4/5 global theme - "Trolltech.conf".text = '' - [Qt] - style=Nordic-blue - ''; - }; - }; -} diff --git a/themes/aquanaut/wallpaper.blurred.jpg b/themes/aquanaut/wallpaper.blurred.jpg deleted file mode 100644 index da683b3f..00000000 Binary files a/themes/aquanaut/wallpaper.blurred.jpg and /dev/null differ diff --git a/themes/pianocat/README.md b/themes/pianocat/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/themes/pianocat/Xresources b/themes/pianocat/Xresources deleted file mode 100644 index 80f61943..00000000 --- a/themes/pianocat/Xresources +++ /dev/null @@ -1,66 +0,0 @@ -!! Colors -#define blk #21242b -#define bblk #969896 -#define red #cc6666 -#define bred #de935f -#define grn #b5bd68 -#define bgrn #757d28 -#define ylw #f0c674 -#define bylw #f9a03f -#define blu #81a2be -#define bblu #2a8fed -#define mag #b294bb -#define bmag #bc77a8 -#define cyn #8abeb7 -#define bcyn #a3685a -#define wht #c5c8c6 -#define bwht #ffffff -#define bg blk -#define fg wht - -*.foreground: fg -*.background: bg -*.cursorColor: mag - -*.color0: blk -*.color8: bblk -*.color1: red -*.color9: bred -*.color2: grn -*.color10: bgrn -*.color3: ylw -*.color11: bylw -*.color4: blu -*.color12: bblu -*.color5: mag -*.color13: bmag -*.color6: cyn -*.color14: bcyn -*.color7: wht -*.color15: bwht - -! greys -*.color234: #1d2021 -*.color235: #282828 -*.color236: #32302f -*.color237: #3c3836 -*.color239: #504945 -*.color240: #544c49 -*.color241: #665c54 - - -!! Fonts -st.font: Fira Code:pixelsize=13 -rofi.font: Fira Code 15 - - -!! Rofi -rofi.padding: 12 -! bg fg bgalt hlbg hlfg -rofi.color-normal: argb:00292d35, #bbc2cf, #292d35, #141411, #f8f8f2 -rofi.color-urgent: argb:00292d35, #bbc2cf, #292d35, #f92672, #f8f8f2 -rofi.color-active: argb:00292d35, #bbc2cf, #292d35, #141411, #a6e22a -! bg border sep -rofi.color-window: argb:ee292d35, argb:00bbc2cf, #292d35 -! Separator style (none, dash, solid) -rofi.separator-style: solid diff --git a/themes/pianocat/default.nix b/themes/pianocat/default.nix deleted file mode 100644 index eed74e8b..00000000 --- a/themes/pianocat/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ ../. ]; # Load framework for themes - - environment.systemPackages = with pkgs; [ arc-theme ]; - - home = { - home.file.".background-image".source = ./wallpaper.jpg; - - xdg.configFile = { - "xtheme/90-theme".source = ./Xresources; - "dunst/dunstrc".source = ./dunstrc; - - # GTK - "gtk-3.0/settings.ini".text = '' - [Settings] - gtk-theme-name=Arc-Dark - gtk-icon-theme-name=Arc-Dark - gtk-fallback-icon-theme=gnome - gtk-application-prefer-dark-theme=true - gtk-cursor-theme-name=Numix - gtk-xft-hinting=1 - gtk-xft-hintstyle=hintfull - gtk-xft-rgba=none - ''; - - # GTK2 global theme (widget and icon theme) - "gtk-2.0/gtkrc".text = '' - gtk-theme-name="Arc-Dark" - gtk-icon-theme-name="adwaita" - gtk-font-name="Sans 10" - ''; - - # QT4/5 global theme - "Trolltech.conf".text = '' - [Qt] - style=Arc-Dark - ''; - }; - }; -} diff --git a/themes/pianocat/dunstrc b/themes/pianocat/dunstrc deleted file mode 100644 index cbbcb0f7..00000000 --- a/themes/pianocat/dunstrc +++ /dev/null @@ -1,57 +0,0 @@ -[global] -alignment = left -markup = full -bounce_freq = 0 -browser = firefox -new-tab -dmenu = rofi -dmenu -p dunst: -follow = none -font = Fira Code 14 -# font = Misc Tamsyn 12 -format = "%s\n%b" -# geometry [{width}]x{height}][+/-{x}+/-{y}] -geometry = "365x15-21+21" -history_length = 20 -horizontal_padding = 16 -idle_threshold = 120 -ignore_newline = no -indicate_hidden = yes -line_height = 0 -monitor = 0 -padding = 12 -separator_color = "#18191b" -separator_height = 2 -show_age_threshold = 60 -show_indicators = yes -shrink = no -sort = yes -startup_notification = false -sticky_history = yes -transparency = 1 -word_wrap = yes -max_icon_size = 64 -# Align icons left/right/off -icon_position = right -# Paths to default icons. -icon_path = /usr/share/icons/hicolor/32x32/apps/:/usr/share/icons/Adwaita/32x32/actions/ -frame_width = 0 -frame_color = "#131416" - -[shortcuts] -context = ctrl+shift+period - -[urgency_low] -# IMPORTANT: colors have to be defined in quotation marks. -# Otherwise the "#" and following would be interpreted as a comment. -background = "#0a0b0c" -foreground = "#b5bd68" -timeout = 8 - -[urgency_normal] -background = "#b5bd68" -foreground = "#131416" -timeout = 14 - -[urgency_critical] -background = "#cc6666" -foreground = "#131416" -timeout = 0 diff --git a/themes/pianocat/polybar/config b/themes/pianocat/polybar/config deleted file mode 100644 index d5de865b..00000000 --- a/themes/pianocat/polybar/config +++ /dev/null @@ -1,336 +0,0 @@ -[colors] -bg = ${xrdb:background} -fg = ${xrdb:foreground} -black = ${xrdb:color0} -bblack = ${xrdb:color8} -red = ${xrdb:color1} -bred = ${xrdb:color9} -green = ${xrdb:color2} -bgreen = ${xrdb:color10} -yellow = ${xrdb:color3} -byellow = ${xrdb:color11} -blue = ${xrdb:color4} -bblue = ${xrdb:color12} -magenta = ${xrdb:color5} -bmagenta = ${xrdb:color13} -cyan = ${xrdb:color6} -bcyan = ${xrdb:color14} -white = ${xrdb:color7} -bwhite = ${xrdb:color15} - -bg-alt = #0F1013 -fg-alt = #25282a -icons = #555856 -alert = ${colors.red} - -[global/wm] -margin-top = 0 -margin-bottom = 24 - -[bar/main] -monitor = ${env:MONITOR} -monitor-strict = true -enable-ipc = true -wm-restack = bspwm -# REQUIRED to move the window with hideit.sh -override-redirect = true - -background = -foreground = ${colors.fg} - -width = 100% -height = 24 -offset-x = 0 -offset-y = 8 -bottom = 1 - -overline-size = 0 -overline-color = #f00 -underline-size = 0 -underline-color = #00f - -border-bottom-size = 0 - -padding-left = 2 -padding-right = 2 -module-margin-left = 0 -module-margin-right = 0 - -font-0 = "Fira Code:pixelsize=9;2" -font-1 = "Wuncon Siji:pixelsize=12;2" -font-2 = "Siji:pixelsize=10;2" - -; modules-left = volume pad cpu memory pad pkg mail -modules-left = volume pad cpu memory -modules-center = bspwm -; modules-right = battery wlan app-rslsync app-redshift pad date -modules-right = battery wlan app-redshift pad date - -;tray-position = center -;tray-padding = 2 -;tray-transparent = true -;tray-background = #0063ff - -[module/bspwm] -type = internal/bspwm -pin-workspaces = true -enable-click = true - -ws-icon-0 = 1; -ws-icon-1 = 2; -ws-icon-2 = 3; -ws-icon-3 = 4; -ws-icon-4 = 5; -ws-icon-default = x - -format = -label-padding = 1 - -label-focused = %icon% -label-focused-background = #33000000 -label-focused-foreground = ${colors.green} -; label-focused-underline = ${colors.magenta} -; label-focused-foreground = ${xrdb:color2} -label-focused-padding = 1 - -label-occupied = %icon% -label-occupied-foreground = ${colors.icons} -label-occupied-padding = 1 - -; label-urgent = %icon% -label-urgent-foreground = ${colors.red} -; label-urgent-background = ${colors.alert} -label-urgent-padding = 1 - -label-empty = %icon% -label-empty-foreground = ${colors.fg-alt} -label-empty-padding = 1 - -[module/date] -type = internal/date -interval = 5 - -label = %date% %time% -date = %A, %h %d -date-alt = %Y-%m-%d -time = %I:%M %p -time-alt = %H:%M:%S -format-prefix = "" -format-prefix-padding = 1 -; format-prefix-background = ${colors.bg-alt} -format-prefix-foreground = ${colors.icons} -; format-underline = ${xrdb:color4} - -[module/xwindow] -type = internal/xwindow -label = %title:0:80:...% -label-padding-left = 2 - -; [module/mpd] -; type = internal/mpd -; host = /home/hlissner/.config/mpd/mpd.sock -; -; format-online = -; format-padding = 5 -; -; label-song-maxlen = 45 -; label-song-ellipsis = true -; -; icon-prev =  -; icon-seekb =  -; icon-stop =  -; icon-play =  -; icon-pause =  -; icon-next =  -; icon-seekf =  -; -; icon-random =  -; icon-repeat =  -; -; toggle-on-foreground = ${colors.fg} -; toggle-off-foreground = #66 - -[module/cpu] -type = internal/cpu -interval = 2 -format = -format-prefix = "" -format-foreground = ${colors.icons} -; format-underline = #f90000 -; label = %percentage%% -format-padding = 1 - -bar-load-indicator = -bar-load-width = 6 -bar-load-foreground-0 = ${colors.green} -bar-load-foreground-1 = ${colors.green} -bar-load-foreground-2 = ${colors.yellow} -bar-load-foreground-3 = ${colors.red} -bar-load-foreground-4 = ${colors.red} -bar-load-fill = | -bar-load-empty = ¦ -bar-load-empty-foreground = ${colors.fg-alt} - -[module/memory] -type = internal/memory -interval = 3 -format = -format-prefix = "" -format-prefix-foreground = ${colors.icons} -; format-underline = #4bffdc -; label = %percentage_used%% -format-padding-left = 1 - -; Only applies if is used -bar-used-indicator = -bar-used-width = 6 -bar-used-foreground-0 = ${colors.green} -bar-used-foreground-1 = ${colors.green} -bar-used-foreground-2 = ${colors.yellow} -bar-used-foreground-3 = ${colors.red} -bar-used-foreground-4 = ${colors.red} -bar-used-fill = | -bar-used-empty = ¦ -bar-used-empty-foreground = ${colors.fg-alt} - -[module/wlan] -type = internal/network -interface = ${env:WLP:wlp3s0} -interval = 3.0 - -format-connected = -format-disconnected = ! -format-disconnected-foreground = ${colors.red} - -; label-connected = -; label-disconnected = ! -; label-disconnected-foreground = ${colors.red} - -ramp-signal-0 =  -ramp-signal-0-foreground = ${colors.yellow} -ramp-signal-1 =  -ramp-signal-1-foreground = ${colors.yellow} -ramp-signal-2 =  -ramp-signal-2-foreground = ${colors.yellow} -ramp-signal-3 =  -ramp-signal-3-foreground = ${colors.icons} -ramp-signal-4 =  -ramp-signal-4-foreground = ${colors.icons} - -; [module/eth] -; type = internal/network -; interface = ${env:ETH:enp2s0} -; interval = 4.0 -; -; ; format-connected-underline = #55aa55 -; ; format-connected-prefix = " " -; format-connected-foreground-foreground = ${colors.fg-alt} -; label-connected = %local_ip% -; -; format-disconnected-underline = ${self.format-connected-underline} -; label-disconnected = %ifname% disconnected -; label-disconnected-foreground = ${colors.fg-alt} - -[module/volume] -type = internal/volume - -; format-volume = -format-volume = -; label-volume = " " -label-volume-foreground = ${colors.fg} - -; format-muted-prefix = " " -format-muted-foreground = ${colors.red} -label-muted =  - -bar-volume-width = 8 -bar-volume-foreground-0 = ${colors.blue} -bar-volume-foreground-1 = ${colors.blue} -bar-volume-foreground-2 = ${colors.blue} -bar-volume-foreground-3 = ${colors.blue} -bar-volume-foreground-4 = ${colors.blue} -bar-volume-foreground-5 = ${colors.blue} -bar-volume-foreground-6 = ${colors.blue} -bar-volume-gradient = false -bar-volume-indicator = | -bar-volume-indicator-font = 2 -bar-volume-indicator-foreground = #ff -bar-volume-fill = ─ -bar-volume-fill-font = 2 -bar-volume-empty = ─ -bar-volume-empty-font = 2 -bar-volume-empty-foreground = ${colors.fg-alt} - -; Only applies if is used -ramp-volume-0 =  -ramp-volume-1 =  -ramp-volume-2 =  - -[module/battery] -type = internal/battery -battery = BAT0 -adapter = ADP1 -full-at = 98 - -format-charging = -format-charging-underline = #ffb52a - -format-discharging = -format-discharging-underline = ${self.format-charging-underline} - -format-full-prefix = " " -format-full-prefix-foreground = ${colors.fg-alt} -format-full-underline = ${self.format-charging-underline} - -ramp-capacity-0 =  -ramp-capacity-1 =  -ramp-capacity-2 =  -ramp-capacity-foreground = ${colors.fg-alt} - -animation-charging-0 =  -animation-charging-1 =  -animation-charging-2 =  -animation-charging-foreground = ${colors.fg-alt} -animation-charging-framerate = 750 - - -;===================================================== -; Custom scripts -;===================================================== - -[module/pad] -type = custom/text -content = " " -content-foreground = ${colors.fg-alt} - -[module/pkg] -type = custom/ipc -hook-0 = ~/.config/polybar/modules/updates -initial = 1 -click-left = polybar-msg -p %pid% hook pkg 1 -format-padding = 1 - -[module/mail] -type = custom/ipc -hook-0 = ~/.config/polybar/modules/mail -initial = 1 -click-left = polybar-msg -p %pid% hook mail 1 -format-padding-right = 1 - -[module/app-redshift] -type = custom/script -exec = echo 1 -exec-if = pgrep -x redshift -format = "" -format-foreground = ${colors.icons} -interval = 2 - -[module/app-rslsync] -type = custom/script -exec = echo 1 -exec-if = pgrep -x rslsync -format = "" -format-foreground = ${colors.icons} -interval = 60 - -; vim:ft=dosini diff --git a/themes/pianocat/polybar/modules/app-redshift b/themes/pianocat/polybar/modules/app-redshift deleted file mode 100755 index 7733a7fc..00000000 --- a/themes/pianocat/polybar/modules/app-redshift +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -# Specifying the icon(s) in the script -# This allows us to change its appearance conditionally -pgrep -x redshift &> /dev/null -if [[ $? -eq 0 ]]; then - temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3) - temp=${temp//K/} -fi - -# OPTIONAL: Append ' ${temp}K' after $icon -if [[ -z $temp ]]; then - echo "%{F#65737E}$icon" # Greyed out (not running) -elif [[ $temp -ge 5000 ]]; then - echo "%{F#8FA1B3}$icon" # Blue -elif [[ $temp -ge 4000 ]]; then - echo "%{F#EBCB8B}$icon" # Yellow -else - echo "%{F#D08770}$icon" # Orange -fi - diff --git a/themes/pianocat/polybar/modules/app-rslsync b/themes/pianocat/polybar/modules/app-rslsync deleted file mode 100755 index 043f678c..00000000 --- a/themes/pianocat/polybar/modules/app-rslsync +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -icon="" - -if pgrep -x rslsync &> /dev/null; then - echo "%{F#e5e8e6}$icon" -else - echo "%{F#65737E}$icon" -fi diff --git a/themes/pianocat/polybar/modules/mail b/themes/pianocat/polybar/modules/mail deleted file mode 100755 index 7242afb3..00000000 --- a/themes/pianocat/polybar/modules/mail +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 - -import imaplib -import os -import sys -import socket -from subprocess import Popen - -CONFIG_FILE = os.path.expanduser("~/.secrets/email") -CACHE_FILE = "/tmp/polybar-mail" -ICON = "" - -try: - import gnupg - from pathlib import Path -except ImportError: - print("%{{F{}}}*".format("#555856", ICON)) - sys.exit(1) - - -# -def internet_is_on(): - try: - host = socket.gethostbyname("www.google.com") - socket.create_connection((host, 80), 2) - return True - except: - pass - return False - - -def unread_count(address, password): - imap = imaplib.IMAP4_SSL('imap.gmail.com', 993) - imap.login(address, password) - imap.select('INBOX') - - status, resp = imap.search(None, 'UNSEEN') - imap.close() - imap.logout() - - return len(resp[0].split()) - - -def ding(): - Popen(["{}/bin/ding".format(os.getenv("DOTFILES", os.expanduser("~/.dotfiles")))]) - -# -def main(): - try: - if not internet_is_on(): - raise IOError("Internet is off") - - secrets = Path(CONFIG_FILE) - if not secrets.exists(): - raise IOError("Can't find secrets") - - gpg = gnupg.GPG() - gpgdata = gpg.decrypt(secrets.read_bytes()) - if not gpgdata.ok: - raise IOError("Couldn't decrypt secrets: {}".format(gpgdata.status)) - accounts = [line.split(':') for line in gpgdata.data.decode('utf-8').strip().split('\n')] - - last_total = 0 - cache = Path(CACHE_FILE) - if cache.exists(): - cache_text = cache.read_text() - last_total = int(cache.read_text()) - - total = 0 - for addr, pwd in accounts: - total += unread_count(addr, pwd) - - if total != last_total: - ding() - if total != 0: - print("%{{F{}}}{}{}".format("#f0c674", ICON, total)) - else: - print("%{{F{}}}{}".format("#555856", ICON)) - - cache.write_text(str(total)) - except IOError as e: - print("ERROR: {}".format(e), file=sys.stderr) - print("%{{F{}}}{}!".format("#cc6666", ICON)) - sys.exit(1) - - -# -if __name__ == '__main__': - if sys.argv[1:]: - print("%{{F{}}}{}".format("#555856", ICON)) - else: - main() diff --git a/themes/pianocat/polybar/run.sh b/themes/pianocat/polybar/run.sh deleted file mode 100755 index 528a069a..00000000 --- a/themes/pianocat/polybar/run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -killall -q polybar -while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done - -polybar main >>$XDG_DATA_HOME/polybar.log 2>&1 & -echo 'Polybar launched...' \ No newline at end of file diff --git a/themes/pianocat/wallpaper.jpg b/themes/pianocat/wallpaper.jpg deleted file mode 100644 index 55828e24..00000000 Binary files a/themes/pianocat/wallpaper.jpg and /dev/null differ