Extract the git configuration to a separate module

This commit is contained in:
Sameer Rahmani 2024-03-10 22:23:19 +00:00
parent 667a1e46cf
commit 18ca5a18ec
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
8 changed files with 212 additions and 82 deletions

View File

@ -30,6 +30,8 @@ rec {
};
git = import ./git;
base = {config, lib, pkgs, inputs, ...}:
let
universePkg = pkgs.callPackage ../derivations/universe.nix {};
@ -96,6 +98,8 @@ rec {
pkgs.man-pages
pkgs.man-pages-posix
pkgs.git
pkgs.emacs-nox
universePkg
];
@ -299,6 +303,8 @@ rec {
yubikey = { config, lib, pkgs, ...}: {
services.pcscd.enable = true;
services.udev.packages = [ pkgs.yubikey-personalization ];
environment.systemPackages = [];
environment.systemPackages = [
pkgs.yubikey-manager
];
};
}

63
modules/git/default.nix Normal file
View File

@ -0,0 +1,63 @@
# Universe - The big bang to my universe
#
# Copyright (c) 2023-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{ user, email, signingKey ? null, extraConfig ? { } }:
{ pkgs, ... }: {
programs.git = {
enable = true;
package = pkgs.gitFull;
userName = user;
userEmail = email;
aliases = {
co = "checkout";
br = "branch";
ci = "commit";
st = "status";
unstage = "reset HEAD --";
last = "log -1 HEAD";
lg =
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
brs =
"for-each-ref --sort='-authordate:iso8601' --count 20 --format=' %(color:green)%(authordate:relative)%09%(if)%(HEAD)%(then)%(color:brightwhite)*%(else)%(color:white) %(end)%(refname:short)%09%(color:yellow)%(authorname)%(authoremail)' refs/heads";
e = "emacsclient";
};
signing = if (signingKey != null) then {
key = signingKey;
signByDefault = true;
} else
null;
difftastic.enable = true;
# delta.enable = true;
extraConfig = {
core = {
abbrev = 12;
excludesFile = "${./gitignore}";
};
pretty = { fixes = ''Fixes: %h ("%s")''; };
url."git@github.com:" = { insteadOf = "https://github.com/"; };
status.submoduleSummary = true;
pull.rebase = false;
http.sslVerify = true;
} // extraConfig;
};
}

View File

@ -1,9 +1,8 @@
age-encryption.org/v1
-> piv-p256 dyb/fQ Avqdv5hXCtCf36j2GZ3cc33PGge6rlPXfgV8Jzs3wNNQ
i4ZVauP3lVD0d0w2PL9tGulq9ryBq+ZAjrioYBaItcQ
-> piv-p256 W09Pcg Aun+RBk45iXtz9m9/J/qYwA5TPWyUPLFw6ynVgYkwO2Z
WlglI7UwGxIPmRWbfWzjr2o+6x0Mct6hco4441jERd4
-> :&ip@+<4-grease aS0g8|, Vwq_IIFC Ha8
bhUPhurHwcEmNy2X7IfI1YIicP0lB3Z0QdBi/RBL2G9WtA
--- ewRzxwdIyXCnqut0t6hEB1qFcUpBQ73YKtPAGQx95Jg
y•Îj}úŘ+FëzAÎ!O4Ść˝S¶H°·`äţ†.kăy”»p ·ńr]@u´$\«*çž’“}Gż45ľ@u%“Ĺ·ÂÜ F”"zĹuŰ˙Âd·;ś<”ž´ĄîŘÂZswĄ
-> ssh-ed25519 t/BLrQ I85XSxrdxWqV6BZnNF/mFYocfhppmG5jmca2Dk1wVQY
7/4YGANVAhfCgrrwq0XRSsW3oq3hYQ0HwF8NOQSgK5c
-> SSxD-grease tn3.C X!8a
84Znp6Sn7iJFEyUink2WuEg7xWNqJxE1yvoa81HKALSCDsUGc68TEhtaxGbI3YS2
6SAy6eGaJ2aY7bwUcE6Nq1reTg49vT+y1faaCw
--- gYVTu1686hdQwvRLnsvTK9pzK3gkZqJgg7m41lXYxx8
%3)=n<>nv }D hÞþô'f"Þùßd¢E—¢wéÃÛÔ<C39B>£Õ&nðÔ:½o  òÔi&xê±ó1ºž²ÄŽs5ùÏŸƒe©‹‘^Ooq(o¿”5ä¥|2VtG`_…á}ús°ê´NX‰>Ub¦%Ù(ÌQ ½&y„žC

View File

@ -17,7 +17,7 @@ let
lxsameer = {
yubikey_1 = "age1yubikey1qvmhny6mv9p8qqdf5m7zuf4h63kqrjcn93p656clzpwagnz207sk7fnrd4h";
yubikey_2 = "age1yubikey1qgay49623m6klvh0a4jy63vrgxduujz2sg2q69u8we3e3jfmpdaaj6vthje";
pub = "age1k7pkmhhkrmukh95xagc92aakegjuyu8m6dreh5uq4g92p07tsslq66g8eu";
pub = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE71YQsIPp2PwuDcvJsp/JiHzB1+GL36vnMd49ktPp9p lxsameer@majin";
};
mary = {
@ -27,6 +27,6 @@ let
};
in
{
"lxsameer/user.age".publicKeys = [ lxsameer.yubikey_1 lxsameer.yubikey_2 ];
"lxsameer/user.age".publicKeys = [ lxsameer.pub ];
"mary/user.age".publicKeys = [ mary.yubikey_1 mary.yubikey_2 ];
}

View File

@ -45,13 +45,14 @@ rec {
age.identityPaths = [
# This is an actual private key, we should avoid
# including it in the store
"/home/lxsameer/.ssh/universe"
# Since these are stubs, its ok to include them in the store
./yubikey_1.stub.id
./yubikey_2.stub.id
# But this is an actual private key, we should avoid
# including it in the store
#"~/.ssh/universe.priv"
];
age.secrets.user.file = ../../secrets/lxsameer/user.age;
@ -61,6 +62,19 @@ rec {
gid = 1000;
};
users.lxsameer1 = {
isNormalUser = true;
shell = pkgs.zsh;
uid = 9000;
group = "lxsameer";
extraGroups = [
"wheel"
"networkmanager"
];
password = "123123";
};
users.lxsameer = {
isNormalUser = true;
shell = pkgs.zsh;
@ -73,12 +87,15 @@ rec {
];
hashedPasswordFile = config.age.secrets.user.path;
#password = "123123";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG3aV2dwnll3KxFR57Oj6Br51c7gJ/pkRa+IkKM6slve lxsameer@lxsameer.com"
];
};
};
nix.settings = {
trusted-users = [ "root" "@wheel" "lxsameer" ];
trusted-users = [ "root" "@wheel" "lxsameer" "lxsameer1" ];
};
};

