functional update
This commit is contained in:
parent
792cc98d99
commit
6980dd922b
81
README.md
81
README.md
@ -1,84 +1,68 @@
|
|||||||
# Base16 themes for home manager
|
# Base16 themes for home manager
|
||||||
|
|
||||||
This is a fork of [atpotts/base16-nix](https://github.com/atpotts/base16-nix)
|
This is a fork of [lukebfox/base16-nix](https://github.com/lukebfox/base16-nix)
|
||||||
|
|
||||||
Differences:
|
Differences:
|
||||||
- Exports the home manager module as a flake output.
|
|
||||||
- Restricts scope to official base16-themes.
|
|
||||||
- Prefers the colors-only mustache template if supported, as usually I prefer to
|
|
||||||
do my own customisation.
|
|
||||||
|
|
||||||
## Usage
|
- Returns support for obtaining color values from the color scheme
|
||||||
|
- Removed unused files
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
import this flake in your 'flake.nix':
|
import this flake in your 'flake.nix':
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
inputs.base16.url = 'github:lukebfox/base16-nix';
|
inputs.base16.url = 'github:alukardbf/base16-nix';
|
||||||
```
|
```
|
||||||
|
|
||||||
then, in any home-manager configuration:
|
then, in any home-manager configuration:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
home.user.${user} = {config,pkgs,lib}:{
|
home.user.${user} = { config, pkgs, lib }: {
|
||||||
imports = [ base16.hmModule ];
|
imports = [ base16.hmModule ];
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{pkgs, lib, config, ...}:
|
{ pkgs, lib, config, ...}:
|
||||||
{
|
{
|
||||||
imports = [ ./base16.nix ];
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
# Choose your themee
|
# Choose your theme
|
||||||
themes.base16 = {
|
themes.base16 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
scheme = "solarized";
|
scheme = "solarized";
|
||||||
variant = "solarized-dark";
|
variant = "solarized-dark";
|
||||||
|
|
||||||
# Add extra variables for inclusion in custom templates
|
# Add extra variables for inclusion in custom templates
|
||||||
extraParams = {
|
extraParams = {
|
||||||
fontname = mkDefault "Inconsolata LGC for Powerline";
|
fontName = mkDefault "Roboto";
|
||||||
headerfontname = mkDefault "Cabin";
|
fontSize = mkDefault "12";
|
||||||
bodysize = mkDefault "10";
|
};
|
||||||
headersize = mkDefault "12";
|
|
||||||
xdpi= mkDefault ''
|
|
||||||
Xft.hintstyle: hintfull
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# 1. Use pre-provided templates
|
# 1. Use pre-provided templates
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
programs.bash.initExtra = ''
|
programs.bash.initExtra = ''
|
||||||
source ${config.lib.base16.base16template "shell"}
|
source ${config.base16.templateFile "shell"}
|
||||||
'';
|
'';
|
||||||
home.file.".vim/colors/mycolorscheme.vim".source =
|
home.file.".vim/colors/mycolorscheme.vim".source =
|
||||||
config.lib.base16.base16template "vim";
|
config.base16.templateFile "vim";
|
||||||
|
|
||||||
# 2. Use your own templates
|
# 2. Template strings directly into other home-manager configuration
|
||||||
###########################
|
|
||||||
|
|
||||||
home.file.".Xresources".source = config.lib.base16.template {
|
|
||||||
src = ./examples/Xresources;
|
|
||||||
};
|
|
||||||
home.file.".xmonad/xmobarrc".source = config.lib.base16.template {
|
|
||||||
src = ./examples/xmobarrc;
|
|
||||||
};
|
|
||||||
|
|
||||||
# 3. Template strings directly into other home-manager configuration
|
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
services.dunst = {
|
services.dunst = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = with config.lib.base16.theme;
|
settings = with config.base16.theme;
|
||||||
{
|
{
|
||||||
global = {
|
global = {
|
||||||
geometry = "600x1-800+-3";
|
geometry = "600x1-800+-3";
|
||||||
font = "${headerfontname} ${headersize}";
|
|
||||||
icon_path =
|
icon_path =
|
||||||
config.services.dunst.settings.global.icon_folders;
|
config.services.dunst.settings.global.icon_folders;
|
||||||
alignment = "right";
|
alignment = "right";
|
||||||
|
font = "${fontName} ${fontSize}";
|
||||||
frame_width = 0;
|
frame_width = 0;
|
||||||
separator_height = 0;
|
separator_height = 0;
|
||||||
sort = true;
|
sort = true;
|
||||||
@ -98,30 +82,37 @@ home.user.${user} = {config,pkgs,lib}:{
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reloading
|
## Reloading
|
||||||
|
|
||||||
Changing themes involves switching the theme definitoin and typing
|
Changing themes involves switching the theme definition and typing
|
||||||
`home-manager switch`. There is no attempt in general to force programs to
|
`home-manager switch`. There is no attempt in general to force programs to
|
||||||
reload, and not all are able to reload their configs, although I have found
|
reload, and not all are able to reload their configs, although I have found
|
||||||
that reloading xmonad and occasionally restarting applications has been
|
that reloading xmonad and occasionally restarting applications has been
|
||||||
enough.
|
enough.
|
||||||
|
|
||||||
You are unlikely to achieve a complet switch without logging out and logging back
|
You are unlikely to achieve a complete switch without logging out and logging back
|
||||||
in again.
|
in again.
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
Provide better support for custom schemes (currently this assumes you'll
|
Provide better support for custom schemes (currently it
|
||||||
want to use something in the base16 repositories, but there is no reason
|
is assumed that you'll use something in base16
|
||||||
for this).
|
repositories, but there is no reason to).
|
||||||
|
|
||||||
## Updating Sources
|
## Updating Sources
|
||||||
|
|
||||||
`cd` into the directory in which the templates.yaml and schemes.yaml are
|
If you're using nix flakes:
|
||||||
located, and run update_sources.sh
|
|
||||||
|
- Fork this repository
|
||||||
|
- `cd` into repository dir
|
||||||
|
- Enter `nix develop` and then run `update-base16`
|
||||||
|
- Commit and push new files
|
||||||
|
|
||||||
|
If you're **not** using nix flakes:
|
||||||
|
|
||||||
|
- `cd` into repository dir
|
||||||
|
- Run `update_sources.sh`
|
||||||
|
40
base16.nix
40
base16.nix
@ -18,12 +18,12 @@ let
|
|||||||
# if one exists, as I generally prefer to do my own customisations.
|
# if one exists, as I generally prefer to do my own customisations.
|
||||||
# Returns the nix store path of the file.
|
# Returns the nix store path of the file.
|
||||||
mkTemplate = name:
|
mkTemplate = name:
|
||||||
let
|
let
|
||||||
templateDir = "${pkgs.fetchgit (templates."${name}")}/templates";
|
templateDir = "${pkgs.fetchgit (templates."${name}")}/templates";
|
||||||
in
|
in
|
||||||
if pathExists (templateDir + "/colors.mustache")
|
if pathExists (templateDir + "/colors.mustache")
|
||||||
then templateDir + "/colors.mustache"
|
then templateDir + "/colors.mustache"
|
||||||
else templateDir + "/default.mustache";
|
else templateDir + "/default.mustache";
|
||||||
|
|
||||||
# The theme yaml files only supply 16 hex values, but the templates take
|
# The theme yaml files only supply 16 hex values, but the templates take
|
||||||
# a transformation of this data such as rgb. The hacky python script pre-
|
# a transformation of this data such as rgb. The hacky python script pre-
|
||||||
@ -32,13 +32,13 @@ let
|
|||||||
python = pkgs.python.withPackages (ps: [ ps.pyyaml ]);
|
python = pkgs.python.withPackages (ps: [ ps.pyyaml ]);
|
||||||
preprocess = src:
|
preprocess = src:
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
name = "placeholder-change-me";
|
name = "yaml";
|
||||||
inherit src;
|
inherit src;
|
||||||
builder = pkgs.writeText "builder.sh" ''
|
builder = pkgs.writeText "builder.sh" ''
|
||||||
slug_all=$(${pkgs.coreutils}/bin/basename $src)
|
slug_all=$(${pkgs.coreutils}/bin/basename $src)
|
||||||
slug=''${slug_all%.*}
|
slug=''${slug_all%.*}
|
||||||
${python}/bin/python ${./base16writer.py} $slug < $src > $out
|
${python}/bin/python ${./base16writer.py} $slug < $src > $out
|
||||||
'';
|
'';
|
||||||
allowSubstitutes = false; # will never be in cache
|
allowSubstitutes = false; # will never be in cache
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,24 +54,28 @@ let
|
|||||||
allowSubstitutes = false; # will never be in cache
|
allowSubstitutes = false; # will never be in cache
|
||||||
};
|
};
|
||||||
|
|
||||||
|
schemeJSON = scheme: variant:
|
||||||
|
importJSON (preprocess (mkTheme scheme variant));
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
themes.base16.enable = mkEnableOption "Base 16 Color Schemes";
|
themes.base16.enable = mkEnableOption "Base 16 Color Schemes";
|
||||||
themes.base16.scheme = mkOption {
|
themes.base16.scheme = mkOption {
|
||||||
type=types.str;
|
type = types.str;
|
||||||
default="tomorrow";
|
default = "solarized";
|
||||||
};
|
};
|
||||||
themes.base16.variant = mkOption {
|
themes.base16.variant = mkOption {
|
||||||
type=types.str;
|
type = types.str;
|
||||||
default="tomorrow";
|
default = "solarized-dark";
|
||||||
};
|
};
|
||||||
themes.base16.tone = mkOption {
|
themes.base16.extraParams = mkOption {
|
||||||
type=types.str;
|
type = types.attrsOf types.str;
|
||||||
default="light";
|
default = {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
lib.base16.base16template = mustache cfg.scheme cfg.variant;
|
lib.base16.theme = schemeJSON cfg.scheme cfg.variant // cfg.extraParams;
|
||||||
|
lib.base16.templateFile = mustache cfg.scheme cfg.variant;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
{{xdpi}}
|
|
||||||
Xft.autohint: 0
|
|
||||||
Xft.lcdfilter: lcddefault
|
|
||||||
Xft.hinting: 1
|
|
||||||
Xft.antialias: 1
|
|
||||||
Xft.rgba: rgb
|
|
||||||
|
|
||||||
Xft.font: xft:{{headerfontname}}:size={{headersize}},xft:Symbola:size={{headersize}}
|
|
||||||
#define All_font xft:{{fontname}}:size={{bodysize}},xft:Symbola:size={{bodysize}}
|
|
||||||
URxvt.font: All_font
|
|
||||||
URxvt.scrollBar: false
|
|
||||||
URxvt.transparent: false
|
|
||||||
URxvt.borderLess: false
|
|
||||||
URxvt.saveLines: 2000
|
|
||||||
|
|
||||||
*color0: #{{base00}}
|
|
||||||
*color1: #{{base08}}
|
|
||||||
*color2: #{{base0B}}
|
|
||||||
*color3: #{{base0A}}
|
|
||||||
*color4: #{{base0D}}
|
|
||||||
*color5: #{{base0E}}
|
|
||||||
*color6: #{{base0C}}
|
|
||||||
*color7: #{{base05}}
|
|
||||||
*color8: #{{base03}}
|
|
||||||
|
|
||||||
*color9: #{{base08}}
|
|
||||||
*color10: #{{base0B}}
|
|
||||||
*color11: #{{base0A}}
|
|
||||||
*color12: #{{base0D}}
|
|
||||||
*color13: #{{base0E}}
|
|
||||||
*color14: #{{base0C}}
|
|
||||||
|
|
||||||
*color15: #{{base07}}
|
|
||||||
*color16: #{{base09}}
|
|
||||||
*color17: #{{base0F}}
|
|
||||||
*color18: #{{base01}}
|
|
||||||
*color19: #{{base02}}
|
|
||||||
*color20: #{{base04}}
|
|
||||||
*color21: #{{base06}}
|
|
||||||
|
|
||||||
*foreground: #{{base05}}
|
|
||||||
*background: #{{base00}}
|
|
||||||
*fadeColor: #{{base07}}
|
|
||||||
*cursorColor: #{{base01}}
|
|
||||||
*pointerColorBackground: #{{base01}}
|
|
||||||
*pointerColorForeground: #{{base06}}
|
|
||||||
|
|
||||||
dzen2.font : All_font
|
|
||||||
dzen2.foreground: S_base3
|
|
||||||
dzen2.background: S_base01
|
|
@ -1,28 +0,0 @@
|
|||||||
Config
|
|
||||||
{ font = "xft:{{headerfontname}}:size={{headersize}},Meslo LG L DZ:size={{headersize}}"
|
|
||||||
, bgColor = "#{{base01}}"
|
|
||||||
, fgColor = "#{{base03}}"
|
|
||||||
, position = Top L 100
|
|
||||||
, commands = [ Run Cpu ["-t","<total>⚙","-L","30","-H","70","--low","#{{base05}}","--normal","#{{base0A}}","--high","#cb4b16"] 10
|
|
||||||
, Run Memory ["-t","<usedratio>Ξ"] 10
|
|
||||||
, Run Battery ["-t","<left><acstatus> <timeleft>",
|
|
||||||
"-L","30",
|
|
||||||
"-H","80",
|
|
||||||
"--low","#{{base08}},#{{base00}}",
|
|
||||||
"--normal","#{{base0A}},#{{base00}}",
|
|
||||||
"--high","#{{base05}},#{{base00}}",
|
|
||||||
"--",
|
|
||||||
"-O","↑",
|
|
||||||
"-o","↓",
|
|
||||||
"-i","~"
|
|
||||||
] 100
|
|
||||||
, Run Date "%a %b %_d %Y %H:%M" "date" 100
|
|
||||||
, Run StdinReader
|
|
||||||
]
|
|
||||||
, sepChar = "%"
|
|
||||||
, alignSep = "}{"
|
|
||||||
, template = "%StdinReader% }{ <action=`urxvt -e top`> %cpu% %memory% </action><fc=#{{base02}},#{{base00}}> %battery% </fc> <fc=#{{base02}}>%date%</fc> %EGLC% "
|
|
||||||
, persistent = True
|
|
||||||
, lowerOnStart = True
|
|
||||||
, hideOnStart = False
|
|
||||||
}
|
|
@ -1,24 +1,24 @@
|
|||||||
#! /usr/bin/env nix-shell
|
#! /usr/bin/env nix-shell
|
||||||
#! nix-shell -i bash -p bash curl nix-prefetch-git gnused jq
|
#! nix-shell -i bash -p bash curl nix-prefetch-git gnused jq
|
||||||
|
|
||||||
# Run from within the directory which needs the templates.json/schemes.json
|
# Run from within the directory which needs the templates.json/schemes.json
|
||||||
|
|
||||||
# Not very safe - should be cleaner & could be more parallel
|
# Not very safe - should be cleaner & could be more parallel
|
||||||
# should always be permitted to run to completion
|
# should always be permitted to run to completion
|
||||||
|
|
||||||
generate_sources () {
|
generate_sources () {
|
||||||
out=$1
|
out=$1
|
||||||
curl "https://raw.githubusercontent.com/chriskempson/base16-${out}-source/master/list.yaml"\
|
curl "https://raw.githubusercontent.com/chriskempson/base16-${out}-source/master/list.yaml"\
|
||||||
| sed -nE "s~^([-_[:alnum:]]+): *(.*)~\1 \2~p"\
|
| sed -nE "s~^([-_[:alnum:]]+): *(.*)~\1 \2~p"\
|
||||||
| while read name src; do
|
| while read name src; do
|
||||||
echo "{\"key\":\"$name\",\"value\":"
|
echo "{\"key\":\"$name\",\"value\":"
|
||||||
nix-prefetch-git $src
|
nix-prefetch-git $src
|
||||||
echo "}"
|
echo "}"
|
||||||
done\
|
done\
|
||||||
| jq -s ".|del(.[].value.date)|from_entries"\
|
| jq -s ".|del(.[].value.date)|from_entries"\
|
||||||
> $out.json
|
> $out.json
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_sources templates &
|
generate_sources templates &
|
||||||
generate_sources schemes &
|
generate_sources schemes &
|
||||||
wait
|
wait
|
||||||
|
Loading…
x
Reference in New Issue
Block a user