commit 4201d8fa91cf1bf8bac1c768d966052cc31cbbb1
parent c20be9bdcc7a81b6f3b861fa861c29ff030b8a0c
Author: Milutin Popovic <milutin@popovic.xyz>
Date: Sat, 7 Mar 2026 14:38:26 +0100
fix darwin config
Diffstat:
5 files changed, 211 insertions(+), 137 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -69,15 +69,16 @@
]
},
"locked": {
- "lastModified": 1767437240,
- "narHash": "sha256-OA0dBHhccdupFXp+/eaFfb8K1dQxk61in4aF5ITGVX8=",
+ "lastModified": 1747688870,
+ "narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "1cfa305fba94468f665de1bd1b62dddf2e0cb012",
+ "rev": "d5f1f641b289553927b3801580598d200a501863",
"type": "github"
},
"original": {
"owner": "nix-community",
+ "ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
@@ -97,6 +98,27 @@
"type": "github"
}
},
+ "nix-darwin": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1772379624,
+ "narHash": "sha256-NG9LLTWlz4YiaTAiRGChbrzbVxBfX+Auq4Ab/SWmk4A=",
+ "owner": "nix-darwin",
+ "repo": "nix-darwin",
+ "rev": "52d061516108769656a8bd9c6e811c677ec5b462",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-darwin",
+ "ref": "master",
+ "repo": "nix-darwin",
+ "type": "github"
+ }
+ },
"nixos-facter-modules": {
"locked": {
"lastModified": 1766558141,
@@ -178,6 +200,7 @@
"betterfox": "betterfox",
"disko": "disko",
"home-manager": "home-manager",
+ "nix-darwin": "nix-darwin",
"nixos-facter-modules": "nixos-facter-modules",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2",
diff --git a/flake.nix b/flake.nix
@@ -3,24 +3,30 @@
inputs = {
nixpkgs_stable.url = "nixpkgs/nixos-25.11";
nixpkgs.url = "nixpkgs/nixos-unstable";
+
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
- nix-darwin.inputs.nixpkgs.follows = "nixkgs";
+ nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
+
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
nixos-hardware.url = "github:NixOS/nixos-hardware";
- betterfox.url = "github:HeitorAugustoLN/betterfox-nix";
+ betterfox.url = "github:HeitorAugustoLN/betterfox-nix";
+
sops-nix = {
- url = "github:Mic92/sops-nix";
- inputs.nixpkgs.follows = "nixpkgs";
+ url = "github:Mic92/sops-nix";
+ inputs.nixpkgs.follows = "nixpkgs";
};
+
home-manager = {
- url = "github:nix-community/home-manager";
+ url = "github:nix-community/home-manager?ref=release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
+
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
+
outputs = {
self,
nixpkgs_stable,
@@ -32,133 +38,146 @@
sops-nix,
betterfox,
...
- } @inputs: let
- system = "x86_64-linux";
- pkgs = nixpkgs.legacyPackages.${system};
+ } @ inputs:
+ let
+ linuxSystem = "x86_64-linux";
+ darwinSystem = "aarch64-darwin";
+
+ pkgsLinux = nixpkgs.legacyPackages.${linuxSystem};
+ pkgsDarwin = nixpkgs.legacyPackages.${darwinSystem};
in {
nixosConfigurations = {
- nixos-frame = let
- hostName = "nixos-frame";
- in nixpkgs.lib.nixosSystem {
- inherit system;
- specialArgs = {
- inherit inputs;
- inherit hostName;
- };
- modules = [
- nixos-hardware.nixosModules.framework-13-7040-amd
- home-manager.nixosModules.home-manager
- sops-nix.nixosModules.sops
- ./system/host/host-frame.nix
- ./system/hardware/hardware-frame.nix
- {
- home-manager = {
- useGlobalPkgs = true;
- useUserPackages = true;
- extraSpecialArgs = {
- inherit system;
- inherit inputs;
- standalone = false;
+ nixos-frame =
+ let
+ hostName = "nixos-frame";
+ system = linuxSystem;
+ in
+ nixpkgs.lib.nixosSystem {
+ inherit system;
+ specialArgs = {
+ inherit inputs hostName system;
+ };
+ modules = [
+ nixos-hardware.nixosModules.framework-13-7040-amd
+ home-manager.nixosModules.home-manager
+ sops-nix.nixosModules.sops
+ ./system/host/host-frame.nix
+ ./system/hardware/hardware-frame.nix
+ {
+ home-manager = {
+ useGlobalPkgs = true;
+ useUserPackages = true;
+ extraSpecialArgs = {
+ inherit system inputs;
+ standalone = false;
+ };
+ users.mika = import ./users/mika.nix;
};
- users.mika = import ./users/mika.nix;
- };
- }
- ];
- };
- nixos-vm = let
- hostName = "nixos-vm";
- in nixpkgs.lib.nixosSystem {
- inherit system;
- specialArgs = {
- inherit inputs;
- inherit hostName;
+ }
+ ];
};
- modules = [
- home-manager.nixosModules.home-manager
- ./system/host/host-frame.nix
- ./system/hardware/hardware-vm.nix
- {
- home-manager = {
- useGlobalPkgs = true;
- useUserPackages = true;
- extraSpecialArgs = {
- inherit system;
- inherit inputs;
- standalone = false;
+
+ nixos-vm =
+ let
+ hostName = "nixos-vm";
+ system = linuxSystem;
+ in
+ nixpkgs.lib.nixosSystem {
+ inherit system;
+ specialArgs = {
+ inherit inputs hostName system;
+ };
+ modules = [
+ home-manager.nixosModules.home-manager
+ ./system/host/host-frame.nix
+ ./system/hardware/hardware-vm.nix
+ {
+ home-manager = {
+ useGlobalPkgs = true;
+ useUserPackages = true;
+ extraSpecialArgs = {
+ inherit system inputs;
+ standalone = false;
+ };
+ users.mika = import ./users/mika.nix;
};
- users.mika = import ./users/mika.nix;
- };
- }
- ];
- };
- nixos-server = let
- hostName = "nixos-server";
- in nixpkgs_stable.lib.nixosSystem {
- inherit system;
- specialArgs = {
- inherit inputs;
- inherit hostName;
+ }
+ ];
};
- modules = [
- home-manager.nixosModules.home-manager
- ./system/host/host-server.nix
- ./system/hardware/hardware-vm.nix
- {
- home-manager = {
- useGlobalPkgs = true;
- useUserPackages = true;
- extraSpecialArgs = {
- inherit system;
- inherit inputs;
- standalone = false;
+
+ nixos-server =
+ let
+ hostName = "nixos-server";
+ system = linuxSystem;
+ in
+ nixpkgs_stable.lib.nixosSystem {
+ inherit system;
+ specialArgs = {
+ inherit inputs hostName system;
+ };
+ modules = [
+ home-manager.nixosModules.home-manager
+ ./system/host/host-server.nix
+ ./system/hardware/hardware-vm.nix
+ {
+ home-manager = {
+ useGlobalPkgs = true;
+ useUserPackages = true;
+ extraSpecialArgs = {
+ inherit system inputs;
+ standalone = false;
+ };
+ users.r2d2 = import ./users/r2d2.nix;
};
- users.r2d2 = import ./users/r2d2.nix;
- };
- }
- ];
- };
+ }
+ ];
+ };
};
+
darwinConfigurations = {
- "mac" = let
+ mac =
+ let
hostName = "mac";
- system = "nixos-darwin";
- in nix-darwin.lib.darwinSys {
- specialArgs = {
- inherit system;
- inherit hostName;
- };
- modules = [
- home-manager.nixosModules.home-manager
- sops-nix.nixosModules.sops
- ./system/host/mac.nix
+ systemName = darwinSystem;
+ system = darwinSystem;
+ in
+ nix-darwin.lib.darwinSystem {
+ specialArgs = {
+ inherit hostName systemName inputs;
+ };
+ modules = [
+ home-manager.darwinModules.home-manager
+ sops-nix.darwinModules.sops
+ ./system/host/mac.nix
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
- inherit system;
- inherit inputs;
+ inherit system inputs;
standalone = false;
};
users.mika = import ./users/mika.nix;
};
}
-
- ]
-
- };
+ ];
+ };
};
+
homeConfigurations = {
- mika = home-manager.lib.homeManagerConfiguration {
- inherit pkgs;
- modules = [ ./users/mika.nix ];
- extraSpecialArgs = {
- inherit system;
- inherit inputs;
- standalone = true;
+ mika =
+ let
+ system = builtins.currentSystem;
+ pkgs = nixpkgs.legacyPackages.${system};
+ in
+ home-manager.lib.homeManagerConfiguration {
+ inherit pkgs;
+ modules = [ ./users/mika.nix ];
+ extraSpecialArgs = {
+ inherit system inputs;
+ standalone = true;
+ };
};
- };
};
-
};
}
diff --git a/justfile b/justfile
@@ -4,6 +4,12 @@ user := `whoami`
os:
sudo nixos-rebuild switch --flake ./#{{hostname}} --impure
+darwin:
+ sudo darwin-rebuild switch --flake ./#{{hostname}} --impure
+
+darwin_rollback:
+ sudo darwin-rebuild switch --flake --rollback
+
os_rollback:
sudo nixos-rebuild switch --flake --rollback
diff --git a/system/host/mac.nix b/system/host/mac.nix
@@ -1,16 +1,19 @@
{
pkgs,
hostName,
- system,
+ systemName,
...
-} :
+}:
{
- pkgs.hostPlatform = system;
+ # nix-darwin setup
+ nixpkgs.hostPlatform = systemName;
+ system.stateVersion = 6;
+ networking.hostName = hostName;
imports = [
../../users/root.nix
../../modules/nix_settings.nix
- ]
+ ];
environment.variables = {
__ETC_ZSHRC_SOURCED = "1";
@@ -20,7 +23,6 @@
# programs
programs = {
zsh.enable = true;
- dconf.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
@@ -31,9 +33,6 @@
users = {
users = {
mika = {
- isNormalUser = true;
- extraGroups = [ "wheel" ];
- initialPassword = "123";
shell = pkgs.zsh;
};
root = {
@@ -41,7 +40,6 @@
};
};
};
- security.sudo.wheelNeedsPassword = false;
environment.systemPackages = with pkgs; [
neovim
@@ -57,8 +55,31 @@
util-linux
pstree
wireguard-tools
+ kitty
];
+
+ homebrew = {
+ enable = true;
+ brewPrefix = "/opt/homebrew";
+
+ taps = [
+ "homebrew/cask"
+ "homebrew/cask-fonts"
+ ];
+
+ brews = [
+ "fzf"
+ "ripgrep"
+ ];
+
+ onActivation = {
+ autoUpdate = true;
+ upgrade = true;
+ cleanup = "zap";
+ };
+ };
+
fonts.packages = with pkgs; [
nerd-fonts.terminess-ttf
terminus_font
diff --git a/users/mika.nix b/users/mika.nix
@@ -3,7 +3,6 @@
pkgs,
lib,
standalone,
-
...
}:
let
@@ -21,21 +20,27 @@ in
stateVersion = "25.11";
};
- imports = if standalone
- then
- [
- ../modules/xdg.nix
- ../modules/nix_settings.nix
- ../modules/mbsync_timer.nix
- ../modules/theme.nix
- ../modules/firefox.nix
- ]
- else
- [
- ../modules/mbsync_timer.nix
- ../modules/theme.nix
- ../modules/firefox.nix
- ];
+ kitty = lib.mkIf (pkgs.stdenv.isDarwin) {
+ enable = true;
+ font = {
+ name = "Terminess Nerd Font";
+ size = 18;
+ };
+ settings = {
+ confirm_os_window_close = 0;
+ };
+ };
+
+ imports =
+ [
+ ../modules/mbsync_timer.nix
+ ../modules/firefox.nix
+ ]
+ ++ lib.optionals standalone [
+ ../modules/xdg.nix
+ ../modules/nix_settings.nix
+ ]
+ ++ lib.optional (!pkgs.stdenv.isDarwin) ../modules/theme.nix;
nixpkgs = if standalone
then {