From fc975d16c41c4f92f3e3dde4a837be52051b4e77 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Oct 2022 03:32:31 +0200 Subject: Port mba darwin configuration to flakes --- flake.lock | 22 ++++++++++++++++++++++ flake.nix | 9 ++++++++- system/mba.nix | 1 + system/settings/darwin.nix | 4 +++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index 8c6e18ca..b85f5372 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1664210064, + "narHash": "sha256-df6nKVZe/yAhmJ9csirTPahc0dldwm3HBhCVNA6qWr0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "02d2551c927b7d65ded1b3c7cd13da5cc7ae3fcf", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "nixos": { "locked": { "lastModified": 1664883812, @@ -64,6 +85,7 @@ }, "root": { "inputs": { + "darwin": "darwin", "nixos": "nixos", "nixos-hardware": "nixos-hardware", "nixos-unstable": "nixos-unstable", diff --git a/flake.nix b/flake.nix index 2de8b6cf..92a31715 100644 --- a/flake.nix +++ b/flake.nix @@ -4,13 +4,20 @@ nixos-unstable.url = github:NixOS/nixpkgs/nixos-unstable; nixpkgs-unstable.url = github:NixOS/nixpkgs; nixos-hardware.url = github:NixOS/nixos-hardware; + darwin.url = github:lnl7/nix-darwin/master; + darwin.inputs.nixpkgs.follows = "nixpkgs-unstable"; }; - outputs = { self, nixos-unstable, ... }@attrs: { + outputs = { self, darwin, nixos-unstable, ... }@attrs: { nixosConfigurations.prefect = nixos-unstable.lib.nixosSystem { system = "x86_64-linux"; specialArgs = attrs; modules = [ ./system/prefect.nix ]; }; + darwinConfigurations.mba = darwin.lib.darwinSystem { + system = "x86_64-darwin"; # aarch64 is still failing on some compiler-rt derivation + specialArgs = attrs; + modules = [ ./system/mba.nix ]; + }; }; } diff --git a/system/mba.nix b/system/mba.nix index 6a896895..350eb430 100644 --- a/system/mba.nix +++ b/system/mba.nix @@ -25,6 +25,7 @@ # $ darwin-rebuild changelog system.stateVersion = 4; + nix.package = pkgs.nixVersions.stable; # You should generally set this to the total number of logical cores in your system. # $ sysctl -n hw.ncpu nix.settings = { diff --git a/system/settings/darwin.nix b/system/settings/darwin.nix index 62859e7e..65d6f3ee 100644 --- a/system/settings/darwin.nix +++ b/system/settings/darwin.nix @@ -25,7 +25,9 @@ enable = true; enableCompletion = false; # Causes >2s startup time, overlaps home-manager config enableBashCompletion = true; - loginShellInit = builtins.readFile "/System/Library/Templates/Data/private/etc/zprofile"; + loginShellInit = '' + source /System/Library/Templates/Data/private/etc/zprofile + ''; interactiveShellInit = '' if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then setopt COMBINING_CHARS -- cgit 1.4.1