diff --git a/config.nix b/config.nix index ffdb179..4832161 100644 --- a/config.nix +++ b/config.nix @@ -1,5 +1,8 @@ { myConfig = { + macos = { + Username = "lsoriano"; + }; essentials = { # !!! replace it with your own, else system might malfunction. Username = "kenji"; @@ -65,7 +68,7 @@ sshUser = ""; sshKey = ""; system = ""; - supportedFeatures = ["big-parallel" "kvm" "nixos-test"]; + supportedFeatures = ["apple-virt" "big-parallel" "kvm" "nixos-test"]; } ]; }; diff --git a/flake.nix b/flake.nix index 9215c26..009a73b 100644 --- a/flake.nix +++ b/flake.nix @@ -11,8 +11,10 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - hyprland.url = "github:hyprwm/Hyprland"; - hyprland.inputs.nixpkgs.follows = "nixpkgs"; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager"; @@ -37,66 +39,55 @@ home-manager, darwin, chaotic, - nixovim, jovian, ... } @ inputs: let config = import ./config.nix; - - mkArgs = system: + system = "x86_64-linux"; + args = { inherit inputs system; } // config; - - systems = ["x86_64-linux" "aarch64-linux"]; - in - flake-utils.lib.eachSystem systems (system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - }; - args = mkArgs system; - in { - }) - // { - nixosConfigurations = { - hakase = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = mkArgs "x86_64-linux"; - modules = [ - chaotic.nixosModules.default - home-manager.nixosModules.home-manager - jovian.nixosModules.default - nixovim.nixosModules.default - ./hosts/hakase/configuration.nix - ]; - }; - }; - - homeConfigurations = { - hakase = home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - extraSpecialArgs = mkArgs "x86_64-linux"; - }; - modules = [ - home-manager.nixosModules.home-manager - ./home/hakase.nix - ]; - }; - }; - - darwinConfigurations = { - macos = darwin.lib.darwinSystem { - system = "aarch64-darwin"; - specialArgs = mkArgs "aarch64-darwin"; - modules = [ - home-manager.darwinModules.home-manager - ./hosts/macos/darwin.nix - ]; - }; + in { + nixosConfigurations = { + hakase = nixpkgs.lib.nixosSystem { + specialArgs = args; + modules = [ + chaotic.nixosModules.default + home-manager.nixosModules.home-manager + jovian.nixosModules.default + ./hosts/hakase/configuration.nix + ]; }; }; + + homeConfigurations = { + hakase = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + config.allowUnfree = true; + extraSpecialArgs = args; + }; + modules = [ + home-manager.nixosModules.home-manager + ./home/hakase.nix + ]; + }; + }; + darwinConfigurations = { + macos = darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = + { + inherit inputs; + system = "aarch64-darwin"; + } + // config; + modules = [ + home-manager.darwinModules.home-manager + ./hosts/macos/darwin.nix + ]; + }; + }; + }; } diff --git a/hosts/macos/darwin.nix b/hosts/macos/darwin.nix index 2792f70..98bf5eb 100644 --- a/hosts/macos/darwin.nix +++ b/hosts/macos/darwin.nix @@ -3,44 +3,32 @@ myConfig, inputs, system, - mkArgs, + specialArgs, ... }: { imports = [ ../../modules/default/darwin.nix ]; - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget environment.systemPackages = []; - # Auto upgrade nix package and the daemon service. - # services.nix-daemon.enable = true; - # services.karabiner-elements.enable = true; - # nix.package = pkgs.nix; - - # Necessary for using flakes on this system. nix.settings.experimental-features = "nix-command flakes"; - nix.settings.trusted-users = myConfig.optionals.Builds.trustedUsers; + # nix.settings.trusted-users = myConfig.optionals.Builds.trustedUsers; - # Create /etc/zshrc that loads the nix-darwin environment. programs.zsh.enable = true; # default shell on catalina programs.fish.enable = true; - # $ darwin-rebuild changelog system.stateVersion = 5; - # The platform the configuration will be used on. nixpkgs.hostPlatform = "aarch64-darwin"; security.pam.services.sudo_local.touchIdAuth = true; - users.users.${myConfig.essentials.Username} = { - name = "${myConfig.essentials.Username}"; - home = "/Users/${myConfig.essentials.Username}"; - # shell = pkgs.${myConfig.general.terminal.Shell}; # no support for nix-darwin, but can be changed via chsh. + users.users.${myConfig.macos.Username} = { + name = "${myConfig.macos.Username}"; + home = "/Users/${myConfig.macos.Username}"; }; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = mkArgs system; - home-manager.users.${myConfig.essentials.Username} = import ../../home/darwin.nix; + home-manager.extraSpecialArgs = specialArgs; + home-manager.users.${myConfig.macos.Username} = import ../../home/darwin.nix; } diff --git a/modules/default/darwin.nix b/modules/default/darwin.nix index 72c045f..c576eb0 100644 --- a/modules/default/darwin.nix +++ b/modules/default/darwin.nix @@ -1,6 +1,5 @@ { imports = [ ../../packages/python/default.nix - ../../packages/virtualbox/default.nix ]; }