From 087ed3974dbbfb12e5d12d1444553bb5d677a59b Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Wed, 30 Jun 2021 11:16:21 -0400 Subject: [PATCH] Add xmobar, WIP --- features/desktopish/default.nix | 3 +- features/desktopish/xmobar/default.nix | 20 +++++++++++++ .../desktopish/xmobar/xmobar-srid/.gitignore | 2 ++ .../xmobar-srid/.vscode/extensions.json | 8 ++++++ .../xmobar/xmobar-srid/.vscode/settings.json | 6 ++++ .../xmobar/xmobar-srid/CHANGELOG.md | 5 ++++ .../desktopish/xmobar/xmobar-srid/Main.hs | 7 +++++ .../desktopish/xmobar/xmobar-srid/Setup.hs | 2 ++ .../desktopish/xmobar/xmobar-srid/default.nix | 16 +++++++++++ .../xmobar/xmobar-srid/xmobar-srid.cabal | 28 +++++++++++++++++++ 10 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 features/desktopish/xmobar/default.nix create mode 100644 features/desktopish/xmobar/xmobar-srid/.gitignore create mode 100644 features/desktopish/xmobar/xmobar-srid/.vscode/extensions.json create mode 100644 features/desktopish/xmobar/xmobar-srid/.vscode/settings.json create mode 100644 features/desktopish/xmobar/xmobar-srid/CHANGELOG.md create mode 100644 features/desktopish/xmobar/xmobar-srid/Main.hs create mode 100644 features/desktopish/xmobar/xmobar-srid/Setup.hs create mode 100644 features/desktopish/xmobar/xmobar-srid/default.nix create mode 100644 features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal diff --git a/features/desktopish/default.nix b/features/desktopish/default.nix index 426ad01..48b1ea5 100644 --- a/features/desktopish/default.nix +++ b/features/desktopish/default.nix @@ -14,7 +14,8 @@ # WMish things ./xmonad #./sway.nix - ./taffybar # Disabled, because it rarely works + # ./taffybar # Disabled, because it rarely works + ./xmobar ]; environment.systemPackages = with pkgs; [ diff --git a/features/desktopish/xmobar/default.nix b/features/desktopish/xmobar/default.nix new file mode 100644 index 0000000..778254b --- /dev/null +++ b/features/desktopish/xmobar/default.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: +let + xmobarPkg = pkgs.callPackage ./xmobar-srid { inherit pkgs; }; +in +{ + systemd.user.services.xmobar = { + enable = true; + description = "Xmobar"; + wantedBy = [ "graphical-session.target" ]; + serviceConfig = { + ExecStart = "${xmobarPkg}/bin/xmobar-srid"; + Restart = "on-abnormal"; + }; + }; + + # Battery widget requires this. + services.upower = { + enable = true; + }; +} diff --git a/features/desktopish/xmobar/xmobar-srid/.gitignore b/features/desktopish/xmobar/xmobar-srid/.gitignore new file mode 100644 index 0000000..1f594a8 --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/.gitignore @@ -0,0 +1,2 @@ +result +dist-newstyle diff --git a/features/desktopish/xmobar/xmobar-srid/.vscode/extensions.json b/features/desktopish/xmobar/xmobar-srid/.vscode/extensions.json new file mode 100644 index 0000000..7539f1d --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/.vscode/extensions.json @@ -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" + ] +} \ No newline at end of file diff --git a/features/desktopish/xmobar/xmobar-srid/.vscode/settings.json b/features/desktopish/xmobar/xmobar-srid/.vscode/settings.json new file mode 100644 index 0000000..5ab7546 --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "nixEnvSelector.nixShellConfig": "${workspaceRoot}/default.nix", + "editor.formatOnType": true, + "editor.formatOnSave": true, + "nixEnvSelector.nixFile": "${workspaceRoot}/default.nix" +} \ No newline at end of file diff --git a/features/desktopish/xmobar/xmobar-srid/CHANGELOG.md b/features/desktopish/xmobar/xmobar-srid/CHANGELOG.md new file mode 100644 index 0000000..42030ab --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for xmobar-srid + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/features/desktopish/xmobar/xmobar-srid/Main.hs b/features/desktopish/xmobar/xmobar-srid/Main.hs new file mode 100644 index 0000000..fa748c4 --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/Main.hs @@ -0,0 +1,7 @@ +module Main where + +import Xmobar + +main :: IO () +main = + xmobarMain diff --git a/features/desktopish/xmobar/xmobar-srid/Setup.hs b/features/desktopish/xmobar/xmobar-srid/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/features/desktopish/xmobar/xmobar-srid/default.nix b/features/desktopish/xmobar/xmobar-srid/default.nix new file mode 100644 index 0000000..ee2fb68 --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/default.nix @@ -0,0 +1,16 @@ +# Since the xmonad config will be built by nixos-rebuild, we use the +# nix-channel's nixpkgs. +{ pkgs ? import { } }: +pkgs.haskellPackages.developPackage { + name = "xmobar-srid"; + root = ./.; + 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; { }; +} diff --git a/features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal b/features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal new file mode 100644 index 0000000..4a32e7f --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal @@ -0,0 +1,28 @@ +cabal-version: >=1.10 +-- Initial package description 'xmobar-srid.cabal' generated by 'cabal +-- init'. For further documentation, see +-- http://haskell.org/cabal/users-guide/ + +name: xmobar-srid +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +-- license: +license-file: LICENSE +author: Sridhar Ratnakumar +maintainer: srid@srid.ca +-- copyright: +-- category: +build-type: Simple +extra-source-files: CHANGELOG.md + +executable xmobar-srid + main-is: Main.hs + -- other-modules: + -- other-extensions: + build-depends: base >=4.13 && <4.14 + , xmobar + , text + -- hs-source-dirs: + default-language: Haskell2010