Skip to content

Instantly share code, notes, and snippets.

@ericbmerritt
Created October 13, 2017 23:04
Show Gist options
  • Save ericbmerritt/f2e67b0517390e2fd14bc55330d074af to your computer and use it in GitHub Desktop.
Save ericbmerritt/f2e67b0517390e2fd14bc55330d074af to your computer and use it in GitHub Desktop.
default.nix
with import <nixpkgs> {};
with import <nixhome> { inherit stdenv; inherit pkgs; };
let
toBin = pkg: "${pkg}/bin";
localPkgs = [ tmux
awscli
sbt
jq
moreutils
unzip ];
binDirs = map toBin localPkgs;
emacs = callPackage ./.config/nixpkgs/emacs-config.nix {};
dotfiles = callPackage ./.config/nixpkgs/dotfiles.nix {};
managed-bash = ''
export PATH=${builtins.concatStringsSep ":" binDirs}:$PATH
export GPG_TTY=$(tty)
'';
gpg-agent = ''
[Unit]
Description=GnuPG private key agent
IgnoreOnIsolate=true
ConditionFileIsExecutable=/usr/bin/gpg-agent
[Service]
Type=forking
Environment=SSH_AUTH_SOCK=%h/S.gpg-agent.ssh
ExecStart=/usr/bin/gpg-agent --daemon --homedir=%h/.gnupg --enable-ssh-support --log-file ~/.gnupg/gpg-agent.log --pinentry-program /usr/bin/pinentry --allow-preset-passphrase --allow-emacs-pinentry
ExecStartPost=/usr/bin/systemctl --user set-environment SSH_AUTH_SOCK=$SSH_AUTH_SOCK
ExecStop=/usr/bin/pkill gpg-agent
Restart=on-abort
[Install]
WantedBy=default.target
'';
in mkHome {
user = "eric";
files = {
".tmux.conf" = "${dotfiles}/tmux/tmux.config";
".emacs-store" = "${emacs}/emacs";
".emacsrc" = "${emacs}/emacsrc";
".managed-bash".content = managed-bash;
".config/systemd/user/gpg-agent.service".content = gpg-agent;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment