From 44c0812e94d07ff53348123e83aff5174a3886c1 Mon Sep 17 00:00:00 2001 From: tristan Date: Sat, 3 Aug 2024 18:31:13 +0100 Subject: [PATCH] zenix: tidy up --- flake.nix | 12 +++------ home/default.nix | 1 + home/desktop/hyprland/default.nix | 1 + home/modules/menu.nix | 3 ++- home/programs/graphical.nix | 1 - home/programs/personal/default.nix | 1 - home/programs/tmux.nix | 43 ++++++++++++++++++++++++++++++ lib/nixvim.nix | 4 --- nixos/default.nix | 39 --------------------------- nixos/programs/hyprland.nix | 13 +++++++++ nixos/programs/pipewire.nix | 15 +++++++++++ nixos/workstation.nix | 22 --------------- 12 files changed, 78 insertions(+), 77 deletions(-) create mode 100644 home/programs/tmux.nix create mode 100644 nixos/programs/hyprland.nix create mode 100644 nixos/programs/pipewire.nix diff --git a/flake.nix b/flake.nix index 976798f..8c2f542 100644 --- a/flake.nix +++ b/flake.nix @@ -33,13 +33,12 @@ nixos-modules = [ ./hardware/zenix.nix (auto-login "Hyprland") + ./nixos/programs/hyprland.nix ./nixos/programs/gamer.nix ./nixos/programs/personal.nix ./nixos/workstation.nix ]; home-modules = [ - ./home/workstation.nix - ./home/desktop/hyprland/. ./home/programs/graphical.nix ./home/programs/gamer.nix ./home/programs/personal/. @@ -51,11 +50,10 @@ nixos-modules = [ ./hardware/fcs-tristan-nixbook.nix (auto-login "Hyprland") + ./nixos/hyprland.nix ./nixos/modules/work.nix - ./nixos/workstation.nix ]; home-modules = [ - ./home/workstation.nix ./home/desktop/hyprland/. ./home/programs/work.nix ./home/programs/graphical.nix @@ -129,11 +127,7 @@ nixos-modules = [ ./hardware/vm.nix (auto-login "Hyprland") - ./nixos/workstation.nix - ]; - home-modules = [ - ./home/desktop/hyprland/. - ./home/workstation.nix + ./nixos/programs/hyprland.nix ]; }; diff --git a/home/default.nix b/home/default.nix index c75a258..7fc5d0d 100644 --- a/home/default.nix +++ b/home/default.nix @@ -10,6 +10,7 @@ ./programs/git.nix ./programs/lf/. ./programs/zsh.nix + ./programs/tmux.nix ]; programs.home-manager.enable = true; diff --git a/home/desktop/hyprland/default.nix b/home/desktop/hyprland/default.nix index 2d90459..33fb7a2 100644 --- a/home/desktop/hyprland/default.nix +++ b/home/desktop/hyprland/default.nix @@ -18,6 +18,7 @@ in { imports = [ (import ../utils/waybar.nix) (import ../utils/display.nix) + ../../workstation.nix ]; xdg.portal = { enable = true; diff --git a/home/modules/menu.nix b/home/modules/menu.nix index 3e7943b..ea30348 100644 --- a/home/modules/menu.nix +++ b/home/modules/menu.nix @@ -8,8 +8,9 @@ terminal = config.programs.terminal; termcmd = "${terminal}/bin/${terminal.pname}"; menucmd = config.programs.menu.drunCommand; + inherit (lib) mkPackageOption mkOption; in { - options.programs = with lib; { + options.programs = { menu = { package = mkPackageOption pkgs "wofi" { example = "pkgs.dmenu-wayland"; diff --git a/home/programs/graphical.nix b/home/programs/graphical.nix index 342376f..70bc7d2 100644 --- a/home/programs/graphical.nix +++ b/home/programs/graphical.nix @@ -37,7 +37,6 @@ brave vieb bitwarden - logseq ]; xdg.mimeApps.defaultApplications = { diff --git a/home/programs/personal/default.nix b/home/programs/personal/default.nix index 5c24f89..a740d23 100644 --- a/home/programs/personal/default.nix +++ b/home/programs/personal/default.nix @@ -33,7 +33,6 @@ project = "\${workspaceFolder}"; } ]; - }; }; diff --git a/home/programs/tmux.nix b/home/programs/tmux.nix new file mode 100644 index 0000000..f2b301d --- /dev/null +++ b/home/programs/tmux.nix @@ -0,0 +1,43 @@ +{ + programs.tmux = { + enable = true; + baseIndex = 1; + escapeTime = 0; + keyMode = "vi"; + mouse = true; + terminal = "screen-256color"; + historyLimit = 5000; + extraConfig = '' + bind -n M-s split-window -v + bind -n M-v split-window -h + bind -n M-Enter split-window -h + bind -n M-h select-pane -L + bind -n M-j select-pane -D + bind -n M-k select-pane -U + bind -n M-l select-pane -R + bind -n M-q kill-pane + bind -n M-< resize-pane -L 10 + bind -n M-> resize-pane -R 10 + bind -n M-- resize-pane -D 10 + bind -n M-+ resize-pane -U 10 + bind -n M-z resize-pane -Z + bind -n M-u copy-mode + bind -n M-p paste-buffer + bind -n M-n next-window + + set-option -g renumber-windows on + ''; + }; + + # programs.kitty = { + # enable = true; + # keybindings = { + # "alt+h" = "neighboring_window left"; + # "alt+l" = "neighboring_window right"; + # "alt+j" = "neighboring_window down"; + # "alt+k" = "neighboring_window up"; + # "alt+enter" = "new_window"; + # }; + # shellIntegration.enableZshIntegration = true; + # }; +} diff --git a/lib/nixvim.nix b/lib/nixvim.nix index 1b0570a..75ef7a0 100644 --- a/lib/nixvim.nix +++ b/lib/nixvim.nix @@ -121,10 +121,6 @@ lazygit.enable = true; which-key.enable = true; - toggleterm = { - enable = true; - settings = {open_mapping = "[[]]";}; - }; dap = { enable = true; diff --git a/nixos/default.nix b/nixos/default.nix index 122f780..68a84c1 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -8,7 +8,6 @@ }: let user = config.user; in { - imports = [ ./modules/podman.nix ]; @@ -99,44 +98,6 @@ in { sops ]; - programs.tmux.enable = true; - programs.tmux.extraConfig = '' - set-option -sa terminal-overrides ",xterm*:Tc" - - set escape-time 0 - - bind -n M-s split-window -v - bind -n M-v split-window -h - bind -n M-Enter split-window -h - bind -n M-h select-pane -L - bind -n M-j select-pane -D - bind -n M-k select-pane -U - bind -n M-l select-pane -R - bind -n M-q kill-pane - bind -n M-< resize-pane -L 10 - bind -n M-> resize-pane -R 10 - bind -n M-- resize-pane -D 10 - bind -n M-+ resize-pane -U 10 - bind -n M-z resize-pane -Z - bind -n M-u copy-mode - bind -n M-p paste-buffer - bind -n M-n next-window - - set-window-option -g mode-keys vi - bind-key -T copy-mode-vi v send-keys -X begin-selection - bind-key -T copy-mode-vi y send-keys -X copy-selection - - set -g mouse on - - set -g base-index 1 - set -g pane-base-index 1 - set-window-option -g pane-base-index 1 - set-option -g renumber-windows on - - bind -n "M-`" break-pane -d - bind -n "M-`" break-pane -d - ''; - boot.kernel.sysctl = { "net.ipv4.ip_unprivileged_port_start" = 53; }; diff --git a/nixos/programs/hyprland.nix b/nixos/programs/hyprland.nix new file mode 100644 index 0000000..0b00516 --- /dev/null +++ b/nixos/programs/hyprland.nix @@ -0,0 +1,13 @@ +{config, ...}: { + programs.hyprland.enable = true; + security.pam.services.hyprlock = {}; + + imports = [ + ./pipewire.nix + ../workstation.nix + ]; + + home-manager.users.${config.user}.imports = [ + ../../home/desktop/hyprland/. + ]; +} diff --git a/nixos/programs/pipewire.nix b/nixos/programs/pipewire.nix new file mode 100644 index 0000000..2610134 --- /dev/null +++ b/nixos/programs/pipewire.nix @@ -0,0 +1,15 @@ +{ + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + # pipewire raop + networking.firewall.allowedUDPPorts = [6002 6001]; + # network streaming + networking.firewall.allowedTCPPorts = [4713]; +} diff --git a/nixos/workstation.nix b/nixos/workstation.nix index a616009..dd667e0 100644 --- a/nixos/workstation.nix +++ b/nixos/workstation.nix @@ -7,29 +7,7 @@ imports = [ inputs.stylix.nixosModules.stylix ]; - nixpkgs.config.permittedInsecurePackages = [ - "electron-27.3.11" - ]; - programs.hyprland.enable = true; - - # use pipewire - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - # pipewire raop - networking.firewall.allowedUDPPorts = [6002 6001]; - # network streaming - networking.firewall.allowedTCPPorts = [4713]; - - security.pam.services.swaylock = {}; - security.pam.services.hyprlock = {}; security.polkit.enable = true; systemd.user.services.polkit-gnome-authentication-agent-1 = { description = "polkit-gnome-authentication-agent-1";