diff --git a/.config/home-manager/flake.nix b/.config/home-manager/flake.nix index 1fe4b111..694415ac 100644 --- a/.config/home-manager/flake.nix +++ b/.config/home-manager/flake.nix @@ -1,5 +1,5 @@ { - description = "Home Manager configuration of connerohnesorge"; + description = "Home Manager configuration"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; @@ -17,17 +17,38 @@ ... }: { homeConfigurations = { - # macOS configuration + # Personal macOS configuration "connerohnesorge@Conners-MacBook-Air.local" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.aarch64-darwin; # Assuming M1/M2 Mac, use x86_64-darwin for Intel + pkgs = nixpkgs.legacyPackages.aarch64-darwin; + extraSpecialArgs = {username = "connerohnesorge";}; modules = [ ./home-darwin.nix ]; }; - # Linux configuration + # Work macOS configuration + "cohnesor@CB14957.local" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.aarch64-darwin; + extraSpecialArgs = {username = "cohnesor";}; + modules = [ + ./home-darwin.nix + ]; + }; + + # Personal Linux configuration "connerohnesorge" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {username = "connerohnesorge";}; + modules = [ + stylix.homeManagerModules.stylix + ./home.nix + ]; + }; + + # Work Linux configuration (if needed) + "cohnesor" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {username = "cohnesor";}; modules = [ stylix.homeManagerModules.stylix ./home.nix diff --git a/.config/home-manager/home-darwin.nix b/.config/home-manager/home-darwin.nix index e46313a0..5ef8a5a8 100644 --- a/.config/home-manager/home-darwin.nix +++ b/.config/home-manager/home-darwin.nix @@ -2,11 +2,12 @@ config, pkgs, lib, + username ? "connerohnesorge", ... }: { home = { - username = "connerohnesorge"; - homeDirectory = "/home/connerohnesorge"; + inherit username; + homeDirectory = "/Users/${username}"; # You should not change this value, even if you update Home Manager. If you do # want to update the value, then make sure to first check the Home Manager diff --git a/.config/home-manager/home.nix b/.config/home-manager/home.nix index 13bcf12c..69ead439 100644 --- a/.config/home-manager/home.nix +++ b/.config/home-manager/home.nix @@ -3,11 +3,12 @@ pkgs, lib, stylix, + username ? "connerohnesorge", ... }: { home = { - username = "connerohnesorge"; - homeDirectory = "/home/connerohnesorge"; + inherit username; + homeDirectory = "/home/${username}"; # You should not change this value, even if you update Home Manager. If you do # want to update the value, then make sure to first check the Home Manager diff --git a/flake.lock b/flake.lock index b3459593..ad5819d2 100644 --- a/flake.lock +++ b/flake.lock @@ -355,6 +355,28 @@ "type": "github" } }, + "firefox-addons": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1768144062, + "narHash": "sha256-LSgAmBS9JKqQG3GitIScLxoLuA9egTrZMd3+LNz895E=", + "owner": "connerohnesorge", + "repo": "nur-expressions", + "rev": "63e65b8a46a8e9c953d49fb6da439f59a2304480", + "type": "github" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "connerohnesorge", + "repo": "nur-expressions", + "type": "github" + } + }, "firefox-gnome-theme": { "flake": false, "locked": { @@ -1662,39 +1684,6 @@ "url": "https://github.com/NixOS/nixpkgs" } }, - "nixpkgs_12": { - "locked": { - "lastModified": 1766840161, - "narHash": "sha256-Ss/LHpJJsng8vz1Pe33RSGIWUOcqM1fjrehjUkdrWio=", - "ref": "nixpkgs-unstable", - "rev": "3edc4a30ed3903fdf6f90c837f961fa6b49582d1", - "shallow": true, - "type": "git", - "url": "https://github.com/NixOS/nixpkgs" - }, - "original": { - "ref": "nixpkgs-unstable", - "shallow": true, - "type": "git", - "url": "https://github.com/NixOS/nixpkgs" - } - }, - "nixpkgs_12": { - "locked": { - "lastModified": 1758277210, - "narHash": "sha256-iCGWf/LTy+aY0zFu8q12lK8KuZp7yvdhStehhyX1v8w=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "8eaee110344796db060382e15d3af0a9fc396e0e", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1754340878, @@ -1991,6 +1980,7 @@ "determinate": "determinate", "disko": "disko", "fff": "fff", + "firefox-addons": "firefox-addons", "flake-compat": "flake-compat_3", "flake-parts": "flake-parts_3", "flake-utils": "flake-utils_2", @@ -2626,18 +2616,23 @@ }, "zen-browser": { "inputs": { - "nixpkgs": "nixpkgs_12" + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1767199027, - "narHash": "sha256-+WuVorK+k1OQHViJ/Pucbj/gvUoYVABJmXWmYPnON+4=", - "owner": "connerohnesorge", + "lastModified": 1768083628, + "narHash": "sha256-6M+vlMGur7UgzkHucgA61pjq3gtjGH9OywxJM/KHL8I=", + "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "64eb0272fa3b59685584df65b659e19a8ff3aadc", + "rev": "5c9624f3d0176727284678aebf677770dd1375b2", "type": "github" }, "original": { - "owner": "connerohnesorge", + "owner": "0xc000022070", "repo": "zen-browser-flake", "type": "github" } diff --git a/flake.nix b/flake.nix index 7e4a7105..4c316b8e 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,17 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - zen-browser.url = "github:connerohnesorge/zen-browser-flake"; + zen-browser = { + url = "github:0xc000022070/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + + firefox-addons = { + url = "github:connerohnesorge/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + proton-authenticator.url = "github:connerohnesorge/proton-authenticator-flake?ref=0494e1b70724861b4f8e2fb314b744e0591dfbb5"; proton-authenticator.inputs.nixpkgs.follows = "nixpkgs"; @@ -141,7 +151,8 @@ flake = let mkConfigurations = moduleSystem: denix.lib.configurations { - homeManagerUser = "connerohnesorge"; + # homeManagerUser is set dynamically per-host via myconfig.host.username + # See modules/config/constants.nix and modules/config/home.nix inherit moduleSystem; paths = [./hosts ./modules ./rices]; diff --git a/hosts/CB14957.local/default.nix b/hosts/CB14957.local/default.nix new file mode 100644 index 00000000..9b311704 --- /dev/null +++ b/hosts/CB14957.local/default.nix @@ -0,0 +1,113 @@ +{ + delib, + inputs, + pkgs, + config, + lib, + ... +}: let + system = "aarch64-darwin"; +in + delib.host { + name = "CB14957.local"; + + # Work machine username + username = "cohnesor"; + + rice = "empty"; + type = "laptop"; + + home.home.stateVersion = "24.11"; + homeManagerSystem = system; + + myconfig = { + features = { + engineer.enable = true; + }; + programs = { + dx.enable = true; + catls.enable = true; + convert_img.enable = true; + }; + }; + + nixos = { + imports = [ + inputs.determinate.nixosModules.default + ]; + nixpkgs.hostPlatform = "x86_64-linux"; + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnsupportedSystem = true; + system.stateVersion = "24.11"; + + # Minimal file system configuration to prevent assertion failures + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + }; + + darwin = {myconfig, ...}: { + imports = [ + # inputs.determinate.darwinModules.default + ]; + + nixpkgs = { + hostPlatform = system; + config.allowUnfree = true; + }; + nix.enable = false; + programs = { + direnv = { + enable = true; + nix-direnv = { + enable = true; + package = pkgs.nix-direnv; + }; + }; + ssh = { + extraConfig = '' + SetEnv TERM=xterm-256color + ''; + }; + }; + system = { + stateVersion = 5; + primaryUser = myconfig.constants.username; + defaults = { + dock.autohide = true; + + trackpad = { + Clicking = true; + TrackpadThreeFingerDrag = true; + Dragging = true; + }; + }; + }; + + environment = { + systemPackages = [ + # Macos Only + pkgs.aerospace + pkgs.raycast + pkgs.xcodes + # Shared + ]; + shells = [pkgs.zsh]; + + pathsToLink = ["/share/qemu"]; + etc."containers/containers.conf.d/99-gvproxy-path.conf".text = '' + [engine] + helper_binaries_dir = ["${pkgs.gvproxy}/bin"] + ''; + }; + users.users.${myconfig.constants.username} = { + home = "/Users/${myconfig.constants.username}"; + }; + + security.pam.services.sudo_local.touchIdAuth = true; + }; + } diff --git a/hosts/mac-nix/default.nix b/hosts/mac-nix/default.nix index 64fec178..15f224e9 100644 --- a/hosts/mac-nix/default.nix +++ b/hosts/mac-nix/default.nix @@ -46,7 +46,7 @@ in boot.loader.efi.canTouchEfiVariables = true; }; - darwin = { + darwin = {myconfig, ...}: { imports = [ # inputs.determinate.darwinModules.default ]; @@ -73,7 +73,7 @@ in }; system = { stateVersion = 5; - primaryUser = "connerohnesorge"; + primaryUser = myconfig.constants.username; defaults = { dock.autohide = true; @@ -101,8 +101,8 @@ in helper_binaries_dir = ["${pkgs.gvproxy}/bin"] ''; }; - users.users.connerohnesorge = { - home = "/Users/connerohnesorge"; + users.users.${myconfig.constants.username} = { + home = "/Users/${myconfig.constants.username}"; }; security.pam.services.sudo_local.touchIdAuth = true; diff --git a/modules/config/constants.nix b/modules/config/constants.nix index 6441600b..94f9e3cd 100644 --- a/modules/config/constants.nix +++ b/modules/config/constants.nix @@ -16,8 +16,9 @@ delib.module { name = "constants"; options.constants = with delib; { - # Primary username for the system (used for account creation and home directory) - username = readOnly (strOption "connerohnesorge"); + # Primary username for the system (derived from host configuration) + # This allows different usernames per machine (e.g., "connerohnesorge" locally, "cohnesor" at work) + username = strOption "connerohnesorge"; # Full display name for the user (used in Git commits and system identification) userfullname = readOnly (strOption "Conner Ohnesorge"); @@ -25,4 +26,9 @@ delib.module { # Primary email address (used for Git commits, SSH keys, and notifications) useremail = readOnly (strOption "connerohnesorge@outlook.com"); }; + + # Derive username from host configuration + myconfig.always = {myconfig, ...}: { + constants.username = myconfig.host.username; + }; } diff --git a/modules/config/home.nix b/modules/config/home.nix index ede5aa65..559d375d 100644 --- a/modules/config/home.nix +++ b/modules/config/home.nix @@ -18,6 +18,7 @@ { delib, pkgs, + inputs, ... }: let inherit (pkgs.stdenv) isDarwin isLinux; @@ -28,6 +29,21 @@ in home.always = {myconfig, ...}: let inherit (myconfig.constants) username; in { + imports = [ + inputs.zen-browser.homeModules.beta + ]; + + programs.zen-browser = { + enable = true; + profiles.default = { + isDefault = true; + extensions.packages = with pkgs.firefox-addons; [ + surfingkeys + keeper-password-manager + ]; + }; + }; + # GTK theming configuration (Linux only) # Provides a consistent dark theme across GTK applications gtk = diff --git a/modules/config/hosts.nix b/modules/config/hosts.nix index 1c17d4fe..86042851 100644 --- a/modules/config/hosts.nix +++ b/modules/config/hosts.nix @@ -32,6 +32,12 @@ delib.module { options = hostSubmoduleOptions // { + # Username for this host (allows different usernames per machine) + username = strOption "connerohnesorge"; + + # Home Manager user - defaults to username for multi-user support + homeManagerUser = strOption config.username; + # Required: Host type classification type = noDefault (enumOption ["desktop" "server" "laptop"] null); diff --git a/modules/config/rices.nix b/modules/config/rices.nix index c62ad984..5eca5021 100644 --- a/modules/config/rices.nix +++ b/modules/config/rices.nix @@ -53,7 +53,16 @@ delib.module { # Import Stylix module for system-wide theming imports = [inputs.stylix.nixosModules.stylix]; + # Apply firefox-addons overlay for zen-browser extensions + nixpkgs.overlays = [inputs.firefox-addons.overlays.default]; + # Validate that all referenced rice names exist in the rices directory assertions = delib.riceNamesAssertions myconfig.rices; }; + + # Darwin configuration + darwin.always = {myconfig, ...}: { + # Apply firefox-addons overlay for zen-browser extensions + nixpkgs.overlays = [inputs.firefox-addons.overlays.default]; + }; } diff --git a/modules/config/user.nix b/modules/config/user.nix index 5cadcc7b..53e798d4 100644 --- a/modules/config/user.nix +++ b/modules/config/user.nix @@ -28,14 +28,14 @@ in trusted-users = [ "root" "@wheel" # All wheel group members - "connerohnesorge" + username ]; # Users allowed to use Nix daemon allowed-users = [ "root" "@wheel" - "connerohnesorge" + username ]; # Binary cache configuration for faster builds diff --git a/modules/features/engineer.nix b/modules/features/engineer.nix index 545e5914..33649aa0 100644 --- a/modules/features/engineer.nix +++ b/modules/features/engineer.nix @@ -9,20 +9,22 @@ in delib.module { name = "features.engineer"; - nixos.always.imports = [ - inputs.nix-ld.nixosModules.nix-ld - inputs.nordvpn.nixosModules.default - { - services.nordvpn = { - enable = true; - users = ["connerohnesorge"]; # Users to add to nordvpn group - }; - } - ]; + nixos.always = {myconfig, ...}: { + imports = [ + inputs.nix-ld.nixosModules.nix-ld + inputs.nordvpn.nixosModules.default + { + services.nordvpn = { + enable = true; + users = [myconfig.constants.username]; + }; + } + ]; + }; options = singleEnableOption false; - nixos.ifEnabled = { + nixos.ifEnabled = {myconfig, ...}: { myconfig = { features = { zshell.enable = true; @@ -160,7 +162,6 @@ in inputs.nix-ai-tools.packages."${pkgs.stdenv.hostPlatform.system}".crush inputs.nix-ai-tools.packages."${pkgs.stdenv.hostPlatform.system}".amp inputs.nordvpn.packages."${pkgs.stdenv.hostPlatform.system}".default - inputs.zen-browser.packages."${pkgs.stdenv.hostPlatform.system}".default inputs.blink.packages."${pkgs.stdenv.hostPlatform.system}".default inputs.blink.packages."${pkgs.stdenv.hostPlatform.system}".blink-fuzzy-lib inputs.fff.packages."${pkgs.stdenv.hostPlatform.system}".default @@ -199,7 +200,7 @@ in package = pkgs.nh; clean.enable = true; clean.extraArgs = "--keep-since 4d --keep 3"; - flake = "/home/connerohnesorge/dotfiles"; + flake = "/home/${myconfig.constants.username}/dotfiles"; }; };