diff --git a/flake.nix b/flake.nix index a1d45fc..533c056 100644 --- a/flake.nix +++ b/flake.nix @@ -43,7 +43,7 @@ inherit inputs; }; sharedModules = [ - ./hosts/common/base.nix + ./hosts/common/default.nix stylix.nixosModules.stylix home-manager.nixosModules.home-manager ({ config, ...}: { @@ -74,6 +74,7 @@ ./home/alisceon/base.nix ./home/alisceon/workstation.nix ./home/wm/sway.nix + ./home/alisceon/hosts/electra.nix ]; home-manager.users.root.imports = [ ./home/root/base.nix @@ -96,6 +97,7 @@ ./home/alisceon/base.nix ./home/alisceon/workstation.nix ./home/wm/sway.nix + ./home/alisceon/hosts/tower.nix ]; home-manager.users.root.imports = [ ./home/root/base.nix diff --git a/home/alisceon/base.nix b/home/alisceon/base.nix new file mode 100644 index 0000000..60e690e --- /dev/null +++ b/home/alisceon/base.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./default.nix + ]; +} # end file diff --git a/home/alisceon/default.nix b/home/alisceon/default.nix index e5f929a..fe6c1b0 100644 --- a/home/alisceon/default.nix +++ b/home/alisceon/default.nix @@ -1,5 +1,11 @@ { pkgs, config, hostName, lib, ... }: { + imports = [ + ./modules/programs/direnv.nix + ./modules/programs/git.nix + ./modules/programs/ssh.nix + ]; + home.username = "alisceon"; home.homeDirectory = "/home/alisceon"; home.stateVersion = "24.05"; diff --git a/home/alisceon/hosts/electra.nix b/home/alisceon/hosts/electra.nix new file mode 100644 index 0000000..fb672ea --- /dev/null +++ b/home/alisceon/hosts/electra.nix @@ -0,0 +1,28 @@ +{ pkgs, config, hostName, lib, ... }: +{ + imports = [ + ../modules/services/swayidle.nix + ]; + + wayland.windowManager.sway.config = { + output = { + eDP-1 = { + mode = "1920x1200@59.950Hz"; + position = "0 0"; + }; + DP-2 = { + mode = "1280x720@60.000Hz"; + position = "0 1200"; + }; + }; + + workspaceOutputAssign = []; + + input."*" = { + xkb_layout = "se,us"; + xkb_options = "grp:win_space_toggle"; + }; + }; + + services.espanso.configs.default.keyboard_layout.layout = "se"; +} # end file diff --git a/home/alisceon/hosts/tower.nix b/home/alisceon/hosts/tower.nix new file mode 100644 index 0000000..c95ba2e --- /dev/null +++ b/home/alisceon/hosts/tower.nix @@ -0,0 +1,39 @@ +{ pkgs, config, hostName, lib, ... }: +{ + wayland.windowManager.sway.config = { + output = { + DP-1 = { + mode = "1920x1080@143.981Hz"; + transform = "90"; + position = "0 0"; + }; + DP-2 = { + mode = "3440x1440@99.982Hz"; + position = "1080 250"; + }; + DP-3 = { + mode = "1920x1080@143.981Hz"; + position = "4520 250"; + }; + }; + + workspaceOutputAssign = [ + { output = "DP-2"; workspace = "1"; } + { output = "DP-2"; workspace = "2"; } + { output = "DP-2"; workspace = "3"; } + { output = "DP-3"; workspace = "4"; } + { output = "DP-3"; workspace = "5"; } + { output = "DP-3"; workspace = "6"; } + { output = "DP-1"; workspace = "7"; } + { output = "DP-1"; workspace = "8"; } + { output = "DP-1"; workspace = "9"; } + ]; + + input."*" = { + xkb_layout = "us,se"; + xkb_options = "grp:win_space_toggle"; + }; + }; + + services.espanso.configs.default.keyboard_layout.layout = "us"; +} # end file diff --git a/home/alisceon/lib/commands.nix b/home/alisceon/lib/commands.nix new file mode 100644 index 0000000..dbb543f --- /dev/null +++ b/home/alisceon/lib/commands.nix @@ -0,0 +1,17 @@ +{ pkgs }: +let + swaymsg = "${pkgs.sway}/bin/swaymsg"; +in +{ + uwsm = "${pkgs.uwsm}/bin/uwsm-app --"; + inherit swaymsg; + + lock = "${pkgs.swaylock}/bin/swaylock --daemonize"; + term = "${pkgs.foot}/bin/footclient"; + notify = "${pkgs.libnotify}/bin/notify-send"; + nag = "${pkgs.sway}/bin/swaynag --edge bottom"; + dmenu = "${pkgs.rofi-unwrapped}/bin/rofi"; + espanso = "${pkgs.espanso-wayland}/bin/espanso cmd"; + + display = status: "${swaymsg} 'output * power ${status}'"; +} # end file diff --git a/home/alisceon/modules/programs/rofi.nix b/home/alisceon/modules/programs/rofi.nix index d15ce48..5b330c3 100644 --- a/home/alisceon/modules/programs/rofi.nix +++ b/home/alisceon/modules/programs/rofi.nix @@ -1,4 +1,8 @@ { pkgs, config, hostName, lib, ... }: +let + commands = import ../../lib/commands.nix { inherit pkgs; }; + inherit (commands) term; +in { programs.rofi = { enable = true; diff --git a/home/alisceon/modules/programs/waybar.nix b/home/alisceon/modules/programs/waybar.nix index e536b76..224e8b1 100644 --- a/home/alisceon/modules/programs/waybar.nix +++ b/home/alisceon/modules/programs/waybar.nix @@ -1,4 +1,8 @@ { pkgs, config, hostName, lib, ... }: +let + commands = import ../../lib/commands.nix { inherit pkgs; }; + inherit (commands) uwsm term; +in { programs.waybar = { enable = true; diff --git a/home/alisceon/modules/services/espanso.nix b/home/alisceon/modules/services/espanso.nix index 1dfaac9..835b2ae 100644 --- a/home/alisceon/modules/services/espanso.nix +++ b/home/alisceon/modules/services/espanso.nix @@ -8,7 +8,7 @@ toggle_key = "OFF"; preserve_clipboard = true; show_notifications = true; - keyboard_layout = { layout="${hostnameInput1}"; }; + keyboard_layout = { layout = "se"; }; }; }; matches = { diff --git a/home/alisceon/modules/services/gnome-keyring.nix b/home/alisceon/modules/services/gnome-keyring.nix index aacc0a4..df768b5 100644 --- a/home/alisceon/modules/services/gnome-keyring.nix +++ b/home/alisceon/modules/services/gnome-keyring.nix @@ -1,13 +1,11 @@ { pkgs, config, hostName, lib, ... }: { - services = { - gnome-keyring = { - enable = true; - components = [ - "ssh" - "pkcs11" - "secrets" - ]; - }; - } // hostnameServices; # end services + services.gnome-keyring = { + enable = true; + components = [ + "ssh" + "pkcs11" + "secrets" + ]; + }; } # end file diff --git a/home/alisceon/modules/services/swayidle.nix b/home/alisceon/modules/services/swayidle.nix index de29f70..68ae998 100644 --- a/home/alisceon/modules/services/swayidle.nix +++ b/home/alisceon/modules/services/swayidle.nix @@ -1,4 +1,8 @@ { pkgs, config, hostName, lib, ... }: +let + commands = import ../../lib/commands.nix { inherit pkgs; }; + inherit (commands) notify lock display; +in { services.swayidle = { enable = true; diff --git a/home/alisceon/modules/wm/gnome/default.nix b/home/alisceon/modules/wm/gnome/default.nix index f455276..a4d0a4c 100644 --- a/home/alisceon/modules/wm/gnome/default.nix +++ b/home/alisceon/modules/wm/gnome/default.nix @@ -1,2 +1,5 @@ { pkgs, config, hostName, lib, ... }: { + imports = [ + "./dconf.nix" + ] } # end file diff --git a/home/alisceon/modules/wm/sway/default.nix b/home/alisceon/modules/wm/sway/default.nix index 0bcdfb3..8c37b32 100644 --- a/home/alisceon/modules/wm/sway/default.nix +++ b/home/alisceon/modules/wm/sway/default.nix @@ -1,14 +1,8 @@ { pkgs, config, hostName, lib, ... }: let - # execs - uwsm = "${pkgs.uwsm}/bin/uwsm-app --"; - swaymsg = "${pkgs.sway}/bin/swaymsg"; - lock = "${pkgs.swaylock}/bin/swaylock --daemonize"; - term = "${pkgs.foot}/bin/footclient"; - notify = "${pkgs.libnotify}/bin/notify-send"; - nag = "${pkgs.sway}/bin/swaynag --edge bottom"; - dmenu = "${pkgs.rofi-unwrapped}/bin/rofi"; - espanso = "${pkgs.espanso-wayland}/bin/espanso cmd"; + # shared command aliases + commands = import ../../../lib/commands.nix { inherit pkgs; }; + inherit (commands) uwsm lock term notify nag dmenu espanso; # keybinds key_mod = "Mod4"; @@ -18,106 +12,20 @@ key_up = "Up"; key_down = "Down"; - # other - display = status: "${swaymsg} 'output * power ${status}'"; - hostnameOutput = - if hostName == "tower" then { - # Left monitor - DP-1 = { - mode = "1920x1080@143.981Hz"; - transform = "90"; - position = "0 0"; - }; - # Main monitor - DP-2 = { - mode = "3440x1440@99.982Hz"; - position = "1080 250"; - }; - # Right monitor - DP-3 = { - mode = "1920x1080@143.981Hz"; - position = "4520 250"; - }; - } - else if hostName == "electra" then { - eDP-1 = { - mode = "1920x1200@59.950Hz"; - position = "0 0"; - }; - DP-2 = { - mode = "1280x720@60.000Hz"; - position = "0 1200"; - }; - - } - else {}; - hostnameWorkspaceAssign = - if hostName == "tower" then [ - { output = "DP-2"; workspace = "1"; } - { output = "DP-2"; workspace = "2"; } - { output = "DP-2"; workspace = "3"; } - { output = "DP-3"; workspace = "4"; } - { output = "DP-3"; workspace = "5"; } - { output = "DP-3"; workspace = "6"; } - { output = "DP-1"; workspace = "7"; } - { output = "DP-1"; workspace = "8"; } - { output = "DP-1"; workspace = "9"; } - ] - else if hostName == "electra" then [] - else []; - hostnameServices = - if hostName == "tower" then {} - else if hostName == "electra" then { - swayidle = { - enable = true; - timeouts = [ - { - timeout = 120; - command = "${notify} 'Locking in 5 seconds' -t 5000"; - } - { - timeout = 125; - command = lock; - } - { - timeout = 125; - command = display "off"; - resumeCommand = display "on"; - } - { - timeout = 600; - command = "${pkgs.systemd}/bin/systemctl suspend"; - } - ]; # end timeouts - events = [ - { - event = "before-sleep"; - command = "display off; systemctl --user stop libinput-gestures; ${lock}"; - } - { - event = "after-resume"; - command = "display on; systemctl --user start libinput-gestures"; - } - { - event = "lock"; - command = (display "off") + "; " + lock; - } - { - event = "unlock"; - command = display "on"; - } - ]; # end events - }; # end swayidle - } - else {}; - hostnameInput1 = - if hostName == "tower" then "us" - else "se"; - hostnameInput2 = - if hostName == "tower" then "se" - else "us"; in { + imports = [ + "./gtk.nix" + "./xdg.nix" + "../../modules/programs/foot.nix" + "../../modules/programs/rofi.nix" + "../../modules/programs/swaylock.nix" + "../../modules/programs/waybar.nix" + "../../modules/services/espanso.nix" + "../../modules/services/gnome-keyring.nix" + "../../modules/services/mako.nix" + "../../modules/services/swayidle.nix" + ]; wayland.windowManager.sway = { enable = true; wrapperFeatures.gtk = true; @@ -147,7 +55,7 @@ pointer_accel = "0.5"; }; "*" = { - xkb_layout = "${hostnameInput1},${hostnameInput2}"; + xkb_layout = "se,us"; xkb_options = "grp:win_space_toggle"; }; }; # end input @@ -269,8 +177,6 @@ "8" = [{app_id = "discord";}]; "9" = [{app_id = "signal";}]; }; - output = {} // hostnameOutput; - workspaceOutputAssign = hostnameWorkspaceAssign; }; # end config }; # end wayland.windowManager.sway } # end file diff --git a/home/alisceon/modules/wm/sway/xdg.nix b/home/alisceon/modules/wm/sway/xdg.nix index 928289e..1758082 100644 --- a/home/alisceon/modules/wm/sway/xdg.nix +++ b/home/alisceon/modules/wm/sway/xdg.nix @@ -1,122 +1,8 @@ { pkgs, config, hostName, lib, ... }: - let - # execs - uwsm = "${pkgs.uwsm}/bin/uwsm-app --"; - swaymsg = "${pkgs.sway}/bin/swaymsg"; - lock = "${pkgs.swaylock}/bin/swaylock --daemonize"; - term = "${pkgs.foot}/bin/footclient"; - notify = "${pkgs.libnotify}/bin/notify-send"; - nag = "${pkgs.sway}/bin/swaynag --edge bottom"; - dmenu = "${pkgs.rofi-unwrapped}/bin/rofi"; - espanso = "${pkgs.espanso-wayland}/bin/espanso cmd"; - - # keybinds - key_mod = "Mod4"; - key_mod_misc = "Alt"; - key_left = "Left"; - key_right = "Right"; - key_up = "Up"; - key_down = "Down"; - - # other - display = status: "${swaymsg} 'output * power ${status}'"; - hostnameOutput = - if hostName == "tower" then { - # Left monitor - DP-1 = { - mode = "1920x1080@143.981Hz"; - transform = "90"; - position = "0 0"; - }; - # Main monitor - DP-2 = { - mode = "3440x1440@99.982Hz"; - position = "1080 250"; - }; - # Right monitor - DP-3 = { - mode = "1920x1080@143.981Hz"; - position = "4520 250"; - }; - } - else if hostName == "electra" then { - eDP-1 = { - mode = "1920x1200@59.950Hz"; - position = "0 0"; - }; - DP-2 = { - mode = "1280x720@60.000Hz"; - position = "0 1200"; - }; - - } - else {}; - hostnameWorkspaceAssign = - if hostName == "tower" then [ - { output = "DP-2"; workspace = "1"; } - { output = "DP-2"; workspace = "2"; } - { output = "DP-2"; workspace = "3"; } - { output = "DP-3"; workspace = "4"; } - { output = "DP-3"; workspace = "5"; } - { output = "DP-3"; workspace = "6"; } - { output = "DP-1"; workspace = "7"; } - { output = "DP-1"; workspace = "8"; } - { output = "DP-1"; workspace = "9"; } - ] - else if hostName == "electra" then [] - else []; - hostnameServices = - if hostName == "tower" then {} - else if hostName == "electra" then { - swayidle = { - enable = true; - timeouts = [ - { - timeout = 120; - command = "${notify} 'Locking in 5 seconds' -t 5000"; - } - { - timeout = 125; - command = lock; - } - { - timeout = 125; - command = display "off"; - resumeCommand = display "on"; - } - { - timeout = 600; - command = "${pkgs.systemd}/bin/systemctl suspend"; - } - ]; # end timeouts - events = [ - { - event = "before-sleep"; - command = "display off; systemctl --user stop libinput-gestures; ${lock}"; - } - { - event = "after-resume"; - command = "display on; systemctl --user start libinput-gestures"; - } - { - event = "lock"; - command = (display "off") + "; " + lock; - } - { - event = "unlock"; - command = display "on"; - } - ]; # end events - }; # end swayidle - } - else {}; - hostnameInput1 = - if hostName == "tower" then "us" - else "se"; - hostnameInput2 = - if hostName == "tower" then "se" - else "us"; - in +let + commands = import ../../../lib/commands.nix { inherit pkgs; }; + inherit (commands) swaymsg lock; +in { xdg = { configFile."libinput-gestures.conf".text = '' @@ -144,32 +30,27 @@ pkgs.nautilus pkgs.chromium ]; - defaultApplications = { # mostly redundant but the additional granularity is good for reducing friction - # Text + defaultApplications = { "text/*" = [ "${pkgs.gnome-text-editor}/share/applications/org.gnome.TextEditor.desktop" ]; "application/xml" = [ "${pkgs.gnome-text-editor}/share/applications/org.gnome.TextEditor.desktop" ]; "application/json" = [ "${pkgs.gnome-text-editor}/share/applications/org.gnome.TextEditor.desktop" ]; "application/pdf" = [ "${pkgs.evince}/share/applications/org.gnome.Evince.desktop" ]; - # Media + "video/*" = [ "${pkgs.vlc}/share/applications/vlc.desktop" ]; "audio/*" = [ "${pkgs.vlc}/share/applications/vlc.desktop" ]; - # Browser "text/html" = [ "${pkgs.chromium}/share/applications/chromium.desktop" ]; "application/xhtml+xml" = [ "${pkgs.chromium}/share/applications/chromium.desktop" ]; "application/x-web-app-manifest+json" = [ "${pkgs.chromium}/share/applications/chromium.desktop" ]; "application/xml-dtd" = [ "${pkgs.chromium}/share/applications/chromium.desktop" ]; - # Images "image/*" = [ "${pkgs.loupe}/share/applications/org.gnome.Loupe.desktop.desktop" ]; }; }; }; + systemd.user.sessionVariables = { - # this right here offends me https://source.chromium.org/chromium/chromium/src/+/main:base/nix/xdg_util.cc;l=179-180 - # setting GNOME_DESKTOP_SESSION_ID will fool some legacy systems into thinking we're running gnome - # this is an issue for xdg-open which can be circumvented by adding glib to the system which lets xdg-open fallback to gio-open GNOME_DESKTOP_SESSION_ID = "999"; - SHELL_THICCNESS = "LOW"; # instructs xonsh to default to a slim environment + SHELL_THICCNESS = "LOW"; }; } # end file diff --git a/home/alisceon/server.nix b/home/alisceon/server.nix new file mode 100644 index 0000000..d4cc402 --- /dev/null +++ b/home/alisceon/server.nix @@ -0,0 +1,3 @@ +{ ... }: +{ +} # end file diff --git a/home/alisceon/workstation.nix b/home/alisceon/workstation.nix index 3119b12..4147f77 100644 --- a/home/alisceon/workstation.nix +++ b/home/alisceon/workstation.nix @@ -1,4 +1,11 @@ { pkgs, config, hostName, lib, ... }: { + imports = [ + ./modules/programs/chromium.nix + ./modules/programs/discord.nix + ./modules/programs/vscode.nix + ./modules/services/syncthing.nix + ]; + stylix.enableReleaseChecks = false; # obsidian special case # programs.obsidian.enable = true; diff --git a/home/root/base.nix b/home/root/base.nix new file mode 100644 index 0000000..60e690e --- /dev/null +++ b/home/root/base.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./default.nix + ]; +} # end file diff --git a/home/wm/sway.nix b/home/wm/sway.nix new file mode 100644 index 0000000..6305b22 --- /dev/null +++ b/home/wm/sway.nix @@ -0,0 +1,18 @@ +{ ... }: +{ + imports = [ + ../alisceon/modules/wm/sway/default.nix + ../alisceon/modules/wm/sway/gtk.nix + ../alisceon/modules/wm/sway/xdg.nix + + ../alisceon/modules/programs/foot.nix + ../alisceon/modules/programs/kitty.nix + ../alisceon/modules/programs/rofi.nix + ../alisceon/modules/programs/swaylock.nix + ../alisceon/modules/programs/waybar.nix + + ../alisceon/modules/services/espanso.nix + ../alisceon/modules/services/gnome-keyring.nix + ../alisceon/modules/services/mako.nix + ]; +} # end file