From 111c824354016ccb686d7e7bddb082126e2d8b2b Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 9 Oct 2020 22:42:12 -0500 Subject: [PATCH 1/4] Add initial nixos configuration --- apps/kitty/kitty.conf | 2 +- bin/floating-term | 2 +- bin/is_wayland | 3 +- bin/launch | 2 +- env/laptop/hardware.nix | 32 +++++++++++++ env/laptop/sway/config.d/main | 7 +-- env/nix/personal-machine.nix | 88 +++++++++++++++++++++++++++++++++++ 7 files changed, 129 insertions(+), 7 deletions(-) create mode 100644 env/laptop/hardware.nix create mode 100644 env/nix/personal-machine.nix diff --git a/apps/kitty/kitty.conf b/apps/kitty/kitty.conf index b698d2f..d8f9366 100644 --- a/apps/kitty/kitty.conf +++ b/apps/kitty/kitty.conf @@ -1,4 +1,4 @@ -font_family Iosevka Fixed SS07 Medium +font_family Iosevka repaint_delay 5 input_delay 1 diff --git a/bin/floating-term b/bin/floating-term index f07fff9..98680dd 100755 --- a/bin/floating-term +++ b/bin/floating-term @@ -5,7 +5,7 @@ flags=("") case "$TERMINAL" in kitty ) - flags=(-o remember_window_size=no -o initial_window_width=122c -o initial_window_height=24c --class floating_terminal) + flags=(-o remember_window_size=no -o initial_window_width=60c -o initial_window_height=12c --class floating_terminal) ;; # TODO: rxvt? diff --git a/bin/is_wayland b/bin/is_wayland index 60c9321..0bdd24b 100755 --- a/bin/is_wayland +++ b/bin/is_wayland @@ -1,3 +1,4 @@ #!/usr/bin/env bash -loginctl show-session "$(loginctl | grep "$(whoami)" | head -n 1 | field 1)" -p Type | grep -i wayland >/dev/null +exit 0 +# loginctl show-session "$(loginctl | grep "$(whoami)" | head -n 1 | field 1)" -p Type | grep -i wayland >/dev/null diff --git a/bin/launch b/bin/launch index d18fa57..a6681cf 100755 --- a/bin/launch +++ b/bin/launch @@ -7,7 +7,7 @@ app="$( awk 'NF{NF--};1' | \ cat - <(dmenu_path) | \ sort | uniq -c | sort -nr | \ - sd '^\s+' '' | \ + sd -fm '^\s+' '' | \ cut -d' ' -f2- | \ fzf )" diff --git a/env/laptop/hardware.nix b/env/laptop/hardware.nix new file mode 100644 index 0000000..f98b636 --- /dev/null +++ b/env/laptop/hardware.nix @@ -0,0 +1,32 @@ +# 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, ... }: + +{ + imports = + [ + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/d1d92974-c0c0-4566-8131-c3dda9b21122"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3EB9-C18F"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + nix.maxJobs = lib.mkDefault 4; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + # High-DPI console + console.font = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-u28n.psf.gz"; +} diff --git a/env/laptop/sway/config.d/main b/env/laptop/sway/config.d/main index e3e1218..61a3a53 100644 --- a/env/laptop/sway/config.d/main +++ b/env/laptop/sway/config.d/main @@ -2,9 +2,6 @@ exec libinput-gestures -c $DOTFILES_PATH/apps/de/libinput/sway-gestures.conf # exec swayidle -w timeout 300 'swaylock -f -c 000000' timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' before-sleep 'swaylock -f -c 000000' -# TODO: setup displays (when docked for work?) -output eDP-1 res 1600x900 pos 0 0 - bindswitch lid:toggle exec swaylock input type:touchpad { @@ -18,3 +15,7 @@ input type:touchpad { input type:keyboard { xkb_options ctrl:nocaps } + +# TODO: setup displays (when docked for work?) +output eDP-1 res 1600x900 pos 0 0 + diff --git a/env/nix/personal-machine.nix b/env/nix/personal-machine.nix new file mode 100644 index 0000000..ed76038 --- /dev/null +++ b/env/nix/personal-machine.nix @@ -0,0 +1,88 @@ +{ config, pkgs, ... }: + +{ + imports = [ /etc/nixos/hardware-configuration.nix ]; + + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + nixpkgs.config = { + allowUnfree = true; + packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; + }; + + networking = { + networkmanager.enable = true; + hostName = "third.lyte.dev"; + }; + + i18n.defaultLocale = "en_US.UTF-8"; + console.keyMap = "us"; + + time.timeZone = "America/Chicago"; + + environment = { + systemPackages = with pkgs; [ + wget vim neovim git curl fish bash tmux pciutils usbutils w3m networkmanager sway zsh kitty firefox-devedition-bin ripgrep lightdm fortune sd fzf dmenu ranger nodejs python3 rsync pass brightnessctl wl-clipboard waybar mako vulkan-tools htop rustup clang + ]; + variables = { + EDITOR = "nvim"; + }; + }; + + fonts.fonts = with pkgs; [ iosevka ]; + + hardware = { + pulseaudio = { + enable = true; + support32Bit = true; + }; + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + }; + }; + + programs = { + fish.enable = true; + mtr.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "curses"; + }; + }; + + services = { + openssh.enable = true; + xserver = { + enable = true; + displayManager.lightdm = { + enable = true; + }; + }; + }; + + networking.firewall.enable = false; + + sound.enable = true; + + users.users.daniel = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + shell = pkgs.fish; + home = "/home/daniel/.home"; + }; + + system.stateVersion = "20.03"; +} From 506b0f6c89e4665c7bbc7dd87c2dde5d44627bcc Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 9 Oct 2020 22:53:45 -0500 Subject: [PATCH 2/4] Remove blank lines from launcher --- bin/launch | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/launch b/bin/launch index a6681cf..a7a63f8 100755 --- a/bin/launch +++ b/bin/launch @@ -9,6 +9,7 @@ app="$( sort | uniq -c | sort -nr | \ sd -fm '^\s+' '' | \ cut -d' ' -f2- | \ + grep "\S" | \ fzf )" echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE" From 4afa2740be20a84dd84b42ce83495fd35e9727ab Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 16 Oct 2020 15:00:11 -0500 Subject: [PATCH 3/4] Various changey fixes --- apps/de/waybar/style.css | 2 +- apps/shell/fish/config.fish | 1 + env/laptop/hardware.nix | 10 +++++- env/nix/personal-machine.nix | 61 +++++++++++++++++++++++++++++------- env/nix/pkgs/home.nix | 7 +++++ setup.bash | 3 ++ 6 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 env/nix/pkgs/home.nix diff --git a/apps/de/waybar/style.css b/apps/de/waybar/style.css index a6f4d73..6f47ab3 100644 --- a/apps/de/waybar/style.css +++ b/apps/de/waybar/style.css @@ -2,7 +2,7 @@ border: none; border-radius: 0; /* `otf-font-awesome` is required to be installed for icons */ - font-family: "iosevka-lyte", Roboto, Helvetica, Arial, sans-serif; + font-family: "Iosevka", Roboto, Helvetica, Arial, sans-serif; font-size: 16px; min-height: 0; } diff --git a/apps/shell/fish/config.fish b/apps/shell/fish/config.fish index 7b326c6..7cc7b60 100755 --- a/apps/shell/fish/config.fish +++ b/apps/shell/fish/config.fish @@ -63,5 +63,6 @@ mkdir -p $NOTES_PATH $USER_LOGS_PATH $SCROTS_PATH # start a tmux session by default if possible and we're not already in # a terminal multiplexer if has_command tmux && string match -v -q '*tmux*' $TERM && string match -v -q '*screen*' $TERM + tmux start-server tmux attach -t default || tmux new -s default end diff --git a/env/laptop/hardware.nix b/env/laptop/hardware.nix index f98b636..2b0f5b8 100644 --- a/env/laptop/hardware.nix +++ b/env/laptop/hardware.nix @@ -12,6 +12,8 @@ boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; + boot.kernelParams = [ "resume=/swapfile" "resume_offset=874496" ]; + boot.resumeDevice = "/dev/disk/by-uuid/d1d92974-c0c0-4566-8131-c3dda9b21122"; fileSystems."/" = { device = "/dev/disk/by-uuid/d1d92974-c0c0-4566-8131-c3dda9b21122"; @@ -23,7 +25,13 @@ fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = [ + { + device = "/swapfile"; + priority = 0; + size = 16000; + } + ]; nix.maxJobs = lib.mkDefault 4; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; diff --git a/env/nix/personal-machine.nix b/env/nix/personal-machine.nix index ed76038..2dead06 100644 --- a/env/nix/personal-machine.nix +++ b/env/nix/personal-machine.nix @@ -3,9 +3,11 @@ { imports = [ /etc/nixos/hardware-configuration.nix ]; - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; }; nixpkgs.config = { @@ -27,7 +29,35 @@ environment = { systemPackages = with pkgs; [ - wget vim neovim git curl fish bash tmux pciutils usbutils w3m networkmanager sway zsh kitty firefox-devedition-bin ripgrep lightdm fortune sd fzf dmenu ranger nodejs python3 rsync pass brightnessctl wl-clipboard waybar mako vulkan-tools htop rustup clang + fish bash tmux + vim neovim + networkmanager + wget curl w3m + git + kitty + pciutils usbutils binutils + sway waybar mako wl-clipboard + firefox-devedition-bin + ripgrep sd + nodejs python3 + fzf + fortune + dmenu + ranger + rsync + pass + brightnessctl + vulkan-tools # TODO: vulkan? + htop + rustup + clang + pavucontrol + pamixer + strongswan + gnumake + elixir + docker docker-compose + postgresql ]; variables = { EDITOR = "nvim"; @@ -36,10 +66,19 @@ fonts.fonts = with pkgs; [ iosevka ]; + virtualisation.docker.enable = true; + hardware = { + bluetooth = { + enable = true; + }; pulseaudio = { enable = true; support32Bit = true; + package = pkgs.pulseaudioFull; + # extraConfig = " + # load-module module-switch-on-connect + # "; }; opengl = { enable = true; @@ -65,12 +104,6 @@ services = { openssh.enable = true; - xserver = { - enable = true; - displayManager.lightdm = { - enable = true; - }; - }; }; networking.firewall.enable = false; @@ -79,9 +112,15 @@ users.users.daniel = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = [ "wheel" "docker" ]; shell = pkgs.fish; home = "/home/daniel/.home"; + packages = with pkgs; [ + steam + pulsemixer + file + appimage-run + ]; }; system.stateVersion = "20.03"; diff --git a/env/nix/pkgs/home.nix b/env/nix/pkgs/home.nix new file mode 100644 index 0000000..a4bf7f8 --- /dev/null +++ b/env/nix/pkgs/home.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + programs.home-manager.enable = true; + + home.stateVersion = "20.03"; +} diff --git a/setup.bash b/setup.bash index 67f3925..920a416 100755 --- a/setup.bash +++ b/setup.bash @@ -116,6 +116,9 @@ links=( # XDG user directories "apps/shell/user-dirs" "$XDG_CONFIG_HOME/user-dirs.dirs" + + # XDG user directories + "env/nix/pkgs" "$XDG_CONFIG_HOME/nixpkgs" ) chmod 700 -R "$HOME/.bin" From 437ea5ce33db78d7554d7ade4724e64b70d0e18f Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 16 Oct 2020 15:35:17 -0500 Subject: [PATCH 4/4] Fix mime type for clipshot and add some necessary packages --- bin/clipshot | 2 +- env/nix/personal-machine.nix | 42 +++++++++++++++++++----------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/bin/clipshot b/bin/clipshot index 033999e..c4b4d4d 100755 --- a/bin/clipshot +++ b/bin/clipshot @@ -9,7 +9,7 @@ fn="$SCROTS_PATH/clipshot_$d.png" if is_wayland; then dim="$(slurp -d)" if [ $? -eq 0 ]; then - grim -g "$dim" - | wl-copy + grim -g "$dim" - | wl-copy -t image/png wl-paste -n > "$fn" echo "$fn" # grim -g "$dim" - | tee "$fn" | wl-copy -f diff --git a/env/nix/personal-machine.nix b/env/nix/personal-machine.nix index 2dead06..ae4321f 100644 --- a/env/nix/personal-machine.nix +++ b/env/nix/personal-machine.nix @@ -34,30 +34,10 @@ networkmanager wget curl w3m git - kitty pciutils usbutils binutils - sway waybar mako wl-clipboard - firefox-devedition-bin ripgrep sd nodejs python3 - fzf - fortune - dmenu - ranger rsync - pass - brightnessctl - vulkan-tools # TODO: vulkan? - htop - rustup - clang - pavucontrol - pamixer - strongswan - gnumake - elixir - docker docker-compose - postgresql ]; variables = { EDITOR = "nvim"; @@ -120,6 +100,28 @@ pulsemixer file appimage-run + kitty + sway waybar mako wl-clipboard + firefox-devedition-bin + fzf + fortune + dmenu + ranger + pass + brightnessctl + vulkan-tools # TODO: vulkan? + rustup + clang + pavucontrol + pamixer + strongswan + gnumake + elixir + docker docker-compose + postgresql + htop + google-cloud-sdk + slurp grim ]; };