View File

@ -14,16 +14,33 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{ config, lib, pkgs, ... }@params:
{
let modules = import ../../modules params;
in {
imports = [
(modules.git {
user = "Sameer Rahmani";
email = "lxsameer@gnu.org";
signingKey = "0x8741FACBF412FFA5";
extraConfig = {
sendemail = {
smtpEncryption = "tls";
smtpServer = "fencepost.gnu.org";
smtpUser = "lxsameer";
smtpServerPort = 587;
};
};
})
];
home.username = "lxsameer";
home.homeDirectory = "/home/lxsameer";
# This is a hack to make fg42/home-manager/startx co-operate
home.file.".xinitrc".text = ''
xset b off
xsetroot -solid black &
exec $HOME/.fg42-xsession
xset b off
xsetroot -solid black &
exec $HOME/.fg42-xsession
'';
home.file.".fg42.el".source = ./fg42.el;
@ -71,7 +88,7 @@
# networking tools
mtr # A network diagnostic tool
iperf3 # A TCP, UDP, and SCTP network bandwidth measurement tool
dnsutils # `dig` + `nslookup`
dnsutils # `dig` + `nslookup`
ldns # replacement of `dig`, it provide the command `drill`
aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat
@ -98,7 +115,7 @@
nixfmt
# productivity
btop # replacement of htop/nmon
btop # replacement of htop/nmon
iotop # io monitoring
iftop # network monitoring
@ -127,59 +144,63 @@
yubioath-flutter
yubikey-manager
feh
ticker
ddgr
remmina
];
# basic configuration of git, please change to your own
programs.git = {
enable = true;
package = pkgs.gitFull;
userName = "Sameer Rahmani";
userEmail = "lxsameer@gnu.org";
aliases = {
co = "checkout";
br = "branch";
ci = "commit";
st = "status";
unstage = "reset HEAD --";
last = "log -1 HEAD";
lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
brs = "for-each-ref --sort='-authordate:iso8601' --count 20 --format=' %(color:green)%(authordate:relative)%09%(if)%(HEAD)%(then)%(color:brightwhite)*%(else)%(color:white) %(end)%(refname:short)%09%(color:yellow)%(authorname)%(authoremail)' refs/heads";
e = "emacsclient";
};
signing = {
key = "0x8741FACBF412FFA5";
signByDefault = true;
};
# # basic configuration of git, please change to your own
# programs.git = {
# enable = true;
# package = pkgs.gitFull;
# userName = "Sameer Rahmani";
# userEmail = "lxsameer@gnu.org";
# aliases = {
# co = "checkout";
# br = "branch";
# ci = "commit";
# st = "status";
# unstage = "reset HEAD --";
# last = "log -1 HEAD";
# lg =
# "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
# brs =
# "for-each-ref --sort='-authordate:iso8601' --count 20 --format=' %(color:green)%(authordate:relative)%09%(if)%(HEAD)%(then)%(color:brightwhite)*%(else)%(color:white) %(end)%(refname:short)%09%(color:yellow)%(authorname)%(authoremail)' refs/heads";
# e = "emacsclient";
# };
difftastic.enable = true;
# delta.enable = true;
# signing = {
# key = "0x8741FACBF412FFA5";
# signByDefault = true;
# };
extraConfig = {
core = {
abbrev = 12;
excludesFile = "${./git/gitignore}";
};
# difftastic.enable = true;
# # delta.enable = true;
pretty = {
fixes = "Fixes: %h (\"%s\")";
};
# extraConfig = {
# core = {
# abbrev = 12;
# excludesFile = "${./git/gitignore}";
# };
url."git@github.com:" = {
insteadOf = "https://github.com/";
};
# pretty = { fixes = ''Fixes: %h ("%s")''; };
sendemail = {
smtpEncryption = "tls";
smtpServer = "fencepost.gnu.org";
smtpUser = "lxsameer";
smtpServerPort = 587;
};
# url."git@github.com:" = { insteadOf = "https://github.com/"; };
status.submoduleSummary = true;
pull.rebase = false;
http.sslVerify = true;
};
};
# sendemail = {
# smtpEncryption = "tls";
# smtpServer = "fencepost.gnu.org";
# smtpUser = "lxsameer";
# smtpServerPort = 587;
# };
# status.submoduleSummary = true;
# pull.rebase = false;
# http.sslVerify = true;
# };
# };
# starship - an customizable prompt for any shell
programs.starship = {
@ -187,9 +208,37 @@
# custom settings
settings = {
add_newline = true;
aws.disabled = true;
gcloud.disabled = true;
line_break.disabled = true;
line_break.disabled = false;
username.show_always = true;
directory.truncate_to_repo = false;
fill.symbol = "-";
fill.style = "gray";
git_branch.format = " [$symbol$branch(:$remote_branch)]($style) ";
git_commit.only_detached = false;
format = lib.concatStrings [
"$line_break"
"$hostname"
"$directory"
"$direnv"
"$c"
"$cmake"
"$package"
"$fill"
"$git_state"
"$git_branch"
"$git_commit"
"$git_status"
"$line_break"
"$cmd_duration"
"$character"
];
};
};
@ -198,9 +247,7 @@
# custom settings
settings = {
env.TERM = "xterm-256color";
font = {
size = lib.mkDefault 10;
};
font = { size = lib.mkDefault 10; };
scrolling.multiplier = 5;
selection.save_to_clipboard = true;
};
@ -231,7 +278,10 @@
F = "find . -iname";
f = "fd";
_ = "sudo";
rebuild = "sudo nixos-rebuild switch --flake '/home/lxsameer/src/Universe#majin'";
rebuild =
"sudo nixos-rebuild switch --flake '/home/lxsameer/src/Universe#majin'";
sus = "systemctl suspend";
"..." = "../..";
"...." = "../../..";
"....." = "../../../..";
@ -295,7 +345,6 @@
enableZshIntegration = true;
};
systemd.user.sessionVariables.TMUX_FZF_LAUNCH_KEY = "Tab";
programs.tmux = {
@ -305,10 +354,7 @@
keyMode = "emacs";
prefix = "M-Space";
baseIndex = 1;
plugins = (with pkgs.tmuxPlugins; [
jump
tmux-fzf
]);
plugins = (with pkgs.tmuxPlugins; [ jump tmux-fzf ]);
extraConfig = ''
unbind C-b
@ -347,7 +393,6 @@
# changes in each release.
home.stateVersion = "24.05";
home.sessionVariables.XMODIFIERS = "@im=exim";
home.sessionVariables.GTK_IM_MODULE = "xim";
home.sessionVariables.QT_IM_MODULE = "xim";
@ -377,9 +422,7 @@
iconTheme.name = "Adwaita";
};
qt = {
platformTheme = "gtk";
};
qt = { platformTheme = "gtk"; };
services.pass-secret-service = {
enable = true;

View File

@ -44,6 +44,8 @@ let
192.168.0.122 mc
192.168.0.202 mary
'';
fileSystems."/home".neededForBoot = true;
};
lxsameer = pkgs.callPackage ../users/lxsameer/default.nix {};