diff --git a/flake.nix b/flake.nix index 2493cff..cbcb97c 100644 --- a/flake.nix +++ b/flake.nix @@ -12,31 +12,29 @@ outputs = { self, nixpkgs, home-manager }: let - # Set the system type globally (changeme) - system = "x86_64-linux"; - - # Gather the Nix packages - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; + # Gather packages + pkgs = import nixpkgs { system = "x86_64-linux"; }; + identity = { + user = "noah"; + name = "Noah Masur"; + hostname = "nixos"; + gitEmail = "7386960+nmasur@users.noreply.github.com"; }; - - user = "noah"; - fullName = "Noah Masur"; - font = { - package = pkgs.victor-mono; - name = "Victor Mono"; + gui = { + enable = false; + font = { + package = pkgs.victor-mono; + name = "Victor Mono"; + }; + gtkTheme = "Adwaita-dark"; }; - hostname = "nixos"; - gtkTheme = "Adwaita-dark"; - in { nixosConfigurations = { desktop = nixpkgs.lib.nixosSystem { - inherit system; + system = "x86_64-linux"; specialArgs = { - gui = true; - inherit user fullName font hostname gtkTheme; + gui = gui // { enable = true; }; + inherit identity; }; modules = [ home-manager.nixosModules.home-manager diff --git a/modules/applications/1password.nix b/modules/applications/1password.nix index efd8ed5..b62d085 100644 --- a/modules/applications/1password.nix +++ b/modules/applications/1password.nix @@ -1,8 +1,8 @@ -{ pkgs, lib, gui, user, ... }: { +{ pkgs, lib, gui, identity, ... }: { - config = lib.mkIf gui { + config = lib.mkIf gui.enable { nixpkgs.config.allowUnfree = true; - home-manager.users.${user} = { + home-manager.users.${identity.user} = { home.packages = with pkgs; [ _1password-gui ]; }; }; diff --git a/modules/applications/alacritty.nix b/modules/applications/alacritty.nix index aef0daa..1a7f22c 100644 --- a/modules/applications/alacritty.nix +++ b/modules/applications/alacritty.nix @@ -1,6 +1,6 @@ -{ pkgs, user, font, ... }: { +{ pkgs, identity, gui, ... }: { - home-manager.users.${user} = { + home-manager.users.${identity.user} = { xsession.windowManager.i3.config.terminal = "alacritty"; programs.alacritty = { enable = true; @@ -18,7 +18,7 @@ scrolling.history = 10000; font = { size = 14.0; - normal = { family = font.name; }; + normal = { family = gui.font.name; }; }; key_bindings = [ { diff --git a/modules/applications/discord.nix b/modules/applications/discord.nix index 6b015ae..343db1f 100644 --- a/modules/applications/discord.nix +++ b/modules/applications/discord.nix @@ -1,7 +1,7 @@ -{ pkgs, lib, user, gui, ... }: { +{ pkgs, lib, identity, gui, ... }: { - config = lib.mkIf gui { - home-manager.users.${user} = { + config = lib.mkIf gui.enable { + home-manager.users.${identity.user} = { nixpkgs.config.allowUnfree = true; home.packages = with pkgs; [ discord ]; }; diff --git a/modules/applications/firefox.nix b/modules/applications/firefox.nix index aed05aa..98eb47d 100644 --- a/modules/applications/firefox.nix +++ b/modules/applications/firefox.nix @@ -1,12 +1,12 @@ -{ pkgs, lib, user, gui, gtkTheme, ... }: +{ pkgs, lib, identity, gui, ... }: { - config = lib.mkIf gui { - home-manager.users.${user} = { + config = lib.mkIf gui.enable { + home-manager.users.${identity.user} = { home.packages = [ pkgs.firefox ]; gtk = { enable = true; - theme = { name = gtkTheme; }; + theme = { name = gui.gtkTheme; }; }; }; diff --git a/modules/applications/media.nix b/modules/applications/media.nix index f9ec376..bcd88af 100644 --- a/modules/applications/media.nix +++ b/modules/applications/media.nix @@ -1,7 +1,7 @@ -{ pkgs, lib, gui, user, ... }: { +{ pkgs, lib, gui, identity, ... }: { - config = lib.mkIf gui { - home-manager.users.${user}.home.packages = with pkgs; [ + config = lib.mkIf gui.enable { + home-manager.users.${identity.user}.home.packages = with pkgs; [ mpv # Video viewer sxiv # Image viewer zathura # PDF viewer diff --git a/modules/desktop/fonts.nix b/modules/desktop/fonts.nix index 128eaa0..8d809ba 100644 --- a/modules/desktop/fonts.nix +++ b/modules/desktop/fonts.nix @@ -1,10 +1,10 @@ -{ pkgs, font, ... }: { +{ pkgs, gui, ... }: { - fonts.fonts = with pkgs; [ - font.package # Used for Vim and Terminal - font-awesome # Icons for i3 - # siji # More icons for Polybar - ]; - fonts.fontconfig.defaultFonts.monospace = [ font.name ]; + fonts.fonts = with pkgs; + [ + gui.font.package # Used for Vim and Terminal + # siji # More icons for Polybar + ]; + fonts.fontconfig.defaultFonts.monospace = [ gui.font.name ]; } diff --git a/modules/desktop/i3.nix b/modules/desktop/i3.nix index 06d0983..c4ee171 100644 --- a/modules/desktop/i3.nix +++ b/modules/desktop/i3.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, user, ... }: +{ config, pkgs, lib, identity, ... }: let @@ -8,6 +8,9 @@ let polybar & ''; + i3 = + config.home-manager.users.${identity.user}.xsession.windowManager.i3.config; + in { config = lib.mkIf config.services.xserver.enable { @@ -21,11 +24,13 @@ in { polybarFull # Polybar + PulseAudio ]; - home-manager.users.${user}.xsession.windowManager.i3 = { + # Icons for i3 + fonts.fonts = with pkgs; [ font-awesome ]; + + home-manager.users.${identity.user}.xsession.windowManager.i3 = { enable = true; config = let - modifier = - config.home-manager.users.${user}.xsession.windowManager.i3.config.modifier; + modifier = i3.modifier; ws1 = "1:"; ws2 = "2:"; ws3 = "3:"; @@ -118,16 +123,16 @@ in { # Launchers "${modifier}+Return" = "exec alacritty"; - "${modifier}+d" = "exec --no-startup-id dmenu_run"; + "${modifier}+space" = "exec --no-startup-id dmenu_run"; "${modifier}+Shift+c" = "reload"; "${modifier}+Shift+r" = "restart"; - "${modifier}+Shift+e" = '' + "${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+t" = "exec alacritty"; # Window options - "${modifier}+Shift+q" = "kill"; + "${modifier}+q" = "kill"; "${modifier}+h" = "focus left"; "${modifier}+j" = "focus down"; "${modifier}+k" = "focus up"; @@ -149,10 +154,10 @@ in { "${modifier}+i" = "split h"; "${modifier}+v" = "split v"; "${modifier}+s" = "layout stacking"; - "${modifier}+w" = "layout tabbed"; + "${modifier}+t" = "layout tabbed"; "${modifier}+e" = "layout toggle split"; "${modifier}+Shift+space" = "floating toggle"; - "${modifier}+space" = "focus mode_toggle"; + "${modifier}+Control+space" = "focus mode_toggle"; "${modifier}+a" = "focus parent"; # Workspaces diff --git a/modules/desktop/xorg.nix b/modules/desktop/xorg.nix index ef3cd09..3958004 100644 --- a/modules/desktop/xorg.nix +++ b/modules/desktop/xorg.nix @@ -1,8 +1,8 @@ -{ pkgs, user, gui, gtkTheme, ... }: { +{ config, pkgs, identity, gui, ... }: { # Enable the X11 windowing system. services.xserver = { - enable = gui; + enable = gui.enable; # Enable touchpad support libinput.enable = true; @@ -10,10 +10,10 @@ # Login screen displayManager = { lightdm = { - enable = gui; + enable = config.services.xserver.enable; # Make the login screen dark - greeters.gtk.theme.name = gtkTheme; + greeters.gtk.theme.name = gui.gtkTheme; }; }; @@ -25,7 +25,7 @@ xclip # Clipboard ]; - home-manager.users.${user}.programs.fish.shellAliases = { + home-manager.users.${identity.user}.programs.fish.shellAliases = { pbcopy = "xclip -selection clipboard -in"; pbpaste = "xclip -selection clipboard -out"; }; diff --git a/modules/editor/neovim.nix b/modules/editor/neovim.nix index 89b85af..0d616d1 100644 --- a/modules/editor/neovim.nix +++ b/modules/editor/neovim.nix @@ -1,6 +1,6 @@ -{ pkgs, user, ... }: { +{ pkgs, identity, ... }: { - home-manager.users.${user} = { + home-manager.users.${identity.user} = { home.packages = with pkgs; [ neovim diff --git a/modules/hardware/monitors.nix b/modules/hardware/monitors.nix index f53cd89..6b954d8 100644 --- a/modules/hardware/monitors.nix +++ b/modules/hardware/monitors.nix @@ -1,4 +1,4 @@ -{ pkgs, user, ... }: { +{ pkgs, identity, ... }: { # Timezone required for Redshift schedule imports = [ ../system/timezone.nix ]; @@ -21,7 +21,7 @@ hardware.i2c.enable = true; # Grant user access to external monitors - users.users.${user}.extraGroups = [ "i2c" ]; + users.users.${identity.user}.extraGroups = [ "i2c" ]; services.xserver.displayManager = { diff --git a/modules/hardware/networking.nix b/modules/hardware/networking.nix index b81c007..705434b 100644 --- a/modules/hardware/networking.nix +++ b/modules/hardware/networking.nix @@ -1,6 +1,6 @@ -{ hostname, ... }: { +{ identity, ... }: { - networking.hostName = hostname; # Define your hostname. + networking.hostName = identity.hostname; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # The global useDHCP flag is deprecated, therefore explicitly set to false here. diff --git a/modules/services/keybase.nix b/modules/services/keybase.nix index 2c70643..40885cb 100644 --- a/modules/services/keybase.nix +++ b/modules/services/keybase.nix @@ -1,10 +1,10 @@ -{ pkgs, lib, user, gui, ... }: { +{ pkgs, lib, identity, gui, ... }: { services.keybase.enable = true; services.kbfs.enable = true; - home-manager.users.${user} = { - home.packages = [ (lib.mkIf gui pkgs.keybase-gui) ]; + home-manager.users.${identity.user} = { + home.packages = [ (lib.mkIf gui.enable pkgs.keybase-gui) ]; home.file = let ignorePatterns = '' keybase/ diff --git a/modules/shell/fish.nix b/modules/shell/fish.nix index 7d7f930..42d58ab 100644 --- a/modules/shell/fish.nix +++ b/modules/shell/fish.nix @@ -1,8 +1,8 @@ -{ pkgs, user, ... }: { +{ pkgs, identity, ... }: { - users.users.${user}.shell = pkgs.fish; + users.users.${identity.user}.shell = pkgs.fish; - home-manager.users.${user} = { + home-manager.users.${identity.user} = { home.packages = with pkgs; [ exa fd bat ripgrep ]; diff --git a/modules/shell/git.nix b/modules/shell/git.nix index f837ce5..d1b5cba 100644 --- a/modules/shell/git.nix +++ b/modules/shell/git.nix @@ -1,14 +1,14 @@ -{ config, pkgs, lib, user, fullName, ... }: +{ config, pkgs, lib, identity, ... }: -let home-packages = config.home-manager.users.${user}.home.packages; +let home-packages = config.home-manager.users.${identity.user}.home.packages; in { - home-manager.users.${user} = { + home-manager.users.${identity.user} = { programs.git = { enable = true; - userName = fullName; - userEmail = "7386960+nmasur@users.noreply.github.com"; + userName = identity.name; + userEmail = identity.gitEmail; extraConfig = { pager = { branch = "false"; }; safe = { directory = builtins.toString ../../.; }; diff --git a/modules/shell/github.nix b/modules/shell/github.nix index 0673e25..8bf1c01 100644 --- a/modules/shell/github.nix +++ b/modules/shell/github.nix @@ -1,8 +1,8 @@ -{ pkgs, user, ... }: { +{ pkgs, identity, ... }: { imports = [ ./git.nix ]; - home-manager.users.${user} = { + home-manager.users.${identity.user} = { programs.gh = { enable = true; enableGitCredentialHelper = true; diff --git a/modules/shell/utilities.nix b/modules/shell/utilities.nix index ada3e5b..741c0e2 100644 --- a/modules/shell/utilities.nix +++ b/modules/shell/utilities.nix @@ -1,4 +1,4 @@ -{ pkgs, user, ... }: +{ pkgs, identity, ... }: let @@ -13,7 +13,7 @@ let in { - home-manager.users.${user} = { + home-manager.users.${identity.user} = { home.packages = with pkgs; [ unzip diff --git a/modules/system/doas.nix b/modules/system/doas.nix index cc4a63f..96b3627 100644 --- a/modules/system/doas.nix +++ b/modules/system/doas.nix @@ -1,6 +1,6 @@ # Replace sudo with doas -{ user, ... }: { +{ identity, ... }: { security = { @@ -24,5 +24,7 @@ }; }; - home-manager.users.${user}.programs.fish.shellAliases = { sudo = "doas"; }; + home-manager.users.${identity.user}.programs.fish.shellAliases = { + sudo = "doas"; + }; } diff --git a/modules/system/user.nix b/modules/system/user.nix index 7571f14..2b83c7f 100644 --- a/modules/system/user.nix +++ b/modules/system/user.nix @@ -1,7 +1,7 @@ -{ user, ... }: { +{ identity, ... }: { # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.${user} = { + users.users.${identity.user} = { # Create a home directory for human user isNormalUser = true; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index c442e27..95cb860 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, user, font, ... }: +{ pkgs, ... }: { nix.extraOptions = "experimental-features = nix-command flakes"; diff --git a/nixos/home.nix b/nixos/home.nix index a74daf8..9d10fb8 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -1,7 +1,7 @@ -{ pkgs, lib, user, ... }: { +{ pkgs, lib, identity, ... }: { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.${user} = { + home-manager.users.${identity.user} = { home.packages = with pkgs; [ # neomutt