From ad478d1e9e4335b7147f38f8d5c435e83888b9dd Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 12 Apr 2023 16:02:21 +0100 Subject: [PATCH] autologin, tmux, mpd, mpv --- flake.lock | 6 ++--- flake.nix | 1 - system/configuration.nix | 43 +++++++++++++++++++++++++++++---- users/tristan/home.nix | 52 +++++++++++++++++++++++++++------------- 4 files changed, 77 insertions(+), 25 deletions(-) diff --git a/flake.lock b/flake.lock index 8fb760d..e2550ea 100644 --- a/flake.lock +++ b/flake.lock @@ -82,11 +82,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1680865339, - "narHash": "sha256-H6rmJ1CyJ3Q5ZyoLMYq/UEYMS9Q1orJjRpWiQ47HudE=", + "lastModified": 1681154110, + "narHash": "sha256-OQwWzlzAY1dCqgSsgZzsPIOGmX4pBGaoXOy0rSl4b5Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0040164e473509b4aee6aedb3b923e400d6df10b", + "rev": "115a96e2ac1e92937cd47c30e073e16dcaaf6247", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 4eb9370..48cbe1f 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,6 @@ modules = [ hyprland.nixosModules.default - {programs.hyprland.enable = true;} ./system/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/system/configuration.nix b/system/configuration.nix index 58737b0..9ba9ca9 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -2,6 +2,8 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running โ€˜nixos-helpโ€™). +# https://search.nixos.org/options + { config, pkgs, ... }: { imports = [ @@ -10,6 +12,8 @@ nix.settings = { experimental-features = [ "nix-command" "flakes" ]; + + # temporary unstable hyprland release substituters = ["https://hyprland.cachix.org"]; trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; }; @@ -53,9 +57,16 @@ # Configure graphical stuff services.xserver = { - enable = false; + enable = true; layout = "gb"; libinput.enable = true; + + # the only display manager that works? + displayManager.gdm.enable = true; + displayManager.autoLogin = { + enable = true; + user = "tristan"; + }; }; qt5.enable = true; @@ -123,10 +134,32 @@ services.dbus.enable = true; programs.light.enable = true; programs.dconf.enable = true; - programs.hyprland = { - enable = true; - xwayland.enable = true; - }; + programs.hyprland.enable = true; + + programs.tmux.enable = true; + programs.tmux.extraConfig = '' + set escape-time 0 + set -g default-terminal screen + + 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-u copy-mode + bind -n M-p paste-buffer + + 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 + ''; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. diff --git a/users/tristan/home.nix b/users/tristan/home.nix index 74061e0..288f37e 100644 --- a/users/tristan/home.nix +++ b/users/tristan/home.nix @@ -1,23 +1,13 @@ { config, pkgs, user, ... }: +# https://nix-community.github.io/home-manager/options.html { - # Home Manager needs a bit of information about you and the - # paths it should manage. + # don't change + home.stateVersion = "22.05"; + programs.home-manager.enable = true; + home.username = "tristan"; home.homeDirectory = "/home/tristan"; - # This value determines the Home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new Home Manager release introduces backwards - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = "22.05"; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - home.packages = with pkgs; [ gimp ]; @@ -41,7 +31,7 @@ services.swayidle.enable = true; services.swayidle.events = [ { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; } - { event = "lock"; command = "lock"; } + { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock"; } ]; programs.waybar.enable = true; @@ -60,6 +50,10 @@ format-icons.default = ["๐Ÿ”ˆ" "๐Ÿ”‰" "๐Ÿ”Š"]; on-click = "pavucontrol"; }; + mpd = { + server = "192.168.1.2"; + on-click = "foot -e ncmpcpp"; + }; }; }; @@ -70,4 +64,30 @@ package = pkgs.materia-theme; }; }; + + programs.ncmpcpp.enable = true; + programs.ncmpcpp.settings.mpd_host = "192.168.1.2"; + # services.mpd-mpris.enable = true; + # services.mpd-mpris.mpd = { + # host = "192.168.1.2"; + # }; + + programs.mpv.enable = true; + programs.mpv.bindings = { + l = "seek 5"; + h = "seek -5"; + e = "add chapter 1"; + b = "add chapter -1"; + ">" = "multiply speed 1.1"; + "<" = "multiply speed 1/1.1"; + "." = "frame-step"; + "," = "frame-back-step"; + "ctrl+n" = "playlist-next"; + "ctrl+p" = "playlist-prev"; + k = "add volume 2"; + j = "add volume -2"; + m = "cycle mute"; + c = "cycle sub-visibility"; + }; + }