nix-config: 9a0008152073c48e082f8f91fe5f3a064ab57986

     1: {
     2:   config,
     3:   lib,
     4:   pkgs,
     5:   ...
     6: }:
     7: with {
     8:   inherit (lib)
     9:     mkIf
    10:     mkMerge
    11:     mkOption
    12:     types
    13:     ;
    14:   cfg = config.warbo;
    15: };
    16: {
    17:   options.warbo = import ../../warbo-options.nix { inherit lib pkgs; };
    18: 
    19:   config = mkIf cfg.enable (mkMerge [
    20:     {
    21:       # Unconditional; override if desired
    22:       home.stateVersion = cfg.home-manager.stateVersion;
    23:       home.file.".config/git/ignore".text = ''
    24:         # Per-directory Emacs config can by put into a .dir-locals.el file (a
    25:         # bit like direnv's .envrc files). They shouldn't be globally ignored by
    26:         # git, since some repos may include them, and that would cause problems.
    27: 
    28:         # However, Emacs will ALSO read files called .dir-locals-2.el, which are
    29:         # intended for personal settings that shouldn't be distributed. That way
    30:         # we can (a) ignore them globally to ensure they don't get committed, or
    31:         # show up as unstaged changes, etc. whilst (b) not having to worry about
    32:         # repos which include such files, since they're not for distribution!
    33:         .dir-locals-2.el
    34:       '';
    35:       home.file.".config/pinentry/preexec".source = ./pinentry-preexec.sh;
    36:       home.packages = cfg.packages;
    37:       nixpkgs.config.allowUnfree = true;
    38:       programs = {
    39:         bash = {
    40:           enable = true;
    41:           profileExtra = ''
    42:             if [[ -n "$BASH_VERSION" ]] && [[ -e "$HOME/.bashrc" ]]
    43:             then
    44:               . "$HOME/.bashrc"
    45:             fi
    46:             true
    47:           '';
    48:         };
    49:         git = {
    50:           enable = true;
    51:           extraConfig.diff.algorithm = "histogram";
    52:         };
    53:         home-manager.enable = true;
    54:         home-manager.path = import ../nixos-import.nix;
    55:         htop.enable = true;
    56:         jq.enable = true;
    57:         jujutsu.enable = true;
    58:         password-store = {
    59:           enable = true;
    60:           package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
    61:           settings.PASSWORD_STORE_DIR =
    62:             builtins.toString config.home.homeDirectory + "/.password-store";
    63:         };
    64:         ssh = {
    65:           enable = true;
    66:           matchBlocks = {
    67:             chromebook = {
    68:               hostname = "chromebook.local";
    69:               user = "jo";
    70:             };
    71:             phone = {
    72:               hostname = "manjaro-arm.local";
    73:               user = "manjaro";
    74:             };
    75:             pi = {
    76:               hostname = "dietpi.local";
    77:               user = "pi";
    78:             };
    79:             laptop = {
    80:               hostname = "nixos-amd64.local";
    81:               user = "chris";
    82:             };
    83:             s5 = {
    84:               hostname = "s5.local";
    85:               user = "nixos";
    86:             };
    87:           };
    88:         };
    89:         /*
    90:           TODO: Add these?
    91:           https://github.com/nix-community/home-manager/blob/master/modules/programs/mbsync.nix
    92:           https://github.com/nix-community/home-manager/blob/master/modules/programs/msmtp.nix
    93:           https://github.com/nix-community/home-manager/blob/master/modules/programs/mu.nix
    94:         */
    95:       };
    96:       services.emacs.defaultEditor = true;
    97:     }
    98:     (mkIf (cfg.nixpkgs.path != null) {
    99:       home.sessionVariables.NIX_PATH = "nixpkgs=${cfg.nixpkgs.path}";
   100:     })
   101:     (mkIf (cfg.nixpkgs.overlays != null) {
   102:       nixpkgs.overlays = cfg.nixpkgs.overlays (import ../../overlays.nix);
   103:     })
   104:     (mkIf (!cfg.professional) {
   105:       # Disable by setting 'warbo.professional'
   106:       programs.yt-dlp.enable = true;
   107:       #rtorrent.enable = true;
   108:     })
   109:     (mkIf (cfg.direnv && (!cfg.is-nixos)) {
   110:       programs.direnv = {
   111:         enable = true;
   112:         nix-direnv.enable = true;
   113:       };
   114:     })
   115:     (mkIf (cfg.dotfiles != null) {
   116:       programs.bash.bashrcExtra =
   117:         with builtins;
   118:         assert
   119:           (typeOf cfg.dotfiles == "path" && pathExists cfg.dotfiles)
   120:           || (cfg.dotfiles ? outPath);
   121:         ''
   122:           # Always make Nix binaries available. If they're not defined in /etc,
   123:           # then splice pkgs.nix as a fallback.
   124:           [[ -e /etc/profile.d/nix.sh ]] || . ${pkgs.nix}/etc/profile.d/nix.sh
   125:           ${readFile "${cfg.dotfiles}/bashrc"}
   126:         '';
   127:     })
   128:   ]);
   129: }

Generated by git2html.