refactor arguments to options

also change theme to colorscheme
This commit is contained in:
Noah Masur 2022-05-05 23:01:56 -04:00
parent 531c78ebe0
commit 417623965e
33 changed files with 415 additions and 347 deletions

View File

@ -12,38 +12,35 @@
outputs = { self, nixpkgs, home-manager }:
let
identity = {
globals = {
user = "noah";
name = "Noah Masur";
hostname = "nixos";
fullName = "Noah Masur";
passwordHash =
"$6$J15o3OLElCEncVB3$0FW.R7YFBMgtBp320kkZO.TdKvYDLHmnP6dgktdrVYCC3LUvzXj0Fj0elR/fXo9geYwwWi.EAHflCngL5T.3g/";
gitEmail = "7386960+nmasur@users.noreply.github.com";
};
gui = {
enable = false;
font = {
package = "victor-mono";
name = "Victor Mono";
gui = {
colorscheme = (import ./modules/colorscheme/gruvbox);
wallpaper = ./modules/theme/gruvbox/gray-forest.jpg;
gtkTheme = "Adwaita-dark";
};
theme = "gruvbox";
gtkTheme = "Adwaita-dark";
};
in {
nixosConfigurations = {
desktop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
gui = gui // { enable = true; };
inherit identity;
};
specialArgs = { };
modules = [
globals
{
networking.hostName = "desktop";
gui.enable = true;
}
home-manager.nixosModules.home-manager
{ networking.hostName = "desktop"; }
./hosts/desktop/hardware-configuration.nix
./modules/common.nix
./modules/desktop
./modules/theme
./modules/hardware
./modules/system
./modules/desktop
./modules/shell
./modules/gaming
./modules/services/keybase.nix

View File

@ -1,8 +1,8 @@
{ pkgs, lib, gui, identity, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
nixpkgs.config.allowUnfree = true;
home-manager.users.${identity.user} = {
home-manager.users.${config.user} = {
home.packages = with pkgs; [ _1password-gui ];
};
};

View File

@ -1,6 +1,6 @@
{ config, pkgs, identity, gui, ... }: {
{ config, pkgs, ... }: {
home-manager.users.${identity.user} = {
home-manager.users.${config.user} = {
xsession.windowManager.i3.config.terminal = "alacritty";
programs.alacritty = {
enable = true;
@ -14,12 +14,15 @@
x = 20;
y = 20;
};
opacity = config.theme.opacity;
opacity = 1.0;
};
scrolling.history = 10000;
font = {
size = 14.0;
normal = { family = gui.font.name; };
normal = {
family =
builtins.head config.fonts.fontconfig.defaultFonts.monospace;
};
};
key_bindings = [
{
@ -39,37 +42,36 @@
action = "ToggleViMode";
}
];
colors = config.theme.colors;
# colors = {
# primary = {
# background = "#282828";
# foreground = "#d5c4a1";
# };
# cursor = {
# text = "#1d2021";
# cursor = "#d5c4a1";
# };
# normal = {
# black = "#1d2021";
# red = "#fb4934";
# green = "#b8bb26";
# yellow = "#fabd2f";
# blue = "#83a598";
# magenta = "#d3869b";
# cyan = "#8ec07c";
# white = "#d5c4a1";
# };
# bright = {
# black = "#665c54";
# red = "#fe8019";
# green = "#3c3836";
# yellow = "#504945";
# blue = "#bdae93";
# magenta = "#ebdbb2";
# cyan = "#d65d0e";
# white = "#fbf1c7";
# };
# };
colors = {
primary = {
background = config.gui.colorscheme.base00;
foreground = config.gui.colorscheme.base05;
};
cursor = {
text = "#1d2021";
cursor = config.gui.colorscheme.base05;
};
normal = {
black = "#1d2021";
red = config.gui.colorscheme.base08;
green = config.gui.colorscheme.base0B;
yellow = config.gui.colorscheme.base0A;
blue = config.gui.colorscheme.base0D;
magenta = config.gui.colorscheme.base0E;
cyan = config.gui.colorscheme.base0C;
white = config.gui.colorscheme.base05;
};
bright = {
black = config.gui.colorscheme.base03;
red = config.gui.colorscheme.base09;
green = config.gui.colorscheme.base01;
yellow = config.gui.colorscheme.base02;
blue = config.gui.colorscheme.base04;
magenta = config.gui.colorscheme.base06;
cyan = config.gui.colorscheme.base0F;
white = config.gui.colorscheme.base07;
};
};
draw_bold_text_with_bright_colors = false;
};
};

View File

@ -1,7 +1,7 @@
{ pkgs, lib, identity, gui, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
home-manager.users.${identity.user} = {
config = lib.mkIf config.gui.enable {
home-manager.users.${config.user} = {
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [ discord ];
};

View File

@ -1,12 +1,12 @@
{ pkgs, lib, identity, gui, ... }:
{ config, pkgs, lib, ... }:
{
config = lib.mkIf gui.enable {
home-manager.users.${identity.user} = {
config = lib.mkIf config.gui.enable {
home-manager.users.${config.user} = {
home.packages = [ pkgs.firefox ];
gtk = {
enable = true;
theme = { name = gui.gtkTheme; };
theme = { name = config.gui.gtkTheme; };
};
};

View File

@ -1,7 +1,7 @@
{ pkgs, lib, gui, identity, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
home-manager.users.${identity.user}.home.packages = with pkgs; [
config = lib.mkIf config.gui.enable {
home-manager.users.${config.user}.home.packages = with pkgs; [
mpv # Video viewer
sxiv # Image viewer
zathura # PDF viewer

View File

@ -1,8 +1,8 @@
{ config, pkgs, lib, gui, identity, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
home-manager.users.${identity.user} = {
home-manager.users.${config.user} = {
home.packages = with pkgs; [ qbittorrent ];

View File

@ -0,0 +1,21 @@
{
name = "gruvbox"; # Dark, Medium
author =
"Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)";
base00 = "#282828"; # ----
base01 = "#3c3836"; # ---
base02 = "#504945"; # --
base03 = "#665c54"; # -
base04 = "#bdae93"; # +
base05 = "#d5c4a1"; # ++
base06 = "#ebdbb2"; # +++
base07 = "#fbf1c7"; # ++++
base08 = "#fb4934"; # red
base09 = "#fe8019"; # orange
base0A = "#fabd2f"; # yellow
base0B = "#b8bb26"; # green
base0C = "#8ec07c"; # aqua/cyan
base0D = "#83a598"; # blue
base0E = "#d3869b"; # purple
base0F = "#d65d0e"; # brown
}

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ config, lib, pkgs, ... }: {
nix.extraOptions = "experimental-features = nix-command flakes";

View File

@ -10,11 +10,35 @@
./rofi.nix
];
options = {
launcherCommand = lib.mkOption {
type = lib.types.str;
description = "Command to use for launching";
options = with lib; {
gui = {
enable = mkEnableOption {
description = "Enable graphics";
default = false;
};
compositor.enable = mkEnableOption {
description = "Enable transparency, blur, shadows";
default = false;
};
launcherCommand = mkOption {
type = types.str;
description = "Command to use for launching";
};
gtkTheme = mkOption {
type = types.str;
description = "Theme for GTK applications";
};
colorscheme = mkOption {
type = types.attrs;
description = "Base16 color scheme";
};
wallpaper = mkOption {
type = types.path;
description = "Wallpaper background image file";
};
};
};
}

View File

@ -1,11 +1,11 @@
{ config, pkgs, lib, identity, ... }:
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user}.home.packages = [ pkgs.dmenu ];
launcherCommand = "${pkgs.dmenu}/bin/dmenu_run";
home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ];
gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run";
};

View File

@ -1,13 +1,12 @@
{ pkgs, lib, gui, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
fonts.fonts = with pkgs;
[
pkgs."${gui.font.package}" # Used for Vim and Terminal
# siji # More icons for Polybar
pkgs.victor-mono # Used for Vim and Terminal
];
fonts.fontconfig.defaultFonts.monospace = [ gui.font.name ];
fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ];
};

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, identity, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf config.services.xserver.enable {
@ -15,7 +15,7 @@
playerctl # Media control
];
home-manager.users.${identity.user}.xsession.windowManager.i3 = {
home-manager.users.${config.user}.xsession.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
config = let
@ -40,19 +40,16 @@
};
bars = [{ command = "echo"; }]; # Disable i3bar
colors = let
background = "#2f343f";
inactiveBackground = "#2f343f";
border = "#2f343f";
inactiveBorder = "#2f343f";
# border = "#F0C674";
# inactiveBorder = "#E2B860";
text = "#f3f4f5";
inactiveText = "#676E7D";
urgentBackground = "#E53935";
# indicator = "#00ff00";
background = config.gui.colorscheme.base00;
inactiveBackground = config.gui.colorscheme.base01;
border = config.gui.colorscheme.base01;
inactiveBorder = config.gui.colorscheme.base01;
text = config.gui.colorscheme.base07;
inactiveText = config.gui.colorscheme.base04;
urgentBackground = config.gui.colorscheme.base08;
indicator = "#00000000";
in {
background = background;
background = config.gui.colorscheme.base00;
focused = {
inherit background indicator text border;
childBorder = background;
@ -117,12 +114,13 @@
# Launchers
"${modifier}+Return" = "exec alacritty";
"${modifier}+space" =
"exec --no-startup-id ${config.launcherCommand}";
"exec --no-startup-id ${config.gui.launcherCommand}";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = ''
exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = ''exec i3lock --color "#2f343f"'';
"${modifier}+Shift+x" =
''exec i3lock --color "${config.gui.colorscheme.base00}"'';
"${modifier}+Shift+t" = "exec alacritty";
# Window options
@ -202,8 +200,7 @@
};
startup = [
{
command =
"feh --bg-fill ${builtins.toString config.theme.wallpaper}";
command = "feh --bg-fill ${builtins.toString config.gui.wallpaper}";
always = true;
notification = false;
}

View File

@ -1,48 +1,49 @@
{ config, lib, identity, ... }: {
{ config, lib, ... }: {
config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user} = {
config =
lib.mkIf (config.services.xserver.enable && config.gui.compositor.enable) {
home-manager.users.${config.user} = {
services.picom = {
enable = true;
blur = true;
blurExclude = [ ];
# extraOptions = ''
# shadow-radius = 20
# '';
extraOptions = ''
shadow-radius = 20
corner-radius = 10
blur-size = 20
rounded-corners-exclude = [
"window_type = 'dock'",
"class_g = 'i3-frame'"
]
'';
fade = false;
experimentalBackends = true;
inactiveDim = "0.05";
inactiveOpacity = "1.0";
menuOpacity = "1.0";
noDNDShadow = false;
noDockShadow = false;
opacityRule = [
"0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows
];
shadow = true;
shadowExclude = [ ];
shadowOffsets = [ (-10) (-10) ];
shadowOpacity = "0.5";
vSync = false;
};
xsession.windowManager.i3.config.startup = [{
command = "systemctl --user restart picom";
always = true;
notification = false;
}];
services.picom = {
enable = false;
blur = true;
blurExclude = [ ];
# extraOptions = ''
# shadow-radius = 20
# '';
extraOptions = ''
shadow-radius = 20
corner-radius = 10
blur-size = 20
rounded-corners-exclude = [
"window_type = 'dock'",
"class_g = 'i3-frame'"
]
'';
fade = false;
experimentalBackends = true;
inactiveDim = "0.05";
inactiveOpacity = "1.0";
menuOpacity = "1.0";
noDNDShadow = false;
noDockShadow = false;
opacityRule = [
"0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows
];
shadow = true;
shadowExclude = [ ];
shadowOffsets = [ (-10) (-10) ];
shadowOpacity = "0.5";
vSync = false;
};
xsession.windowManager.i3.config.startup = [{
command = "systemctl --user restart picom";
always = true;
notification = false;
}];
};
};
}

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, identity, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf config.services.xserver.enable {
@ -6,7 +6,7 @@
fonts.fonts = with pkgs;
[ (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) ];
home-manager.users.${identity.user} = {
home-manager.users.${config.user} = {
services.polybar = {
enable = true;
@ -16,17 +16,7 @@
githubSupport = true;
};
script = "polybar &";
config = let
colors = {
background = "#282828";
background-alt = "#373B41";
foreground = "#C5C8C6";
primary = "#F0C674";
secondary = "#8ABEB7";
alert = "#A54242";
disabled = "#707880";
};
in {
config = {
"bar/main" = {
bottom = false;
width = "100%";
@ -35,14 +25,14 @@
# offset-y = -5;
# offset-y = "5%";
# dpi = 96;
background = config.theme.colors.primary.background;
foreground = config.theme.colors.primary.foreground;
background = config.gui.colorscheme.base00;
foreground = config.gui.colorscheme.base07;
line-size = "3pt";
border-top-size = 0;
border-right-size = 0;
border-left-size = 0;
border-bottom-size = "4pt";
border-color = config.theme.colors.cursor.text;
border-color = config.gui.colorscheme.base02;
padding-left = 2;
padding-right = 2;
module-margin = 1;
@ -68,17 +58,17 @@
"module/xworkspaces" = {
type = "internal/xworkspaces";
label-active = "%name%";
label-active-background = config.theme.colors.primary.foreground;
label-active-foreground = config.theme.colors.primary.background;
label-active-background = config.gui.colorscheme.base07;
label-active-foreground = config.gui.colorscheme.base00;
# label-active-underline = config.theme.colors.normal.yellow;
label-active-padding = 1;
label-occupied = "%name%";
label-occupied-padding = 1;
label-urgent = "%name%";
label-urgent-background = config.theme.colors.bright.red;
label-urgent-background = config.gui.colorscheme.base08;
label-urgent-padding = 1;
label-empty = "%name%";
label-empty-foreground = config.theme.colors.normal.white;
label-empty-foreground = config.gui.colorscheme.base06;
label-empty-padding = 1;
};
"module/xwindow" = {
@ -100,10 +90,10 @@
format-volume = "<ramp-volume> <label-volume>";
# format-volume-background = colors.background;
# label-volume-background = colors.background;
format-volume-foreground = config.theme.colors.primary.foreground;
format-volume-foreground = config.gui.colorscheme.base07;
label-volume = "%percentage%%";
label-muted = " ---";
label-muted-foreground = config.theme.colors.bright.black;
label-muted-foreground = config.gui.colorscheme.base03;
ramp-volume-0 = "";
ramp-volume-1 = "";
ramp-volume-2 = "";

View File

@ -1,16 +1,16 @@
{ config, pkgs, lib, identity, ... }:
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user}.programs.rofi = {
home-manager.users.${config.user}.programs.rofi = {
enable = true;
cycle = true;
location = "center";
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ];
};
launcherCommand = "${pkgs.rofi}/bin/rofi -show run";
gui.launcherCommand = "${pkgs.rofi}/bin/rofi -show run";
};

View File

@ -1,10 +1,10 @@
{ config, pkgs, lib, identity, gui, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
# Enable the X11 windowing system.
services.xserver = {
enable = gui.enable;
enable = config.gui.enable;
# Enable touchpad support
libinput.enable = true;
@ -15,7 +15,7 @@
enable = config.services.xserver.enable;
# Make the login screen dark
greeters.gtk.theme.name = gui.gtkTheme;
greeters.gtk.theme.name = config.gui.gtkTheme;
};
};
@ -27,7 +27,7 @@
xclip # Clipboard
];
home-manager.users.${identity.user}.programs.fish.shellAliases = {
home-manager.users.${config.user}.programs.fish.shellAliases = {
pbcopy = "xclip -selection clipboard -in";
pbpaste = "xclip -selection clipboard -out";
};

View File

@ -1,6 +1,6 @@
{ pkgs, identity, ... }: {
{ config, pkgs, ... }: {
home-manager.users.${identity.user} = {
home-manager.users.${config.user} = {
home.packages = with pkgs; [
neovim

View File

@ -1,8 +1,9 @@
{ identity, ... }: {
home-manager.users.${identity.user} = {
{ config, ... }: {
home-manager.users.${config.user} = {
home.sessionVariables = {
NOTES_PATH = "/home/${identity.user}/dev/personal/notes";
NOTES_PATH = "/home/${config.user}/dev/personal/notes";
};
};

View File

@ -1,6 +1,6 @@
{ pkgs, lib, gui, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
sound.enable = true;
hardware.pulseaudio.enable = true;

View File

@ -1,4 +1,4 @@
{ lib, gui, ... }: {
{ ... }: {
imports = [
./audio.nix
@ -7,6 +7,7 @@
./monitors.nix
./mouse.nix
./networking.nix
./wifi.nix
];
}

View File

@ -1,9 +1,9 @@
{ pkgs, lib, gui, identity, ... }: {
{ config, pkgs, lib, ... }: {
# Timezone required for Redshift schedule
imports = [ ../system/timezone.nix ];
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
environment.systemPackages = with pkgs;
[
@ -23,7 +23,7 @@
hardware.i2c.enable = true;
# Grant user access to external monitors
users.users.${identity.user}.extraGroups = [ "i2c" ];
users.users.${config.user}.extraGroups = [ "i2c" ];
services.xserver.displayManager = {

View File

@ -1,6 +1,6 @@
{ pkgs, lib, gui, ... }: {
{ config, pkgs, lib, ... }: {
config = lib.mkIf gui.enable {
config = lib.mkIf config.gui.enable {
# Mouse config
services.ratbagd.enable = true;

View File

@ -1,9 +1,5 @@
{ ... }: {
networking.wireless.enable =
true; # Enables wireless support via wpa_supplicant.
networking.wireless.userControlled.enable = true;
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.

View File

@ -0,0 +1,7 @@
{ ... }: {
networking.wireless.enable =
true; # Enables wireless support via wpa_supplicant.
networking.wireless.userControlled.enable = true;
}

View File

@ -1,10 +1,10 @@
{ pkgs, lib, identity, gui, ... }: {
{ config, pkgs, lib, ... }: {
services.keybase.enable = true;
services.kbfs.enable = true;
home-manager.users.${identity.user} = {
home.packages = [ (lib.mkIf gui.enable pkgs.keybase-gui) ];
home-manager.users.${config.user} = {
home.packages = [ (lib.mkIf config.gui.enable pkgs.keybase-gui) ];
home.file = let
ignorePatterns = ''
keybase/

View File

@ -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 ];

View File

@ -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;
};
};
};
};
}

View File

@ -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
'';
};
};
};
};
};
}

View File

@ -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

View File

@ -1,6 +1,6 @@
# Replace sudo with doas
{ identity, ... }: {
{ config, ... }: {
security = {
@ -24,7 +24,7 @@
};
};
home-manager.users.${identity.user}.programs.fish.shellAliases = {
home-manager.users.${config.user}.programs.fish.shellAliases = {
sudo = "doas";
};
}

View File

@ -1,14 +1,10 @@
{ config, ... }:
{ ... }: {
{
config = {
# Service to determine location for time zone
services.geoclue2.enable = true;
location = { provider = "geoclue2"; };
# Service to determine location for time zone
services.geoclue2.enable = true;
location = { provider = "geoclue2"; };
# Enable local time based on time zone
services.localtime.enable = true;
# Enable local time based on time zone
services.localtime.enable = true;
};
}

View File

@ -1,17 +1,36 @@
{ identity, ... }: {
{ config, lib, ... }: {
# Define a user account. Don't forget to set a password with passwd.
users.users.${identity.user} = {
options = {
# Create a home directory for human user
isNormalUser = true;
user = lib.mkOption {
type = lib.types.str;
description = "Primary user of the system";
default = "nixos";
};
# Automatically create a password to start
initialPassword = "changeme";
passwordHash = lib.mkOption {
type = lib.types.str;
description = "Password created with mkpasswd -m sha-512";
};
extraGroups = [
"wheel" # Sudo privileges
];
};
config = {
# Define a user account. Don't forget to set a password with passwd.
users.users.${config.user} = {
# Create a home directory for human user
isNormalUser = true;
# Automatically create a password to start
hashedPassword = config.passwordHash;
extraGroups = [
"wheel" # Sudo privileges
];
};
};