diff --git a/flake.lock b/flake.lock index 13a5a58..3522931 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,26 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715901937, + "narHash": "sha256-eMyvWP56ZOdraC2IOvZo0/RTDcrrsqJ0oJWDC76JTak=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "ffc01182f90118119930bdfc528c1ee9a39ecef8", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1715668745, @@ -40,6 +60,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index a09d4cd..83b7d41 100644 --- a/flake.nix +++ b/flake.nix @@ -7,23 +7,45 @@ url = "github:nix-community/home-manager/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nix-darwin = { + url = "github:LnL7/nix-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, home-manager, ... } @ inputs: - let + outputs = { self, nixpkgs, nix-darwin, home-manager, ... } @ inputs: { + nixosConfigurations.randomctf = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - in { - nixosConfigurations.randomctf = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { inherit inputs; }; - modules = [ ./nixos/configuration.nix ]; - }; - - homeConfigurations.random = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.${system}; - modules = [ - ./home-manager/home.nix - ]; - }; + specialArgs = { inherit inputs; }; + modules = [ ./nixos/configuration.nix ]; }; + + homeConfigurations.random = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + modules = [ + ./home-manager/nixos-home.nix + ]; + }; + + darwinConfigurations."Jadens-MacBook-Air" = nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = { inherit inputs; }; + modules = [ + ./nixos/darwin-configuration.nix + home-manager.darwinModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jadenmaxwell = import ./home-manager/darwin-home.nix; + } + ]; + }; + + homeConfigurations.jadenmaxwell = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."aarch64-darwin"; + modules = [ + ./home-manager/darwin-home.nix + ]; + }; + }; } diff --git a/home-manager/common.nix b/home-manager/common.nix new file mode 100644 index 0000000..49c0842 --- /dev/null +++ b/home-manager/common.nix @@ -0,0 +1,55 @@ +{ inputs, config, pkgs, ... }: { + nixpkgs.config.allowUnfree = true; + fonts.fontconfig.enable = true; + + home.packages = with pkgs; [ + feh + clang + cargo + neofetch + #microsoft-edge + #nextcloud-client + #bitwarden-cli + #bitwarden + #discord + + # Emacs + cmake + isync + ispell + mu + + # fonts + fira-code + fira-code-symbols + meslo-lgs-nf + ]; + + programs = { + home-manager.enable = true; + zoxide.enable = true; + eza.enable = true; + fzf.enable = true; + + git = { + enable = true; + userName = "Random936"; + userEmail = "randomdude936@gmail.com"; + }; + }; + + + home.file = { + ".mbsyncrc".source = ../dotfiles/.mbsyncrc; + ".functions.zsh".source = ../dotfiles/.functions.zsh; + + # Emacs files + ".emacs".source = ../dotfiles/.emacs; + ".emacs.d/config.org".source = ../dotfiles/.emacs.d/config.org; + ".emacs.d/terminal.org".source = ../dotfiles/.emacs.d/terminal.org; + ".emacs.d/functions.org".source = ../dotfiles/.emacs.d/functions.org; + ".emacs.d/email.org".source = ../dotfiles/.emacs.d/email.org; + ".emacs.d/org.org".source = ../dotfiles/.emacs.d/org.org; + ".emacs.d/lsp.org".source = ../dotfiles/.emacs.d/lsp.org; + }; +} diff --git a/home-manager/darwin-home.nix b/home-manager/darwin-home.nix new file mode 100644 index 0000000..96385d7 --- /dev/null +++ b/home-manager/darwin-home.nix @@ -0,0 +1,16 @@ +{ inputs, config, pkgs, ... }: { + + home = { + username = "jadenmaxwell"; + homeDirectory = "/Users/jadenmaxwell"; + }; + + imports = [ + ./common.nix + ./zsh.nix + ]; + + programs.emacs.package = pkgs.emacs-macport; + + home.stateVersion = "23.11"; +} diff --git a/home-manager/emacs.nix b/home-manager/emacs.nix new file mode 100644 index 0000000..84b22df --- /dev/null +++ b/home-manager/emacs.nix @@ -0,0 +1,11 @@ +{ inputs, config, pkgs, ... }: { + programs.emacs = { + enable = true; + extraPackages = epkgs: with epkgs; [ + mu4e + vterm + all-the-icons + nerd-icons + ]; + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix deleted file mode 100644 index 8365747..0000000 --- a/home-manager/home.nix +++ /dev/null @@ -1,123 +0,0 @@ -{ inputs, config, pkgs, ... }: { - home = { - username = "random"; - homeDirectory = "/home/random"; - }; - - gtk = { - enable = true; - theme = { - name = "Materia-dark"; - package = pkgs.materia-theme; - }; - }; - - nixpkgs.config.allowUnfree = true; - fonts.fontconfig.enable = true; - home.packages = with pkgs; [ - feh - clang - cargo - neofetch - microsoft-edge - nextcloud-client - bitwarden-cli - bitwarden - discord - - # Emacs - cmake - isync - ispell - mu - - # fonts - fira-code - fira-code-symbols - meslo-lgs-nf - ]; - - programs = { - home-manager.enable = true; - command-not-found.enable = true; - zoxide.enable = true; - eza.enable = true; - fzf.enable = true; - - emacs = { - enable = true; - extraPackages = epkgs: with epkgs; [ - mu4e - vterm - all-the-icons - nerd-icons - ]; - }; - - git = { - enable = true; - userName = "Random936"; - userEmail = "randomdude936@gmail.com"; - }; - - zsh = { - enable = true; - enableCompletion = true; - enableAutosuggestions = true; - syntaxHighlighting.enable = true; - history.size = 100000000; - - shellAliases = { - update-system = "sudo nixos-rebuild switch --flake ~/dotfiles"; - update-user = "home-manager switch --flake ~/dotfiles"; - update-all = "update-system && update-user"; - }; - - plugins = [ - { - name = "custom-functions"; - src = ../dotfiles; - file = ".functions.zsh"; - } - { - name = "powerlevel10k-config"; - src = ../dotfiles; - file = ".p10k.zsh"; - } - ]; - - zplug = { - enable = true; - plugins = [ - { name = "romkatv/powerlevel10k"; tags = [ as:theme depth:1 ]; } - ]; - }; - - }; - }; - - home.file = { - ".mbsyncrc".source = ../dotfiles/.mbsyncrc; - ".Xresources".source = ../dotfiles/.Xresources; - ".functions.zsh".source = ../dotfiles/.functions.zsh; - ".scripts/brightness.sh".source = ../dotfiles/.scripts/brightness.sh; - ".scripts/autostart_desktop.sh".source = ../dotfiles/.scripts/autostart_desktop.sh; - ".screenlayout/launch.sh".source = ../dotfiles/.screenlayout/launch.sh; - ".screenlayout/wallpapers.sh".source = ../dotfiles/.screenlayout/wallpapers.sh; - ".config/i3/config".source = ../dotfiles/.config/i3/config; - ".config/rofi/config.rasi".source = ../dotfiles/.config/rofi/config.rasi; - ".config/polybar/config.ini".source = ../dotfiles/.config/polybar/config.ini; - - # Emacs files - ".emacs".source = ../dotfiles/.emacs; - ".emacs.d/config.org".source = ../dotfiles/.emacs.d/config.org; - ".emacs.d/terminal.org".source = ../dotfiles/.emacs.d/terminal.org; - ".emacs.d/functions.org".source = ../dotfiles/.emacs.d/functions.org; - ".emacs.d/email.org".source = ../dotfiles/.emacs.d/email.org; - ".emacs.d/org.org".source = ../dotfiles/.emacs.d/org.org; - ".emacs.d/lsp.org".source = ../dotfiles/.emacs.d/lsp.org; - }; - - - home.stateVersion = "23.05"; -} diff --git a/home-manager/nixos-home.nix b/home-manager/nixos-home.nix new file mode 100644 index 0000000..6a6fefc --- /dev/null +++ b/home-manager/nixos-home.nix @@ -0,0 +1,40 @@ +{ inputs, config, pkgs, ... }: { + + home = { + username = "random"; + homeDirectory = "/home/random"; + }; + + imports = [ + ./common.nix + ./emacs.nix + ./zsh.nix + ]; + + gtk = { + enable = true; + theme = { + name = "Materia-dark"; + package = pkgs.materia-theme; + }; + }; + + programs = { + command-not-found.enable = true; + }; + + home.file = { + ".Xresources".source = ../dotfiles/.Xresources; + ".scripts/brightness.sh".source = ../dotfiles/.scripts/brightness.sh; + ".scripts/autostart_desktop.sh".source = ../dotfiles/.scripts/autostart_desktop.sh; + ".screenlayout/launch.sh".source = ../dotfiles/.screenlayout/launch.sh; + ".screenlayout/wallpapers.sh".source = ../dotfiles/.screenlayout/wallpapers.sh; + ".config/i3/config".source = ../dotfiles/.config/i3/config; + ".config/rofi/config.rasi".source = ../dotfiles/.config/rofi/config.rasi; + ".config/polybar/config.ini".source = ../dotfiles/.config/polybar/config.ini; + + }; + + + home.stateVersion = "23.11"; +} diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix new file mode 100644 index 0000000..b5c12aa --- /dev/null +++ b/home-manager/zsh.nix @@ -0,0 +1,36 @@ +{ inputs, config, pkgs, ... }: { + programs.zsh = { + enable = true; + enableCompletion = true; + enableAutosuggestions = true; + syntaxHighlighting.enable = true; + history.size = 100000000; + + shellAliases = { + update-system = "sudo nixos-rebuild switch --flake ~/dotfiles"; + update-user = "home-manager switch --flake ~/dotfiles"; + update-all = "update-system && update-user"; + }; + + plugins = [ + { + name = "custom-functions"; + src = ../dotfiles; + file = ".functions.zsh"; + } + { + name = "powerlevel10k-config"; + src = ../dotfiles; + file = ".p10k.zsh"; + } + ]; + + zplug = { + enable = true; + plugins = [ + { name = "romkatv/powerlevel10k"; tags = [ as:theme depth:1 ]; } + ]; + }; + + }; +} diff --git a/nixos/darwin-configuration.nix b/nixos/darwin-configuration.nix new file mode 100644 index 0000000..9d680d3 --- /dev/null +++ b/nixos/darwin-configuration.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +{ + nix.settings.experimental-features = ["nix-command" "flakes"]; + + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; []; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + nix.package = pkgs.nix; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; + + users.users.jadenmaxwell = { + name = "jadenmaxwell"; + home = "/Users/jadenmaxwell"; + }; + + # Used for backwards compatibility. + system.stateVersion = 4; +}