summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortom barrett <tom@tombarrett.xyz>2024-05-30 16:02:56 +0200
committertom barrett <tom@tombarrett.xyz>2024-06-02 21:56:18 +0200
commitd6a28baef6549996d5e6bd9c31f77ad508c9f6c9 (patch)
tree0338f12515e71021cc38d2fad2ac35d11090af60
parent4f7a32e108e46bed8d2468d176259c255cf0e94b (diff)
hyperlandhyprland
-rw-r--r--configuration.nix15
-rw-r--r--hardware-configuration.nix1
-rw-r--r--home.nix267
-rwxr-xr-xpassfi30
-rw-r--r--xmobarrc19
-rw-r--r--xmonad.hs115
6 files changed, 238 insertions, 209 deletions
diff --git a/configuration.nix b/configuration.nix
index e5bd3b5..6def88f 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -1,8 +1,4 @@
-{
- config,
- pkgs,
- ...
-}: {
+{pkgs, ...}: {
imports = [./hardware-configuration.nix];
nix.settings = {
experimental-features = ["nix-command" "flakes"];
@@ -39,14 +35,7 @@
};
};
fonts.packages = [pkgs.hermit];
- services = {
- openssh.enable = true;
- xserver = {
- enable = true;
- autorun = false;
- displayManager.startx.enable = true;
- };
- };
+ services.openssh.enable = true;
system.stateVersion = "23.11";
zramSwap.enable = true;
}
diff --git a/hardware-configuration.nix b/hardware-configuration.nix
index a09ff30..207ce9e 100644
--- a/hardware-configuration.nix
+++ b/hardware-configuration.nix
@@ -4,7 +4,6 @@
{
config,
lib,
- pkgs,
modulesPath,
...
}: {
diff --git a/home.nix b/home.nix
index f62bd4c..71e8cfe 100644
--- a/home.nix
+++ b/home.nix
@@ -1,67 +1,55 @@
{
config,
- lib,
nixvim,
+ lib,
pkgs,
...
}: let
- vars = {
- BEMENU_OPTS =
- "--fn 'Hermit 12' --line-height 25 "
- + "--hb #a1b56c --hf #f8f8f8 --nf #b8b8b8 --af #b8b8b8 "
- + "--tf #f8f8f8 --fbf #f8f8f8 --ff #f8f8f8 --cf #f8f8f8 "
- + "--sf #f8f8f8 --scf #f8f8f8 --hp 10";
- };
+ black = "#000000";
+ white = "#FFFFFF";
+ red = "#880000";
+ cyan = "#AAFFEE";
+ magenta = "#CC44CC";
+ green = "#00CC55";
+ blue = "#0088FF";
+ yellow = "#EEEE77";
+ grey = "#333333";
+ font = "Hermit";
+ primary = green;
in {
home = {
username = "tom";
- homeDirectory = "/home/tom";
+ homeDirectory = "/home/${config.home.username}";
stateVersion = "23.11";
- packages = with pkgs; [
- acpi
- bemenu
- binutils
- brave
- feh
- file
- firefox
- ghc
- gimp
- haskellPackages.fourmolu
- htop
- jq
- ncdu
- ncmpcpp
+ packages = [
nixvim.packages.x86_64-linux.default
- nmap
- pavucontrol
- python3Packages.ipython
- scrot
- tmux
- tree
- unzip
- vim
- xautolock
- xmobar
+ (pkgs.writeShellScriptBin
+ "passfi"
+ (builtins.readFile ./passfi))
+ pkgs.acpi
+ pkgs.binutils
+ pkgs.brave
+ pkgs.feh
+ pkgs.file
+ pkgs.firefox
+ pkgs.gimp
+ pkgs.htop
+ pkgs.jq
+ pkgs.ncdu
+ pkgs.ncmpcpp
+ pkgs.nmap
+ pkgs.pavucontrol
+ pkgs.python3Packages.ipython
+ pkgs.tmux
+ pkgs.tree
+ pkgs.unzip
+ pkgs.vim
+ pkgs.wl-clipboard
];
- sessionVariables =
- vars
- // {
- LESS = "-R -F";
- EDITOR = "vim";
- };
-
- file.".xinitrc".text = ''
- xmonad
- '';
- # todo find better solution for
- # restarting without nixos switch
- file.".config/xmonad/xmonad.hs".source =
- config.lib.file.mkOutOfStoreSymlink
- "${config.home.homeDirectory}/src/nixos/xmonad.hs";
- file.".xmobarrc".source =
- config.lib.file.mkOutOfStoreSymlink
- "${config.home.homeDirectory}/src/nixos/xmobarrc";
+ sessionVariables = {
+ LESS = "-R -F";
+ EDITOR = "vim";
+ };
};
programs = {
home-manager.enable = true;
@@ -70,11 +58,11 @@ in {
settings = {
env.TERM = "xterm-256color";
font = {
- bold.family = "Hermit";
- bold_italic.family = "Hermit";
- italic.family = "Hermit";
- normal.family = "Hermit";
- size = 10;
+ bold.family = font;
+ bold_italic.family = font;
+ italic.family = font;
+ normal.family = font;
+ size = 12;
};
keyboard.bindings = [
{
@@ -88,6 +76,22 @@ in {
action = "DecreaseFontSize";
}
];
+ colors = {
+ primary = {
+ background = "#222222";
+ foreground = "${white}";
+ };
+ normal = {
+ black = "${black}";
+ red = "${red}";
+ green = "${green}";
+ yellow = "${yellow}";
+ blue = "${blue}";
+ magenta = "${magenta}";
+ cyan = "${cyan}";
+ white = "${white}";
+ };
+ };
};
};
git = {
@@ -105,6 +109,77 @@ in {
enable = true;
package = pkgs.pass.withExtensions (exts: [exts.pass-otp]);
};
+ waybar = {
+ enable = true;
+ settings = {
+ main = {
+ layer = "top";
+ position = "top";
+ height = 25;
+ modules-left = ["hyprland/workspaces"];
+ modules-right = ["battery" "clock"];
+ "hyprland/workspaces" = {
+ persistent-workspaces = {
+ "*" = 9;
+ };
+ };
+ };
+ };
+ style = ''
+ * {
+ font-family: ${font};
+ font-size: 16px;
+ border-radius: 0;
+ }
+ window#waybar {
+ background-color: ${primary};
+ }
+ .modules-right {
+ background-color: ${grey};
+ color: ${white};
+ }
+ .modules-left {
+ background-color: ${grey};
+ }
+ #workspaces button {
+ padding: 0px 5px 0px 5px;
+ color: ${primary};
+ }
+ #workspaces button.empty {
+ background-color: ${grey};
+ color: ${white};
+ }
+ #workspaces button.active {
+ background-color: ${primary};
+ color: ${white};
+ }
+ '';
+ };
+ wofi = {
+ enable = true;
+ settings = {
+ hide_scroll = true;
+ insensitive = true;
+ };
+ style = ''
+ * {
+ font-family: ${font};
+ padding: 0px 0px 0px 0px;
+ border-radius: 0;
+ color: ${white};
+ }
+ window {
+ background-color: ${grey};
+ }
+ #input {
+ background-color: ${grey};
+ border: 0px;
+ }
+ #entry:selected {
+ background-color: ${primary};
+ }
+ '';
+ };
zsh = {
enable = true;
autosuggestion.enable = true;
@@ -112,16 +187,86 @@ in {
autocd = true;
};
};
- systemd.user.settings.Manager.DefaultEnvironment = vars;
- xsession.windowManager.xmonad = {
+ wayland.windowManager.hyprland = {
enable = true;
- enableContribAndExtras = true;
+ /*
+ package = pkgs.hyprland.override {
+ legacyRenderer = true;
+ };
+ */
+ xwayland.enable = true;
+ settings = {
+ general = {
+ layout = "master";
+ gaps_in = 3;
+ gaps_out = 6;
+ border_size = 2;
+ "col.active_border" =
+ "rgb(" + lib.strings.removePrefix "#" primary + ")";
+ "col.inactive_border" =
+ "rgb(" + lib.strings.removePrefix "#" grey + ")";
+ };
+ cursor.no_warps = true;
+ bind = [
+ "ALT, Return, exec, alacritty"
+ "ALT, Q, killactive"
+ "ALT, D, exec, wofi --show run"
+ "ALT, C, exec, passfi"
+ "ALT, X, exec, passfi otp"
+ "ALT_SHIFT, E, exit"
+ "ALT, J, cyclenext"
+ "ALT, K, cyclenext, prev"
+ "ALT, H, layoutmsg, mfact -0.05"
+ "ALT, L, layoutmsg, mfact +0.05"
+ "ALT, U, layoutmsg, removemaster"
+ "ALT, I, layoutmsg, addmaster"
+ "ALT_SHIFT, Return, layoutmsg, swapwithmaster"
+ "ALT_SHIFT, SPACE, togglefloating"
+ "ALT, F, fullscreen"
+ "ALT, T, fullscreen"
+ "ALT, M, fullscreen"
+ "ALT, TAB, workspace, previous"
+ "ALT, 1, workspace, 1"
+ "ALT, 2, workspace, 2"
+ "ALT, 3, workspace, 3"
+ "ALT, 4, workspace, 4"
+ "ALT, 5, workspace, 5"
+ "ALT, 6, workspace, 6"
+ "ALT, 7, workspace, 7"
+ "ALT, 8, workspace, 8"
+ "ALT, 9, workspace, 9"
+ "ALT_SHIFT, 1, movetoworkspacesilent, 1"
+ "ALT_SHIFT, 2, movetoworkspacesilent, 2"
+ "ALT_SHIFT, 3, movetoworkspacesilent, 3"
+ "ALT_SHIFT, 4, movetoworkspacesilent, 4"
+ "ALT_SHIFT, 5, movetoworkspacesilent, 5"
+ "ALT_SHIFT, 6, movetoworkspacesilent, 6"
+ "ALT_SHIFT, 7, movetoworkspacesilent, 7"
+ "ALT_SHIFT, 8, movetoworkspacesilent, 8"
+ "ALT_SHIFT, 9, movetoworkspacesilent, 9"
+ ];
+ bindm = [
+ "ALT, mouse:272, movewindow"
+ "ALT, mouse:273, resizewindow"
+ ];
+ decoration = {
+ blur.enabled = false;
+ drop_shadow = false;
+ };
+ animations.enabled = false;
+ exec-once = "waybar";
+ misc = {
+ disable_hyprland_logo = true;
+ background_color =
+ "rgb(" + lib.strings.removePrefix "#" black + ")";
+ };
+ };
};
services = {
gpg-agent = {
enable = true;
enableSshSupport = true;
- pinentryPackage = pkgs.pinentry-bemenu;
+ pinentryPackage = pkgs.pinentry-curses;
# from gpg --list-secret-keys --with-keygrip ([A] keygrip)
sshKeys = [""];
};
diff --git a/passfi b/passfi
new file mode 100755
index 0000000..ec16c16
--- /dev/null
+++ b/passfi
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -x
+
+shopt -s nullglob globstar
+
+if [[ $1 == "otp" ]]; then
+ otp=1
+fi
+
+prefix=${PASSWORD_STORE_DIR-~/.password-store}
+password_files=("$prefix"/**/*.gpg)
+password_files=("${password_files[@]#"$prefix"/}")
+password_files=("${password_files[@]%.gpg}")
+
+if [[ ! $otp -eq 0 ]]; then
+ for f in "${password_files[@]}"; do
+ [[ $f == *"otp"* ]] && otp_files+=("$f")
+ done
+ password_files=("${otp_files[@]}")
+fi
+
+password=$(printf '%s\n' "${password_files[@]}" | wofi --show dmenu "$@")
+
+[[ -n $password ]] || exit
+
+if [[ $otp -eq 0 ]]; then
+ pass show -c "$password" 2>/dev/null
+else
+ pass otp show -c "$password" 2>/dev/null
+fi
diff --git a/xmobarrc b/xmobarrc
deleted file mode 100644
index 52b9159..0000000
--- a/xmobarrc
+++ /dev/null
@@ -1,19 +0,0 @@
-Config
- { font = "Hermit 13"
- , textOffset = 0
- , borderWidth = 0
- , position = TopH 25
- , bgColor = "#a1b56c"
- , fgColor = "#b8b8b8"
- , commands =
- [ Run Date "%a %d %b %Y %H:%M:%S" "date" 10
- , Run DiskU [("/", "<free>")] ["-L", "1"] 50
- , Run Battery ["-t", "<left>%"] 10
- , Run Cpu ["-t", "<total>%"] 10
- , Run Com "sh" ["-c", "ip -br -4 a | awk '!/lo/ {if ($3) printf \"%s \", $3 }'"] "" 10
- , Run XMonadLog
- ]
- , sepChar = "%"
- , alignSep = "}{"
- , template = "%XMonadLog% }{ <fc=#b8b8b8,#181818> %sh%| %cpu% | %disku% | %battery% | %date% </fc>"
- }
diff --git a/xmonad.hs b/xmonad.hs
deleted file mode 100644
index 143f4a2..0000000
--- a/xmonad.hs
+++ /dev/null
@@ -1,115 +0,0 @@
-import System.Exit
-import XMonad
-import XMonad.Actions.CycleWS
-import XMonad.Hooks.EwmhDesktops
-import XMonad.Hooks.StatusBar
-import XMonad.Hooks.StatusBar.PP
-import XMonad.Layout.IndependentScreens
-import XMonad.Layout.Renamed
-import XMonad.Layout.Spacing
-import XMonad.Prompt
-import XMonad.Prompt.FuzzyMatch
-import XMonad.Prompt.Pass
-import qualified XMonad.StackSet as W
-import XMonad.Util.Cursor
-import XMonad.Util.EZConfig
-import XMonad.Util.SpawnOnce
-
-primary = "#a1b56c"
-grey0 = "#181818"
-grey1 = "#585858"
-grey2 = "#b8b8b8"
-grey3 = "#f8f8f8"
-
-main :: IO ()
-main = do
- nScreens <- countScreens
- xmonad
- . ewmhFullscreen
- . ewmh
- . withEasySB
- ( statusBarProp
- "xmobar"
- ( pure
- ( marshallPP
- (S 0)
- def
- { ppSep = ""
- , ppWsSep = ""
- , ppHiddenNoWindows = xmobarColor grey2 grey0 . pad
- , ppCurrent = xmobarColor grey3 primary . pad
- , ppHidden = xmobarBorder "Top" primary 2 . xmobarColor grey2 grey0 . pad
- , ppTitle = const ""
- , ppLayout = xmobarColor grey2 grey0 . pad
- }
- )
- )
- )
- defToggleStrutsKey
- $ let promptConfig =
- def
- { position = Top
- , bgColor = grey0
- , bgHLight = primary
- , promptBorderWidth = 0
- , fgHLight = grey3
- , height = 25
- , font = "xft:Hermit:size=12"
- , searchPredicate = fuzzyMatch
- , sorter = fuzzySort
- , alwaysHighlight = True
- }
- in def
- { borderWidth = 2
- , workspaces = [marshall s vw | vw <- (map show [1 .. 9]), s <- [0 .. nScreens]]
- , layoutHook =
- renamed
- [Replace "[]="]
- (spacingWithEdge 8 $ Tall 1 (5 / 100) (1 / 3))
- ||| renamed [Replace "[M]"] Full
- , normalBorderColor = grey1
- , focusedBorderColor = primary
- , keys = \c ->
- mkKeymap c $
- [ ("M-<Return>", spawn "alacritty")
- , ("M-q", kill)
- , ("M-d", spawn $ "bemenu-run -p ' ' --cw 2")
- , ("M-r", spawn "xmonad --recompile && xmonad --restart")
- , ("M-w", spawn "slock")
- , ("M-S-e", io exitSuccess)
- , ("M-j", windows W.focusDown)
- , ("M-k", windows W.focusUp)
- , ("M-c", passPrompt promptConfig)
- , ("M-x", passOTPPrompt promptConfig)
- , ("M-i", sendMessage $ IncMasterN 1)
- , ("M-u", sendMessage $ IncMasterN $ -1)
- , ("M-h", sendMessage Shrink)
- , ("M-l", sendMessage Expand)
- , ("M-m", sendMessage $ JumpToLayout "[M]")
- , ("M-t", sendMessage $ JumpToLayout "[]=")
- ,
- ( "M-<Tab>"
- , gets (W.screen . W.current . windowset)
- >>= \currentScreen ->
- toggleWS'
- [ marshall s vw
- | vw <- (map show [1 .. 9])
- , s <- [x | x <- [0 .. nScreens], x /= currentScreen]
- ]
- )
- , ("M-S-<Return>", windows W.swapMaster)
- , ("M-S-<Space>", withFocused $ windows . W.sink)
- ]
- ++ concatMap
- ( \n ->
- [ ("M-" ++ n, windows $ onCurrentScreen W.greedyView n)
- , ("M-S-" ++ n, windows $ onCurrentScreen W.shift n)
- ]
- )
- (map show [1 .. 9])
- , startupHook =
- do
- spawnOnce "feh --bg-fill --no-fehbg --randomize /home/tom/src/nixos/wallpapers"
- spawnOnce "xautolock -locker slock -time 1"
- setDefaultCursor xC_left_ptr
- }