ops/nixos/lib: add hgrc in a more sensible way
This commit is contained in:
parent
a58ee896ff
commit
d7897ddbe5
3 changed files with 56 additions and 62 deletions
|
@ -3,8 +3,6 @@ let
|
||||||
inherit (lib) mkDefault;
|
inherit (lib) mkDefault;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ./hgrc.nix ];
|
|
||||||
|
|
||||||
hardware.enableRedistributableFirmware = true;
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
|
@ -71,4 +69,8 @@ in
|
||||||
kernel.sysctl."net.ipv4.tcp_congestion_control" = "bbr";
|
kernel.sysctl."net.ipv4.tcp_congestion_control" = "bbr";
|
||||||
kernel.sysctl."net.core.default_qdisc" = "fq_codel";
|
kernel.sysctl."net.core.default_qdisc" = "fq_codel";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
system.activationScripts.lukegb-hgrc = lib.stringAfter [ "users" "groups" ] ''
|
||||||
|
ln -sfn ${./hgrc} /home/lukegb/.hgrc
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
52
ops/nixos/lib/hgrc
Normal file
52
ops/nixos/lib/hgrc
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
[ui]
|
||||||
|
username = Luke Granger-Brown <hg@lukegb.com>
|
||||||
|
interface = curses
|
||||||
|
tweakdefaults = True
|
||||||
|
merge = internal:merge3
|
||||||
|
|
||||||
|
[alias]
|
||||||
|
log = log --template lukegblogshort --graph
|
||||||
|
xl = log -r 'smartlog()'
|
||||||
|
|
||||||
|
[revsetalias]
|
||||||
|
# We're interested in the current commit, and any non-extinct commits in the draft or secret phases.
|
||||||
|
smartlogstart() = . | ((draft() | secret()) - extinct())
|
||||||
|
# Now expand smartlogstart to go up to the parent public commit.
|
||||||
|
publichead(r1) = ancestors(r1) - (descendants(public(), 1) and public())
|
||||||
|
smartlogstart() = (parents(not public()) or not public() or . or head()) and (not obsolete() or unstable()^) and not closed()
|
||||||
|
smartlog() = publichead(smartlogstart())::smartlogstart() | smartlogstart()
|
||||||
|
|
||||||
|
[color]
|
||||||
|
mode = terminfo
|
||||||
|
|
||||||
|
custom.rev = green bold
|
||||||
|
custom.revprefix = green bold inverse
|
||||||
|
custom.author = red
|
||||||
|
custom.currentcommit_message = magenta
|
||||||
|
custom.bookmarks = bold orange
|
||||||
|
custom.topics = bold orange
|
||||||
|
custom.date = lightyellow
|
||||||
|
custom.branch_tip = yellow
|
||||||
|
|
||||||
|
color.orange = 202
|
||||||
|
color.lightyellow = 191
|
||||||
|
|
||||||
|
[templates]
|
||||||
|
lukegblogshort = {separate(' ', label('custom.rev', lukegbnode), label('custom.date', lukegbdate), label('custom.author', lukegbauthor), label('custom.branch_tip', ifcontains(rev, revset(branch), branch, '')), label('custom.bookmarks', bookmarks), label('custom.topics', topics), label(ifcontains(rev, revset('.'), 'custom.currentcommit_message', 'custom.message'), lukegbmsg))}\n
|
||||||
|
lukegbdate = {date|age}
|
||||||
|
lukegbmsg = {desc|firstline}
|
||||||
|
lukegbcopybarain = {sub('^noreply\+([^@]+)@lukegb.com$', 'copybara:\\1', author|email)}
|
||||||
|
lukegbcopybara = {ifcontains(lukegbcopybarain, '@', "", lukegbcopybarain)}
|
||||||
|
lukegbauthor = {ifeq('hg@lukegb.com', author|email, 'lukegb', if(lukegbcopybara, lukegbcopybara, author|email))}
|
||||||
|
lukegbnode = {label('custom.revprefix', lukegbnodesh)}{lukegbnodelng}
|
||||||
|
lukegbnodesh = {node|shortest}
|
||||||
|
lukegbnodelng = {sub('^{lukegbnodesh}', "", '{node|short}')}
|
||||||
|
|
||||||
|
[extensions]
|
||||||
|
histedit =
|
||||||
|
rebase =
|
||||||
|
strip =
|
||||||
|
remotenames =
|
||||||
|
amend =
|
||||||
|
evolve =
|
||||||
|
topic =
|
|
@ -1,60 +0,0 @@
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
hgrcPkg = pkgs.writeText "lukegb-hgrc" ''
|
|
||||||
[ui]
|
|
||||||
username = Luke Granger-Brown <hg@lukegb.com>
|
|
||||||
interface = curses
|
|
||||||
tweakdefaults = True
|
|
||||||
merge = internal:merge3
|
|
||||||
|
|
||||||
[alias]
|
|
||||||
log = log --template lukegblogshort --graph
|
|
||||||
xl = log -r 'smartlog()'
|
|
||||||
|
|
||||||
[revsetalias]
|
|
||||||
# We're interested in the current commit, and any non-extinct commits in the draft or secret phases.
|
|
||||||
smartlogstart() = . | ((draft() | secret()) - extinct())
|
|
||||||
# Now expand smartlogstart to go up to the parent public commit.
|
|
||||||
publichead(r1) = ancestors(r1) - (descendants(public(), 1) and public())
|
|
||||||
smartlogstart() = (parents(not public()) or not public() or . or head()) and (not obsolete() or unstable()^) and not closed()
|
|
||||||
smartlog() = publichead(smartlogstart())::smartlogstart() | smartlogstart()
|
|
||||||
|
|
||||||
[color]
|
|
||||||
mode = terminfo
|
|
||||||
|
|
||||||
custom.rev = green bold
|
|
||||||
custom.revprefix = green bold inverse
|
|
||||||
custom.author = red
|
|
||||||
custom.currentcommit_message = magenta
|
|
||||||
custom.bookmarks = bold orange
|
|
||||||
custom.date = lightyellow
|
|
||||||
|
|
||||||
color.orange = 202
|
|
||||||
color.lightyellow = 191
|
|
||||||
|
|
||||||
[templates]
|
|
||||||
lukegblogshort = {label('custom.rev', lukegbnode)} {label('custom.date', lukegbdate)} {label('custom.author', lukegbauthor)} {label(ifcontains(rev, revset('.'), 'custom.currentcommit_message', 'custom.message'), lukegbmsg)} {label('custom.bookmarks', bookmarks)}\n
|
|
||||||
lukegbdate = {date|age}
|
|
||||||
lukegbmsg = {desc|firstline}
|
|
||||||
lukegbcopybarain = {sub('^noreply\+([^@]+)@lukegb.com$', 'copybara:\\1', author|email)}
|
|
||||||
lukegbcopybara = {ifcontains(lukegbcopybarain, '@', "", lukegbcopybarain)}
|
|
||||||
lukegbauthor = {ifeq('hg@lukegb.com', author|email, 'lukegb', if(lukegbcopybara, lukegbcopybara, author|email))}
|
|
||||||
lukegbnode = {label('custom.revprefix', lukegbnodesh)}{lukegbnodelng}
|
|
||||||
lukegbnodesh = {node|shortest}
|
|
||||||
lukegbnodelng = {sub('^{lukegbnodesh}', "", '{node|short}')}
|
|
||||||
|
|
||||||
[extensions]
|
|
||||||
histedit =
|
|
||||||
rebase =
|
|
||||||
strip =
|
|
||||||
remotenames =
|
|
||||||
amend =
|
|
||||||
evolve =
|
|
||||||
topic =
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
system.activationScripts.lukegb-hgrc = lib.stringAfter [ "users" "groups" ] ''
|
|
||||||
ln -sfn ${hgrcPkg} /home/lukegb/.hgrc
|
|
||||||
'';
|
|
||||||
}
|
|
Loading…
Reference in a new issue