mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-06 02:40:14 +00:00
refactor arguments to options
also change theme to colorscheme
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
{ pkgs, identity, ... }: {
|
||||
{ config, pkgs, ... }: {
|
||||
|
||||
users.users.${identity.user}.shell = pkgs.fish;
|
||||
users.users.${config.user}.shell = pkgs.fish;
|
||||
|
||||
home-manager.users.${identity.user} = {
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
home.packages = with pkgs; [ exa fd bat ripgrep ];
|
||||
|
||||
|
@ -1,117 +1,132 @@
|
||||
{ config, pkgs, lib, identity, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let home-packages = config.home-manager.users.${identity.user}.home.packages;
|
||||
let home-packages = config.home-manager.users.${config.user}.home.packages;
|
||||
|
||||
in {
|
||||
|
||||
home-manager.users.root.programs.git = {
|
||||
enable = true;
|
||||
extraConfig.safe.directory = "/home/${identity.user}/dev/personal/dotfiles";
|
||||
options = {
|
||||
fullName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Human readable name of the user";
|
||||
};
|
||||
gitEmail = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Email to use for git commits";
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${identity.user} = {
|
||||
programs.git = {
|
||||
config = {
|
||||
|
||||
home-manager.users.root.programs.git = {
|
||||
enable = true;
|
||||
userName = identity.name;
|
||||
userEmail = identity.gitEmail;
|
||||
extraConfig = {
|
||||
pager = { branch = "false"; };
|
||||
safe = { directory = "/home/${identity.user}/dev/personal/dotfiles"; };
|
||||
pull = { ff = "only"; };
|
||||
};
|
||||
extraConfig.safe.directory = "/home/${config.user}/dev/personal/dotfiles";
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
g = "git";
|
||||
gs = "git status";
|
||||
gd = "git diff";
|
||||
gds = "git diff --staged";
|
||||
gdp = "git diff HEAD^";
|
||||
ga = "git add";
|
||||
gaa = "git add -A";
|
||||
gac = "git commit -am";
|
||||
gc = "git commit -m";
|
||||
gca = "git commit --amend --no-edit";
|
||||
gcae = "git commit --amend";
|
||||
gu = "git pull";
|
||||
gp = "git push";
|
||||
gpp = "git-push-upstream";
|
||||
gl = "git log --graph --decorate --oneline -20";
|
||||
gll = "git log --graph --decorate --oneline";
|
||||
gco = "git checkout";
|
||||
gcom = "git switch master";
|
||||
gcob = "git switch -c";
|
||||
gb = "git branch";
|
||||
gbd = "git branch -d";
|
||||
gbD = "git branch -D";
|
||||
gr = "git reset";
|
||||
grh = "git reset --hard";
|
||||
gm = "git merge";
|
||||
gcp = "git cherry-pick";
|
||||
cdg = "cd (git rev-parse --show-toplevel)";
|
||||
};
|
||||
|
||||
programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages
|
||||
&& builtins.elem pkgs.bat home-packages) {
|
||||
git = {
|
||||
body = builtins.readFile ../../fish.configlink/functions/git.fish;
|
||||
};
|
||||
git-add-fuzzy = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-add-fuzzy.fish;
|
||||
};
|
||||
git-fuzzy-branch = {
|
||||
argumentNames = "header";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-fuzzy-branch.fish;
|
||||
};
|
||||
git-checkout-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
'';
|
||||
};
|
||||
git-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
'';
|
||||
};
|
||||
git-force-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
'';
|
||||
};
|
||||
git-merge-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
'';
|
||||
};
|
||||
git-show-fuzzy = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-show-fuzzy.fish;
|
||||
};
|
||||
git-commits = {
|
||||
body =
|
||||
builtins.readFile ../../fish.configlink/functions/git-commits.fish;
|
||||
};
|
||||
git-history = {
|
||||
body =
|
||||
builtins.readFile ../../fish.configlink/functions/git-history.fish;
|
||||
};
|
||||
git-push-upstream = {
|
||||
description = "Create upstream branch";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-push-upstream.fish;
|
||||
};
|
||||
uncommitted = {
|
||||
description = "Find uncommitted git repos";
|
||||
body =
|
||||
builtins.readFile ../../fish.configlink/functions/uncommitted.fish;
|
||||
home-manager.users.${config.user} = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = config.fullName;
|
||||
userEmail = config.gitEmail;
|
||||
extraConfig = {
|
||||
pager = { branch = "false"; };
|
||||
safe = { directory = "/home/${config.user}/dev/personal/dotfiles"; };
|
||||
pull = { ff = "only"; };
|
||||
};
|
||||
};
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
g = "git";
|
||||
gs = "git status";
|
||||
gd = "git diff";
|
||||
gds = "git diff --staged";
|
||||
gdp = "git diff HEAD^";
|
||||
ga = "git add";
|
||||
gaa = "git add -A";
|
||||
gac = "git commit -am";
|
||||
gc = "git commit -m";
|
||||
gca = "git commit --amend --no-edit";
|
||||
gcae = "git commit --amend";
|
||||
gu = "git pull";
|
||||
gp = "git push";
|
||||
gpp = "git-push-upstream";
|
||||
gl = "git log --graph --decorate --oneline -20";
|
||||
gll = "git log --graph --decorate --oneline";
|
||||
gco = "git checkout";
|
||||
gcom = "git switch master";
|
||||
gcob = "git switch -c";
|
||||
gb = "git branch";
|
||||
gbd = "git branch -d";
|
||||
gbD = "git branch -D";
|
||||
gr = "git reset";
|
||||
grh = "git reset --hard";
|
||||
gm = "git merge";
|
||||
gcp = "git cherry-pick";
|
||||
cdg = "cd (git rev-parse --show-toplevel)";
|
||||
};
|
||||
|
||||
programs.fish.functions = lib.mkIf (builtins.elem pkgs.fzf home-packages
|
||||
&& builtins.elem pkgs.bat home-packages) {
|
||||
git = {
|
||||
body = builtins.readFile ../../fish.configlink/functions/git.fish;
|
||||
};
|
||||
git-add-fuzzy = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-add-fuzzy.fish;
|
||||
};
|
||||
git-fuzzy-branch = {
|
||||
argumentNames = "header";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-fuzzy-branch.fish;
|
||||
};
|
||||
git-checkout-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
'';
|
||||
};
|
||||
git-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
'';
|
||||
};
|
||||
git-force-delete-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
'';
|
||||
};
|
||||
git-merge-fuzzy = {
|
||||
body = ''
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
'';
|
||||
};
|
||||
git-show-fuzzy = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-show-fuzzy.fish;
|
||||
};
|
||||
git-commits = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-commits.fish;
|
||||
};
|
||||
git-history = {
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-history.fish;
|
||||
};
|
||||
git-push-upstream = {
|
||||
description = "Create upstream branch";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/git-push-upstream.fish;
|
||||
};
|
||||
uncommitted = {
|
||||
description = "Find uncommitted git repos";
|
||||
body = builtins.readFile
|
||||
../../fish.configlink/functions/uncommitted.fish;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,34 +1,36 @@
|
||||
{ pkgs, identity, ... }: {
|
||||
{ config, pkgs, lib, ... }: {
|
||||
|
||||
imports = [ ./git.nix ];
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
home-manager.users.${identity.user} = {
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
enableGitCredentialHelper = true;
|
||||
settings.git_protocol = "https";
|
||||
};
|
||||
|
||||
programs.fish = {
|
||||
shellAbbrs = {
|
||||
ghr = "gh repo view -w";
|
||||
gha =
|
||||
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
|
||||
grw = "gh run watch";
|
||||
grf = "gh run view --log-failed";
|
||||
grl = "gh run view --log";
|
||||
programs.gh =
|
||||
lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
|
||||
enable = true;
|
||||
enableGitCredentialHelper = true;
|
||||
settings.git_protocol = "https";
|
||||
};
|
||||
functions = {
|
||||
repos = {
|
||||
description = "Clone GitHub repositories";
|
||||
argumentNames = "organization";
|
||||
body = ''
|
||||
set directory (gh-repos $organization)
|
||||
and cd $directory
|
||||
'';
|
||||
|
||||
programs.fish =
|
||||
lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
|
||||
shellAbbrs = {
|
||||
ghr = "gh repo view -w";
|
||||
gha =
|
||||
"gh run list | head -1 | awk '{ print $(NF-2) }' | xargs gh run view";
|
||||
grw = "gh run watch";
|
||||
grf = "gh run view --log-failed";
|
||||
grl = "gh run view --log";
|
||||
};
|
||||
functions = {
|
||||
repos = {
|
||||
description = "Clone GitHub repositories";
|
||||
argumentNames = "organization";
|
||||
body = ''
|
||||
set directory (gh-repos $organization)
|
||||
and cd $directory
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ pkgs, identity, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
@ -13,7 +13,7 @@ let
|
||||
|
||||
in {
|
||||
|
||||
home-manager.users.${identity.user} = {
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
home.packages = with pkgs; [
|
||||
unzip # Extract zips
|
||||
|
Reference in New Issue
Block a user