xmonad config

This commit is contained in:
Mats Rauhala 2021-11-19 21:16:56 +02:00
parent f3e3ab2c13
commit ab25eaed17
4 changed files with 283 additions and 1 deletions

View File

@ -1,5 +1,23 @@
{ {
"nodes": { "nodes": {
"easy-hls-src": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1636606878,
"narHash": "sha256-rLxYl7iYP9vQhSvVlV2uRCdgrqKDz/vN1Z8ZmA8itkM=",
"owner": "jkachmar",
"repo": "easy-hls-nix",
"rev": "edd5710946d46ea40810ef9a708b084d7e05a118",
"type": "github"
},
"original": {
"owner": "jkachmar",
"repo": "easy-hls-nix",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1637014545, "lastModified": 1637014545,
@ -60,6 +78,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_5": {
"locked": {
"lastModified": 1637014545,
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -247,6 +280,21 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_4": {
"locked": {
"lastModified": 1615055905,
"narHash": "sha256-Ig7CXgE5C3mwtTVBl8nSTessa1oMAm6Pm/p+T6iAJD8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f3fc074642a25ef5a1423412f09946149237e338",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"pypi-deps-db": { "pypi-deps-db": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -271,7 +319,51 @@
"myUrxvt": "myUrxvt", "myUrxvt": "myUrxvt",
"myVim": "myVim", "myVim": "myVim",
"myZsh": "myZsh", "myZsh": "myZsh",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3",
"xmonad-masser": "xmonad-masser",
"xmonad-module": "xmonad-module"
}
},
"xmonad-masser": {
"inputs": {
"easy-hls-src": "easy-hls-src",
"flake-utils": "flake-utils_5",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1637084914,
"narHash": "sha256-TTuEa8pngrydMP3nbjb4lT94+Cg6blOy1CjhpsxuIhs=",
"owner": "MasseR",
"repo": "xmonad-masser",
"rev": "837656a2d0c685619793fc282c90f59bf24e8494",
"type": "github"
},
"original": {
"owner": "MasseR",
"repo": "xmonad-masser",
"type": "github"
}
},
"xmonad-module": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1637345727,
"narHash": "sha256-mt7S6iIt6ethG6E9jF5xlhVpyhfEiEWZHKqNRj1JRgk=",
"ref": "master",
"rev": "8ba34427d36adbb276b4e3d6cd8245574918cdc0",
"revCount": 1,
"type": "git",
"url": "https://git.rauhala.info/MasseR/nix-conf-xmonad"
},
"original": {
"type": "git",
"url": "https://git.rauhala.info/MasseR/nix-conf-xmonad"
} }
} }
}, },

View File

@ -23,6 +23,14 @@
url = "git+https://git.rauhala.info/MasseR/nix-conf-urxvt"; url = "git+https://git.rauhala.info/MasseR/nix-conf-urxvt";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
xmonad-module = {
url = "git+https://git.rauhala.info/MasseR/nix-conf-xmonad";
inputs.nixpkgs.follows = "nixpkgs";
};
xmonad-masser = {
url = "github:MasseR/xmonad-masser";
inputs.nixpkgs.follows = "nixpkgs";
};
kobodl = { kobodl = {
url = "github:MasseR/nix-kobodl"; url = "github:MasseR/nix-kobodl";
}; };
@ -38,10 +46,12 @@
selfModules ++ [ selfModules ++ [
inputs.myZsh.nixosModule inputs.myZsh.nixosModule
inputs.myUrxvt.nixosModule inputs.myUrxvt.nixosModule
inputs.xmonad-module.nixosModule
]; ];
overlays = [ overlays = [
inputs.myEmacs.overlay inputs.myEmacs.overlay
inputs.myVim.overlay inputs.myVim.overlay
inputs.xmonad-masser.overlay
]; ];
homeConfigurations = homeConfigurations =

View File

