mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
minimal reproduction
This commit is contained in:
parent
1e3aea45f5
commit
5ebdd1917c
2 changed files with 67 additions and 264 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
let
|
let
|
||||||
sources = import ../sources.nix;
|
sources = import ../sources.nix;
|
||||||
|
|
||||||
hostname = "vm";
|
|
||||||
username = "leana";
|
username = "leana";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
@ -13,38 +12,26 @@ in
|
||||||
inherit (lib.modules) mkAliasOptionModule;
|
inherit (lib.modules) mkAliasOptionModule;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
#
|
|
||||||
# Shorthands
|
|
||||||
#
|
|
||||||
(mkAliasOptionModule ["me"] ["users" "users" username])
|
(mkAliasOptionModule ["me"] ["users" "users" username])
|
||||||
(mkAliasOptionModule ["hm"] ["home-manager" "users" username])
|
(mkAliasOptionModule ["hm"] ["home-manager" "users" username])
|
||||||
|
|
||||||
#
|
../nixosModules/extra/layouts
|
||||||
# hostname
|
|
||||||
#
|
|
||||||
{_module.args = {inherit hostname;};}
|
|
||||||
|
|
||||||
#
|
(sources.home-manager + "/nixos")
|
||||||
# nixpkgs
|
|
||||||
#
|
|
||||||
{
|
{
|
||||||
nixpkgs = {
|
home-manager = {
|
||||||
overlays = map import [
|
useGlobalPkgs = true;
|
||||||
../overlays/packages.nix
|
useUserPackages = true;
|
||||||
];
|
sharedModules = [{home.stateVersion = lib.mkDefault config.system.stateVersion;}];
|
||||||
config.allowUnfreePredicate = pkg:
|
|
||||||
builtins.elem (lib.getName pkg) [
|
|
||||||
"posy-cursors"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
system.nixos.version = lib.substring 0 8 sources.nixpkgs.rev;
|
system.nixos.version = lib.substring 0 8 sources.nixpkgs.rev;
|
||||||
}
|
|
||||||
|
|
||||||
#
|
# Window manager
|
||||||
# NixOS modules
|
|
||||||
#
|
|
||||||
{
|
|
||||||
services.xserver.windowManager.xmonad = {
|
services.xserver.windowManager.xmonad = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableContribAndExtras = true;
|
enableContribAndExtras = true;
|
||||||
|
|
@ -58,46 +45,29 @@ in
|
||||||
|
|
||||||
services.xserver.displayManager.lightdm = {
|
services.xserver.displayManager.lightdm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
background = "#000000";
|
# This seems to effect the root window
|
||||||
# greeters.gtk.cursorTheme = {
|
# However adding this doesn't make the cursor work
|
||||||
# name = "Posy_Cursor_Black";
|
greeters.gtk.cursorTheme = {
|
||||||
# package = pkgs.posy-cursors;
|
name = "Posy_Cursor_Black";
|
||||||
# size = 72;
|
package = pkgs.posy-cursors;
|
||||||
# };
|
size = 72;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
../nixosModules/extra/layouts
|
|
||||||
|
|
||||||
#
|
|
||||||
# home-manager
|
|
||||||
#
|
|
||||||
(sources.home-manager + "/nixos")
|
|
||||||
{
|
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
sharedModules = [{home.stateVersion = lib.mkDefault config.system.stateVersion;}];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hm.imports = [
|
hm = {nixosConfig, ...}: {
|
||||||
#
|
|
||||||
# hostname
|
|
||||||
#
|
|
||||||
{_module.args = {inherit hostname;};}
|
|
||||||
|
|
||||||
#
|
|
||||||
# home modules
|
|
||||||
#
|
|
||||||
({nixosConfig, ...}: {
|
|
||||||
programs.kitty.enable = true;
|
programs.kitty.enable = true;
|
||||||
programs.firefox.enable = true;
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
dmenu
|
|
||||||
];
|
|
||||||
|
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
"xmonad".source = "${./vm/home/xmonad}";
|
"xmonad/xmonad.hs".text = ''
|
||||||
|
import XMonad
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main =
|
||||||
|
xmonad
|
||||||
|
$ def
|
||||||
|
{ modMask = mod4Mask
|
||||||
|
, terminal = "kitty"
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
home.pointerCursor = {
|
home.pointerCursor = {
|
||||||
x11.enable = true;
|
x11.enable = true;
|
||||||
|
|
@ -106,19 +76,13 @@ in
|
||||||
package = pkgs.posy-cursors;
|
package = pkgs.posy-cursors;
|
||||||
size = 72;
|
size = 72;
|
||||||
};
|
};
|
||||||
})
|
};
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
# VM specifics
|
# VM specifics
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
me.password = "";
|
me.password = "";
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
# Me
|
# Me
|
||||||
programs.fish.enable = true;
|
|
||||||
nix.settings.trusted-users = ["leana"];
|
nix.settings.trusted-users = ["leana"];
|
||||||
users.users."leana" = {
|
users.users."leana" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|
@ -126,10 +90,7 @@ in
|
||||||
description = "Leana";
|
description = "Leana";
|
||||||
group = "leana";
|
group = "leana";
|
||||||
extraGroups = ["wheel"];
|
extraGroups = ["wheel"];
|
||||||
shell = pkgs.fish;
|
shell = pkgs.bash;
|
||||||
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
|
|
||||||
};
|
};
|
||||||
users.groups.leana = {};
|
users.groups.leana = {};
|
||||||
}
|
}
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,158 +0,0 @@
|
||||||
{-# LANGUAGE NegativeLiterals #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
|
|
||||||
import XMonad
|
|
||||||
|
|
||||||
import XMonad.Actions.SwapWorkspaces(swapWithCurrent)
|
|
||||||
import XMonad.Actions.Submap (submap)
|
|
||||||
|
|
||||||
import XMonad.Util.EZConfig (additionalKeys, removeKeys)
|
|
||||||
import XMonad.Util.NamedScratchpad (NamedScratchpad (NS),
|
|
||||||
customFloating,
|
|
||||||
namedScratchpadAction,
|
|
||||||
namedScratchpadManageHook, scratchpadWorkspaceTag)
|
|
||||||
import XMonad.Util.SpawnOnce (spawnOnce)
|
|
||||||
|
|
||||||
import XMonad.Layout.NoBorders (smartBorders)
|
|
||||||
import XMonad.Layout.Reflect (reflectHoriz)
|
|
||||||
import XMonad.Layout.Spacing (smartSpacingWithEdge)
|
|
||||||
import XMonad.Layout.ResizableTile (ResizableTall(ResizableTall), MirrorResize (MirrorShrink, MirrorExpand))
|
|
||||||
|
|
||||||
import XMonad.Hooks.ManageHelpers (isFullscreen, (~?), composeOne, (-?>))
|
|
||||||
import XMonad.Hooks.FadeWindows (fadeWindowsLogHook, opaque, isUnfocused, transparency, isFloating)
|
|
||||||
import XMonad.Hooks.EwmhDesktops (ewmh, ewmhFullscreen)
|
|
||||||
import XMonad.Hooks.InsertPosition (insertPosition, Focus(Newer, Older), Position(Below, Above))
|
|
||||||
import XMonad.Hooks.RefocusLast (refocusLastLogHook)
|
|
||||||
import XMonad.Hooks.StatusBar (StatusBarConfig, statusBarProp, dynamicEasySBs)
|
|
||||||
import XMonad.Hooks.DynamicLog (PP(ppHiddenNoWindows, ppCurrent, ppSep), xmobarColor, filterOutWsPP, wrap)
|
|
||||||
|
|
||||||
import XMonad.Util.Hacks (javaHack)
|
|
||||||
|
|
||||||
import XMonad.StackSet qualified as W
|
|
||||||
|
|
||||||
|
|
||||||
import Data.Map.Strict qualified as M
|
|
||||||
import Graphics.X11.ExtraTypes.XF86
|
|
||||||
import System.Posix.Env (putEnv)
|
|
||||||
import Data.Char (chr, ord, toUpper)
|
|
||||||
import System.Exit (exitSuccess)
|
|
||||||
|
|
||||||
|
|
||||||
-- Note: `xmonad --restart` will make Firefox's fullscreen work duck the xmobar stop working
|
|
||||||
-- You need restart Firefox
|
|
||||||
main :: IO ()
|
|
||||||
main = do
|
|
||||||
xmonad
|
|
||||||
. javaHack
|
|
||||||
. dynamicEasySBs xmobar
|
|
||||||
. ewmhFullscreen . ewmh
|
|
||||||
$ def
|
|
||||||
{ modMask = superMask
|
|
||||||
, focusFollowsMouse = True
|
|
||||||
, workspaces = myWorkspaces
|
|
||||||
, terminal = myTerm
|
|
||||||
, startupHook = do
|
|
||||||
spawn "xterm"
|
|
||||||
|
|
||||||
, layoutHook =
|
|
||||||
let tallr = reflectHoriz
|
|
||||||
$ ResizableTall 1 (1/10) (3/7) []
|
|
||||||
in smartBorders
|
|
||||||
( smartSpacingWithEdge 5 tallr
|
|
||||||
||| Full
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Only remove mappings that needs pass through (it's a map).
|
|
||||||
`removeKeys`
|
|
||||||
[ (superMask, xK_h)
|
|
||||||
, (superMask, xK_l)
|
|
||||||
, (superMask, xK_p)
|
|
||||||
|
|
||||||
-- It has been more than once that I actidently killed xmonad >:(
|
|
||||||
, (superMask .|. shiftMask, xK_q)
|
|
||||||
]
|
|
||||||
++ [ (superMask , n) | n <- [xK_1 .. xK_9] ]
|
|
||||||
++ [ (superMask .|. shiftMask, n) | n <- [xK_1 .. xK_9] ]
|
|
||||||
|
|
||||||
`additionalKeys`
|
|
||||||
[
|
|
||||||
-- Toggle fullscreen
|
|
||||||
((superMask, xK_Escape), sendMessage NextLayout)
|
|
||||||
|
|
||||||
-- Resize windows
|
|
||||||
, ((superMask, xK_equal ), sendMessage $ IncMasterN 1)
|
|
||||||
, ((superMask, xK_minus ), sendMessage $ IncMasterN -1)
|
|
||||||
, ((superMask, xK_comma ), sendMessage Shrink )
|
|
||||||
, ((superMask, xK_period ), sendMessage Expand )
|
|
||||||
, ((superMask .|. shiftMask, xK_comma ), sendMessage MirrorShrink )
|
|
||||||
, ((superMask .|. shiftMask, xK_period), sendMessage MirrorExpand )
|
|
||||||
]
|
|
||||||
|
|
||||||
-- Yeet
|
|
||||||
++ (let
|
|
||||||
workspaceKeys = [xK_h, xK_t, xK_n, xK_s, xK_m, xK_w, xK_v, xK_z]
|
|
||||||
in
|
|
||||||
[ ((superMask, k), windows $ W.greedyView space)
|
|
||||||
| (k, space) <- zip workspaceKeys myWorkspaces
|
|
||||||
]
|
|
||||||
++
|
|
||||||
[ ((superMask .|. altMask, k), windows $ W.greedyView space . W.shift space)
|
|
||||||
| (k, space) <- zip workspaceKeys myWorkspaces
|
|
||||||
]
|
|
||||||
++
|
|
||||||
[ ((superMask .|. controlMask, k), windows $ swapWithCurrent space)
|
|
||||||
| (k, space) <- zip workspaceKeys myWorkspaces
|
|
||||||
])
|
|
||||||
|
|
||||||
-- Launcher
|
|
||||||
++ (let
|
|
||||||
launchFirefox = "if type firefox; then firefox; else firefox-esr; fi"
|
|
||||||
launchDmenu = "dmenu_run -i -fn \"Iosevka Extended-17\" -nb \"#36363a\" -nf \"#e2e2e4\" -sb \"#f7f7f8\" -sf \"#36363a\" -l 10"
|
|
||||||
lock = "xscreensaver-command -lock"
|
|
||||||
in
|
|
||||||
[ ((controlMask .|. altMask, xK_b), spawn launchFirefox)
|
|
||||||
, ((superMask, xK_o), spawn launchDmenu )
|
|
||||||
, ((superMask, xK_l), spawn lock )
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
myTerm :: String
|
|
||||||
myTerm = "kitty"
|
|
||||||
|
|
||||||
superMask, altMask :: KeyMask
|
|
||||||
superMask = mod4Mask
|
|
||||||
altMask = mod1Mask
|
|
||||||
|
|
||||||
myWorkspaces :: [String]
|
|
||||||
myWorkspaces = map pure ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
|
|
||||||
|
|
||||||
xmobar :: ScreenId -> X StatusBarConfig
|
|
||||||
xmobar = \case
|
|
||||||
0 -> pure $ statusBarProp "xmobar -x 0" (pure myPrettyPrinter)
|
|
||||||
1 -> pure $ statusBarProp "xmobar -x 1" (pure myPrettyPrinter)
|
|
||||||
_ -> mempty
|
|
||||||
where
|
|
||||||
myPrettyPrinter =
|
|
||||||
filterOutWsPP [scratchpadWorkspaceTag]
|
|
||||||
$ def
|
|
||||||
{ ppCurrent = xmobarColor "#000000" "#ffffff" . wrap " " " " . fmap toUpper
|
|
||||||
, ppHiddenNoWindows = xmobarColor "#9c9c9c" "" . const "⋅"
|
|
||||||
, ppSep = " | "
|
|
||||||
}
|
|
||||||
|
|
||||||
isFirefoxPIP :: Query Bool
|
|
||||||
isFirefoxPIP =
|
|
||||||
className =? "firefox"
|
|
||||||
<&&> title =? "Picture-in-Picture"
|
|
||||||
|
|
||||||
isFirefoxFullscreen :: Query Bool
|
|
||||||
isFirefoxFullscreen =
|
|
||||||
className =? "firefox"
|
|
||||||
<&&> isFullscreen
|
|
||||||
|
|
||||||
-- Firefox having multimedia content
|
|
||||||
isFirefoxVideo :: Query Bool
|
|
||||||
isFirefoxVideo =
|
|
||||||
className =? "firefox"
|
|
||||||
<&&> title ~? "YouTube"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue