From 386d856c6082706b9710d93bd75f28f5c771ab4f Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 17 May 2024 16:03:50 +0200 Subject: [PATCH] Update flake --- nix/flake.lock | 33 +++++++++++++++++++++++++++------ nix/flake.nix | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/nix/flake.lock b/nix/flake.lock index a024de3..22c5c48 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1712212014, - "narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=", + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", "owner": "nix-community", "repo": "home-manager", - "rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", "type": "github" }, "original": { @@ -20,13 +20,33 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715901937, + "narHash": "sha256-eMyvWP56ZOdraC2IOvZo0/RTDcrrsqJ0oJWDC76JTak=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "ffc01182f90118119930bdfc528c1ee9a39ecef8", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1712163089, - "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", + "lastModified": 1715787315, + "narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", + "rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", "type": "github" }, "original": { @@ -39,6 +59,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs" } } diff --git a/nix/flake.nix b/nix/flake.nix index 4c8d414..6066d4c 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -3,17 +3,53 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { nixpkgs, home-manager, ... }: + outputs = { self, nix-darwin, nixpkgs, home-manager, ... }: let system = "x86_64-darwin"; pkgs = nixpkgs.legacyPackages.${system}; + + configuration = { pkgs, ... }: { + environment.systemPackages = + [ + pkgs.vim + ]; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + nix.settings.experimental-features = "nix-command flakes"; + + programs.zsh.enable = true; # default shell on catalina + + # 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 = 4; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = system; + }; in { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#Martins-MacBook-Pro + darwinConfigurations."Martins-MacBook-Pro" = nix-darwin.lib.darwinSystem { + modules = [ configuration ]; + }; + + # Expose the package set, including overlays, for convenience. + darwinPackages = self.darwinConfigurations."Martins-MacBook-Pro".pkgs; + homeConfigurations = { "moustachioed" = home-manager.lib.homeManagerConfiguration { inherit pkgs;