Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
biegunka scripts to keep various environments' configuration updated
VimL Haskell Nix Shell
branch: master

README.markdown

dotfiles Build Status

biegunka scripts to keep various environments' configuration updated

tl;dr

  • >1 environments
  • configuration is stored in a template files, not in a ready-to-use format
  • provisioning by biegunka
  • CI via Travis

Why biegunka?

  • regular install.sh is not enough when number of working environments is more than 1.
  • regular install.sh is not enough when you need to remove all installed shit out of your system.
  • regular install.sh is not enough when you need to rollback all changes.
  • regular install.sh is not enough when you need some declarative syntax describing your configuration.
  • regular install.sh is not enough actually because of bash.

Biegunka could do that for you.

Another solutions

Chef and chef-solo could be helpful here with all these recipes and roles power, but I'm too lazy for writing a cookbook for every application that I have.

nix language and package manager fits our needs perfectly here. Installing nix over existed package manager and rewriting all dotfiles as a nix expressions can take much time. But it is a perfect solution for a NixOS.

Usage

There is a dotfiles.cabal project pointed at Main.hs. It compiles to a dotfiles executable. Currently I'm provisioning all these dotfiles using nix only.

$> nix-shell --run 'cabal install && dotfiles --qumsrc --force'

Windows

TODO: biegunka package depends on a unix package which is impossible to use inside a windows.

Modularity

All dotfiles could be split into a number of modules. Each working environment is using only a subset of a all dotfiles stored in git repository. that it is really needed.

E.g. X-less nixos environment doesn't need no pentadactyl or mpv

namespaces = sequence_
  [ namespace_git
  , namespace_haskell
  , namespace_nixpkgs
  , namespace_tmux
  , namespace_vifm
  , namespace_vim
  , namespace_zsh
  ]

which describes pretty well what is going tbe installed by runningbiegunka`'s provisioning for this environment.

All namespaces are defined in Namespaces.hs. Almost all of them are using dotfiles function

dotfiles :: Script Actions () -> Script Sources ()
dotfiles as = git "git@github.com:dmalikov/dotfiles" "dmalikov/dotfiles"

Here is an example of vim namespace:

namespace_vim :: Script Sources ()
namespace_vim = do
  namespace "vim/rc" $ do
    git_ "git@github.com:Shougo/neobundle.vim" ".vim/bundle/neobundle.vim"
    git "git@github.com:tpope/vim-pathogen" ".vim/bundle/vim-pathogen" $
      copy "autoload/pathogen.vim" ".vim/autoload/pathogen.vim"
    dotfiles $ copy "configs/vim/vimrc" ".vimrc"
  namespace "vim/syntax" $ do
    dotfiles $ copy "configs/vim/syntax/haskell.vim" ".vim/after/syntax/haskell.vim"
    dotfiles $ copy "configs/vim/syntax/nix.vim" ".vim/after/syntax/nix.vim"
  namespace "vim/colorschemes" $
    dotfiles $ copy "configs/vim/colors/neverland-darker.vim" ".vim/colors/neverland-darker.vim"
  namespace "vim/plugins" $
    dotfiles $ copy "configs/vim/MyTabularMaps.vim" ".vim/bundle/tabular/after/plugin/MyTabularMaps.vim"

It's just a bunch of script sources with a type Script Sources ().

Templating

Working with a number of different environments produce a lot of interesting problems. E.g. some parts of a configuration files become dependant on a particular environment.

I.e. configuring tmux with a different default shell path.

tmux.conf:

set -g default-command $template.tmux.shell$
set -g default-shell $template.tmux.shell$

Tmux configuration is defined in a Defaults.hs:

data Tmux = Tmux
  { shell :: String
  } deriving (Data, Typeable)

Different environments has a different Tmux settings:

X220 (R.I.P.):

configs :: Configs
configs = def
  {
...
  , tmux = def
    { shell = "/bin/zsh"
    }
...
  }

S10:

configs :: Configs
configs = def
  {
...
  , tmux = def
    { shell = "~/.nix-profile/bin/zsh"
    }
...
  }
Something went wrong with that request. Please try again.