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 }: outputs = { self, nixpkgs, home-manager }:
let let
identity = { globals = {
user = "noah"; user = "noah";
name = "Noah Masur"; fullName = "Noah Masur";
hostname = "nixos"; passwordHash =
"$6$J15o3OLElCEncVB3$0FW.R7YFBMgtBp320kkZO.TdKvYDLHmnP6dgktdrVYCC3LUvzXj0Fj0elR/fXo9geYwwWi.EAHflCngL5T.3g/";
gitEmail = "7386960+nmasur@users.noreply.github.com"; gitEmail = "7386960+nmasur@users.noreply.github.com";
};
gui = { gui = {
enable = false; colorscheme = (import ./modules/colorscheme/gruvbox);
font = { wallpaper = ./modules/theme/gruvbox/gray-forest.jpg;
package = "victor-mono";
name = "Victor Mono";
};
theme = "gruvbox";
gtkTheme = "Adwaita-dark"; gtkTheme = "Adwaita-dark";
}; };
};
in { in {
nixosConfigurations = { nixosConfigurations = {
desktop = nixpkgs.lib.nixosSystem { desktop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { specialArgs = { };
gui = gui // { enable = true; };
inherit identity;
};
modules = [ modules = [
globals
{
networking.hostName = "desktop";
gui.enable = true;
}
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ networking.hostName = "desktop"; }
./hosts/desktop/hardware-configuration.nix ./hosts/desktop/hardware-configuration.nix
./modules/common.nix ./modules/common.nix
./modules/desktop
./modules/theme
./modules/hardware ./modules/hardware
./modules/system ./modules/system
./modules/desktop
./modules/shell ./modules/shell
./modules/gaming ./modules/gaming
./modules/services/keybase.nix ./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; nixpkgs.config.allowUnfree = true;
home-manager.users.${identity.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ _1password-gui ]; 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"; xsession.windowManager.i3.config.terminal = "alacritty";
programs.alacritty = { programs.alacritty = {
enable = true; enable = true;
@ -14,12 +14,15 @@
x = 20; x = 20;
y = 20; y = 20;
}; };
opacity = config.theme.opacity; opacity = 1.0;
}; };
scrolling.history = 10000; scrolling.history = 10000;
font = { font = {
size = 14.0; size = 14.0;
normal = { family = gui.font.name; }; normal = {
family =
builtins.head config.fonts.fontconfig.defaultFonts.monospace;
};
}; };
key_bindings = [ key_bindings = [
{ {
@ -39,37 +42,36 @@
action = "ToggleViMode"; action = "ToggleViMode";
} }
]; ];
colors = config.theme.colors; colors = {
# colors = { primary = {
# primary = { background = config.gui.colorscheme.base00;
# background = "#282828"; foreground = config.gui.colorscheme.base05;
# foreground = "#d5c4a1"; };
# }; cursor = {
# cursor = { text = "#1d2021";
# text = "#1d2021"; cursor = config.gui.colorscheme.base05;
# cursor = "#d5c4a1"; };
# }; normal = {
# normal = { black = "#1d2021";
# black = "#1d2021"; red = config.gui.colorscheme.base08;
# red = "#fb4934"; green = config.gui.colorscheme.base0B;
# green = "#b8bb26"; yellow = config.gui.colorscheme.base0A;
# yellow = "#fabd2f"; blue = config.gui.colorscheme.base0D;
# blue = "#83a598"; magenta = config.gui.colorscheme.base0E;
# magenta = "#d3869b"; cyan = config.gui.colorscheme.base0C;
# cyan = "#8ec07c"; white = config.gui.colorscheme.base05;
# white = "#d5c4a1"; };
# }; bright = {
# bright = { black = config.gui.colorscheme.base03;
# black = "#665c54"; red = config.gui.colorscheme.base09;
# red = "#fe8019"; green = config.gui.colorscheme.base01;
# green = "#3c3836"; yellow = config.gui.colorscheme.base02;
# yellow = "#504945"; blue = config.gui.colorscheme.base04;
# blue = "#bdae93"; magenta = config.gui.colorscheme.base06;
# magenta = "#ebdbb2"; cyan = config.gui.colorscheme.base0F;
# cyan = "#d65d0e"; white = config.gui.colorscheme.base07;
# white = "#fbf1c7"; };
# }; };
# };
draw_bold_text_with_bright_colors = false; 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 { config = lib.mkIf config.gui.enable {
home-manager.users.${identity.user} = { home-manager.users.${config.user} = {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [ discord ]; home.packages = with pkgs; [ discord ];
}; };

View File

@ -1,12 +1,12 @@
{ pkgs, lib, identity, gui, ... }: { 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 = [ pkgs.firefox ]; home.packages = [ pkgs.firefox ];
gtk = { gtk = {
enable = true; 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 { config = lib.mkIf config.gui.enable {
home-manager.users.${identity.user}.home.packages = with pkgs; [ home-manager.users.${config.user}.home.packages = with pkgs; [
mpv # Video viewer mpv # Video viewer
sxiv # Image viewer sxiv # Image viewer
zathura # PDF 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 ]; 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"; nix.extraOptions = "experimental-features = nix-command flakes";

View File

@ -10,11 +10,35 @@
./rofi.nix ./rofi.nix
]; ];
options = { options = with lib; {
launcherCommand = lib.mkOption {
type = lib.types.str; 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"; 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 { config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user}.home.packages = [ pkgs.dmenu ]; home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ];
launcherCommand = "${pkgs.dmenu}/bin/dmenu_run"; 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; fonts.fonts = with pkgs;
[ [
pkgs."${gui.font.package}" # Used for Vim and Terminal pkgs.victor-mono # Used for Vim and Terminal
# siji # More icons for Polybar
]; ];
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 { config = lib.mkIf config.services.xserver.enable {
@ -15,7 +15,7 @@
playerctl # Media control playerctl # Media control
]; ];
home-manager.users.${identity.user}.xsession.windowManager.i3 = { home-manager.users.${config.user}.xsession.windowManager.i3 = {
enable = true; enable = true;
package = pkgs.i3-gaps; package = pkgs.i3-gaps;
config = let config = let
@ -40,19 +40,16 @@
}; };
bars = [{ command = "echo"; }]; # Disable i3bar bars = [{ command = "echo"; }]; # Disable i3bar
colors = let colors = let
background = "#2f343f"; background = config.gui.colorscheme.base00;
inactiveBackground = "#2f343f"; inactiveBackground = config.gui.colorscheme.base01;
border = "#2f343f"; border = config.gui.colorscheme.base01;
inactiveBorder = "#2f343f"; inactiveBorder = config.gui.colorscheme.base01;
# border = "#F0C674"; text = config.gui.colorscheme.base07;
# inactiveBorder = "#E2B860"; inactiveText = config.gui.colorscheme.base04;
text = "#f3f4f5"; urgentBackground = config.gui.colorscheme.base08;
inactiveText = "#676E7D";
urgentBackground = "#E53935";
# indicator = "#00ff00";
indicator = "#00000000"; indicator = "#00000000";
in { in {
background = background; background = config.gui.colorscheme.base00;
focused = { focused = {
inherit background indicator text border; inherit background indicator text border;
childBorder = background; childBorder = background;
@ -117,12 +114,13 @@
# Launchers # Launchers
"${modifier}+Return" = "exec alacritty"; "${modifier}+Return" = "exec alacritty";
"${modifier}+space" = "${modifier}+space" =
"exec --no-startup-id ${config.launcherCommand}"; "exec --no-startup-id ${config.gui.launcherCommand}";
"${modifier}+Shift+c" = "reload"; "${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart"; "${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = '' "${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'"''; 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"; "${modifier}+Shift+t" = "exec alacritty";
# Window options # Window options
@ -202,8 +200,7 @@
}; };
startup = [ startup = [
{ {
command = command = "feh --bg-fill ${builtins.toString config.gui.wallpaper}";
"feh --bg-fill ${builtins.toString config.theme.wallpaper}";
always = true; always = true;
notification = false; notification = false;
} }

View File

@ -1,10 +1,11 @@
{ config, lib, identity, ... }: { { config, lib, ... }: {
config = lib.mkIf config.services.xserver.enable { config =
home-manager.users.${identity.user} = { lib.mkIf (config.services.xserver.enable && config.gui.compositor.enable) {
home-manager.users.${config.user} = {
services.picom = { services.picom = {
enable = false; enable = true;
blur = true; blur = true;
blurExclude = [ ]; blurExclude = [ ];
# extraOptions = '' # extraOptions = ''

View File

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

View File

@ -1,16 +1,16 @@
{ config, pkgs, lib, identity, ... }: { config, pkgs, lib, ... }:
{ {
config = lib.mkIf config.services.xserver.enable { config = lib.mkIf config.services.xserver.enable {
home-manager.users.${identity.user}.programs.rofi = { home-manager.users.${config.user}.programs.rofi = {
enable = true; enable = true;
cycle = true; cycle = true;
location = "center"; location = "center";
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; 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. # Enable the X11 windowing system.
services.xserver = { services.xserver = {
enable = gui.enable; enable = config.gui.enable;
# Enable touchpad support # Enable touchpad support
libinput.enable = true; libinput.enable = true;
@ -15,7 +15,7 @@
enable = config.services.xserver.enable; enable = config.services.xserver.enable;
# Make the login screen dark # Make the login screen dark
greeters.gtk.theme.name = gui.gtkTheme; greeters.gtk.theme.name = config.gui.gtkTheme;
}; };
}; };
@ -27,7 +27,7 @@
xclip # Clipboard xclip # Clipboard
]; ];
home-manager.users.${identity.user}.programs.fish.shellAliases = { home-manager.users.${config.user}.programs.fish.shellAliases = {
pbcopy = "xclip -selection clipboard -in"; pbcopy = "xclip -selection clipboard -in";
pbpaste = "xclip -selection clipboard -out"; 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; [ home.packages = with pkgs; [
neovim neovim

View File

@ -1,8 +1,9 @@
{ identity, ... }: { { config, ... }: {
home-manager.users.${identity.user} = {
home-manager.users.${config.user} = {
home.sessionVariables = { 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; sound.enable = true;
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;

View File

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

View File

@ -1,9 +1,9 @@
{ pkgs, lib, gui, identity, ... }: { { config, pkgs, lib, ... }: {
# Timezone required for Redshift schedule # Timezone required for Redshift schedule
imports = [ ../system/timezone.nix ]; imports = [ ../system/timezone.nix ];
config = lib.mkIf gui.enable { config = lib.mkIf config.gui.enable {
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs;
[ [
@ -23,7 +23,7 @@
hardware.i2c.enable = true; hardware.i2c.enable = true;
# Grant user access to external monitors # Grant user access to external monitors
users.users.${identity.user}.extraGroups = [ "i2c" ]; users.users.${config.user}.extraGroups = [ "i2c" ];
services.xserver.displayManager = { 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 # Mouse config
services.ratbagd.enable = true; 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. # 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 # Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour. # 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.keybase.enable = true;
services.kbfs.enable = true; services.kbfs.enable = true;
home-manager.users.${identity.user} = { home-manager.users.${config.user} = {
home.packages = [ (lib.mkIf gui.enable pkgs.keybase-gui) ]; home.packages = [ (lib.mkIf config.gui.enable pkgs.keybase-gui) ];
home.file = let home.file = let
ignorePatterns = '' ignorePatterns = ''
keybase/ 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 ]; home.packages = with pkgs; [ exa fd bat ripgrep ];

View File

@ -1,22 +1,35 @@
{ 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 { in {
home-manager.users.root.programs.git = { options = {
enable = true; fullName = lib.mkOption {
extraConfig.safe.directory = "/home/${identity.user}/dev/personal/dotfiles"; 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} = { config = {
home-manager.users.root.programs.git = {
enable = true;
extraConfig.safe.directory = "/home/${config.user}/dev/personal/dotfiles";
};
home-manager.users.${config.user} = {
programs.git = { programs.git = {
enable = true; enable = true;
userName = identity.name; userName = config.fullName;
userEmail = identity.gitEmail; userEmail = config.gitEmail;
extraConfig = { extraConfig = {
pager = { branch = "false"; }; pager = { branch = "false"; };
safe = { directory = "/home/${identity.user}/dev/personal/dotfiles"; }; safe = { directory = "/home/${config.user}/dev/personal/dotfiles"; };
pull = { ff = "only"; }; pull = { ff = "only"; };
}; };
}; };
@ -94,12 +107,12 @@ in {
../../fish.configlink/functions/git-show-fuzzy.fish; ../../fish.configlink/functions/git-show-fuzzy.fish;
}; };
git-commits = { git-commits = {
body = body = builtins.readFile
builtins.readFile ../../fish.configlink/functions/git-commits.fish; ../../fish.configlink/functions/git-commits.fish;
}; };
git-history = { git-history = {
body = body = builtins.readFile
builtins.readFile ../../fish.configlink/functions/git-history.fish; ../../fish.configlink/functions/git-history.fish;
}; };
git-push-upstream = { git-push-upstream = {
description = "Create upstream branch"; description = "Create upstream branch";
@ -108,10 +121,12 @@ in {
}; };
uncommitted = { uncommitted = {
description = "Find uncommitted git repos"; description = "Find uncommitted git repos";
body = body = builtins.readFile
builtins.readFile ../../fish.configlink/functions/uncommitted.fish; ../../fish.configlink/functions/uncommitted.fish;
}; };
}; };
}; };
};
} }

View File

@ -1,15 +1,16 @@
{ pkgs, identity, ... }: { { config, pkgs, lib, ... }: {
imports = [ ./git.nix ]; home-manager.users.${config.user} = {
home-manager.users.${identity.user} = { programs.gh =
programs.gh = { lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
enable = true; enable = true;
enableGitCredentialHelper = true; enableGitCredentialHelper = true;
settings.git_protocol = "https"; settings.git_protocol = "https";
}; };
programs.fish = { programs.fish =
lib.mkIf config.home-manager.users.${config.user}.programs.gh.enable {
shellAbbrs = { shellAbbrs = {
ghr = "gh repo view -w"; ghr = "gh repo view -w";
gha = gha =
@ -29,6 +30,7 @@
}; };
}; };
}; };
}; };
} }

View File

@ -1,4 +1,4 @@
{ pkgs, identity, ... }: { config, pkgs, ... }:
let let
@ -13,7 +13,7 @@ let
in { in {
home-manager.users.${identity.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
unzip # Extract zips unzip # Extract zips

View File

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

View File

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

View File

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