Skip to main content
  1. Advanced/

NixOS / home-manager

Installing BMC #

NixOS (configuration.nix) #

{
  inputs.bmc.url = "github:wearetechnative/bmc";

  outputs = { nixpkgs, bmc, ... }: {
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      modules = [
        {
          environment.systemPackages = [
            bmc.packages.${system}.bmc
          ];
        }
      ];
    };
  };
}

home-manager #

{
  inputs.bmc.url = "github:wearetechnative/bmc";

  home.packages = [ inputs.bmc.packages.${system}.bmc ];
}

Shell integration with home-manager #

bmc install-shell-integration prints snippets instead of writing files when it detects a managed shell config. Add them manually:

zsh #

programs.zsh.initContent = ''
  bmc() {
    if [[ "$1" == "profsel" ]]; then
      eval "$(command bmc profsel "$@")"
    else
      command bmc "$@"
    fi
  }
'';

bash #

programs.bash.initExtra = ''
  bmc() {
    if [[ "$1" == "profsel" ]]; then
      eval "$(command bmc profsel "$@")"
    else
      command bmc "$@"
    fi
  }
'';

Fish #

programs.fish.functions.bmc = ''
  if test "$argv[1]" = "profsel"
    eval (command bmc profsel $argv)
  else
    command bmc $argv
  end
'';

Shell completions #

programs.zsh.initContent = ''
  source <(bmc completion zsh)
'';

# or for bash:
programs.bash.initExtra = ''
  source <(bmc completion bash)
'';