Compare commits

..

No commits in common. "5d15a604dc492911c05bac3fa131f5f9efa612fb" and "ba80c212fffe3fe9d00ba0229cab31aade909e8d" have entirely different histories.

4 changed files with 120 additions and 273 deletions

113
flake.lock generated
View file

@ -103,22 +103,6 @@
} }
}, },
"flake-compat": { "flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1668681692, "lastModified": 1668681692,
@ -152,45 +136,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -417,22 +362,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1704874635,
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1705316053, "lastModified": 1705316053,
@ -512,30 +441,6 @@
"type": "gitlab" "type": "gitlab"
} }
}, },
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1708018599,
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
@ -547,14 +452,13 @@
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-droid": "nixpkgs-droid", "nixpkgs-droid": "nixpkgs-droid",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"pre-commit-hooks": "pre-commit-hooks",
"snm": "snm" "snm": "snm"
} }
}, },
"snm": { "snm": {
"inputs": { "inputs": {
"blobs": "blobs", "blobs": "blobs",
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nixpkgs-22_11": "nixpkgs-22_11", "nixpkgs-22_11": "nixpkgs-22_11",
"nixpkgs-23_05": "nixpkgs-23_05", "nixpkgs-23_05": "nixpkgs-23_05",
@ -590,21 +494,6 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1659877975,

134
flake.nix
View file

@ -4,9 +4,6 @@
nixpkgs-droid.url = "github:NixOS/nixpkgs/nixos-23.05"; nixpkgs-droid.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -48,94 +45,51 @@
disko.inputs.nixpkgs.follows = "nixpkgs"; disko.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { self, home-manager, nixpkgs, nixpkgs-unstable, pre-commit-hooks outputs = { home-manager, nixpkgs, nixpkgs-unstable, ... }@inputs: {
, ... }@inputs: { nixosConfigurations."thrall" = nixpkgs.lib.nixosSystem {
checks."x86_64-linux" = let system = "x86_64-linux";
system = "x86_64-linux"; specialArgs = { inherit inputs; };
pkgs = import nixpkgs { inherit system; }; modules = let
in { postfix-overlay = final: prev: {
pre-commit-check = pre-commit-hooks.lib.${system}.run { postfix = nixpkgs-unstable.legacyPackages."x86_64-linux".postfix;
src = ./.;
settings = { ormolu.defaultExtensions = [ "GHC2021" ]; };
tools.fourmolu = pkgs.haskellPackages.fourmolu;
hooks = {
nixfmt.enable = true;
fourmolu.enable = true;
hpack.enable = true;
hlint.enable = true;
};
}; };
}; in [
({ inputs, lib, ... }: {
nixosConfigurations."thrall" = nixpkgs.lib.nixosSystem { nixpkgs = {
system = "x86_64-linux"; config.allowUnfree = true;
specialArgs = { inherit inputs; }; overlays = with inputs; [ emacs.overlay postfix-overlay ];
modules = let
postfix-overlay = final: prev: {
postfix = nixpkgs-unstable.legacyPackages."x86_64-linux".postfix;
}; };
in [ nix.registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
({ inputs, lib, ... }: { })
nixpkgs = { ./hosts/thrall
config.allowUnfree = true; home-manager.nixosModules.home-manager
overlays = with inputs; [ emacs.overlay postfix-overlay ]; {
}; home-manager.useGlobalPkgs = true;
nix.registry = lib.mapAttrs (_: value: { flake = value; }) inputs; home-manager.useUserPackages = true;
}) home-manager.users.alex = import ./home/alex/cli.nix;
./hosts/thrall }
home-manager.nixosModules.home-manager ];
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alex = import ./home/alex/cli.nix;
}
];
};
nixosConfigurations."dregil" = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./hosts/dregil ];
};
nixosConfigurations."igor" = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./hosts/igor ];
};
nixOnDroidConfigurations.default = with inputs;
nix-on-droid.lib.nixOnDroidConfiguration {
modules = [
./hosts/redmi
{ nix.registry.nixpkgs.flake = nixpkgs-droid; }
{ nix.nixPath = [ "nixpkgs=${nixpkgs-droid}" ]; }
];
};
devShells."x86_64-linux".default = let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in pkgs.haskellPackages.shellFor {
inherit (self.checks.${system}.pre-commit-check) shellHook;
packages = p: [ p.xmonad p.xmonad-contrib ];
withHoogle = true;
nativeBuildInputs = with pkgs; [
haskellPackages.haskell-language-server
haskellPackages.fourmolu
haskellPackages.hspec-discover
haskellPackages.doctest
haskellPackages.xmonad
haskellPackages.xmonad-contrib
cabal-install
ghcid
nixfmt
hpack
hlint
];
};
}; };
nixosConfigurations."dregil" = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./hosts/dregil ];
};
nixosConfigurations."igor" = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./hosts/igor ];
};
nixOnDroidConfigurations.default = with inputs;
nix-on-droid.lib.nixOnDroidConfiguration {
modules = [
./hosts/redmi
{ nix.registry.nixpkgs.flake = nixpkgs-droid; }
{ nix.nixPath = [ "nixpkgs=${nixpkgs-droid}" ]; }
];
};
};
} }