@ -1,5 +1,6 @@
{ config, pkgs, ...}: { config, pkgs, ...}:
{ {
nixpkgs.config.allowUnfree = true;
programs.command-not-found.enable = true; programs.command-not-found.enable = true;
home.keyboard.layout = "fi"; home.keyboard.layout = "fi";
@ -70,4 +71,63 @@
programs.myZsh.enable = true; programs.myZsh.enable = true;
programs.myUrxvt.enable = true; programs.myUrxvt.enable = true;
programs.xmonad = {
enable = true;
dhallConfigPath = ./xmonad.dhall;
packages = with pkgs;
let
prompt = writeScriptBin "prompt" ''
${pkgs.haskellPackages.xmobar}/bin/xmobar ${xmobarConf}
'';
xmobarConf = pkgs.writeText "xmobar" ''
Config {
font = "xft:Iosevka-9"
, bgColor = "#3F3F3F"
, fgColor = "#DCDCCC"
, position = Top
, lowerOnStart = True
, commands = [
Run MultiCpu ["-t", "CPU: <total>%"] 30
, Run Memory ["-t", "Mem: <usedbar> (<cache>M)"] 3600
, Run Date "%a %b %_d %Y %H:%M:%S" "date" 20
, Run StdinReader
, Run Battery [ "--template" , "Batt: <acstatus>"
, "--Low" , "10" -- units: %
, "--High" , "80" -- units: %
, "--low" , "darkred"
, "--normal" , "darkorange"
, "--high" , "darkgreen"
, "--" -- battery specific options
-- discharging status
, "-o" , "<left>% (<timeleft>)"
-- AC "on" status
, "-O" , "<fc=#dAA520>Charging</fc>"
-- charged status
, "-i" , "<fc=#006000>Charged</fc>"
] 120
, Run DynNetwork [ "--template" , "<dev>: <tx>kB/s|<rx>kB/s"
, "--Low" , "1000" -- units: B/s
, "--High" , "500000" -- units: B/s
, "--normal" , "darkorange"
, "--high" , "darkred"
] 30
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{%dynnetwork% | %battery% | %multicpu% | %memory% | <fc=#FFFFCC>%date%</fc>"
}
'';
in
{
inherit qutebrowser flameshot calibre spotify hledger obsidian prompt;
hledger_ui = hledger-ui;
element = element-desktop;
signal = signal-desktop;
vim = myVim;
emacs = myEmacs;
urxvt = rxvt-unicode;
};
};
} }

120
macbook/xmonad.dhall Normal file
View File

@ -0,0 +1,120 @@
let Prelude =
https://prelude.dhall-lang.org/v20.1.0/package.dhall
sha256:26b0ef498663d269e4dc6a82b0ee289ec565d683ef4c00d0ebdd25333a5a3c98
let Config =
/home/masse/git/xmonad-masser/dhall/package.dhall
sha256:8cca83716bc75d06cb22c7f45091606159404289d9866601817b2ab81170afcb
let pkgs =
{ qutebrowser = "@qutebrowser@"
, prompt = "@prompt@"
, signal = "@signal@"
, element = "@element@"
, emacs = "@emacs@"
, urxvt = "@urxvt@"
, flameshot = "@flameshot@"
, obsidian = "@obsidian@"
, vim = "@vim@"
, calibre = "@calibre@"
, spotify = "@spotify@"
, hledger = "@hledger@"
, hledger-ui = "@hledger_ui@"
}
let browser = "${pkgs.qutebrowser}/bin/qutebrowser"
let terminal = "${pkgs.urxvt}/bin/urxvt"
let prompt = "${pkgs.prompt}/bin/prompt"
let shellIn = \(path : Text) -> "${terminal} -cd ${path}"
let paths =
let pathElement = \(x : Prelude.Map.Entry Text Text) -> x.mapValue
in Prelude.Text.concatMapSep
":"
(Prelude.Map.Entry Text Text)
pathElement
(toMap pkgs)
let runOnTopic =
\(name : Text) ->
\(action : Text) ->
Config.Topic::{ name, action = [ Config.Command.Spawn action ] }
let spawn = Config.Command.Spawn
in Config::{
, path = paths
, applications = { terminal, prompt = pkgs.prompt }
, topics =
[ runOnTopic "signal" "${pkgs.signal}/bin/signal-desktop"
, runOnTopic "element" "${pkgs.element}/bin/element-desktop"
, runOnTopic "xmonad" (shellIn "/home/masse/git/xmonad-masser")
, runOnTopic "adhoc" (shellIn "/home/masse/code_practice")
, Config.Topic::{
, name = "zettel"
, action =
[ spawn "${pkgs.obsidian}/bin/obsidian"
, spawn "${pkgs.vim}/bin/vim -g"
]
}
, runOnTopic "conf" (shellIn "/etc/nixos")
, runOnTopic "web" browser
, Config.Topic::{
, name = "ledger"
, action =
[ spawn
"${pkgs.vim}/bin/vim -g /home/masse/wikidata/accounting/2021.journal"
, spawn (shellIn "/home/masse/wikidata/accounting")
, spawn
( shellIn
"/home/masse/wikidata/accounting -e ${pkgs.hledger-ui}/bin/hledger-ui --watch --register checking -U -P"
)
, spawn
( shellIn
"/home/masse/wikidata/accounting -e ${pkgs.hledger-ui}/bin/hledger-ui --watch --register savings -U -P"
)
, spawn
( shellIn
"/home/masse/wikidata/accounting -e ${pkgs.hledger-ui}/bin/hledger-ui --watch --register lunchcard -U -P"
)
]
}
, runOnTopic "pdf" "${pkgs.calibre}/bin/calibre"
, runOnTopic "music" "${pkgs.spotify}/bin/spotify"
]
, bindings =
let mkCommand =
\(prefix : Text) ->
\(name : Text) ->
\(command : Text) ->
Config.SubCommand.act
{ prefix, name, command = Config.Command.Spawn command }
let mkSearch =
\(prefix : Text) ->
\(name : Text) ->
\(site : Text) ->
Config.SubCommand.act
{ prefix
, name
, command = Config.Command.Search { name, browser, site }
}
in [ mkCommand
"M-<Print>"
"Take a screenshot"
"${pkgs.flameshot}/bin/flameshot gui"
, Config.SubCommand.subMap
{ prefix = "M-s"
, name = "Search"
, sub =
[ mkSearch "h" "hoogle" "https://hoogle.haskell.org?hoogle="
, mkSearch "g" "google" "https://google.com/search?q="
, mkSearch "d" "duckduckgo" "https://duckduckgo.com/?q="
]
}
]
}