diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2021-01-03 01:14:47 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2021-01-03 16:21:34 +0100 |
commit | 392e6768f9f60c761b65f8774c1667ab8d00f230 (patch) | |
tree | e84d0439a01402e3bd85a627c6594526f1d0a8ed /accounts/gkleen@sif/xmobar | |
parent | 4a3d2a8ddaf4e546df360656bc54b2947bdb890b (diff) | |
download | nixos-392e6768f9f60c761b65f8774c1667ab8d00f230.tar nixos-392e6768f9f60c761b65f8774c1667ab8d00f230.tar.gz nixos-392e6768f9f60c761b65f8774c1667ab8d00f230.tar.bz2 nixos-392e6768f9f60c761b65f8774c1667ab8d00f230.tar.xz nixos-392e6768f9f60c761b65f8774c1667ab8d00f230.zip |
gkleen@sif: systemd
Diffstat (limited to 'accounts/gkleen@sif/xmobar')
-rw-r--r-- | accounts/gkleen@sif/xmobar/default.nix | 7 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/nixpkgs.nix | 9 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/package.yaml | 13 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/shell.nix | 28 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/stack.nix | 17 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/stack.yaml | 10 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/stack.yaml.lock | 12 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/stackage.nix | 31 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/xmobar-yggdrasil.nix | 13 | ||||
-rw-r--r-- | accounts/gkleen@sif/xmobar/xmobar.hs | 52 |
10 files changed, 192 insertions, 0 deletions
diff --git a/accounts/gkleen@sif/xmobar/default.nix b/accounts/gkleen@sif/xmobar/default.nix new file mode 100644 index 00000000..fcac5e60 --- /dev/null +++ b/accounts/gkleen@sif/xmobar/default.nix | |||
@@ -0,0 +1,7 @@ | |||
1 | argumentPackages@{ ... }: | ||
2 | |||
3 | let | ||
4 | # defaultPackages = (import ./stackage.nix {}); | ||
5 | # haskellPackages = defaultPackages // argumentPackages; | ||
6 | haskellPackages = argumentPackages; | ||
7 | in haskellPackages.callPackage ./xmobar-yggdrasil.nix {} | ||
diff --git a/accounts/gkleen@sif/xmobar/nixpkgs.nix b/accounts/gkleen@sif/xmobar/nixpkgs.nix new file mode 100644 index 00000000..783ede00 --- /dev/null +++ b/accounts/gkleen@sif/xmobar/nixpkgs.nix | |||
@@ -0,0 +1,9 @@ | |||
1 | { nixpkgs ? import <nixpkgs> | ||
2 | }: | ||
3 | |||
4 | import ((nixpkgs {}).fetchFromGitHub { | ||
5 | owner = "NixOS"; | ||
6 | repo = "nixpkgs"; | ||
7 | rev = "10e61bf5be57736035ec7a804cb0bf3d083bf2cf"; | ||
8 | sha256 = "0fplfm2zx4vk7gs8bdcxnvzkdmpx2w0llqwf8475z9dz9cl132rm"; | ||
9 | }) | ||
diff --git a/accounts/gkleen@sif/xmobar/package.yaml b/accounts/gkleen@sif/xmobar/package.yaml new file mode 100644 index 00000000..b638b6ac --- /dev/null +++ b/accounts/gkleen@sif/xmobar/package.yaml | |||
@@ -0,0 +1,13 @@ | |||
1 | name: xmobar-yggdrasil | ||
2 | |||
3 | executables: | ||
4 | xmobar: | ||
5 | dependencies: | ||
6 | - base | ||
7 | - xmobar | ||
8 | |||
9 | main: xmobar.hs | ||
10 | source-dirs: | ||
11 | - . | ||
12 | |||
13 | ghc-options: -threaded | ||
diff --git a/accounts/gkleen@sif/xmobar/shell.nix b/accounts/gkleen@sif/xmobar/shell.nix new file mode 100644 index 00000000..18188e78 --- /dev/null +++ b/accounts/gkleen@sif/xmobar/shell.nix | |||
@@ -0,0 +1,28 @@ | |||
1 | { nixpkgs ? import ./nixpkgs.nix {} }: | ||
2 | |||
3 | let | ||
4 | inherit (nixpkgs {}) pkgs; | ||
5 | haskellPackages = import ./stackage.nix { inherit nixpkgs; }; | ||
6 | |||
7 | drv = haskellPackages.callPackage ./xmobar-yggdrasil.nix {}; | ||
8 | override = oldAttrs: { | ||
9 | nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (with pkgs; []) ++ (with haskellPackages; [ stack cabal-install cabal2nix ]); | ||
10 | shellHook = '' | ||
11 | export PROMPT_INFO="${oldAttrs.name}" | ||
12 | |||
13 | if [ -n "$ZSH_VERSION" ]; then | ||
14 | autoload -U +X compinit && compinit | ||
15 | autoload -U +X bashcompinit && bashcompinit | ||
16 | fi | ||
17 | eval "$(stack --bash-completion-script stack)" | ||
18 | |||
19 | ${oldAttrs.shellHook} | ||
20 | ''; | ||
21 | }; | ||
22 | |||
23 | dummy = pkgs.stdenv.mkDerivation { | ||
24 | name = "interactive-xmobar-environment"; | ||
25 | shellHook = ""; | ||
26 | }; | ||
27 | in pkgs.stdenv.lib.overrideDerivation dummy override | ||
28 | #pkgs.stdenv.lib.overrideDerivation drv.env override | ||
diff --git a/accounts/gkleen@sif/xmobar/stack.nix b/accounts/gkleen@sif/xmobar/stack.nix new file mode 100644 index 00000000..17a49e04 --- /dev/null +++ b/accounts/gkleen@sif/xmobar/stack.nix | |||
@@ -0,0 +1,17 @@ | |||
1 | { ghc, nixpkgs ? import ./nixpkgs.nix {} }: | ||
2 | |||
3 | let | ||
4 | haskellPackages = import ./stackage.nix { inherit nixpkgs; }; | ||
5 | inherit (nixpkgs {}) pkgs; | ||
6 | in pkgs.haskell.lib.buildStackProject { | ||
7 | inherit ghc; | ||
8 | inherit (haskellPackages) stack; | ||
9 | name = "stackenv"; | ||
10 | buildInputs = (with pkgs; | ||
11 | [ xorg.libX11 xorg.libXrandr xorg.libXinerama xorg.libXScrnSaver xorg.libXext xorg.libXft | ||
12 | cairo | ||
13 | glib | ||
14 | ]) ++ (with haskellPackages; | ||
15 | [ | ||
16 | ]); | ||
17 | } | ||
diff --git a/accounts/gkleen@sif/xmobar/stack.yaml b/accounts/gkleen@sif/xmobar/stack.yaml new file mode 100644 index 00000000..b8ed1147 --- /dev/null +++ b/accounts/gkleen@sif/xmobar/stack.yaml | |||
@@ -0,0 +1,10 @@ | |||
1 | nix: | ||
2 | enable: true | ||
3 | shell-file: stack.nix | ||
4 | |||
5 | resolver: lts-13.21 | ||
6 | |||
7 | packages: | ||
8 | - . | ||
9 | |||
10 | extra-deps: [] | ||
diff --git a/accounts/gkleen@sif/xmobar/stack.yaml.lock b/accounts/gkleen@sif/xmobar/stack.yaml.lock new file mode 100644 index 00000000..fcc2f5f3 --- /dev/null +++ b/accounts/gkleen@sif/xmobar/stack.yaml.lock | |||
@@ -0,0 +1,12 @@ | |||
1 | # This file was autogenerated by Stack. | ||
2 | # You should not edit this file by hand. | ||
3 | # For more information, please see the documentation at: | ||
4 | # https://docs.haskellstack.org/en/stable/lock_files | ||
5 | |||
6 | packages: [] | ||
7 | snapshots: | ||
8 | - completed: | ||
9 | size: 498180 | ||
10 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/13/21.yaml | ||
11 | sha256: eff2de19a6d4691ccbf6edc1fba858f1918683047dce0f09adede874bbd2a8f3 | ||
12 | original: lts-13.21 | ||
diff --git a/accounts/gkleen@sif/xmobar/stackage.nix b/accounts/gkleen@sif/xmobar/stackage.nix new file mode 100644 index 00000000..c162ca2c --- /dev/null +++ b/accounts/gkleen@sif/xmobar/stackage.nix | |||
@@ -0,0 +1,31 @@ | |||
1 | { nixpkgs ? import ./nixpkgs.nix {} | ||
2 | , snapshot ? "lts-13.21" | ||
3 | }: | ||
4 | |||
5 | let | ||
6 | stackage = import (fetchTarball { | ||
7 | url = "https://stackage.serokell.io/zb36jsy3r5h4ydz0pnp00g9vk94dvv03-stackage/default.nix.tar.gz"; | ||
8 | sha256 = "0h6f80gds0ds77y51hhiadh2h2k8njqq8n0gayp729ana9m9agma"; | ||
9 | }); | ||
10 | |||
11 | overlays = | ||
12 | [ stackage."${snapshot}" | ||
13 | (self: super: { | ||
14 | haskell = super.haskell // { | ||
15 | packages = super.haskell.packages // { | ||
16 | "${snapshot}" = super.haskell.packages."${snapshot}".override { | ||
17 | overrides = hself: hsuper: { | ||
18 | zip-archive = self.haskell.lib.overrideCabal hsuper.zip-archive (old: { | ||
19 | testToolDepends = old.testToolDepends ++ (with self; [ unzip which ]); | ||
20 | }); | ||
21 | alex = self.haskell.lib.dontCheck hsuper.alex; | ||
22 | }; | ||
23 | }; | ||
24 | }; | ||
25 | }; | ||
26 | } | ||
27 | ) | ||
28 | ]; | ||
29 | |||
30 | inherit (nixpkgs { inherit overlays; }) pkgs; | ||
31 | in pkgs.haskell.packages."${snapshot}" | ||
diff --git a/accounts/gkleen@sif/xmobar/xmobar-yggdrasil.nix b/accounts/gkleen@sif/xmobar/xmobar-yggdrasil.nix new file mode 100644 index 00000000..1dfc619b --- /dev/null +++ b/accounts/gkleen@sif/xmobar/xmobar-yggdrasil.nix | |||
@@ -0,0 +1,13 @@ | |||
1 | { mkDerivation, base, hpack, stdenv, xmobar }: | ||
2 | mkDerivation { | ||
3 | pname = "xmobar-yggdrasil"; | ||
4 | version = "0.0.0"; | ||
5 | src = ./.; | ||
6 | isLibrary = false; | ||
7 | isExecutable = true; | ||
8 | libraryToolDepends = [ hpack ]; | ||
9 | executableHaskellDepends = [ base xmobar ]; | ||
10 | preConfigure = "hpack"; | ||
11 | license = "unknown"; | ||
12 | hydraPlatforms = stdenv.lib.platforms.none; | ||
13 | } | ||
diff --git a/accounts/gkleen@sif/xmobar/xmobar.hs b/accounts/gkleen@sif/xmobar/xmobar.hs new file mode 100644 index 00000000..ea53082d --- /dev/null +++ b/accounts/gkleen@sif/xmobar/xmobar.hs | |||
@@ -0,0 +1,52 @@ | |||
1 | import Xmobar | ||
2 | |||
3 | import Data.List (intercalate) | ||
4 | |||
5 | |||
6 | main :: IO () | ||
7 | main = xmobar config | ||
8 | where | ||
9 | config = defaultConfig | ||
10 | { font = "xft:Fira Mono for Powerline:style=Medium:pixelsize=22.5" | ||
11 | , position = OnScreen 0 $ TopP 0 307 | ||
12 | , bgColor = "black" | ||
13 | , fgColor = "grey" | ||
14 | , overrideRedirect = False | ||
15 | , template = | ||
16 | let left = intercalate " | " | ||
17 | [ "%XMonadWorkspaces%" | ||
18 | , "%XMonadLayout%" | ||
19 | , "%XMonadTitle%" | ||
20 | ] | ||
21 | right = intercalate " | " | ||
22 | [ {- "%status%" | ||
23 | , -} "%battery%" | ||
24 | , "%kbd%" | ||
25 | , "%worktime%" | ||
26 | , "%worktime-today%" | ||
27 | , "%time%" | ||
28 | , "%date%" | ||
29 | ] | ||
30 | in left <> "}{" <> right | ||
31 | , commands = | ||
32 | [ Run $ NamedXPropertyLog "_XMONAD_WORKSPACES" "XMonadWorkspaces" | ||
33 | , Run $ NamedXPropertyLog "_XMONAD_LAYOUT" "XMonadLayout" | ||
34 | , Run $ NamedXPropertyLog "_XMONAD_TITLE" "XMonadTitle" | ||
35 | , Run $ Date "%H:%M" "time" 50 | ||
36 | , Run $ Date "%a %b %_d" "date" 50 | ||
37 | , Run $ Com "worktime" [] "worktime" 1500 | ||
38 | , Run $ Com "worktime" ["today"] "worktime-today" 1500 | ||
39 | , Run $ Com "ssh" ["status.odin"] "status" 600 | ||
40 | , Run $ Kbd [("us(dvp)", "dvp")] | ||
41 | , Run $ Battery | ||
42 | [ "--template", "<watts> <left> (<timeleft>) AC <acstatus>" | ||
43 | , "--suffix", "On" | ||
44 | , "--Low", "10" | ||
45 | , "--High", "80" | ||
46 | , "--low", "darkred" | ||
47 | , "--normal", "darkorange" | ||
48 | , "--high", "darkgreen" | ||
49 | , "-p", "3" | ||
50 | ] 50 | ||
51 | ] | ||
52 | } | ||