diff --git a/flake.lock b/flake.lock index dc409d8..5b9268c 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1717316182, - "narHash": "sha256-Xi0EpZcu39N0eW7apLjFfUOR9y80toyjYizez7J1wMI=", + "lastModified": 1717525419, + "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", "owner": "nix-community", "repo": "home-manager", - "rev": "9b53a10f4c91892f5af87cf55d08fba59ca086af", + "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716948383, - "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", + "lastModified": 1717196966, + "narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", + "rev": "57610d2f8f0937f39dbd72251e9614b1561942d8", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6239c59..7e892d4 100644 --- a/flake.nix +++ b/flake.nix @@ -10,13 +10,9 @@ outputs = inputs@{ self, nixpkgs, home-manager, ... }: let inherit (self) outputs; - hostname = - if (builtins.pathExists ./hostname) then - builtins.readFile(./hostname) - else - "default-hostname"; - configs."ankaa" = { + system = "x86_64-linux"; + openssh = { enable = true; port = 2222; @@ -49,6 +45,27 @@ enable = true; protonmail = true; matrix = true; + + sway = { + enable = true; + desktop = true; + }; + + monitors = pkgs.lib.mkMerge [ + (utils.mkMonitor { + monitor = "DP-2"; + resolution = "3440x1440"; + refreshRate = 144; + x = 1920; + wallpaper = "ship_moon.png"; + }) + (utils.mkMonitor { + monitor = "HDMI-A-1"; + resolution = "1920x1080"; + refreshRate = 75; + }) + ]; + }; games.enable = true; @@ -57,9 +74,12 @@ networking.wireguard.enable = true; + }; configs."alpheratz" = { + system = "x86_64-linux"; + audio = { pipewire.enable = true; music.enable = true; @@ -68,6 +88,13 @@ enable = true; protonmail = true; matrix = true; + + monitors = utils.mkMonitor { + monitor = "eDP-1"; + resolution = "1920x1200"; + refreshRate = 60; + }; + }; }; @@ -80,10 +107,21 @@ }; + hostname = + if (builtins.pathExists ./hostname) then + builtins.readFile(./hostname) + else + "default-hostname"; + + utils = import ./utils; + system = configs."${hostname}".system; + pkgs = nixpkgs.legacyPackages.${system}; + + + in { nixosConfigurations = { "${hostname}" = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; specialArgs = { inherit (outputs) localPackages; }; @@ -101,6 +139,10 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + systemConfig = configs."${hostname}"; + inherit utils; + }; home-manager.users.eesim = import (./. + "/hosts/${hostname}/home.nix"); } @@ -108,9 +150,6 @@ }; }; localPackages = nixpkgs.lib.genAttrs [ "x86_64-linux" ] (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in { kickoff-dot-desktop = pkgs.callPackage ./pkgs/kickoff-dot-desktop.nix { }; gamescope-old = pkgs.callPackage ./pkgs/gamescope-old {}; diff --git a/hosts/ankaa/home.nix b/hosts/ankaa/home.nix index 0e60f82..d407528 100644 --- a/hosts/ankaa/home.nix +++ b/hosts/ankaa/home.nix @@ -15,7 +15,6 @@ homeDirectory = "/home/eesim"; }; - home.file.".config/sway/config".source = ./dotfiles/sway/config; home.file.".config/nvim".source = ./dotfiles/nvim; home.file.".config/waybar".source = ./dotfiles/waybar; home.file.".config/fish/config.fish".source = ./dotfiles/fish/config.fish; diff --git a/modules/home/default.nix b/modules/home/default.nix index 8452bb0..b0dea03 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -10,5 +10,7 @@ ./direnv.nix ./git.nix ./qt.nix + ./sway.nix + ./gtk.nix ]; } diff --git a/modules/home/gtk.nix b/modules/home/gtk.nix index 893c83a..c6f8f4a 100644 --- a/modules/home/gtk.nix +++ b/modules/home/gtk.nix @@ -1,24 +1,16 @@ { lib , pkgs , config +, systemConfig , ... }: with lib; let - cfg = config.simmer.gtk; - gui = config.simmer.gui; + gui = systemConfig.gui; in { - options.simmer.gtk = { - theme.enable = mkOption { - description = "Whether to enable gtk themes"; - type = types.bool; - default = gui.enable; - }; - }; - config = { - gtk = mkIf cfg.enable { + gtk = mkIf gui.enable { enable = true; cursorTheme = { name = "phinger-cursors-dark"; diff --git a/modules/home/sway.nix b/modules/home/sway.nix new file mode 100644 index 0000000..9822160 --- /dev/null +++ b/modules/home/sway.nix @@ -0,0 +1,230 @@ +{ lib +, pkgs +, config +, systemConfig +, utils +, ... +}: + +with lib; let + cfg = config.simmer.sway; + gui = systemConfig.gui; + modifier = "Mod4"; +in +{ + options.simmer.sway = { + enable = mkOption { + description = "Whether to install and set sway as window manager"; + type = types.bool; + default = gui.enable; + }; + }; + + config = mkIf cfg.enable { + wayland.windowManager.sway = { + enable = true; + checkConfig = false; + + config = { + modifier = modifier; + keybindings = { + "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = "exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + "XF86AudioPause" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrev" = "exec playerctl previous"; + "${modifier}+Return" = "exec alacritty "; + "${modifier}+Control+f" = "exec MOZ_ENABLE_WAYLAND=1 firefox"; + "${modifier}+Control+s" = "exec steam"; + "${modifier}+Control+t" = "exec thunar"; + "${modifier}+Control+d" = "exec vesktop --enable-features=WebRTCPipeWireCapturer"; + "${modifier}+Control+x" = "exec feishin"; + "${modifier}+Control+h" = "exec helvum"; + "${modifier}+Control+p" = "exec pavucontrol"; + "${modifier}+Shift+s" = "exec grip -g $(slurp)"; + "${modifier}+Shift+q" = "kill"; + "${modifier}+h" = "focus left"; + "${modifier}+j" = "focus down"; + "${modifier}+k" = "focus up"; + "${modifier}+l" = "focus right"; + "${modifier}+Left" = "focus left"; + "${modifier}+Down" = "focus down"; + "${modifier}+Up" = "focus up"; + "${modifier}+Right" = "focus right"; + "${modifier}+Shift+h" = "move left"; + "${modifier}+Shift+j" = "move down"; + "${modifier}+Shift+k" = "move up"; + "${modifier}+Shift+l" = "move right"; + "${modifier}+Shift+Left" = "move left"; + "${modifier}+Shift+Down" = "move down"; + "${modifier}+Shift+Up" = "move up"; + "${modifier}+Shift+Right" = "move right"; + "${modifier}+b" = "split h"; + "${modifier}+v" = "split v"; + "${modifier}+f" = "fullscreen toggle"; + "${modifier}+s" = "layout stacking"; + "${modifier}+w" = "layout tabbed"; + "${modifier}+e" = "layout toggle split"; + "${modifier}+Shift+space" = "floating toggle"; + "${modifier}+a" = "focus parent"; + "${modifier}+1" = "workspace 1 "; + "${modifier}+2" = "workspace 2"; + "${modifier}+3" = "workspace 3"; + "${modifier}+4" = "workspace 4"; + "${modifier}+5" = "workspace 5"; + "${modifier}+6" = "workspace 6"; + "${modifier}+7" = "workspace 7"; + "${modifier}+8" = "workspace 8"; + "${modifier}+9" = "workspace 9"; + "${modifier}+0" = "workspace 10"; + "${modifier}+Shift+1" = "move container to workspace 1"; + "${modifier}+Shift+2" = "move container to workspace 2"; + "${modifier}+Shift+3" = "move container to workspace 3"; + "${modifier}+Shift+4" = "move container to workspace 4"; + "${modifier}+Shift+5" = "move container to workspace 5"; + "${modifier}+Shift+6" = "move container to workspace 6"; + "${modifier}+Shift+7" = "move container to workspace 7"; + "${modifier}+Shift+8" = "move container to workspace 8"; + "${modifier}+Shift+9" = "move container to workspace 9"; + "${modifier}+Shift+0" = "move container to workspace 10"; + "${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'"; + "${modifier}+Shift+c" = "reload"; + "${modifier}+r" = "mode 'resize'"; + }; + + startup = [ + { command = "--no-startup-id swayidle -w timeout 600 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"'"; } + ] + ++ optionals gui.sway.desktop [ + { command = "vorta"; } + { command = "MOZ_ENABLE_WAYLAND=1 firefox"; } + { command = "sleep 20 && vesktop --enable-features=WebRTCPipeWireCapturer"; } + { command = "--no-startup-id openrgb --startminimized"; } + { command = "--no-startup-id easyeffects --gapplication-service"; } + { command = "--no-startup-id wayland-pipewire-idle-inhibit"; } + { command = "--no-startup-id protonmail-bridge --noninteractive"; } + ]; + + workspaceOutputAssign = mkIf gui.sway.desktop [ + {workspace = "1"; output = "DP-2"; } + {workspace = "2"; output = "DP-2"; } + {workspace = "3"; output = "DP-2"; } + {workspace = "4"; output = "HDMI-A-1"; } + {workspace = "5"; output = "HDMI-A-1"; } + {workspace = "6"; output = "HDMI-A-1"; } + {workspace = "7"; output = "HDMI-A-1"; } + {workspace = "8"; output = "HDMI-A-1"; } + {workspace = "9"; output = "HDMI-A-1"; } + {workspace = "10"; output = "HDMI-A-1"; } + ]; + + assigns = mkIf gui.sway.desktop { + "1" = []; + + "2" = [ + {app_id="mpv"; } + ]; + + "3" = [ + {class="steam"; } + {class="gamescope"; } + {app_id="gamescope"; } + ]; + + "4" = [ + {app_id="firefox"; } + ]; + + "5" = [ + {app_id="de.shorsh.discord-screenaudio"; } + {class="discord"; } + {class="vesktop"; } + ]; + + "6" = [ + {app_id="com.obsproject.Studio"; } + ]; + + "7" = [ + {app_id="org.strawberrymusicplayer.strawberry"; } + ]; + + "8" = [ + {app_id="com.github.wwmm.easyeffects"; } + {app_id="org.pipewire.Helvum"; } + {app_id="pavucontrol"; } + ]; + + "9" = []; + + "0" = [ + {app_id="python3"; } + {class="steam_proton"; } + ]; + }; + + input."type:keyboard" = { + xkb_layout = "us,de"; + xkb_options = "caps:escape,grp:shifts_toggle"; + }; + + output = gui.monitors; + + floating = { + modifier = modifier; + border = 5; + }; + + window = { + border = 5; + titlebar = false; + commands = [ + { criteria = { class = "vesktop"; }; command = "opacity 0.9"; } + { criteria = { app_id = "Alacritty"; }; command = "opacity 0.9"; } + { criteria = { class = "gamescope"; }; command = "fullscreen"; } + { criteria = { app_id = "gamescope"; }; command = "fullscreen"; } + { criteria = { app_id = "mpv"; }; command = "fullscreen"; } + ]; + }; + + gaps = { + inner = 10; + outer = -5; + smartGaps = true; + }; + + bars = [ + { command = "\${pkgs.waybar}/bin/waybar"; } + ]; + }; + + + extraConfig = '' + + bindsym ${modifier}+space exec kickoff-dot-desktop | kickoff --from-stdin --stdout | xargs -d '\n' swaymsg exec + + set $bg-color #58536d + set $inactive-bg-color #2f343f + set $text-color #f3f4f5 + set $inactive-text-color #676E7D + set $urgent-bg-color #E53935 + + # window colors + # border background text indicator + client.focused $bg-color $bg-color $text-color #4B5177 + client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color #4B5177 + client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #4B5177 + client.urgent $urgent-bg-color $urgent-bg-color $text-color #4B5177 + + smart_gaps inverse_outer + + bar { + swaybar_command waybar + } + + ''; + }; + }; +} diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 7fefff3..1b225f7 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -13,5 +13,6 @@ ./common.nix ./networking.nix ./games.nix + ./system.nix ]; } diff --git a/modules/nix/gui.nix b/modules/nix/gui.nix index 808b9d4..f619751 100644 --- a/modules/nix/gui.nix +++ b/modules/nix/gui.nix @@ -17,10 +17,19 @@ in default = false; }; - wm = mkOption { - description = "Which window manager to install"; - type = types.enum [ "sway" ]; - default = "sway"; + sway = { + enable = mkOption { + description = "Install and configure sway window manager"; + type = types.bool; + default = true; + }; + + desktop = mkOption { + description= "Use desktop configuration"; + type = types.bool; + default = false; + }; + }; terminal = mkOption { @@ -29,6 +38,12 @@ in default = pkgs.alacritty; }; + gtk = mkOption { + description = "Whether to configure gtk"; + type = types.bool; + default = cfg.gui.enable; + }; + protonmail = mkOption { description = "Whether to install protonmail bridge and mail application"; type = types.bool; @@ -46,13 +61,20 @@ in type = types.bool; default = false; }; + + monitors = mkOption { + description = "Attribute set of system monitors"; + type = types.attrs; + default = {}; + }; + }; config = mkIf cfg.enable { environment.systemPackages = with pkgs; with localPackages.x86_64-linux; [] - ++ optionals (cfg.wm == "sway") [ + ++ optionals cfg.sway.enable [ wl-clipboard grim slurp @@ -69,8 +91,6 @@ in ++ optional cfg.secrets libsecret ++ optionals cfg.protonmail [ thunderbird protonmail-bridge ]; - programs.sway.enable = mkIf (cfg.wm == "sway") true; - programs.dconf.enable = mkIf cfg.secrets true; services.gnome.gnome-keyring.enable = mkIf cfg.secrets true; services.dbus.packages = mkIf cfg.secrets [ pkgs.gnome.seahorse ]; diff --git a/modules/nix/system.nix b/modules/nix/system.nix new file mode 100644 index 0000000..ed4e7fb --- /dev/null +++ b/modules/nix/system.nix @@ -0,0 +1,13 @@ +{ lib +, pkgs +, config +, ... +}: + +with lib; { + options.simmer.system = mkOption { + description = "System architecture"; + type = types.str; + default = "x86_64-linux"; + }; +} diff --git a/utils/default.nix b/utils/default.nix new file mode 100644 index 0000000..5a30cbc --- /dev/null +++ b/utils/default.nix @@ -0,0 +1,17 @@ +{ + mkMonitor = { + monitor, + resolution, + refreshRate, + wallpaper ? "default.png", + x ? 0, + y ? 0, + }: + { + ${monitor} = { + mode = "${resolution}@${toString refreshRate}Hz"; + pos = "${toString x} ${toString y}"; + bg = "/etc/nixos/wallpapers/${wallpaper} fill"; + }; + }; +} diff --git a/wallpapers/default.png b/wallpapers/default.png new file mode 100644 index 0000000..4eeb19e Binary files /dev/null and b/wallpapers/default.png differ diff --git a/wallpapers/planet_ring.png b/wallpapers/planet_ring.png new file mode 100644 index 0000000..d7610f3 Binary files /dev/null and b/wallpapers/planet_ring.png differ diff --git a/wallpapers/ship_moon.png b/wallpapers/ship_moon.png new file mode 100644 index 0000000..6549849 Binary files /dev/null and b/wallpapers/ship_moon.png differ