mirror of
https://github.com/srid/nixos-config.git
synced 2026-05-11 17:36:07 +08:00
Add Xmonad (#4)
* Import my old xmonad config * import taffybar as well * xmonad working * break features into individual files * break features into individual files * Add fonts, and enable taffybar * trackpad behaviour
This commit is contained in:
parent
6362b4d9b4
commit
48659e786d
42 changed files with 542 additions and 2 deletions
1
features/desktopish/README.md
Normal file
1
features/desktopish/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
Individual features to be added to tiling window managers and such as to provide a desktop-like experience.
|
||||
10
features/desktopish/default.nix
Normal file
10
features/desktopish/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs, ... }: {
|
||||
imports = [
|
||||
./hidpi.nix
|
||||
./swap-caps-ctrl.nix
|
||||
./light-terminal.nix
|
||||
./screencapture.nix
|
||||
./fonts.nix
|
||||
./touchpad-trackpoint.nix
|
||||
];
|
||||
}
|
||||
23
features/desktopish/fonts.nix
Normal file
23
features/desktopish/fonts.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
fonts = {
|
||||
enableDefaultFonts = true;
|
||||
|
||||
fonts = with pkgs; [
|
||||
# NOTE: Some fonts may break colour emojis in Chrome
|
||||
# cf. https://github.com/NixOS/nixpkgs/issues/69073#issuecomment-621982371
|
||||
# If this happens , keep noto-fonts-emoji and try disabling others (nerdfonts, etc.)
|
||||
noto-fonts-emoji
|
||||
|
||||
nerdfonts
|
||||
|
||||
# For fish powerline plugin
|
||||
powerline-fonts
|
||||
cascadia-code
|
||||
|
||||
# Doom emacs
|
||||
emacs-all-the-icons-fonts
|
||||
];
|
||||
};
|
||||
}
|
||||
11
features/desktopish/hidpi.nix
Normal file
11
features/desktopish/hidpi.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.xserver.dpi = 192;
|
||||
services.xserver.displayManager.sessionCommands = ''
|
||||
${pkgs.xorg.xrdb}/bin/xrdb -merge <<EOF
|
||||
Xft.dpi: 192
|
||||
Xcursor.theme: Adwaita
|
||||
Xcursor.size: 64
|
||||
EOF
|
||||
'';
|
||||
}
|
||||
16
features/desktopish/light-terminal.nix
Normal file
16
features/desktopish/light-terminal.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
# Suckless Terminal provides good performance. Just need to increase the
|
||||
# fontsize on retina display.
|
||||
myst = pkgs.writeScriptBin "myst"
|
||||
''
|
||||
#!${pkgs.runtimeShell}
|
||||
# Use fc-list to lookup font names
|
||||
exec ${pkgs.st}/bin/st -f "CascadiaCode:pixelsize=26" $*
|
||||
'';
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
myst
|
||||
];
|
||||
}
|
||||
13
features/desktopish/screencapture.nix
Normal file
13
features/desktopish/screencapture.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
screenshot = pkgs.writeScriptBin "screenshot"
|
||||
''
|
||||
#!${pkgs.runtimeShell}
|
||||
${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
|
||||
'';
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
screenshot
|
||||
];
|
||||
}
|
||||
5
features/desktopish/swap-caps-ctrl.nix
Normal file
5
features/desktopish/swap-caps-ctrl.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.xserver.xkbOptions = "ctrl:swapcaps";
|
||||
console.useXkbConfig = true;
|
||||
}
|
||||
11
features/desktopish/touchpad-trackpoint.nix
Normal file
11
features/desktopish/touchpad-trackpoint.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
services.xserver.libinput = {
|
||||
enable = true;
|
||||
# macOS like behaviour
|
||||
touchpad.naturalScrolling = true;
|
||||
# Tap to click
|
||||
touchpad.tapping = true;
|
||||
};
|
||||
}
|
||||
20
features/taffybar/default.nix
Normal file
20
features/taffybar/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
taffyPkg = pkgs.callPackage ./taffybar-srid { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
systemd.user.services.taffybar = {
|
||||
enable = true;
|
||||
description = "Taffybar";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${taffyPkg}/bin/taffybar-srid";
|
||||
Restart = "on-abnormal";
|
||||
};
|
||||
};
|
||||
|
||||
# Battery widget requires this.
|
||||
services.upower = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
2
features/taffybar/taffybar-srid/.gitignore
vendored
Normal file
2
features/taffybar/taffybar-srid/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
result
|
||||
dist-newstyle
|
||||
8
features/taffybar/taffybar-srid/.vscode/extensions.json
vendored
Normal file
8
features/taffybar/taffybar-srid/.vscode/extensions.json
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"haskell.haskell",
|
||||
"arrterian.nix-env-selector"
|
||||
]
|
||||
}
|
||||
5
features/taffybar/taffybar-srid/.vscode/settings.json
vendored
Normal file
5
features/taffybar/taffybar-srid/.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"nixEnvSelector.nixShellConfig": "${workspaceRoot}/default.nix",
|
||||
"editor.formatOnType": true,
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
5
features/taffybar/taffybar-srid/CHANGELOG.md
Normal file
5
features/taffybar/taffybar-srid/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Revision history
|
||||
|
||||
## 0.1.0.0 -- YYYY-mm-dd
|
||||
|
||||
* First version. Released on an unsuspecting world.
|
||||
86
features/taffybar/taffybar-srid/Main.hs
Normal file
86
features/taffybar/taffybar-srid/Main.hs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
import Data.Foldable (traverse_)
|
||||
import GI.Gtk.Objects.Widget (Widget)
|
||||
import System.Log.Logger
|
||||
( Priority (DEBUG),
|
||||
getLogger,
|
||||
saveGlobalLogger,
|
||||
setLevel,
|
||||
)
|
||||
import System.Taffybar (startTaffybar)
|
||||
import System.Taffybar.Context (TaffyIO)
|
||||
import System.Taffybar.Information.CPU (cpuLoad)
|
||||
import System.Taffybar.SimpleConfig (SimpleTaffyConfig (endWidgets), barHeight, defaultSimpleTaffyConfig, startWidgets, toTaffyConfig)
|
||||
import System.Taffybar.Widget (defaultClockConfig, defaultWorkspacesConfig, textClockNewWith, workspacesNew)
|
||||
import System.Taffybar.Widget.Battery (batteryIconNew)
|
||||
import System.Taffybar.Widget.CommandRunner (commandRunnerNew)
|
||||
import System.Taffybar.Widget.Generic.Graph
|
||||
( GraphConfig (..),
|
||||
defaultGraphConfig,
|
||||
graphLabel,
|
||||
)
|
||||
import System.Taffybar.Widget.Generic.PollingGraph (pollingGraphNew)
|
||||
import System.Taffybar.Widget.Layout
|
||||
( defaultLayoutConfig,
|
||||
layoutNew,
|
||||
)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
-- enableDebugLogging
|
||||
startTaffybar $ toTaffyConfig cfg
|
||||
|
||||
cfg :: SimpleTaffyConfig
|
||||
cfg =
|
||||
defaultSimpleTaffyConfig
|
||||
{ startWidgets =
|
||||
[ workspacesW
|
||||
],
|
||||
endWidgets =
|
||||
[ clockW,
|
||||
batteryW,
|
||||
-- scratchW,
|
||||
-- FIXME: doesn't work
|
||||
-- menuWidgetNew Nothing,
|
||||
layoutNew defaultLayoutConfig,
|
||||
cpuW
|
||||
],
|
||||
barHeight = 50
|
||||
}
|
||||
|
||||
workspacesW :: TaffyIO Widget
|
||||
workspacesW = workspacesNew defaultWorkspacesConfig
|
||||
|
||||
clockW :: TaffyIO Widget
|
||||
clockW = textClockNewWith defaultClockConfig
|
||||
|
||||
batteryW :: TaffyIO Widget
|
||||
batteryW = batteryIconNew
|
||||
|
||||
scratchW :: TaffyIO Widget
|
||||
scratchW = commandRunnerNew 1.0 "uname" [] "Cmd failed"
|
||||
|
||||
cpuW :: TaffyIO Widget
|
||||
cpuW =
|
||||
pollingGraphNew cpuCfg 0.5 $ do
|
||||
(_, systemLoad, totalLoad) <- cpuLoad
|
||||
pure [totalLoad, systemLoad]
|
||||
where
|
||||
cpuCfg =
|
||||
defaultGraphConfig
|
||||
{ graphDataColors = [(0, 1, 0, 1), (1, 0, 1, 0.5)],
|
||||
graphLabel = Just "cpu",
|
||||
graphWidth = 150
|
||||
}
|
||||
|
||||
enableDebugLogging :: IO ()
|
||||
enableDebugLogging = do
|
||||
traverse_ (saveGlobalLogger . setLevel DEBUG)
|
||||
=<< sequence
|
||||
[ getLogger "",
|
||||
getLogger "System.Taffybar",
|
||||
getLogger "StatusNotifier.Tray",
|
||||
getLogger "System.Taffybar.Widget.Battery"
|
||||
]
|
||||
3
features/taffybar/taffybar-srid/README.md
Normal file
3
features/taffybar/taffybar-srid/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Srid's taffybar configuration
|
||||
|
||||
Use `bin/run` to run reloadable taffybar during development.
|
||||
2
features/taffybar/taffybar-srid/Setup.hs
Normal file
2
features/taffybar/taffybar-srid/Setup.hs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import Distribution.Simple
|
||||
main = defaultMain
|
||||
3
features/taffybar/taffybar-srid/bin/run
Executable file
3
features/taffybar/taffybar-srid/bin/run
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
nix-shell --run "ghcid -T \":main $*\""
|
||||
24
features/taffybar/taffybar-srid/default.nix
Normal file
24
features/taffybar/taffybar-srid/default.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Since the xmonad config will be built by nixos-rebuild, we use the
|
||||
# nix-channel's nixpkgs.
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
inherit (import ./dep/gitignoresrc { inherit (pkgs) lib; }) gitignoreSource;
|
||||
in
|
||||
pkgs.haskellPackages.developPackage {
|
||||
name = "taffybar-srid";
|
||||
root = gitignoreSource ./.;
|
||||
modifier = drv:
|
||||
pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
|
||||
[ cabal-install
|
||||
cabal-fmt
|
||||
ghcid
|
||||
haskell-language-server
|
||||
]);
|
||||
overrides = self: super: with pkgs.haskell.lib; {
|
||||
taffybar = dontCheck (
|
||||
self.callCabal2nix "taffybar"
|
||||
(import ./dep/taffybar/thunk.nix)
|
||||
{ inherit (pkgs) gtk3; }
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# DO NOT HAND-EDIT THIS FILE
|
||||
import (import ./thunk.nix)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"private": false,
|
||||
"rev": "c4662e662462e7bf3c2a968483478a665d00e717",
|
||||
"sha256": "1npnx0h6bd0d7ql93ka7azhj40zgjp815fw2r6smg8ch9p7mzdlx"
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# DO NOT HAND-EDIT THIS FILE
|
||||
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
|
||||
if !fetchSubmodules && !private then builtins.fetchTarball {
|
||||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
|
||||
} else (import <nixpkgs> {}).fetchFromGitHub {
|
||||
inherit owner repo rev sha256 fetchSubmodules private;
|
||||
};
|
||||
json = builtins.fromJSON (builtins.readFile ./github.json);
|
||||
in fetch json
|
||||
2
features/taffybar/taffybar-srid/dep/taffybar/default.nix
Normal file
2
features/taffybar/taffybar-srid/dep/taffybar/default.nix
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# DO NOT HAND-EDIT THIS FILE
|
||||
import (import ./thunk.nix)
|
||||
7
features/taffybar/taffybar-srid/dep/taffybar/github.json
Normal file
7
features/taffybar/taffybar-srid/dep/taffybar/github.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"owner": "taffybar",
|
||||
"repo": "taffybar",
|
||||
"private": false,
|
||||
"rev": "4d3227e9cd8308c1e43846496a8a7ab417ef8e5b",
|
||||
"sha256": "1x6f3scjglaj9my0lgkrz8hbr25sv1xs6ssdkydq8w6lqqm15ydb"
|
||||
}
|
||||
9
features/taffybar/taffybar-srid/dep/taffybar/thunk.nix
Normal file
9
features/taffybar/taffybar-srid/dep/taffybar/thunk.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# DO NOT HAND-EDIT THIS FILE
|
||||
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
|
||||
if !fetchSubmodules && !private then builtins.fetchTarball {
|
||||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
|
||||
} else (import <nixpkgs> {}).fetchFromGitHub {
|
||||
inherit owner repo rev sha256 fetchSubmodules private;
|
||||
};
|
||||
json = builtins.fromJSON (builtins.readFile ./github.json);
|
||||
in fetch json
|
||||
4
features/taffybar/taffybar-srid/hie.yaml
Normal file
4
features/taffybar/taffybar-srid/hie.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
cradle:
|
||||
cabal:
|
||||
- path: "./"
|
||||
component: "exe:taffybar-srid"
|
||||
24
features/taffybar/taffybar-srid/taffybar-srid.cabal
Normal file
24
features/taffybar/taffybar-srid/taffybar-srid.cabal
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
cabal-version: 3.0
|
||||
name: taffybar-srid
|
||||
version: 0.1.0.0
|
||||
license: BSD-3-Clause
|
||||
author: Sridhar Ratnakumar
|
||||
maintainer: srid@srid.ca
|
||||
extra-source-files: CHANGELOG.md
|
||||
|
||||
executable taffybar-srid
|
||||
main-is: Main.hs
|
||||
build-depends:
|
||||
, base
|
||||
, taffybar
|
||||
, xmonad
|
||||
, xmonad-contrib
|
||||
, xmobar
|
||||
, containers
|
||||
, text
|
||||
, time
|
||||
, dbus
|
||||
, gi-gtk
|
||||
, hslogger
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
default-language: Haskell2010
|
||||
29
features/xmonad/default.nix
Normal file
29
features/xmonad/default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
xorg.xdpyinfo
|
||||
xorg.xrandr
|
||||
arandr
|
||||
autorandr
|
||||
|
||||
dmenu
|
||||
gmrun
|
||||
xmobar
|
||||
dzen2
|
||||
# For taffybar?
|
||||
hicolor-icon-theme
|
||||
];
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
windowManager.xmonad = {
|
||||
enable = true;
|
||||
extraPackages = haskellPackages: [
|
||||
haskellPackages.xmonad-contrib
|
||||
];
|
||||
enableContribAndExtras = true;
|
||||
config = pkgs.lib.readFile ./xmonad-srid/Main.hs;
|
||||
};
|
||||
};
|
||||
services.xserver.displayManager.defaultSession = "none+xmonad";
|
||||
}
|
||||
2
features/xmonad/xmonad-srid/.gitignore
vendored
Normal file
2
features/xmonad/xmonad-srid/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
result
|
||||
dist-newstyle
|
||||
8
features/xmonad/xmonad-srid/.vscode/extensions.json
vendored
Normal file
8
features/xmonad/xmonad-srid/.vscode/extensions.json
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"haskell.haskell",
|
||||
"arrterian.nix-env-selector"
|
||||
]
|
||||
}
|
||||
5
features/xmonad/xmonad-srid/.vscode/settings.json
vendored
Normal file
5
features/xmonad/xmonad-srid/.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"nixEnvSelector.nixShellConfig": "${workspaceRoot}/default.nix",
|
||||
"editor.formatOnType": true,
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
5
features/xmonad/xmonad-srid/CHANGELOG.md
Normal file
5
features/xmonad/xmonad-srid/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Revision history for xmonad-srid
|
||||
|
||||
## 0.1.0.0 -- YYYY-mm-dd
|
||||
|
||||
* First version. Released on an unsuspecting world.
|
||||
99
features/xmonad/xmonad-srid/Main.hs
Normal file
99
features/xmonad/xmonad-srid/Main.hs
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
import qualified Data.Map.Strict as M
|
||||
import XMonad
|
||||
import XMonad.Hooks.EwmhDesktops (ewmh)
|
||||
import XMonad.Hooks.ManageDocks (ToggleStruts (..), avoidStruts, docks)
|
||||
import XMonad.Layout.NoBorders (withBorder)
|
||||
import XMonad.Layout.Spacing (Border (Border), spacingRaw)
|
||||
import XMonad.Layout.ThreeColumns (ThreeCol (..))
|
||||
|
||||
-- NOTE:
|
||||
-- Chromium won't respect Xmonad's border width, until this is done:
|
||||
-- https://wiki.archlinux.org/index.php/xmonad#Chrome/Chromium_not_displaying_defined_window_border_color
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
xmonad $ docks $ ewmh cfg
|
||||
where
|
||||
cfg =
|
||||
def
|
||||
{ modMask = mod4Mask, -- Use Super instead of Alt
|
||||
terminal = "myst",
|
||||
layoutHook =
|
||||
borderSpacing $
|
||||
avoidStruts $
|
||||
ThreeColMid 1 (3 / 100) (1 / 2) ||| layoutHook def,
|
||||
keys = myKeys,
|
||||
-- https://htmlcolorcodes.com/
|
||||
focusedBorderColor = "#50CBE8"
|
||||
}
|
||||
-- Add border spacing between windows
|
||||
myKeys baseConfig@XConfig {modMask = modKey} =
|
||||
keys def baseConfig
|
||||
<> M.fromList
|
||||
[ ((modKey, xK_q), restart "/run/current-system/sw/bin/xmonad" True),
|
||||
((modKey, xK_f), spawn "screenshot"),
|
||||
((modKey, xK_b), sendMessage ToggleStruts)
|
||||
-- ...
|
||||
]
|
||||
borderSpacing =
|
||||
withBorder 5
|
||||
. spacingRaw
|
||||
-- Apply borders only when there are 2 or more windows
|
||||
True
|
||||
-- Screen border
|
||||
(Border 0 10 10 10)
|
||||
-- Enable screen border?
|
||||
False
|
||||
-- Window borders
|
||||
(Border 10 10 10 10)
|
||||
-- Enable window border?
|
||||
True
|
||||
|
||||
{- old status bar; remove after configuring taffybar
|
||||
|
||||
myStatusBar =
|
||||
statusBar dzenCli pp toggleStrutsKey
|
||||
where
|
||||
-- -dock is necessary for https://github.com/xmonad/xmonad/issues/21
|
||||
-- https://github.com/xmonad/xmonad-contrib/pull/203
|
||||
dzenCli = "dzen2 -dock -fn CascadiaCode:pixelsize=26"
|
||||
pp =
|
||||
dzenPP
|
||||
{ -- ppSep = "🔥", Neither unicode, nor emoji work with dzen2
|
||||
ppTitleSanitize =
|
||||
shorten 15 . dzenEscape,
|
||||
ppExtras =
|
||||
[ padL $ pure $ Just "|",
|
||||
battery,
|
||||
padL $ pure $ Just "|",
|
||||
moment
|
||||
]
|
||||
}
|
||||
toggleStrutsKey :: XConfig t -> (KeyMask, KeySym)
|
||||
toggleStrutsKey XConfig {modMask = modm} = (modm, xK_b)
|
||||
|
||||
moment :: Logger
|
||||
moment = do
|
||||
now <- liftIO getZonedTime
|
||||
pure $ do
|
||||
pure $ formatTime defaultTimeLocale "%d/%a %R" now
|
||||
|
||||
battery :: Logger
|
||||
battery = do
|
||||
s <-
|
||||
fmap trim . liftIO . readFile $
|
||||
"/sys/class/power_supply/BAT0/capacity"
|
||||
pure $ do
|
||||
pct <- readMaybe @Int s
|
||||
let fmt
|
||||
| pct < 33 = dzenColor "white" "red"
|
||||
| pct < 66 = dzenColor "white" "orange"
|
||||
| otherwise = id
|
||||
pure $ fmt $ show pct <> "%"
|
||||
where
|
||||
trim = T.unpack . T.strip . T.pack
|
||||
|
||||
-}
|
||||
11
features/xmonad/xmonad-srid/README.md
Normal file
11
features/xmonad/xmonad-srid/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Srid's XMonad configuration
|
||||
|
||||
See https://www.srid.ca/xmonad-conf-ide.html
|
||||
|
||||
## Reloading running XMonad
|
||||
|
||||
Once the new `xmonad` binary is in $PATH (as a result of running `nixos-rebuild` which uses this package), run:
|
||||
|
||||
```
|
||||
xmonad --restart
|
||||
```
|
||||
2
features/xmonad/xmonad-srid/Setup.hs
Normal file
2
features/xmonad/xmonad-srid/Setup.hs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import Distribution.Simple
|
||||
main = defaultMain
|
||||
20
features/xmonad/xmonad-srid/default.nix
Normal file
20
features/xmonad/xmonad-srid/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Since the xmonad config will be built by nixos-rebuild, we use the
|
||||
# nix-channel's nixpkgs.
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
inherit (import ./dep/gitignoresrc { inherit (pkgs) lib; }) gitignoreSource;
|
||||
in
|
||||
pkgs.haskellPackages.developPackage {
|
||||
name = "xmonad-srid";
|
||||
root = gitignoreSource ./.;
|
||||
modifier = drv:
|
||||
pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
|
||||
[ cabal-install
|
||||
cabal-fmt
|
||||
ghcid
|
||||
haskell-language-server
|
||||
]);
|
||||
overrides = self: super: with pkgs.haskell.lib; {
|
||||
# dulwich = dontCheck super.dulwich;
|
||||
};
|
||||
}
|
||||
2
features/xmonad/xmonad-srid/dep/gitignoresrc/default.nix
Normal file
2
features/xmonad/xmonad-srid/dep/gitignoresrc/default.nix
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# DO NOT HAND-EDIT THIS FILE
|
||||
import (import ./thunk.nix)
|
||||
7
features/xmonad/xmonad-srid/dep/gitignoresrc/github.json
Normal file
7
features/xmonad/xmonad-srid/dep/gitignoresrc/github.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"private": false,
|
||||
"rev": "c4662e662462e7bf3c2a968483478a665d00e717",
|
||||
"sha256": "1npnx0h6bd0d7ql93ka7azhj40zgjp815fw2r6smg8ch9p7mzdlx"
|
||||
}
|
||||
9
features/xmonad/xmonad-srid/dep/gitignoresrc/thunk.nix
Normal file
9
features/xmonad/xmonad-srid/dep/gitignoresrc/thunk.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# DO NOT HAND-EDIT THIS FILE
|
||||
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
|
||||
if !fetchSubmodules && !private then builtins.fetchTarball {
|
||||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
|
||||
} else (import <nixpkgs> {}).fetchFromGitHub {
|
||||
inherit owner repo rev sha256 fetchSubmodules private;
|
||||
};
|
||||
json = builtins.fromJSON (builtins.readFile ./github.json);
|
||||
in fetch json
|
||||
4
features/xmonad/xmonad-srid/hie.yaml
Normal file
4
features/xmonad/xmonad-srid/hie.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
cradle:
|
||||
cabal:
|
||||
- path: "./"
|
||||
component: "exe:xmonad-srid"
|
||||
20
features/xmonad/xmonad-srid/xmonad-srid.cabal
Normal file
20
features/xmonad/xmonad-srid/xmonad-srid.cabal
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
cabal-version: 3.0
|
||||
name: xmonad-srid
|
||||
version: 0.1.0.0
|
||||
license: BSD-3-Clause
|
||||
author: Sridhar Ratnakumar
|
||||
maintainer: srid@srid.ca
|
||||
extra-source-files: CHANGELOG.md
|
||||
|
||||
executable xmonad-srid
|
||||
main-is: Main.hs
|
||||
build-depends:
|
||||
, base
|
||||
, xmonad
|
||||
, xmonad-contrib
|
||||
, xmobar
|
||||
, containers
|
||||
, text
|
||||
, time
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
default-language: Haskell2010
|
||||
|
|
@ -23,6 +23,9 @@
|
|||
# ./features/virtualization.nix
|
||||
./features/email
|
||||
./features/monitor-brightness.nix
|
||||
./features/xmonad
|
||||
./features/desktopish
|
||||
./features/taffybar
|
||||
|
||||
# HACK: This should really go under ./features/email
|
||||
({
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
};
|
||||
|
||||
# Enable the GNOME 3 Desktop Environment.
|
||||
services.xserver.displayManager.gdm.enable = true;
|
||||
#services.xserver.displayManager.gdm.enable = true;
|
||||
services.xserver.desktopManager.gnome3.enable = true;
|
||||
services.openssh.enable = true;
|
||||
services.ipfs.enable = true;
|
||||
|
|
@ -79,9 +79,11 @@
|
|||
environment.systemPackages = with pkgs; [
|
||||
gnome3.gnome-tweaks
|
||||
brave
|
||||
vscode nodejs-12_x # Need this node https://nixos.wiki/wiki/Vscode
|
||||
vscode
|
||||
nodejs-12_x # Need this node https://nixos.wiki/wiki/Vscode
|
||||
obsidian
|
||||
signal-desktop
|
||||
ripgrep
|
||||
];
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue