Nix

This sets up my local nix workflow. It uses home manager.

{ config, pkgs, ... }:

{
  # Home Manager needs a bit of information about you and the paths it should
  # manage.
  home.username = "abrahms";
  home.homeDirectory = "/home/abrahms";
  xdg.dataHome = "/home/abrahms/.local/share/";
  nixpkgs.config.allowUnfree = true;

  # This value determines the Home Manager release that your configuration is
  # compatible with. This helps avoid breakage when a new Home Manager release
  # introduces backwards incompatible changes.
  #
  # You should not change this value, even if you update Home Manager. If you do
  # want to update the value, then make sure to first check the Home Manager
  # release notes.
  home.stateVersion = "23.05"; # Please read the comment before changing.

  # The home.packages option allows you to install Nix packages into your
  # environment.
  home.packages = [
    # backups
    pkgs.dropbox
    pkgs.maestral
    pkgs.duplicacy

    # desktop apps
    pkgs.discord
    pkgs.firefox
    pkgs.slack
    pkgs.signal-desktop
    pkgs.spotify
    pkgs.remmina # remote desktop
    pkgs.element-desktop # matrix client
    pkgs.gimp # image editing
    pkgs.obs-studio # screen recording
    pkgs.skypeforlinux # phone calls
    pkgs.zotero # knowledge base
    pkgs.calibre # ebook software
    pkgs.zoom-us # video conferencing
    pkgs.libreoffice-fresh # office suite like spreadsheets

    # unix utils
    pkgs.xclip # pipe to clipboard
    pkgs.zsh
    pkgs.htop
    pkgs.pinentry-gtk2
    pkgs.ripgrep # faster grep
    pkgs.bat # nicer cat
    pkgs.git
    pkgs.delta # pretty, side-by-side diffs
    pkgs.scrot # screenshots
    pkgs.gnupg
    pkgs.pinentry-gtk2 # enter pin for gnupg
    pkgs.gh # github cli (makes issue creation easier)
    pkgs.dogdns # nicer dig output
    pkgs.fx # explore json
    pkgs.tmux # terminal multiplexer

    pkgs.isync # download email locally via mbsync
    pkgs.mu # mail indexing
    pkgs.imapfilter # mail sorting


    # prog lang
    pkgs.go
    pkgs.languagetool
    pkgs.rustup
    pkgs.gcc # tried to keep it in the relevant project, but somehow $CC gets changed which causes lots of recompilation in rust.

    # graphics
    pkgs.graphviz
    pkgs.texlive.combined.scheme-full
    pkgs.pandoc

    pkgs.libvterm
    pkgs.emacsPackages.jinx
    pkgs.aspellDicts.en # And the dictionaries for jinx
    pkgs.aspellDicts.en-computers
    pkgs.aspellDicts.en-science
    pkgs.profont

    # maybe
    pkgs.nodePackages.mermaid-cli
    pkgs.haskellPackages.markdown
    pkgs.emacsPackages.vterm
    pkgs.plantuml
    pkgs.nodePackages.typescript-language-server
    pkgs.nodePackages.javascript-typescript-langserver
    pkgs.nodePackages.yaml-language-server
    pkgs.nodePackages.typescript
    pkgs.gopls
    pkgs.gocode
    pkgs.golint
    pkgs.gotools
    pkgs.godef
    pkgs.proselint
    pkgs.hub
    pkgs.shellcheck
    pkgs.sourceHighlight

    # fonts
    pkgs.unifont
    pkgs.inconsolata-nerdfont
    pkgs.terminus-nerdfont
    pkgs.vollkorn
    pkgs.cascadia-code
    pkgs.anonymousPro
    pkgs.hack-font
    pkgs.profont
    pkgs.nerdfonts

    # TODO:
    # dkjson
    # mu4e
    # gpg
    # docker
    # pip
    # imapfilter, isync
    (pkgs.emacsWithPackagesFromUsePackage {
      config = "~/src/justin.abrah.ms/blog/_post/dotfiles/emacs.org";
      package = pkgs.emacs-unstable;
      alwaysEnsure = true;
      alwaysTangle = true;
      extraEmacsPackages = epkgs: [
	pkgs.rustc
      ];
    })
  ];


  systemd.user.services.maestral = {
    Unit.Description = "Maestral daemon";
    Install.WantedBy = ["default.target"];
    Service = {
      ExecStart = "${pkgs.maestral}/bin/maestral start -f";
      ExecStop = "${pkgs.maestral}/bin/maestral stop";
      Restart = "on-failure";
      Nice = 10;
    };
  };

  # Home Manager is pretty good at managing dotfiles. The primary way to manage
  # plain files is through 'home.file'.
  home.file = {
    # # Building this configuration will create a copy of 'dotfiles/screenrc' in
    # # the Nix store. Activating the configuration will then make '~/.screenrc' a
    # # symlink to the Nix store copy.
    # ".screenrc".source = dotfiles/screenrc;

    # # You can also set the file content immediately.
    # ".gradle/gradle.properties".text = ''
    #   org.gradle.console=verbose
    #   org.gradle.daemon.idletimeout=3600000
    # '';
  };

  # You can also manage environment variables but you will have to manually
  # source
  #
  #  ~/.nix-profile/etc/profile.d/hm-session-vars.sh
  #
  # or
  #
  #  /etc/profiles/per-user/abrahms/etc/profile.d/hm-session-vars.sh
  #
  # if you don't want to manage your shell through Home Manager.
  home.sessionVariables = {
    EDITOR = "emacs";
  };

  nixpkgs.config.permittedInsecurePackages = [
    "zotero-6.0.26"
  ];

  programs = {
    autojump.enable = true;
    # Let Home Manager install and manage itself.
    home-manager.enable = true;

    direnv.enable = true;
    direnv.nix-direnv.enable = true;
    bash = {
      enable = true;
      enableVteIntegration = true;
      bashrcExtra = ''
. ~/.shell/aliases
. ~/.shell/completions
. ~/.shell/functions
. ~/.shell/variables
[ -f ~/.shell/host_specific ] &&   . ~/.shell/host_specific
'';
      shellAliases = {
	cd = "pushd";
      };
    };
    zsh = {
      enable = true;
      defaultKeymap = "emacs";
      autocd = true;
      enableAutosuggestions = true;
      initExtraFirst = ''setopt inc_append_history autocd nomatch autopushd pushdignoredups promptsubst hist_ignore_dups
unsetopt beep
	 . ~/.shell/aliases
	 '';
      prezto = {
	# https://github.com/nix-community/home-manager/blob/master/modules/programs/zsh/prezto.nix
	enable = true;
	prompt = {
	  theme = "agnoster";
	  pwdLength = "long";
	  showReturnVal = true;
	};
      };
    };
  };

  nixpkgs.overlays = [
    (import (builtins.fetchTarball {
      url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
    }))
  ];
}

I'd like to enable nix search as a convenience function, which requires enabling experimental features.

experimental-features = nix-command flakes
© 2012 - 2023 · Home — Theme Simpleness