View file

@ -121,11 +121,11 @@
;; will define elisp functions for the given lsp code actions, prefixing the ;; will define elisp functions for the given lsp code actions, prefixing the
;; given function names with "lsp" ;; given function names with "lsp"
;;(lsp-make-interactive-code-action wingman-fill-hole "refactor.wingman.fillHole") (lsp-make-interactive-code-action wingman-fill-hole "refactor.wingman.fillHole")
;;(lsp-make-interactive-code-action wingman-case-split "refactor.wingman.caseSplit") (lsp-make-interactive-code-action wingman-case-split "refactor.wingman.caseSplit")
;;(lsp-make-interactive-code-action wingman-refine "refactor.wingman.refine") (lsp-make-interactive-code-action wingman-refine "refactor.wingman.refine")
;;(lsp-make-interactive-code-action wingman-split-func-args "refactor.wingman.spltFuncArgs") (lsp-make-interactive-code-action wingman-split-func-args "refactor.wingman.spltFuncArgs")
;;(lsp-make-interactive-code-action wingman-use-constructor "refactor.wingman.useConstructor") (lsp-make-interactive-code-action wingman-use-constructor "refactor.wingman.useConstructor")
;; example key bindings ;; example key bindings
;; (define-key haskell-mode-map (kbd "C-c d") #'lsp-wingman-case-split) ;; (define-key haskell-mode-map (kbd "C-c d") #'lsp-wingman-case-split)

View file

@ -1,39 +1,44 @@
import XMonad import XMonad
import XMonad.Actions.CycleWS qualified as WS
import XMonad.Actions.Navigation2D (navigation2DP, windowGo, windowSwap) import XMonad.Actions.Navigation2D (navigation2DP, windowGo, windowSwap)
import XMonad.Hooks.EwmhDesktops import qualified XMonad.Actions.CycleWS as WS
import XMonad.Hooks.ManageDocks qualified as Docks import XMonad.Util.Ungrab (unGrab)
import XMonad.Hooks.SetWMName import XMonad.Layout.ThreeColumns
import XMonad.Layout.ToggleLayouts (ToggleLayout(..), toggleLayouts)
import XMonad.Layout.BinarySpacePartition import XMonad.Layout.BinarySpacePartition
import XMonad.Layout.BorderResize (borderResize) import XMonad.Layout.BorderResize (borderResize)
import XMonad.Layout.ThreeColumns import XMonad.Hooks.EwmhDesktops
import XMonad.Layout.ToggleLayouts (ToggleLayout (..), toggleLayouts) import XMonad.Hooks.SetWMName
import XMonad.Util.EZConfig qualified as EZ import qualified XMonad.Hooks.ManageDocks as Docks
import XMonad.Util.Ungrab (unGrab) import qualified XMonad.Util.EZConfig as EZ
import Control.Monad (when)
import Numeric.Natural import Numeric.Natural
import Control.Monad (when)
import Text.Printf (printf)
import System.Posix.Process (executeFile)
import System.Info (arch,os)
import System.Environment (getArgs) import System.Environment (getArgs)
import System.FilePath ((</>)) import System.FilePath ((</>))
import System.Info (arch, os)
import System.Posix.Process (executeFile)
import Text.Printf (printf)
compiledConfig = printf "xmonad-%s-%s" arch os compiledConfig = printf "xmonad-%s-%s" arch os
compileRestart resume = do compileRestart resume = do
dirs <- asks directories dirs <- asks directories
whenX (recompile dirs True) $ do whenX (recompile dirs True) $ do
when resume writeStateToFile when resume writeStateToFile
catchIO catchIO
( do ( do
args <- getArgs args <- getArgs
executeFile (cacheDir dirs </> compiledConfig) False args Nothing executeFile (cacheDir dirs </> compiledConfig) False args Nothing
) )
myLayout = borderResize $ Docks.avoidStruts layout myLayout = borderResize $ Docks.avoidStruts $ layout
where where
layout = emptyBSP ||| Full layout = (emptyBSP ||| columns ||| tiled ||| Full)
tiled = Tall nmaster delta ratio
columns = ThreeColMid nmaster delta ratio
nmaster = 1 -- default number of windows in the master pane
ratio = 1/2 -- default proportion occupied by master pane
delta = 3/100 -- percent of screen to increment when resizing
main :: IO () main :: IO ()
main = getDirectories >>= launch myConfig main = getDirectories >>= launch myConfig
@ -43,67 +48,66 @@ main = getDirectories >>= launch myConfig
windowMoveSplit :: Direction2D -> Bool -> X () windowMoveSplit :: Direction2D -> Bool -> X ()
windowMoveSplit direction _ = sendMessage $ MoveSplit direction windowMoveSplit direction _ = sendMessage $ MoveSplit direction
data VolumeCommand data VolumeCommand = ToggleVolume
= ToggleVolume | LowerVolume Natural
| LowerVolume Natural | RaiseVolume Natural
| RaiseVolume Natural
interpretVolumeCommand :: VolumeCommand -> String interpretVolumeCommand :: VolumeCommand -> String
interpretVolumeCommand command = "amixer -q set Master " <> cmd interpretVolumeCommand command = "amixer -q set Master " <> cmd
where where
cmd = case command of cmd = case command of
ToggleVolume -> "toggle" ToggleVolume -> "toggle"
LowerVolume delta -> show delta <> "%-" LowerVolume delta -> show delta <> "%-"
RaiseVolume delta -> show delta <> "%+" RaiseVolume delta -> show delta <> "%+"
changeVolume :: VolumeCommand -> X () changeVolume :: VolumeCommand -> X ()
changeVolume = spawn . interpretVolumeCommand changeVolume = spawn . interpretVolumeCommand
myConfig = myConfig = ewmhFullscreen $ ewmh $ Docks.docks $ nav $ def
Docks.docks { modMask = mod4Mask -- Use Super instead of Alt
. ewmh , terminal = "alacritty"
. ewmhFullscreen , layoutHook = myLayout
. nav -- this seems to be necessary to make java gui applications work :(
$ def , startupHook = ewmhDesktopsStartup >> setWMName "LG3D"
{ modMask = mod4Mask -- Use Super instead of Alt }
, terminal = "alacritty" `EZ.additionalKeysP`
, layoutHook = myLayout [ ("M-S-z", spawn "xscreensaver-command -lock")
, -- this seems to be necessary to make java gui applications work :( , ("M-S-r", compileRestart True)
startupHook = ewmhDesktopsStartup >> setWMName "LG3D" , ("M-S-q", restart "xmonad" True)
} , ("M-C-s", unGrab *> spawn "scrot -s")
`EZ.additionalKeysP` [ ("M-S-z", spawn "xscreensaver-command -lock") , ("M-b", sendMessage Docks.ToggleStruts)
, ("M-S-r", compileRestart True) , ("M-f", sendMessage (Toggle "Full"))
, ("M-S-q", restart "xmonad" True) , ("M-p", spawn appLauncher)
, ("M-C-s", unGrab *> spawn "scrot -s") , ("M-i", spawn passLauncher)
, ("M-b", sendMessage Docks.ToggleStruts) , ("M-w", kill)
, ("M-f", sendMessage (Toggle "Full")) , ("M-l", WS.toggleWS)
, ("M-p", spawn appLauncher) , ("M-g", WS.prevWS)
, ("M-i", spawn passLauncher) , ("M-r", WS.nextWS)
, ("M-w", kill)
, ("M-l", WS.toggleWS)
, ("M-g", WS.prevWS)
, ("M-r", WS.nextWS)
, -- backlight control
("<XF86MonBrightnessDown>", spawn "xbacklight -dec 5") -- backlight control
, ("<XF86MonBrightnessUp>", spawn "xbacklight -inc 5")
, ("<F5>", spawn "xbacklight -dec 5")
, ("<F6>", spawn "xbacklight -inc 5")
, -- volume control
("<XF86AudioMute>", changeVolume ToggleVolume) , ("<XF86MonBrightnessDown>", spawn "xbacklight -dec 5")
, ("<XF86AudioLowerVolume>", changeVolume $ LowerVolume 5) , ("<XF86MonBrightnessUp>", spawn "xbacklight -inc 5")
, ("<XF86AudioRaiseVolume>", changeVolume $ RaiseVolume 5) , ("<F5>", spawn "xbacklight -dec 5")
, ("M-a", sendMessage Balance) , ("<F6>", spawn "xbacklight -inc 5")
, ("M-S-a", sendMessage Equalize)
, ("M-o", sendMessage Rotate) -- volume control
]
, ("<XF86AudioMute>", changeVolume ToggleVolume)
, ("<XF86AudioLowerVolume>", changeVolume $ LowerVolume 5)
, ("<XF86AudioRaiseVolume>", changeVolume $ RaiseVolume 5)
, ("M-a", sendMessage Balance)
, ("M-S-a", sendMessage Equalize)
, ("M-o", sendMessage Rotate)
]
where where
-- navigate using dvorak bindings -- navigate using dvorak bindings
nav = navigation2DP def ("c", "h", "t", "n") [("M-", windowGo), ("M-C-", windowSwap), ("M-S-", windowMoveSplit)] True nav = navigation2DP def ("c", "h", "t", "n") [("M-", windowGo), ("M-C-", windowSwap), ("M-S-", windowMoveSplit)] True
appLauncher = "rofi -show combi -modes combi -combi-modes window,drun,run,ssh" appLauncher = "rofi -show combi -modes combi -combi-modes window,drun,run,ssh"
passLauncher = "rofi-pass" passLauncher = "rofi-pass"
-- myManageHook :: ManageHook -- myManageHook :: ManageHook
-- myManageHook = composeAll -- myManageHook = composeAll
-- [ className =? "Gimp" --> doFloat -- [ className =? "Gimp" --> doFloat