Moved git and shell config into separate modules

This commit is contained in:
Emmet 2023-05-13 15:19:11 -05:00
parent 1eee403e6c
commit 227070ac48
4 changed files with 60 additions and 60 deletions

View file

@ -12,6 +12,9 @@
outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, ... }:
let
system = "x86_64-linux";
name = "emmet";
email = "librephoenix@protonmail.com";
dotfilesDir = ./.;
pkgs = import nixpkgs {
inherit system;
@ -29,6 +32,14 @@
nix-doom-emacs.hmModule
stylix.homeManagerModules.stylix
];
extraSpecialArgs = {
myName = name;
myHomeDir = /. + "home/"+name;
myEmail = email;
myDotfilesDir = dotfilesDir;
myNixConfigurationFilePath = dotfilesDir+"/system/configuration.nix";
myHomeManagerFilePath = dotfilesDir+"/user/home.nix";
};
};
};
nixosConfigurations = {

10
user/app/git/git.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, myName, myEmail, ... }:
{
programs.git.enable = true;
programs.git.userName = myName;
programs.git.userEmail = myEmail;
programs.git.extraConfig = {
init.defaultBranch = "main";
};
}

View file

@ -1,24 +1,8 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, myName, myEmail, myHomeDir, myDotfilesDir, ... }:
let
myName = "emmet";
myDotfilesDir = "~/dotfiles/";
# My shell aliases
myAliases = {
ls = "exa --icons -l -T -L=1";
cat = "bat";
htop = "btm";
fd = "fd -Lu";
w3m = "w3m -no-cookie -v";
};
# Variables for my nix configuration paths
myNixConfigurationFilePath = "$HOME/dotfiles/system/configuration.nix";
myHomeManagerFilePath = "$HOME/dotfiles/user/home.nix";
# This sets up my "phoenix" script with my configuration paths
# =phoenix= is just my wrapper script for easier access to nix/nixos commands
myPhoenixScript = ''
if [ "$1" = "sync" ]; then
if [ "$2" != "user" ]; then
@ -39,27 +23,21 @@ let
'';
in
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = myName;
home.homeDirectory = "/home/emmet";
home.homeDirectory = myHomeDir;
programs.home-manager.enable = true;
imports = [
./wm/xmonad/xmonad.nix
./style/stylix.nix
./wm/xmonad/xmonad.nix # My xmonad config
./shell/sh.nix # My zsh and bash config
./app/git/git.nix # My git config
./style/stylix.nix # Styling and themes for my apps
];
programs.git.enable = true;
programs.git.userName = myName;
programs.git.userEmail = "librephoenix@protonmail.com";
programs.git.extraConfig = {
init.defaultBranch = "main";
};
home.stateVersion = "22.11"; # Please read the comment before changing.
home.packages = with pkgs; [
@ -291,39 +269,8 @@ in
# Filesystems
dosfstools
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
shellAliases = myAliases;
oh-my-zsh = {
enable = true;
plugins = [ "git" ];
theme = "agnoster";
};
};
programs.bash = {
enable = true;
enableCompletion = true;
shellAliases = myAliases;
};
programs.doom-emacs = {
enable = true;
doomPrivateDir = ./app/doom-emacs;

32
user/shell/sh.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, pkgs, ... }:
let
# My shell aliases
myAliases = {
ls = "exa --icons -l -T -L=1";
cat = "bat";
htop = "btm";
fd = "fd -Lu";
w3m = "w3m -no-cookie -v";
};
in
{
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
shellAliases = myAliases;
oh-my-zsh = {
enable = true;
plugins = [ "git" ];
theme = "agnoster";
};
};
programs.bash = {
enable = true;
enableCompletion = true;
shellAliases = myAliases;
};
}