pub-solar-os/users/nrd.nix

149 lines
3.4 KiB
Nix
Raw Normal View History

2019-12-16 04:22:09 +00:00
{ config, lib, pkgs, ... }:
2019-12-15 07:06:28 +00:00
let
2019-12-15 09:37:45 +00:00
inherit (builtins)
toFile
2019-12-16 04:22:09 +00:00
readFile
2019-12-15 09:37:45 +00:00
;
2019-12-15 07:06:28 +00:00
inherit (lib)
fileContents
2019-12-15 10:07:35 +00:00
mkForce
2019-12-15 07:06:28 +00:00
;
2019-12-15 08:59:33 +00:00
2019-12-15 09:37:45 +00:00
2019-12-15 08:59:33 +00:00
name = "Timothy DeHerrera";
2019-12-16 04:22:09 +00:00
gpgEnableSsh = true;
2019-12-15 07:06:28 +00:00
in
{
imports = [
../profiles/develop
];
2019-12-16 04:22:09 +00:00
environment.shellInit = ''
# gpg
export GPG_TTY="$(tty)"
'' + lib.optionalString gpgEnableSsh
"${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null";
environment.sessionVariables = {
SSH_AUTH_SOCK = "$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)";
};
2019-12-15 08:59:33 +00:00
home-manager.users.nrd = {
2019-12-15 10:07:35 +00:00
home = {
packages = mkForce [];
file = {
".ec2-keys".source = ../secrets/ec2;
2019-12-15 10:10:13 +00:00
".cargo/credentials".source = ../secrets/cargo;
".zshrc".text = "#";
2019-12-15 10:07:35 +00:00
};
};
2019-12-15 08:59:33 +00:00
2019-12-16 07:54:46 +00:00
programs.mpv = {
enable = true;
config = {
ytdl-format = "bestvideo[height<=?1080]+bestaudio/best";
};
};
2019-12-15 08:59:33 +00:00
programs.git = {
enable = true;
aliases = {
a = "add -p";
co = "checkout";
cob = "checkout -b";
f = "fetch -p";
c = "commit";
p = "push";
ba = "branch -a";
bd = "branch -d";
bD = "branch -D";
2019-12-15 10:07:35 +00:00
d = "diff";
2019-12-15 08:59:33 +00:00
dc = "diff --cached";
2019-12-15 09:46:08 +00:00
ds = "diff --staged";
2019-12-15 08:59:33 +00:00
st = "status -sb";
# logging
lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
plog = "log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s'";
tlog = "log --stat --since='1 Day Ago' --graph --pretty=oneline --abbrev-commit --date=relative";
rank = "shortlog -sn --no-merges";
# delete merged branches
bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d";
};
userName = name;
userEmail = "tim.deh@pm.me";
signing = {
key = "8985725DB5B0C122";
signByDefault = true;
};
};
2019-12-15 09:15:12 +00:00
2019-12-15 09:37:45 +00:00
programs.ssh = {
enable = true;
hashKnownHosts = true;
matchBlocks = let
githubKey = toFile "github"
2019-12-16 04:22:09 +00:00
(readFile ../secrets/github);
2019-12-15 09:37:45 +00:00
gitlabKey = toFile "gitlab"
2019-12-16 04:22:09 +00:00
(readFile ../secrets/gitlab);
2019-12-15 09:37:45 +00:00
in
{
github = {
host = "github.com";
identityFile = githubKey;
extraOptions = {
AddKeysToAgent = "yes";
};
};
gitlab = {
host = "gitlab.com";
identityFile = gitlabKey;
extraOptions = {
AddKeysToAgent = "yes";
};
};
"gitlab.company" = {
host = "gitlab.company.com";
identityFile = gitlabKey;
extraOptions = {
AddKeysToAgent = "yes";
};
};
};
};
2019-12-15 10:07:35 +00:00
services.gpg-agent = {
2019-12-15 09:15:12 +00:00
enable = true;
defaultCacheTtl = 1800;
maxCacheTtl = 1800;
defaultCacheTtlSsh = 60480000;
maxCacheTtlSsh = 60480000;
2019-12-16 04:22:09 +00:00
enableSshSupport = gpgEnableSsh;
extraConfig = ''
2019-12-16 05:31:12 +00:00
pinentry-program ${pkgs.pinentry.tty}/bin/pinentry-tty
2019-12-16 04:22:09 +00:00
'';
2019-12-15 09:15:12 +00:00
};
2019-12-15 08:59:33 +00:00
};
2019-12-15 07:06:28 +00:00
users.users.nrd = {
uid = 1000;
2019-12-15 08:59:33 +00:00
description = name;
2019-12-15 07:06:28 +00:00
isNormalUser = true;
hashedPassword = fileContents ../secrets/nrd;
extraGroups = [
"wheel"
"input"
"networkmanager"
"adbusers"
];
};
}