diff --git a/configuration/hosts/samhain/configuration.nix b/configuration/hosts/samhain/configuration.nix index 39e911c3..f1ebc72e 100644 --- a/configuration/hosts/samhain/configuration.nix +++ b/configuration/hosts/samhain/configuration.nix @@ -6,6 +6,7 @@ ../../profiles/common ../../profiles/desktop ../../profiles/xfce + ../../profiles/sway ../../profiles/gaming ../../profiles/development ../../profiles/network @@ -18,7 +19,8 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; boot.supportedFilesystems = [ "zfs" "xfs" ]; - + boot.extraModulePackages = [ config.boot.kernelPackages.vendor-reset ]; + virtualisation.libvirtd = { enable = true; qemuOvmf = true; @@ -57,8 +59,23 @@ }; }; + services.udev.extraRules = let + localGroup = "users"; + assignLocalGroup = ''GROUP="${localGroup}"''; + i2c = '' + SUBSYSTEM=="i2c-dev", ${assignLocalGroup}, MODE="0660" + ''; # for DDC/monitor control + uinput = '' + ACTION="add", SUBSYSTEM=="input", + ACTION=="add", SUBSYSTEM=="input", DEVPATH=="/devices/virtual/input/*", MODE="0660", GROUP="qemu-libvirtd" + SUBSYSTEM=="misc", KERNEL=="uinput", OPTIONS+="static_node=uinput", MODE="0660", GROUP="uinput" + ''; + in '' + ${i2c} + ${uinput} + ''; environment.systemPackages = [ - pkgs.nur.repos.arc.packages.screenstub # for DDC/CI and input forwarding + #pkgs.nur.repos.arc.packages.screenstub # for DDC/CI and input forwarding pkgs.nur.repos.arc.packages.scream-arc # for audio forwarding pkgs.ddcutil # for diagnostics on DDC/CI pkgs.virt-manager # obvious reasons diff --git a/configuration/profiles/common/default.nix b/configuration/profiles/common/default.nix index 225f5f4b..6cc70de6 100644 --- a/configuration/profiles/common/default.nix +++ b/configuration/profiles/common/default.nix @@ -13,7 +13,7 @@ in { imports = [ ../../../modules "${home-manager}/nixos" ./pbb.nix ./users.nix ]; nixpkgs.overlays = - [ (self: super: import ../../../pkgs { nixpkgs = super.path; }) ]; + [ (self: super: import ../../../pkgs { nixpkgs = super.path; self = self; super = super; }) ]; #boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; #boot.kernelParams = [ "quiet" ]; diff --git a/configuration/profiles/sway/colors.nix b/configuration/profiles/sway/colors.nix new file mode 100644 index 00000000..57d96cf7 --- /dev/null +++ b/configuration/profiles/sway/colors.nix @@ -0,0 +1,55 @@ +rec { + base16 = { + color0 = "#333333"; + color1 = "#ff3399"; + color2 = "#00ff99"; + color3 = "#ffcc33"; + color4 = "#00ccff"; + color5 = "#9977ff"; + color6 = "#3cd8d8"; + color7 = "#f8f8f2"; + + color8 = "#707070"; + color9 = "#ff6699"; + color10 = "#99ff99"; + color11 = "#ffee66"; + color12 = "#99ccff"; + color13 = "#9977ff"; + color14 = "#78e4e4"; + color15 = "#f8f8f2"; + + color16 = "#fd971f"; + color17 = "#cc6633"; + color18 = "#383830"; + color19 = "#49483e"; + color20 = "#a59f85"; + color21 = "#f5f4f1"; + }; + + black = base16.color0; + red = base16.color1; + green = base16.color2; + yellow = base16.color3; + blue = base16.color4; + purple = base16.color5; + cyan = base16.color6; + white = base16.color7; + + normal.black = base16.color0; + normal.red = base16.color1; + normal.green = base16.color2; + normal.yellow = base16.color3; + normal.blue = base16.color4; + normal.purple = base16.color5; + normal.cyan = base16.color6; + normal.white = base16.color7; + + bright.black = base16.color8; + bright.red = base16.color9; + bright.green = base16.color10; + bright.yellow = base16.color11; + bright.blue = base16.color12; + bright.purple = base16.color13; + bright.cyan = base16.color14; + bright.white = base16.color15; +} diff --git a/configuration/profiles/sway/default.nix b/configuration/profiles/sway/default.nix index e69de29b..f2244500 100644 --- a/configuration/profiles/sway/default.nix +++ b/configuration/profiles/sway/default.nix @@ -0,0 +1,253 @@ +{ config, pkgs, lib, ... }: + +let + colors = import ./colors.nix; +in { +fonts.fonts = with pkgs; [ font-awesome nerdfonts iosevka emacs-all-the-icons-fonts ]; +users.users.kat.packages = with pkgs; [ ]; +programs.sway.enable = true; + +systemd.user.services.mako = { + serviceConfig.ExecStart = "${pkgs.mako}/bin/mako"; + restartTriggers = [ + config.home-manager.users.kat.xdg.configFile."mako/config".source + ]; +}; + +home-manager.users.kat = { + programs.kitty = { + enable = true; + font.name = "Iosevka Term"; + settings = { + font_size = "10.0"; + background = colors.black; + foreground = colors.white; + background_opacity = "0.8"; + selection_background = colors.white; + selection_foreground = colors.black; + url_color = colors.yellow; + cursor = colors.white; + active_border_color = "#75715e"; + active_tab_background = "#9900ff"; + active_tab_foreground = colors.white; + inactive_tab_background = "#3a3a3a"; + inactive_tab_foreground = "#665577"; + } // colors.base16; + }; + + programs.mako = { + enable = true; + defaultTimeout = 3000; + borderColor = colors.white; + backgroundColor = "${colors.black}70"; + textColor = colors.white; + }; + wayland.windowManager.sway = { + enable = true; + config = let + dmenu = "${pkgs.bemenu}/bin/bemenu --fn 'Iosevka 12' --nb '${colors.black}' --nf '${colors.white}' --sb '${colors.red}' --sf '${colors.white}' -l 5 -m 0 -i"; + lockCommand = "swaylock -i ${./background.jpg} -s fill"; + cfg = config.home-manager.users.kat.wayland.windowManager.sway.config; + in { + bars = [{ command = "${pkgs.waybar}/bin/waybar"; }]; + + output = let + left = { + res = "1920x1080"; + pos = "0 0"; + bg = "${./left.jpg} fill"; + }; + middle = { + res = "1920x1080"; + pos = "1920 0"; + bg = "${./middle.jpg} fill"; + }; + right = { + res = "1920x1080"; + pos = "3840 0"; + bg = "${./right.jpg} fill"; + }; + in { + "DP-1" = left; + "DVI-D-1" = middle; + "HDMI-A-1" = right; + }; + + input = { + # "1739:0:Synaptics_TM3075-002" = { + # dwt = "enabled"; + # tap = "enabled"; + # natural_scroll = "enabled"; + # middle_emulation = "enabled"; + # click_method = "clickfinger"; + # }; + "*" = { + xkb_layout = "gb"; + # xkb_variant = "nodeadkeys"; + # xkb_options = "ctrl:nocaps"; + }; + }; + + fonts = [ "Iosevka Nerd Font 10" ]; + terminal = "${pkgs.kitty}/bin/kitty"; + # TODO: replace with wofi + menu = "${pkgs.j4-dmenu-desktop}/bin/j4-dmenu-desktop --dmenu=\"${dmenu}\" --term='${cfg.terminal}'"; + modifier = "Mod4"; + + startup = [ + { command = "systemctl --user restart mako"; always = true; } + { command = "${pkgs.swayidle}/bin/swayidle -w before-sleep '${lockCommand}'"; } + ]; + + window = { + border = 1; + titlebar = true; + }; + + keybindings = { + "${cfg.modifier}+Return" = "exec ${cfg.terminal}"; + + "${cfg.modifier}+Left" = "focus left"; + "${cfg.modifier}+Down" = "focus down"; + "${cfg.modifier}+Up" = "focus up"; + "${cfg.modifier}+Right" = "focus right"; + + "${cfg.modifier}+Shift+Left" = "move left"; + "${cfg.modifier}+Shift+Down" = "move down"; + "${cfg.modifier}+Shift+Up" = "move up"; + "${cfg.modifier}+Shift+Right" = "move right"; + + "${cfg.modifier}+Shift+space" = "floating toggle"; + "${cfg.modifier}+space" = "focus mode_toggle"; + + "${cfg.modifier}+1" = "workspace 1"; + "${cfg.modifier}+2" = "workspace 2"; + "${cfg.modifier}+3" = "workspace 3"; + "${cfg.modifier}+4" = "workspace 4"; + "${cfg.modifier}+5" = "workspace 5"; + "${cfg.modifier}+6" = "workspace 6"; + "${cfg.modifier}+7" = "workspace 7"; + "${cfg.modifier}+8" = "workspace 8"; + "${cfg.modifier}+9" = "workspace 9"; + "${cfg.modifier}+0" = "workspace 10"; + + "${cfg.modifier}+Shift+1" = "move container to workspace 1"; + "${cfg.modifier}+Shift+2" = "move container to workspace 2"; + "${cfg.modifier}+Shift+3" = "move container to workspace 3"; + "${cfg.modifier}+Shift+4" = "move container to workspace 4"; + "${cfg.modifier}+Shift+5" = "move container to workspace 5"; + "${cfg.modifier}+Shift+6" = "move container to workspace 6"; + "${cfg.modifier}+Shift+7" = "move container to workspace 7"; + "${cfg.modifier}+Shift+8" = "move container to workspace 8"; + "${cfg.modifier}+Shift+9" = "move container to workspace 9"; + "${cfg.modifier}+Shift+0" = "move container to workspace 10"; + + "XF86AudioRaiseVolume" = "exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') +5%"; + "XF86AudioLowerVolume" = "exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') -5%"; + "XF86AudioMute" = "exec pactl set-sink-mute $(pacmd list-sinks |awk '/* index:/{print $3}') toggle"; + "XF86AudioMicMute" = "exec pactl set-source-mute $(pacmd list-sources |awk '/* index:/{print $3}') toggle"; + "XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5"; + "XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5"; + "${cfg.modifier}+Print" = "exec ${pkgs.bash}/bin/bash -c '~/.local/bin/elixiremanager.sh -w'"; + + "${cfg.modifier}+d" = "exec ${cfg.menu}"; + "${cfg.modifier}+x" = "exec ${lockCommand}"; + + "${cfg.modifier}+i" = "move workspace to output left"; + "${cfg.modifier}+o" = "move workspace to output left"; + "${cfg.modifier}+b" = "splith"; + "${cfg.modifier}+v" = "splitv"; + "${cfg.modifier}+s" = "layout stacking"; + "${cfg.modifier}+w" = "layout tabbed"; + "${cfg.modifier}+e" = "layout toggle split"; + "${cfg.modifier}+f" = "fullscreen"; + + "${cfg.modifier}+Shift+q" = "kill"; + "${cfg.modifier}+Shift+c" = "reload"; + + "${cfg.modifier}+r" = "mode resize"; + "${cfg.modifier}+Delete" = "mode \"System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown\""; + }; + + # keycodebindings = { + # "--no-repeat 107" = "exec dbus-send --session --type=method_call --dest=net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble.startTalking"; + # "--release 107" = "exec dbus-send --session --type=method_call --dest=net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble.stopTalking"; + # }; + + modes = { + "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown" = { + "l" = "exec ${lockCommand}, mode default"; + "e" = "exec swaymsg exit, mode default"; + "s" = "exec systemctl suspend, mode default"; + "h" = "exec systemctl hibernate, mode default"; + "r" = "exec systemctl reboot, mode default"; + "Shift+s" = "exec systemctl shutdown, mode default"; + "Return" = "mode default"; + "Escape" = "mode default"; + }; + }; + + colors = { + focused = { + border = colors.bright.black; + background = colors.bright.green; + text = colors.black; + indicator = colors.green; + childBorder = colors.bright.black; + }; + focusedInactive = { + border = colors.bright.black; + background = colors.green; + text = colors.black; + indicator = colors.green; + childBorder = colors.bright.black; + }; + unfocused = { + border = colors.bright.black; + background = colors.black; + text = colors.bright.black; + indicator = colors.bright.black; + childBorder = colors.bright.black; + }; + urgent = { + border = colors.bright.black; + background = colors.bright.red; + text = colors.black; + indicator = colors.red; + childBorder = colors.bright.black; + }; + }; + }; + wrapperFeatures.gtk = true; + extraConfig = '' + seat seat0 xcursor_theme breeze_cursors 20 + ''; + }; + programs.waybar = { + enable = true; + # style = '' + # * { + # font-family: "Iosevka"; + # } + # ''; + settings = [{ + modules-left = [ "sway/workspaces" "sway/mode" ]; + modules-center = [ "sway/window" ]; + modules-right = [ "pulseaudio" "network" "cpu" "memory" "temperature" "clock" "tray" ]; + + modules = { + network = { + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ifname}: {ipaddr}/{cidr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + clock = { + format = "{:%F %T %Z}"; + }; + }; + }]; + }; +}; +} diff --git a/configuration/profiles/sway/left.jpg b/configuration/profiles/sway/left.jpg new file mode 100755 index 00000000..329d174e Binary files /dev/null and b/configuration/profiles/sway/left.jpg differ diff --git a/configuration/profiles/sway/middle.jpg b/configuration/profiles/sway/middle.jpg new file mode 100755 index 00000000..b92d9e5d Binary files /dev/null and b/configuration/profiles/sway/middle.jpg differ diff --git a/configuration/profiles/sway/right.jpg b/configuration/profiles/sway/right.jpg new file mode 100755 index 00000000..597d127d Binary files /dev/null and b/configuration/profiles/sway/right.jpg differ diff --git a/pkgs/default.nix b/pkgs/default.nix index e6b3d541..13e8b39b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,9 +1,11 @@ -{ nixpkgs ? , ... }: +{ nixpkgs ? , self, super, ... }: let pkgs = import nixpkgs { }; callPackage = pkgs.lib.callPackageWith (pkgs // newpkgs); - - newpkgs = { }; - + newpkgs = { + linuxPackagesFor = kernel: (super.linuxPackagesFor kernel).extend (_: ksuper: { + vendor-reset = (callPackage ./vendor-reset {kernel = ksuper.kernel;}).out; + }); + }; in newpkgs diff --git a/pkgs/vendor-reset/default.nix b/pkgs/vendor-reset/default.nix new file mode 100644 index 00000000..e3f1c7b6 --- /dev/null +++ b/pkgs/vendor-reset/default.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchFromGitHub, kernel }: + +let + version = "0.0.18"; + rev = "765b05cdbd4de854c05f771c954ecee0e019d734"; + sha256 = "0ayn8128i0bfwzcmkn0x2alfplbsmvp0c63z56w11ywyysf342qw"; # TODO add this +in + +stdenv.mkDerivation { + name = "vendor-reset-${version}-${kernel.version}"; + inherit version; + + src = fetchFromGitHub { + owner = "gnif"; + repo = "vendor-reset"; + inherit rev; + inherit sha256; + }; + + nativeBuildInputs = kernel.moduleBuildDependencies; + hardeningDisable = [ "pic" ]; + + makeFlags = [ + "KVER=${kernel.modDirVersion}" + "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "INSTALL_MOD_PATH=$(out)" + ]; + + meta = with stdenv.lib; { + license = [ licenses.gpl2Only ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + description = "Vendor Reset kernel module"; + homepage = "https://github.com/gnif/vendor-reset"; + }; +} \ No newline at end of file