diff --git a/builders.nix b/builders.nix index 23d529a..17d29f3 100644 --- a/builders.nix +++ b/builders.nix @@ -1,4 +1,4 @@ -{ nixpkgs, self, ... }@inputs: +{ nixpkgs, nix-darwin, self, ... }@inputs: let makePkgs = system: (import nixpkgs { @@ -73,4 +73,26 @@ rec { builtins.listToAttrs (map toPartialHomeManagerConfig) systems; + + + toPartialDarwinConfig = + { user, hostname, system ? "aarch64-darwin", }: + nameValuePair + hostname + (nix-darwin.lib.darwinSystem { + pkgs = makePkgs system; + extraSpecialArgs = { inherit inputs self; }; + + modules = [ + inputs.home-manager.darwinModules.home-manager + ./hosts/${hostname}/configuration.nix + ]; + }); + + compileDarwinSystems = + systems: + lib.right + builtins.listToAttrs + (map toPartialDarwinConfig) + systems; } diff --git a/flake.nix b/flake.nix index d217c94..87d4090 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,8 @@ dunst-theme = { url = "github:d2718nis/rose-pine-dunst"; flake = false; }; niri = { url = "github:sodiboo/niri-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-darwin = { url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; + repo-clone.url = "git+https://git.zynh.me/Zynh0722/repo-clone"; fish_theme = { url = "git+https://git.zynh.me/Zynh0722/omf-theme"; flake = false; }; backgrounds = { url = "git+https://git.zynh.me/Zynh0722/backgrounds"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -30,11 +32,10 @@ homeConfigurations = builders.compileHomes [ { user = "zynh"; hostname = "msiserver"; } { user = "val"; hostname = "caveserver"; } - { - user = "zynh"; - hostname = "little-lightning"; - system = "aarch64-darwin"; - } + ]; + + darwinConfigurations = builders.compileDarwinSystems [ + { hostname = "little-lightning"; } ]; overlays.default = import ./pkgs; diff --git a/hosts/little-lightning/configuration.nix b/hosts/little-lightning/configuration.nix new file mode 100644 index 0000000..28c76d3 --- /dev/null +++ b/hosts/little-lightning/configuration.nix @@ -0,0 +1,34 @@ +{ pkgs, self, ... }: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = + [ + pkgs.vim + ]; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Enable alternative shell support in nix-darwin. + # programs.fish.enable = true; + + # Set Git commit hash for darwin-version. + system.configurationRevision = self.rev or self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 5; + + home-manager = { + users = { "zynh" = import ./home.nix; }; + backupFileExtension = "backup"; + useGlobalPkgs = true; + }; + + # The platform the configuration will be used on. + # nixpkgs.hostPlatform = "x86_64-darwin"; +}