From 472c575946c7366f6dc5e2dcaaa2e59ca813c2e0 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Sat, 4 May 2024 09:00:34 +0200 Subject: [PATCH 01/16] xmonad: fix multiscreen support --- home-manager/profiles/xmonad.nix | 11 +- .../profiles/xmonad/{xmobar.hs => xmobar0.hs} | 4 +- home-manager/profiles/xmonad/xmonad.hs | 591 +++++++++--------- 3 files changed, 315 insertions(+), 291 deletions(-) rename home-manager/profiles/xmonad/{xmobar.hs => xmobar0.hs} (93%) diff --git a/home-manager/profiles/xmonad.nix b/home-manager/profiles/xmonad.nix index 6f1c594..a29653a 100644 --- a/home-manager/profiles/xmonad.nix +++ b/home-manager/profiles/xmonad.nix @@ -5,7 +5,7 @@ ./screen-locker.nix ./urxvt.nix ]; - home.file.".xmonad/xmobar.hs".source = xmonad/xmobar.hs; + xdg.configFile."xmonad/xmobar0.hs".source = xmonad/xmobar0.hs; xsession = { enable = true; scriptPath = ".hm-xsession"; @@ -21,11 +21,16 @@ haskellPackages.data-default ]; enableContribAndExtras = true; + # Develop with: + # nix shell --impure --expr 'with import {}; haskellPackages.ghcWithPackages (hs: with hs; [ xmonad-contrib data-default ])' + # ln -fns $PWD/home-manager/profiles/xmonad/xmonad.hs ~/.xmonad/xmonad.hs + # ~/.xmonad/xmonad-x86_64-linux --recompile config = xmonad/xmonad.hs; }; }; home.packages = [ pkgs.acpilight + pkgs.autorandr pkgs.ffmpegthumbnailer pkgs.gmrun pkgs.light @@ -35,7 +40,8 @@ #(pkgs.writeShellScriptBin "mate-terminal" ''exec ${pkgs.rxvt-unicode}/bin/urxvtc -hold "$@"'') pkgs.rofi pkgs.scrot - pkgs.stalonetray + pkgs.trayer + #pkgs.stalonetray pkgs.wmname pkgs.xmobar pkgs.xorg.appres @@ -43,6 +49,7 @@ pkgs.xorg.xhost pkgs.xorg.xmodmap pkgs.xorg.xset + #pkgs.xdotool ]; xresources.properties = { "Xft.antialias" = true; diff --git a/home-manager/profiles/xmonad/xmobar.hs b/home-manager/profiles/xmonad/xmobar0.hs similarity index 93% rename from home-manager/profiles/xmonad/xmobar.hs rename to home-manager/profiles/xmonad/xmobar0.hs index f068da7..335d0e1 100644 --- a/home-manager/profiles/xmonad/xmobar.hs +++ b/home-manager/profiles/xmonad/xmobar0.hs @@ -10,7 +10,7 @@ Config { -- , borderColor = "#646464" , sepChar = "%" -- delineator between plugin names and straight text , alignSep = "}{" -- separator between left-right alignment - , template = "%StdinReader% }{ %multicpu% %thermal0% %memory% %dynnetwork% %battery% %kbd% %parisTime% " + , template = "%_XMONAD_XMOBAR0% }{ %multicpu% %thermal0% %memory% %dynnetwork% %battery% %kbd% %parisTime% " , lowerOnStart = True -- send to bottom of window stack on start , hideOnStart = False -- start with window unmapped (hidden) , allDesktops = True -- show on all desktops @@ -18,7 +18,7 @@ Config { , pickBroadest = False -- choose widest display (multi-monitor) , persistent = True -- enable/disable hiding (True = disabled) , commands = - [ Run StdinReader + [ Run XPropertyLog "_XMONAD_XMOBAR0" , Run MultiCpu [ "--template", "CPU:%" , "--Low", "50" -- units: % diff --git a/home-manager/profiles/xmonad/xmonad.hs b/home-manager/profiles/xmonad/xmonad.hs index 8075a02..0e7925d 100644 --- a/home-manager/profiles/xmonad/xmonad.hs +++ b/home-manager/profiles/xmonad/xmonad.hs @@ -27,7 +27,9 @@ import XMonad.Hooks.DynamicLog import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.Rescreen import XMonad.Hooks.SetWMName +import XMonad.Hooks.StatusBar import XMonad.Hooks.UrgencyHook import XMonad.Layout.Fullscreen import XMonad.Layout.Grid @@ -41,288 +43,251 @@ import XMonad.Layout.ResizableTile import XMonad.Layout.Spiral import XMonad.Layout.Tabbed import XMonad.Layout.ThreeColumns -import XMonad.Util.Run(spawnPipe) +import XMonad.Util.Ungrab (unGrab) +--import XMonad.Operations (unGrab) -- TODO: needs xmonad 0.18 import XMonad.Util.SpawnOnce import qualified XMonad.StackSet as W -myKeys - conf@XConfig{XMonad.modMask} = - Map.fromList $ - let xK_XF86Backward = 0x1008ff26 - xK_XF86Forward = 0x1008ff27 in - [ - -- Start a terminal - ((modMask, xK_Return), spawn $ XMonad.terminal conf) - -- Launch a program - , ((modMask, xK_Menu), spawn "exec rofi -show run -no-disable-history -run-command \"bash -c 'systemd-run --user --unit=app-org.rofi.\\$(systemd-escape \\\"{cmd}\\\")@\\$RANDOM -p CollectMode=inactive-or-failed {cmd}'\"") - -- Browse the filesystem - , ((modMask, xK_BackSpace), spawn "systemd-run --user --unit=app-org.rofi.caja@$RANDOM -p CollectMode=inactive-or-failed caja") - - -- Lock the screen - , ((0, xK_Pause), spawn "systemctl --user start xss-lock.service; xset s activate dpms force off") - - -- Take a full screenshot - , ((0, xK_Print), spawn "cd ~/img/cap && scrot --quality 42 '%Y-%m-%d_%H-%M-%S.png' && caja ~/img/cap") - -- Take a selective screenshot - , ((modMask, xK_Print), spawn "select-screenshot") - - -- Volume control - , ((0, 0x1008FF12), spawn "pactl -- set-sink-mute @DEFAULT_SINK@ toggle") -- XF88AudioMute - , ((0, 0x1008FF11), spawn "pactl -- set-sink-volume @DEFAULT_SINK@ -5%") -- XF86AudioLowerVolume - , ((0, 0x1008FF13), spawn "pactl -- set-sink-volume @DEFAULT_SINK@ +5%") -- XF86AudioRaiseVolume - -- Audio previous - -- , ((0, 0x1008FF16), spawn "") - -- Play/pause - -- , ((0, 0x1008FF14), spawn "") - -- Audio next - -- , ((0, 0x1008FF17), spawn "") - -- Eject CD tray - -- , ((0, 0x1008FF2C), spawn "eject -T") - - -- Close focused window. - , ((modMask, xK_Escape), kill) - , ((modMask, xK_q), kill) - - -- Clipboard - , ((modMask, xK_c), spawn "clipster --select --primary") - - -- Temporarily maximize a window - , ((modMask, xK_f), sendMessage $ XMonad.Layout.MultiToggle.Toggle FULL) - -- , ((modMask, xK_f), withFocused (sendMessage . maximizeRestore)) - - -- Cycle through the available layout algorithms - , ((modMask, 0x13bd), sendMessage NextLayout) -- oe (²) - , ((modMask, xK_ampersand), sendMessage $ JumpToLayout "ResizableTall") -- & (1) - , ((modMask, xK_eacute), sendMessage $ JumpToLayout "Mirror ResizableTall") -- é (2) - , ((modMask, xK_quotedbl), sendMessage $ JumpToLayout "Tabbed Simplest") -- ' (3) - , ((modMask, xK_apostrophe), sendMessage $ JumpToLayout "Magnifier Grid") -- " (4) - , ((modMask, xK_parenleft), sendMessage $ JumpToLayout "Spiral") -- ( (5) - , ((modMask, xK_minus), sendMessage $ JumpToLayout "Full") -- - (6) - , ((modMask, xK_egrave), sendMessage $ JumpToLayout "ThreeCol") -- è (7) - - -- Reset the layouts on the current workspace to default - -- , ((modMask .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf) - - -- Resize viewed windows to the correct size. - , ((modMask, xK_n), refresh) - - -- Move focus between windows - , ((modMask, xK_Tab), windows W.focusDown) - , ((modMask .|. shiftMask, xK_Tab), windows W.focusUp) - , ((modMask, xK_i), windows W.focusUp) - , ((modMask, xK_k), windows W.focusDown) - - -- Move focus to the master window - , ((modMask, xK_m), windows W.focusMaster) - -- Swap the focused window and the master window - , ((modMask, xK_space), windows W.swapMaster) - - -- Swap the focused window with the next window. - --, ((modMask, xK_o), windows W.swapDown >> windows W.focusMaster) - -- Swap the focused window with the previous window. - , ((modMask, xK_m), windows W.swapUp >> windows W.focusMaster) - - -- Push window back into tiling. - , ((modMask, xK_t), withFocused $ windows . W.sink) - - -- Change the number of windows in the master area - , ((modMask, xK_Up), sendMessage $ IncMasterN 1) - , ((modMask, xK_Down), sendMessage $ IncMasterN (-1)) - - -- Toggle the status bar gap. - , ((modMask, xK_b), sendMessage ToggleStruts) - - -- Quit xmonad - , ((modMask .|. shiftMask, xK_End), io exitSuccess) - -- Restart xmonad - , ((modMask, xK_End), restart "xmonad" True) - - -- Workspace management - -- XF86Back: Switch to previous workspace - , ((0, xK_XF86Backward), prevWS) - , ((modMask, xK_j), prevWS) - -- Switch to next workspace - , ((0, xK_XF86Forward), nextWS) - , ((modMask, xK_l), nextWS) - -- XF86Back: Move the current client to the previous workspace and go there - , ((modMask, xK_XF86Backward), shiftToPrev >> prevWS) - , ((modMask .|. shiftMask, xK_j), shiftToPrev >> prevWS) - -- Move the current client to the next workspace and go there - , ((modMask, xK_XF86Forward), shiftToNext >> nextWS) - , ((modMask .|. shiftMask, xK_l), shiftToNext >> nextWS) - -- Switch to previous workspace - -- Switch to next workspace - {- - -- Move the current client to the previous workspace - , ((0 .|. shiftMask , xK_XF86Backward), shiftToPrev ) - -- Move the current client to the next workspace - , ((0 .|. shiftMask , xK_XF86Forward), shiftToNext ) - -} - - -- Toggle copying window on all workspaces (sticky window) - , ((modMask, xK_s), do - copies <- wsContainingCopies -- NOTE: consider only hidden workspaces - case copies of - [] -> windows copyToAll - _ -> killAllOtherCopies - ) - - -- Resize the master area - , ((modMask, xK_Left), sendMessage Shrink) - , ((modMask, xK_Right), sendMessage Expand) - -- Resize windows in ResizableTall mode - , ((modMask .|. shiftMask, xK_Left), sendMessage MirrorShrink) - , ((modMask .|. shiftMask, xK_Right), sendMessage MirrorExpand) - ] ++ - - -- mod-[F1..F9], Switch to workspace N - -- mod-shift-[F1..F9], Move client to workspace N - [ ((m .|. modMask, k), windows $ f i) - | (i, k) <- zip (workspaces conf) [xK_F1 ..] ++ - zip (workspaces conf) [xK_1 ..] - , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] - ] ++ - {- NOTE: with Xinerama - [((m .|. modMask, k), windows $ onCurrentScreen f i) - | (i, k) <- zip (workspaces' conf) [xK_F1 ..] - , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] ] - -} - - -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 - -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 - [ ((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip [xK_w, xK_e, xK_r] [0 ..] - , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] - ] ++ - - -- mod-shift-[F1..F9], Swap workspace with workspace N - -- mod-shift-[1..9], Swap workspace with workspace N - [ ((modMask .|. controlMask, k), windows $ swapWithCurrent i) - | (i, k) <- zip (workspaces conf) [xK_F1 ..] ++ - zip (workspaces conf) [xK_1 ..] - ] - {- NOTE: with Xinerama - [((modMask .|. controlMask, k), windows $ onCurrentScreen swapWithCurrent i) - | (i, k) <- zip (workspaces' conf) [xK_F1 ..] ] - -} - - -myMouseBindings - XConfig{XMonad.modMask} = - Map.fromList - [ - -- mod-button1, Set the window to floating mode and move by dragging - ((modMask, button1), \w -> focus w >> mouseMoveWindow w) - - -- mod-button2, Raise the window to the top of the stack - , ((modMask, button2), \w -> focus w >> windows W.swapMaster) - - -- mod-button3, Set the window to floating mode and resize by dragging - , ((modMask, button3), \w -> focus w >> mouseResizeWindow w) - - , ((modMask, button4), \_ -> windows W.focusUp) - , ((modMask, button5), \_ -> windows W.focusDown) - - -- Cycle through workspaces - , ((controlMask .|. modMask, button5), nextNonEmptyWS) - , ((controlMask .|. modMask, button4), prevNonEmptyWS) - ] - where - nextNonEmptyWS _ = moveTo Next (WSIs ((not .) <$> isWindowSpaceVisible)) - prevNonEmptyWS _ = moveTo Prev (WSIs ((not .) <$> isWindowSpaceVisible)) - -isWindowSpaceVisible :: X (WindowSpace -> Bool) -isWindowSpaceVisible = do - vs <- gets (map (W.tag . W.workspace) . W.visible . windowset) - return (\w -> W.tag w `elem` vs) - -defaults xmproc _nScreens = docks $ ewmhFullscreen $ ewmh $ - azertyConfig - { borderWidth = 1 - , focusFollowsMouse = True +main = xmonad $ + withUrgencyHook NoUrgencyHook $ + -- dzenUrgencyHook { args = ["-bg", "darkgreen", "-xs", "1"] } $ + --addAfterRescreenHook myAfterRescreenHook $ + addRandrChangeHook (spawnExec "autorandr --change") $ + dynamicSBs barSpawner $ + docks $ + setEwmhActivateHook doAskUrgent $ + ewmhFullscreen $ + ewmh $ + azertyConfig + { borderWidth = 1 + , focusFollowsMouse = True , focusedBorderColor = "#00b10b" - , handleEventHook = handleEventHook def - , keys = myKeys - , layoutHook = smartBorders $ - mkToggle (NOBORDERS ?? FULL ?? EOT) $ -- enable temporarily maximizing a window - avoidStruts $ -- prevents windows from overlapping dock windows - let tall = ResizableTall 1 (1%200) (8%13) [] in - tabbed shrinkText tabConfig - ||| tall - ||| Mirror tall - ||| magnifiercz (13%10) Grid - ||| spiral (6%7) - ||| noBorders (fullscreenFull Full) - ||| ThreeColMid 1 (1%200) (1%2) - -- ||| Tall 1 (3/100) (1/2) - , manageHook = composeAll - -- [ , isFullscreen --> (doF W.focusDown <+> doFullFloat) - [ isFullscreen --> doFullFloat - , manageHook def - , manageDocks -- NOTE: do not tile dock windows - , resource =? "desktop_window" --> doIgnore - , className =? "Gimp" --> doFloat - , resource =? "gpicview" --> doSink - , className =? "mpv" --> doFloat - --, className =? "MPlayer" --> doShift "3:media" -- <+> doFloat - --, className =? "vlc" --> doShift "3:media" - , className =? "stalonetray" --> doIgnore - ] - , modMask = mod4Mask - , mouseBindings = myMouseBindings - , normalBorderColor = "#7C7C7C" - , startupHook = setWMName "XMonad" - <+> spawn "wmname XMonad" - <+> spawn "xrdb -all .Xresources" - <+> spawn "sleep 1 && xmodmap .Xmodmap" - <+> spawn "xset r rate 250 25" - <+> spawn "xset b off" - <+> spawn "xhost local:root" - <+> spawn "setxkbmap -option keypad:pointerkeys" - -- Useful for programs launched by rofi - <+> spawnOnce "exec systemctl --user import-environment GNUPGHOME PASSWORD_STORE_DIR PATH" - -- <+> spawnOnce "exec arbtt-capture -r 60" - -- <+> spawnOnce "exec parcellite" - -- <+> spawnOnce "exec xautolock" - -- <+> spawnOnce "exec redshift-gtk -l -45.7800:1.9700 -t 6500:3700" - <+> spawnOnce "exec nm-applet" - <+> spawnOnce (List.unwords - [ "exec stalonetray" - , "--background '#000000'" - , "--geometry 5x1-0+0" - , "--icon-gravity E" - , "--icon-size 16" - , "--kludges force_icons_size" - , "--max-geometry 0x1+0+0" - , "--skip-taskbar" - , "--window-strut none" - ]) - , terminal = "urxvtc" - , workspaces = {- withScreens nScreens $ -} - {-["1:work","2:web","3:media"] ++-} - map show [1::Int .. 9] - , logHook = - dynamicLogWithPP xmobarPP - { ppCurrent = xmobarColor "black" "#CCCCCC" - , ppHidden = xmobarColor "#CCCCCC" "black" - , ppHiddenNoWindows = xmobarColor "#606060" "black" - , ppLayout = \s -> xmobarColor "black" "#606060" $ - case s of - "ResizableTall" -> " | " - "Mirror ResizableTall" -> " - " - "Tabbed Simplest" -> " + " - "Magnifier Grid" -> " ~ " - "Spiral" -> " @ " - "Full" -> " O " - "ThreeCol" -> " # " - _ -> s - , ppOutput = hPutStrLn xmproc - , ppSep = " " - , ppTitle = xmobarColor "white" "black" . shorten 50 - , ppUrgent = xmobarColor "yellow" "black" - , ppWsSep = " " - } - >> updatePointer (0.5, 0.5) (0, 0) + , handleEventHook = handleEventHook def + , keys = \conf@XConfig{XMonad.modMask} -> + Map.fromList $ + let xK_XF86Backward = 0x1008ff26 + xK_XF86Forward = 0x1008ff27 in + [ + -- Start a terminal + ((modMask, xK_Return), spawnExec $ XMonad.terminal conf) + -- Launch a program + , ((modMask, xK_Menu), spawnExec "rofi -show run -no-disable-history -run-command \"bash -c 'systemd-run --user --unit=app-org.rofi.\\$(systemd-escape \\\"{cmd}\\\")@\\$RANDOM -p CollectMode=inactive-or-failed {cmd}'\"") + -- Browse the filesystem + , ((modMask, xK_BackSpace), spawnExec "systemd-run --user --unit=app-org.rofi.caja@$RANDOM -p CollectMode=inactive-or-failed caja") + + -- Lock the screen + , ((0, xK_Pause), unGrab >> spawnExec "loginctl lock-session \"$XDG_SESSION_ID\"") + + -- Take a full screenshot + , ((0, xK_Print), spawn "cd ~/img/cap && scrot --quality 42 '%Y-%m-%d_%H-%M-%S.png' && caja ~/img/cap") + -- Take a selective screenshot + , ((modMask, xK_Print), spawn "select-screenshot") + + -- Volume control + , ((0, 0x1008FF12), spawnExec "pactl -- set-sink-mute @DEFAULT_SINK@ toggle") -- XF88AudioMute + , ((0, 0x1008FF11), spawnExec "pactl -- set-sink-volume @DEFAULT_SINK@ -5%") -- XF86AudioLowerVolume + , ((0, 0x1008FF13), spawnExec "pactl -- set-sink-volume @DEFAULT_SINK@ +5%") -- XF86AudioRaiseVolume + -- Audio previous + -- , ((0, 0x1008FF16), spawnExec "") + -- Play/pause + -- , ((0, 0x1008FF14), spawnExec "") + -- Audio next + -- , ((0, 0x1008FF17), spawnExec "") + -- Eject CD tray + -- , ((0, 0x1008FF2C), spawnExec "eject -T") + + -- Close focused window. + , ((modMask, xK_Escape), kill) + , ((modMask, xK_q), kill) + + -- Clipboard + , ((modMask, xK_c), spawnExec "clipster --select --primary") + + -- Temporarily maximize a window + , ((modMask, xK_f), sendMessage $ XMonad.Layout.MultiToggle.Toggle FULL) + -- , ((modMask, xK_f), withFocused (sendMessage . maximizeRestore)) + + -- Cycle through the available layout algorithms + , ((modMask, 0x13bd), sendMessage NextLayout) -- oe (²) + , ((modMask, xK_ampersand), sendMessage $ JumpToLayout "ResizableTall") -- & (1) + , ((modMask, xK_eacute), sendMessage $ JumpToLayout "Mirror ResizableTall") -- é (2) + , ((modMask, xK_quotedbl), sendMessage $ JumpToLayout "Tabbed Simplest") -- ' (3) + , ((modMask, xK_apostrophe), sendMessage $ JumpToLayout "Magnifier Grid") -- " (4) + , ((modMask, xK_parenleft), sendMessage $ JumpToLayout "Spiral") -- ( (5) + , ((modMask, xK_minus), sendMessage $ JumpToLayout "Full") -- - (6) + , ((modMask, xK_egrave), sendMessage $ JumpToLayout "ThreeCol") -- è (7) + + -- Reset the layouts on the current workspace to default + -- , ((modMask .|. shiftMask, xK_space), setLayout $ XMonad.layoutHook conf) + + -- Resize viewed windows to the correct size. + , ((modMask, xK_n), refresh) + + -- Move focus between windows + , ((modMask, xK_Tab), windows W.focusDown) + , ((modMask .|. shiftMask, xK_Tab), windows W.focusUp) + , ((modMask, xK_i), windows W.focusUp) + , ((modMask, xK_k), windows W.focusDown) + + -- Move focus to the master window + , ((modMask, xK_m), windows W.focusMaster) + -- Swap the focused window and the master window + , ((modMask, xK_space), windows W.swapMaster) + + -- Swap the focused window with the next window. + --, ((modMask, xK_o), windows W.swapDown >> windows W.focusMaster) + -- Swap the focused window with the previous window. + , ((modMask, xK_m), windows W.swapUp >> windows W.focusMaster) + + -- Push window back into tiling. + , ((modMask, xK_t), withFocused $ windows . W.sink) + + -- Change the number of windows in the master area + , ((modMask, xK_Up), sendMessage $ IncMasterN 1) + , ((modMask, xK_Down), sendMessage $ IncMasterN (-1)) + + -- Toggle the status bar gap. + , ((modMask, xK_b), sendMessage ToggleStruts) + + -- Quit xmonad + , ((modMask .|. shiftMask, xK_End), io exitSuccess) + -- Restart xmonad + , ((modMask, xK_End), restart "xmonad" True) + + -- Workspace management + -- XF86Back: Switch to previous workspace + , ((0, xK_XF86Backward), prevWS) + , ((modMask, xK_j), prevWS) + -- Switch to next workspace + , ((0, xK_XF86Forward), nextWS) + , ((modMask, xK_l), nextWS) + -- XF86Back: Move the current client to the previous workspace and go there + , ((modMask, xK_XF86Backward), shiftToPrev >> prevWS) + , ((modMask .|. shiftMask, xK_j), shiftToPrev >> prevWS) + -- Move the current client to the next workspace and go there + , ((modMask, xK_XF86Forward), shiftToNext >> nextWS) + , ((modMask .|. shiftMask, xK_l), shiftToNext >> nextWS) + -- Switch to previous workspace + -- Switch to next workspace + {- + -- Move the current client to the previous workspace + , ((0 .|. shiftMask , xK_XF86Backward), shiftToPrev ) + -- Move the current client to the next workspace + , ((0 .|. shiftMask , xK_XF86Forward), shiftToNext ) + -} + + -- Toggle copying window on all workspaces (sticky window) + , ((modMask, xK_s), do + copies <- wsContainingCopies -- NOTE: consider only hidden workspaces + case copies of + [] -> windows copyToAll + _ -> killAllOtherCopies + ) + + -- Resize the master area + , ((modMask, xK_Left), sendMessage Shrink) + , ((modMask, xK_Right), sendMessage Expand) + -- Resize windows in ResizableTall mode + , ((modMask .|. shiftMask, xK_Left), sendMessage MirrorShrink) + , ((modMask .|. shiftMask, xK_Right), sendMessage MirrorExpand) + ] ++ + + -- mod-[F1..F9], Switch to workspace N + -- mod-shift-[F1..F9], Move client to workspace N + [ ((m .|. modMask, k), windows $ f i) + | (i, k) <- zip (workspaces conf) [xK_F1 ..] ++ + zip (workspaces conf) [xK_1 ..] + , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] + ] ++ + {- NOTE: with Xinerama + [((m .|. modMask, k), windows $ onCurrentScreen f i) + | (i, k) <- zip (workspaces' conf) [xK_F1 ..] + , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] ] + -} + + -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 + -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 + [ ((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip [xK_w, xK_e, xK_r] [0 ..] + , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] + ] ++ + + -- mod-shift-[F1..F9], Swap workspace with workspace N + -- mod-shift-[1..9], Swap workspace with workspace N + [ ((modMask .|. controlMask, k), windows $ swapWithCurrent i) + | (i, k) <- zip (workspaces conf) [xK_F1 ..] ++ + zip (workspaces conf) [xK_1 ..] + ] + {- NOTE: with Xinerama + [((modMask .|. controlMask, k), windows $ onCurrentScreen swapWithCurrent i) + | (i, k) <- zip (workspaces' conf) [xK_F1 ..] ] + -} + , layoutHook = smartBorders $ + mkToggle (NOBORDERS ?? FULL ?? EOT) $ -- enable temporarily maximizing a window + avoidStruts $ -- prevents windows from overlapping dock windows + let tall = ResizableTall 1 (1%200) (8%13) [] in + tabbed shrinkText tabConfig + ||| tall + ||| Mirror tall + ||| magnifiercz (13%10) Grid + ||| spiral (6%7) + ||| noBorders (fullscreenFull Full) + ||| ThreeColMid 1 (1%200) (1%2) + -- ||| Tall 1 (3/100) (1/2) + , manageHook = composeAll + -- [ , isFullscreen --> (doF W.focusDown <+> doFullFloat) + [ isFullscreen --> doFullFloat + , manageHook def + , manageDocks -- NOTE: do not tile dock windows + , resource =? "desktop_window" --> doIgnore + , className =? "Gimp" --> doFloat + , resource =? "gpicview" --> doSink + , className =? "mpv" --> doFloat + --, className =? "MPlayer" --> doShift "3:media" -- <+> doFloat + --, className =? "vlc" --> doShift "3:media" + , className =? "trayer" --> doIgnore + ] + , modMask = mod4Mask + , mouseBindings = \XConfig{XMonad.modMask} -> + Map.fromList + [ + -- mod-button1, Set the window to floating mode and move by dragging + ((modMask, button1), \w -> focus w >> mouseMoveWindow w) + + -- mod-button2, Raise the window to the top of the stack + , ((modMask, button2), \w -> focus w >> windows W.swapMaster) + + -- mod-button3, Set the window to floating mode and resize by dragging + , ((modMask, button3), \w -> focus w >> mouseResizeWindow w) + + , ((modMask, button4), \_ -> windows W.focusUp) + , ((modMask, button5), \_ -> windows W.focusDown) + + -- Cycle through workspaces + , ((controlMask .|. modMask, button5), nextNonEmptyWS) + , ((controlMask .|. modMask, button4), prevNonEmptyWS) + ] + , normalBorderColor = "#7C7C7C" + , startupHook = setWMName "XMonad" + <+> spawnExec "wmname XMonad" + <+> spawnExec "xrdb -all .Xresources" + <+> spawn "sleep 1 && xmodmap .Xmodmap" + <+> spawnExec "xset r rate 250 25" + <+> spawnExec "xset b off" + <+> spawnExec "xhost local:root" + <+> spawnExec "setxkbmap -option keypad:pointerkeys" + -- Useful for programs launched by rofi + <+> spawnExec "systemctl --user import-environment GNUPGHOME PASSWORD_STORE_DIR PATH" + -- <+> spawnOnce "exec arbtt-capture -r 60" + -- <+> spawnOnce "exec parcellite" + -- <+> spawnOnce "exec xautolock" + -- <+> spawnOnce "exec redshift-gtk -l -45.7800:1.9700 -t 6500:3700" + <+> spawnOnce "exec nm-applet" + , terminal = "urxvtc" + , workspaces = {- withScreens nScreens $ -} + {-["1:work","2:web","3:media"] ++-} + map show [1::Int .. 9] + , logHook = updatePointer (0.5, 0.5) (0, 0) -- >> updatePointer (Relative 0.5 0.5) } where @@ -336,12 +301,64 @@ defaults xmproc _nScreens = docks $ ewmhFullscreen $ ewmh $ , fontName = "Hack 7" } --- --- Run xmonad --- -main = do - nScreens <- countScreens - xmproc <- spawnPipe "exec xmobar ~/.xmonad/xmobar.hs" - xmonad $ - withUrgencyHook NoUrgencyHook $ -- dzenUrgencyHook { args = ["-bg", "darkgreen", "-xs", "1"] } - defaults xmproc (nScreens::Integer) +barSpawner :: ScreenId -> IO StatusBarConfig +barSpawner 0 = pure $ topXmobar <> traySB +--barSpawner 1 = pure $ xmobar1 +barSpawner _ = pure $ topXmobar -- nothing on the rest of the screens + +-- Display properties of the root window: +-- xprop -display $DISPLAY -root +topXmobar = statusBarPropTo "_XMONAD_XMOBAR0" "xmobar -x 0 ~/.config/xmonad/xmobar0.hs" (pure topPP) + where + topPP = + xmobarPP + { ppCurrent = xmobarColor "black" "#CCCCCC" + , ppHidden = xmobarColor "#CCCCCC" "black" + , ppHiddenNoWindows = xmobarColor "#606060" "black" + , ppLayout = \s -> xmobarColor "black" "#606060" $ + case s of + "ResizableTall" -> " | " + "Mirror ResizableTall" -> " - " + "Tabbed Simplest" -> " + " + "Magnifier Grid" -> " ~ " + "Spiral" -> " @ " + "Full" -> " O " + "ThreeCol" -> " # " + _ -> s + , ppSep = " " + , ppTitle = xmobarColor "white" "black" . shorten 50 + , ppUrgent = xmobarColor "yellow" "black" + , ppWsSep = " " + } + +traySB :: StatusBarConfig +traySB = + statusBarGeneric + ( List.unwords + [ "trayer" + , "--align right" + , "--distance 0,0" + , "--distancefrom top,right" + , "--edge top" + , "--expand true" + , "--height 16" + , "--monitor primary" + , "--tint 0x000000" + , "--iconspacing 0" + , "--transparent true" + , "--widthtype request" + , "-l" + ] + ) + mempty + +nextNonEmptyWS _ = moveTo Next (WSIs ((not .) <$> isWindowSpaceVisible)) +prevNonEmptyWS _ = moveTo Prev (WSIs ((not .) <$> isWindowSpaceVisible)) + +isWindowSpaceVisible :: X (WindowSpace -> Bool) +isWindowSpaceVisible = do + vs <- gets (map (W.tag . W.workspace) . W.visible . windowset) + return (\w -> W.tag w `elem` vs) + +spawnExec s = spawn $ List.unwords $ [ "exec" ] <> systemdCat <> [ s ] +systemdCat = [ "systemd-cat" , "--priority=info", "--stderr-priority=warning", "--level-prefix=false" , "--" ] -- 2.44.1 From bd6d4a6212779d740e3ca596ad283ae6fcb36c6a Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Mon, 6 May 2024 21:01:48 +0200 Subject: [PATCH 02/16] oignon: enable bluetooth --- hosts/oignon.nix | 1 + nixos/profiles/bluetooth.nix | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 nixos/profiles/bluetooth.nix diff --git a/hosts/oignon.nix b/hosts/oignon.nix index 05b571b..46d3666 100644 --- a/hosts/oignon.nix +++ b/hosts/oignon.nix @@ -9,6 +9,7 @@ ../nixos/profiles/printing.nix ../nixos/profiles/radio.nix ../nixos/profiles/tor.nix + ../nixos/profiles/bluetooth.nix oignon/backup.nix oignon/hardware.nix oignon/nebula.nix diff --git a/nixos/profiles/bluetooth.nix b/nixos/profiles/bluetooth.nix new file mode 100644 index 0000000..5af341b --- /dev/null +++ b/nixos/profiles/bluetooth.nix @@ -0,0 +1,6 @@ +{ config, ... }: +{ + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + services.blueman.enable = config.services.xserver.enable; +} -- 2.44.1 From d906c511ffd0c964e45a1b6b42ceb34cf855c487 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 8 May 2024 12:46:21 +0200 Subject: [PATCH 03/16] patate: nix: diable auto-optimise-store --- nixos/profiles/hardware/X200.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/profiles/hardware/X200.nix b/nixos/profiles/hardware/X200.nix index b6bdcf8..a29e109 100644 --- a/nixos/profiles/hardware/X200.nix +++ b/nixos/profiles/hardware/X200.nix @@ -44,6 +44,8 @@ with lib; hardware.trackpoint.enable = mkDefault true; hardware.trackpoint.emulateWheel = mkDefault config.hardware.trackpoint.enable; + nix.settings.auto-optimise-store = false; + services.thinkfan = { enable = true; smartSupport = true; -- 2.44.1 From d5ad72c333487ee10a4e873ca360764fbd518955 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 8 May 2024 12:46:56 +0200 Subject: [PATCH 04/16] patate: wireguard: disable wg-intra --- hosts/patate/networking.nix | 2 -- hosts/patate/wireguard.nix | 9 --------- hosts/patate/wireguard/wg-intra/privateKey.cred | Bin 213 -> 0 bytes hosts/patate/wireguard/wg-intra/privateKey.gpg | Bin 1228 -> 0 bytes 4 files changed, 11 deletions(-) delete mode 100644 hosts/patate/wireguard.nix delete mode 100644 hosts/patate/wireguard/wg-intra/privateKey.cred delete mode 100644 hosts/patate/wireguard/wg-intra/privateKey.gpg diff --git a/hosts/patate/networking.nix b/hosts/patate/networking.nix index 6628e5e..f3780b0 100644 --- a/hosts/patate/networking.nix +++ b/hosts/patate/networking.nix @@ -2,9 +2,7 @@ { imports = [ ../../nixos/profiles/dnscrypt-proxy2.nix - ../../nixos/profiles/wireguard/wg-intra.nix ../../nixos/profiles/networking/ssh.nix - ./wireguard.nix networking/nftables.nix ]; install.substituteOnDestination = false; diff --git a/hosts/patate/wireguard.nix b/hosts/patate/wireguard.nix deleted file mode 100644 index 75146c5..0000000 --- a/hosts/patate/wireguard.nix +++ /dev/null @@ -1,9 +0,0 @@ -_: -{ - systemd.services."wireguard-wg-intra".serviceConfig.LoadCredentialEncrypted = [ - "privateKey:${./wireguard/wg-intra/privateKey.cred}" - ]; - networking.wireguard.wg-intra.peers.mermet.enable = true; - networking.wireguard.wg-intra.peers.aubergine.enable = true; - networking.wireguard.wg-intra.peers.oignon.enable = true; -} diff --git a/hosts/patate/wireguard/wg-intra/privateKey.cred b/hosts/patate/wireguard/wg-intra/privateKey.cred deleted file mode 100644 index a14b2bbfe1623a71718dc5991c9e048e3b1af744..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 213 zcmV;`04o0gM@dveQdv+`08KAx(yjIhA-eaEgH&7x{4$Z+z&7QoF`Mk1V>QDg!j2|K ztgH%@k9b3p76~>xM`r29|DI=Am7(niqZkt6{I70W$#iB}%6ODtQy!dmA(lEdO7!3F za%nI&(J-5X^}?IV>7;NeQD`;MzuqI{_WI$(_D%JwAg7^+?e`~1TT?AVBL-V40><#f zNR2VGdeSY#PG%g3X-ukTi58Eh76(Eyu-)7KGDx%Tbn2;~5I0QR0mc|S$a_QfLF@O4 PrWWH~L!iV%R*!t{v21An diff --git a/hosts/patate/wireguard/wg-intra/privateKey.gpg b/hosts/patate/wireguard/wg-intra/privateKey.gpg deleted file mode 100644 index d7e6556d540656685926ed6412bfb741cdfadd15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1228 zcmV;-1T*^pM@dveQdv+`0Bq$~e6FyM&o*Pqd|=sRDs%hC;Q*aBkB<@b4b_|4u5mGT(U? zjjD&!UIh$^Ap+L4!3bO9M+N)A9MG`)&KtYS;-ZwW4uf>MKzFL0zdZX=RiIl??@WXsJig6Fd6kGO z5&U%Q!F{VESyR{=&|vmUqZWcTiHyexM+8Wjx!7okQ5M)2Z!W8O>VAR$BQpvZu1Y54 zuktK#5D@ayUDsPxhX!P^^7A|}tiR5x8O4KJ@MZh@Bg_$!r{m=4s1OWd{14yXL51Et zMHR3XL~}CPT^$pTuwVWoQ(^zXCAb@yMLB+SnM5pj5+}H~L$g z2H+OC)#93jy*u(7&cjkm)s#DxN1~5%HJtY?KdZyP-@gFk*={eeS@>~g`Y(Qv{s=yo ztVJ!L9f2W&i@vleb}V<(8J^Nj=PwM#D%@!$58Ai*Q?QAi~KXZ!fh~}>;5`x;)wu3;^?ci(o*0&v>e97#bF|~ q&oiYdap$*JIc%i+FL7e0@0xhwgIy>MJ&zzoWq(!rk^OQ#qT7^le`LY{ -- 2.44.1 From a493a33cd2708a60692514f4371cc9b0d07c12a8 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 8 May 2024 12:47:35 +0200 Subject: [PATCH 05/16] patate: anydesk: update to 6.3.2 --- nixpkgs/overlays/anydesk.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixpkgs/overlays/anydesk.nix b/nixpkgs/overlays/anydesk.nix index 1f533c5..2d0ee0a 100644 --- a/nixpkgs/overlays/anydesk.nix +++ b/nixpkgs/overlays/anydesk.nix @@ -1,12 +1,12 @@ finalPkgs: previousPkgs: { anydesk = previousPkgs.anydesk.overrideAttrs (previousAttrs: rec { - version = "6.3.1"; + version = "6.3.2"; src = finalPkgs.fetchurl { urls = [ "https://download.anydesk.com/linux/anydesk-${version}-amd64.tar.gz" "https://download.anydesk.com/linux/generic-linux/anydesk-${version}-amd64.tar.gz" ]; - hash = "sha256-qVksva6+EfAQiOexP8NlDSCR5Ab2WGsuCG4BD87rlag="; + hash = "sha256-nSY4qHRsEvQk4M3JDHalAk3C6Y21WlfDQ2Gpp6/jjMs="; }; }); } -- 2.44.1 From 2aafcfae700c4e518761369e73e90cba5a89888a Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 15 May 2024 19:16:45 +0200 Subject: [PATCH 06/16] pass: enable extensions --- home-manager/profiles/gnupg.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/home-manager/profiles/gnupg.nix b/home-manager/profiles/gnupg.nix index 2db88c9..85b7d93 100644 --- a/home-manager/profiles/gnupg.nix +++ b/home-manager/profiles/gnupg.nix @@ -44,6 +44,15 @@ #standard-resolver ''; home.packages = lib.mkIf config.programs.gpg.enable [ - pkgs.pass + (pkgs.pass.withExtensions (ext: with ext; [ + pass-audit + pass-checkup + pass-file + pass-genphrase + pass-import + pass-otp + pass-tomb + pass-update + ])) ]; } -- 2.44.1 From cac511e04ffc9db0baa95ae203a7578b31f30c34 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 15 May 2024 19:17:08 +0200 Subject: [PATCH 07/16] ssh: tweak aubergine.sp config --- homes/julm.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homes/julm.nix b/homes/julm.nix index b45ba9c..40de628 100644 --- a/homes/julm.nix +++ b/homes/julm.nix @@ -97,19 +97,20 @@ programs.ssh.matchBlocks = { "aubergine.sp" = { - compression = true; # Helps to get a better framerate with forwardX11 + #compression = true; # Helps to get a better framerate with forwardX11 forwardAgent = true; forwardX11 = true; forwardX11Trusted = true; serverAliveInterval = 15; + extraOptions = { + Ciphers = "aes128-gcm@openssh.com"; + }; }; "patate.sp" = { user = "sevy"; - #proxyJump = "mermet.sp"; }; "courge.sp" = { user = "mo"; - #proxyJump = "mermet.sp"; }; } // lib.genAttrs [ "lan.losurdo.sourcephile.fr" "losurdo.sp" ] -- 2.44.1 From d6eb47810eb3852b0d7f6f509d1b70a0b481adb5 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 15 May 2024 19:17:23 +0200 Subject: [PATCH 08/16] xmonad: play with prompts --- home-manager/profiles/xmonad/xmonad.hs | 78 ++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/home-manager/profiles/xmonad/xmonad.hs b/home-manager/profiles/xmonad/xmonad.hs index 0e7925d..18afef1 100644 --- a/home-manager/profiles/xmonad/xmonad.hs +++ b/home-manager/profiles/xmonad/xmonad.hs @@ -2,11 +2,13 @@ {-# OPTIONS_GHC -Wall #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} import Data.Default +import qualified Data.Char as Char import Data.List as List import Data.Ratio import System.Exit import System.IO import qualified Data.Map as Map +import Control.Arrow (first) -- import XMonad.Actions.DwmPromote -- import XMonad.Actions.Warp @@ -43,6 +45,9 @@ import XMonad.Layout.ResizableTile import XMonad.Layout.Spiral import XMonad.Layout.Tabbed import XMonad.Layout.ThreeColumns +import XMonad.Prompt +import XMonad.Prompt.FuzzyMatch +import XMonad.Prompt.Pass import XMonad.Util.Ungrab (unGrab) --import XMonad.Operations (unGrab) -- TODO: needs xmonad 0.18 import XMonad.Util.SpawnOnce @@ -154,6 +159,10 @@ main = xmonad $ -- Restart xmonad , ((modMask, xK_End), restart "xmonad" True) + , ((modMask, xK_p), passPrompt dtXPConfig) + , ((modMask .|. controlMask, xK_p), passGeneratePrompt dtXPConfig) + , ((modMask .|. controlMask .|. shiftMask, xK_p), passRemovePrompt dtXPConfig) + -- Workspace management -- XF86Back: Switch to previous workspace , ((0, xK_XF86Backward), prevWS) @@ -362,3 +371,72 @@ isWindowSpaceVisible = do spawnExec s = spawn $ List.unwords $ [ "exec" ] <> systemdCat <> [ s ] systemdCat = [ "systemd-cat" , "--priority=info", "--stderr-priority=warning", "--level-prefix=false" , "--" ] + +dtXPConfig :: XPConfig +dtXPConfig = def + { font = "Hack 7" + , bgColor = "#282c34" + , fgColor = "#bbc2cf" + , bgHLight = "#c792ea" + , fgHLight = "#000000" + , borderColor = "#535974" + , promptBorderWidth = 0 + , promptKeymap = dtXPKeymap + , position = Top + -- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 } + , height = 23 + , historySize = 256 + , historyFilter = id + , defaultText = [] + , autoComplete = Just 100000 -- set Just 100000 for .1 sec + , showCompletionOnTab = False + -- , searchPredicate = isPrefixOf + , searchPredicate = fuzzyMatch + , defaultPrompter = id $ List.map Char.toUpper -- change prompt to UPPER + -- , defaultPrompter = unwords . map reverse . words -- reverse the prompt + -- , defaultPrompter = drop 5 .id (++ "XXXX: ") -- drop first 5 chars of prompt and add XXXX: + , alwaysHighlight = True + , maxComplRows = Nothing -- set to 'Just 5' for 5 rows + } + +dtXPKeymap :: Map.Map (KeyMask,KeySym) (XP ()) +dtXPKeymap = Map.fromList $ + List.map (first $ (,) controlMask) -- control + + [ (xK_z, killBefore) -- kill line backwards + , (xK_k, killAfter) -- kill line forwards + , (xK_a, startOfLine) -- move to the beginning of the line + , (xK_e, endOfLine) -- move to the end of the line + , (xK_m, deleteString Next) -- delete a character foward + , (xK_b, moveCursor Prev) -- move cursor forward + , (xK_f, moveCursor Next) -- move cursor backward + , (xK_BackSpace, killWord Prev) -- kill the previous word + , (xK_y, pasteString) -- paste a string + , (xK_g, quit) -- quit out of prompt + , (xK_bracketleft, quit) + ] + ++ + List.map (first $ (,) altMask) -- meta key + + [ (xK_BackSpace, killWord Prev) -- kill the prev word + , (xK_f, moveWord Next) -- move a word forward + , (xK_b, moveWord Prev) -- move a word backward + , (xK_d, killWord Next) -- kill the next word + , (xK_n, moveHistory W.focusUp') -- move up thru history + , (xK_p, moveHistory W.focusDown') -- move down thru history + ] + ++ + List.map (first $ (,) 0) -- + [ (xK_Return, setSuccess True >> setDone True) + , (xK_KP_Enter, setSuccess True >> setDone True) + , (xK_BackSpace, deleteString Prev) + , (xK_Delete, deleteString Next) + , (xK_Left, moveCursor Prev) + , (xK_Right, moveCursor Next) + , (xK_Home, startOfLine) + , (xK_End, endOfLine) + , (xK_Down, moveHistory W.focusUp') + , (xK_Up, moveHistory W.focusDown') + , (xK_Escape, quit) + ] + +altMask :: KeyMask +altMask = mod1Mask -- 2.44.1 From 91127b71a90b1209a3790e0555c09fe13786bbf6 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 15 May 2024 19:18:07 +0200 Subject: [PATCH 09/16] nebula: comment about possible cipher --- share/nebula/sourcephile.fr.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/share/nebula/sourcephile.fr.nix b/share/nebula/sourcephile.fr.nix index 2f8ae76..e3c692b 100644 --- a/share/nebula/sourcephile.fr.nix +++ b/share/nebula/sourcephile.fr.nix @@ -64,6 +64,7 @@ in preferred_ranges = [ "192.168.0.0/16" ]; + #cipher = "chachapoly"; /* stats = { type = "prometheus"; -- 2.44.1 From 0e744bc0af19c0c0b4dcdfe79a918b62ce64566a Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 22 May 2024 22:20:19 +0200 Subject: [PATCH 10/16] nix: update inputs --- flake.lock | 90 +++++++++++++++++------------------------------------- flake.nix | 10 +++--- 2 files changed, 33 insertions(+), 67 deletions(-) diff --git a/flake.lock b/flake.lock index 973f5e5..9b3e12a 100644 --- a/flake.lock +++ b/flake.lock @@ -19,11 +19,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -32,37 +32,44 @@ "type": "github" } }, - "flake-utils": { + "git-hooks": { "inputs": { - "systems": "systems" + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "lastModified": 1716213921, + "narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "cachix", + "repo": "git-hooks.nix", "type": "github" } }, "gitignore": { "inputs": { "nixpkgs": [ - "pre-commit-hooks", + "git-hooks", "nixpkgs" ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -78,11 +85,11 @@ ] }, "locked": { - "lastModified": 1712386041, - "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", + "lastModified": 1715381426, + "narHash": "sha256-wPuqrAQGdv3ISs74nJfGb+Yprm23U/rFpcHFFNWgM94=", "owner": "nix-community", "repo": "home-manager", - "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", + "rev": "ab5542e9dbd13d0100f8baae2bc2d68af901f4b4", "type": "github" }, "original": { @@ -162,54 +169,13 @@ "type": "gitlab" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1692274144, - "narHash": "sha256-BxTQuRUANQ81u8DJznQyPmRsg63t4Yc+0kcyq6OLz8s=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "7e3517c03d46159fdbf8c0e5c97f82d5d4b0c8fa", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { "doom-emacs": "doom-emacs", + "git-hooks": "git-hooks", "home-manager": "home-manager", "nix-formatter-pack": "nix-formatter-pack", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 48e4a42..659d192 100644 --- a/flake.nix +++ b/flake.nix @@ -18,9 +18,9 @@ nix-formatter-pack.inputs.nixpkgs.follows = "nixpkgs"; nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; - pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; - pre-commit-hooks.inputs.nixpkgs-stable.follows = "nixpkgs"; - pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; + git-hooks.inputs.nixpkgs.follows = "nixpkgs"; + git-hooks.inputs.nixpkgs-stable.follows = "nixpkgs"; + git-hooks.url = "github:cachix/git-hooks.nix"; }; outputs = inputs: @@ -124,7 +124,7 @@ default = pkgs.callPackage (self + "/shell.nix") { inherit pkgs inputs system nixpkgsPath; - inherit (checks.${system}.pre-commit-check) shellHook; + inherit (checks.${system}.git-hooks-check) shellHook; }; } ); @@ -189,7 +189,7 @@ # nix flake check checks = forAllSystems (args: with args; { - pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { + git-hooks-check = inputs.git-hooks.lib.${system}.run { src = self; hooks = { nixpkgs-fmt.enable = true; -- 2.44.1 From 5753c482be48dcdd67bf4b64bdd1e1a135ed4cb3 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 22 May 2024 22:21:39 +0200 Subject: [PATCH 11/16] git: add patch alias for radicle --- home-manager/profiles/git.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home-manager/profiles/git.nix b/home-manager/profiles/git.nix index 03a96d1..3787e5a 100644 --- a/home-manager/profiles/git.nix +++ b/home-manager/profiles/git.nix @@ -50,6 +50,8 @@ lp = "log -p --pretty=fuller"; lpg = "log -p --pretty=fuller -g"; p = "push -v"; + pa = "patch"; + patch = "push rad HEAD:refs/patches"; pf = "push -vf"; pl = "pull"; r = "reset"; -- 2.44.1 From f6d412cab6a5294f39674e04e773ff4cdbaf9b95 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 22 May 2024 22:32:08 +0200 Subject: [PATCH 12/16] mpv: fix dynaudnorm --- home-manager/profiles/mpv.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/profiles/mpv.nix b/home-manager/profiles/mpv.nix index c85afc6..68a1e50 100644 --- a/home-manager/profiles/mpv.nix +++ b/home-manager/profiles/mpv.nix @@ -6,7 +6,7 @@ xdg.configFile."mpv/input.conf".text = '' # Volume normalization # See https://github.com/mpv-player/mpv/issues/3979 - Alt+a cycle-values af "loudnorm=I=-25:TP=-1.5:LRA=1:linear=false" "dynaudnorm=framelen=4000:gausssize=151:coupling=1:peak=0.58" "speechnorm" "" + Alt+a cycle-values af "loudnorm=I=-25:TP=-1.5:LRA=1:linear=false" "dynaudnorm=framelen=100:gausssize=10:coupling=1:peak=0.58" "speechnorm" "" Alt+f cycle video-unscaled # Show all chapters (like a right-clic on |<< or >>|) -- 2.44.1 From 8c94989d71b665e454a6b24fc4504e4aeb6017bc Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 22 May 2024 22:32:43 +0200 Subject: [PATCH 13/16] julm: gpg-agent: allow SSH key for radicle --- homes/julm.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homes/julm.nix b/homes/julm.nix index 40de628..c07c5b3 100644 --- a/homes/julm.nix +++ b/homes/julm.nix @@ -81,6 +81,9 @@ # Fingerprints: MD5:fe:fe:81:79:d8:7f:e4:ff:64:ac:f3:1c:bd:65:24:3a # SHA256:bCfwfC8MQTjm6c1HcMLtzvGpnWRdqLwe/bvbh2jsNaA "F6CCA60CF05FADAE911CFBEC0BCDED22F40A19FD" + # Radicle key added on 2024-05-21 23:24:10 + # Fingerprints: SHA256:yhSIWvGFqN0oM/oTE1hMhEdhlSSEeCMcp/g/3TdNKYY + "1D6AF2BF857201D98413475AE022F8A4CFC34BF0" ]; programs.irssi.extraConfig = lib.readFile julm/irssi/irssi.conf; xdg.configFile."doom/config.el".text = lib.readFile julm/emacs/config.el; -- 2.44.1 From b282f472aea7dcd071a79a86070dd8464a2cecc4 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 22 May 2024 22:53:34 +0200 Subject: [PATCH 14/16] gpg-agent: prepare for deprecated pinentryFlavor --- home-manager/profiles/gnupg.nix | 1 + homes/julm/hosts/losurdo.nix | 1 + nixos/profiles/networking/remote.nix | 1 + nixos/profiles/system.nix | 1 + 4 files changed, 4 insertions(+) diff --git a/home-manager/profiles/gnupg.nix b/home-manager/profiles/gnupg.nix index 85b7d93..6305be3 100644 --- a/home-manager/profiles/gnupg.nix +++ b/home-manager/profiles/gnupg.nix @@ -10,6 +10,7 @@ enableSshSupport = true; enableExtraSocket = true; pinentryFlavor = lib.mkDefault (if nixosConfig.services.xserver.enable then "gtk2" else "curses"); + #pinentryPackage = lib.mkDefault (if nixosConfig.services.xserver.enable then pkgs.pinentry-gtk2 else pkgs.pinentry-curses); }; programs.gpg.enable = true; programs.gpg.settings = { diff --git a/homes/julm/hosts/losurdo.nix b/homes/julm/hosts/losurdo.nix index a3d4df0..fa7385d 100644 --- a/homes/julm/hosts/losurdo.nix +++ b/homes/julm/hosts/losurdo.nix @@ -20,6 +20,7 @@ ../../../home-manager/profiles/xmonad.nix ]; services.gpg-agent.pinentryFlavor = lib.mkForce "curses"; + #services.gpg-agent.pinentryPackage = lib.mkForce pkgs.pinentry-curses; home.packages = [ pkgs.evince pkgs.wine diff --git a/nixos/profiles/networking/remote.nix b/nixos/profiles/networking/remote.nix index 66f1797..4b73cc7 100644 --- a/nixos/profiles/networking/remote.nix +++ b/nixos/profiles/networking/remote.nix @@ -14,6 +14,7 @@ with lib; boot.kernelParams = [ "panic=10" ]; programs.gnupg.agent.pinentryFlavor = "curses"; + #programs.gnupg.agent.pinentryPackage = pkgs.pinentry-curses; systemd = { # Always try to start all the units (default.target) diff --git a/nixos/profiles/system.nix b/nixos/profiles/system.nix index 446c483..9e8242e 100644 --- a/nixos/profiles/system.nix +++ b/nixos/profiles/system.nix @@ -29,6 +29,7 @@ with lib; ../../home-manager/profiles/essential.nix ]; services.gpg-agent.pinentryFlavor = "curses"; + #services.gpg-agent.pinentryPackage = pkgs.pinentry-curses; }; nix = { settings.auto-optimise-store = mkDefault true; -- 2.44.1 From c062900ea000cad823a7eee2d5ea63da74be83f0 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Wed, 22 May 2024 22:54:09 +0200 Subject: [PATCH 15/16] pass: no pass-file --- home-manager/profiles/gnupg.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/profiles/gnupg.nix b/home-manager/profiles/gnupg.nix index 6305be3..9d333c1 100644 --- a/home-manager/profiles/gnupg.nix +++ b/home-manager/profiles/gnupg.nix @@ -48,7 +48,7 @@ (pkgs.pass.withExtensions (ext: with ext; [ pass-audit pass-checkup - pass-file + #pass-file pass-genphrase pass-import pass-otp -- 2.44.1 From 64a55f91a4c0c13ffc3dce40d7f7974704e3a9b2 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Sun, 5 May 2024 16:57:37 +0200 Subject: [PATCH 16/16] julm: mermet: re-enable gnupg --- homes/julm/hosts/mermet.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/homes/julm/hosts/mermet.nix b/homes/julm/hosts/mermet.nix index 5facdc3..e3adfe9 100644 --- a/homes/julm/hosts/mermet.nix +++ b/homes/julm/hosts/mermet.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ../../../home-manager/profiles/gnupg.nix ../../../home-manager/profiles/irssi.nix ../../../home-manager/profiles/lf.nix ../../../home-manager/profiles/mutt.nix -- 2.44.1