From 8cfa304ef73906df9439814cd9b72a1d10f93383 Mon Sep 17 00:00:00 2001 From: Alexandre1a Date: Tue, 2 Dec 2025 21:41:53 +0100 Subject: [PATCH] Added the 'premier jet' of my nix-darwin config --- flake.lock | 22 ++++++++++++++++++ flake.nix | 17 +++++++++++--- hosts/macos/configuration.nix | 23 +++++++++++++++++++ hosts/{default => nixos}/configuration.nix | 0 .../hardware-configuration.nix | 0 hosts/{default => nixos}/home.nix | 0 hosts/{default => nixos}/modules.nix | 0 7 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 hosts/macos/configuration.nix rename hosts/{default => nixos}/configuration.nix (100%) rename hosts/{default => nixos}/hardware-configuration.nix (100%) rename hosts/{default => nixos}/home.nix (100%) rename hosts/{default => nixos}/modules.nix (100%) diff --git a/flake.lock b/flake.lock index bd72589..30a3384 100644 --- a/flake.lock +++ b/flake.lock @@ -380,6 +380,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764161084, + "narHash": "sha256-HN84sByg9FhJnojkGGDSrcjcbeioFWoNXfuyYfJ1kBE=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "e95de00a471d07435e0527ff4db092c84998698e", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1763966396, @@ -439,6 +460,7 @@ "inputs": { "home-manager": "home-manager", "hyprland": "hyprland", + "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs_2" } }, diff --git a/flake.nix b/flake.nix index 0be6113..e4efb7c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,27 +1,38 @@ { - description = "Nixos config flake"; + description = "Alexandre1a's nixOS and macOS config flake"; inputs = { + # NixPKGS unstable nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # Hyprland hyprland.url = "github:hyprwm/Hyprland"; + nix-darwin = { + url = "github:nix-darwin/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, ... }@inputs: { + outputs = { self,nix-darwin ,nixpkgs, ... }@inputs: { # use "nixos", or your hostname as the name of the configuration # it's a better practice than "default" shown in the video nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs;}; modules = [ - ./hosts/default/configuration.nix + ./hosts/nixos/configuration.nix inputs.home-manager.nixosModules.default ]; }; + + darwinConfigurations.macOS = nix-darwin.lib.darwinSystem { + modules = [ + ./hosts/macos/configuration.nix + ]; + }; }; } diff --git a/hosts/macos/configuration.nix b/hosts/macos/configuration.nix new file mode 100644 index 0000000..1358861 --- /dev/null +++ b/hosts/macos/configuration.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: + +{ + # All imports go here + imports = + [ + ./modules.nix + ]; + + # All System packages + environment.systemPackages = + [ + pkgs.vim + ]; + + # Enable required settings + # Flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + # Target arch + nixpkgs.hostPlatform = "aarch64-darwin"; + # Nix-Darwin State Version + system.stateVersion = 6; +} diff --git a/hosts/default/configuration.nix b/hosts/nixos/configuration.nix similarity index 100% rename from hosts/default/configuration.nix rename to hosts/nixos/configuration.nix diff --git a/hosts/default/hardware-configuration.nix b/hosts/nixos/hardware-configuration.nix similarity index 100% rename from hosts/default/hardware-configuration.nix rename to hosts/nixos/hardware-configuration.nix diff --git a/hosts/default/home.nix b/hosts/nixos/home.nix similarity index 100% rename from hosts/default/home.nix rename to hosts/nixos/home.nix diff --git a/hosts/default/modules.nix b/hosts/nixos/modules.nix similarity index 100% rename from hosts/default/modules.nix rename to hosts/nixos/modules.nix