Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Aug 9, 2023
1 parent 01f9c1d commit 5817fe7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 4 deletions.
19 changes: 18 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
rec {
devShells.default = with pkgs;
mkShell {
buildInputs = [
Expand All @@ -36,6 +36,23 @@
jq
];
};

# https://gist.github.com/Scoder12/0538252ed4b82d65e59115075369d34d?permalink_comment_id=4650816#gistcomment-4650816
packages.json2nix = pkgs.writeScriptBin "json2nix" ''
${pkgs.python3}/bin/python ${pkgs.fetchurl {
url = "https://gist.githubusercontent.com/Scoder12/0538252ed4b82d65e59115075369d34d/raw/e86d1d64d1373a497118beb1259dab149cea951d/json2nix.py";
hash = "sha256-ROUIrOrY9Mp1F3m+bVaT+m8ASh2Bgz8VrPyyrQf9UNQ=";
}} $@
'';

apps = {
# nix run .#json2nix
json2nix = {
type = "app";
program = "${packages.json2nix}/bin/json2nix";
};
};
}
);
}

56 changes: 53 additions & 3 deletions home-manager/git.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
{ ... }:
{ config, ... }:

# https://github.com/nix-community/home-manager/blob/master/modules/programs/lazygit.nix
{
xdg.configFile."git/config".source = ../home/.config/git/config;
# https://github.com/nix-community/home-manager/blob/master/modules/programs/git.nix
# xdg will be used in home-manager: https://github.com/nix-community/home-manager/blob/7b8d43fbaf8450c30caaed5eab876897d0af891b/modules/programs/git.nix#L417-L418
programs.git = {
enable = true;

extraConfig = {
user = {
email = "[email protected]";
name = "Kenichi Kamiya";
# TODO: Share code to get the path with ./ssh.nix
signingkey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub";
};

core = {
editor = "vim";
quotepath = false;
};
init = {
defaultBranch = "main";
};
color = {
ui = true;
};
grep = {
lineNumber = true;
};
pull = {
ff = "only";
};
alias = {
fixup = "commit --all --amend";
empty = "commit --allow-empty -m 'Add an empty commit'";
current = "symbolic-ref --short HEAD";
"switch-default" = "!git checkout main 2>/dev/null || git checkout master 2>/dev/null";
upstream = "!git remote | grep -E '^upstream$'|| git remote | grep -E '^origin$'";
duster = "remote update origin --prune";
refresh = "!git switch-default && git pull \"$(git upstream)\" \"$(git current)\"";
all = "!git refresh && gh poi";
gui = "!lazygit";
};
gpg = {
format = "ssh";
};
"credential \"https-github.com\"" = {
helper = "!gh auth git-credential";
};
"credential \"https-gist.github.com\"" = {
helper = "!gh auth git-credential";
};
};
};

# https://github.com/nix-community/home-manager/blob/master/modules/programs/lazygit.nix
programs.lazygit = {
enable = true;

Expand Down

0 comments on commit 5817fe7

Please sign in to comment.