From 54b0c5dd8e3913a329617d2809205664a5947a7c Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Fri, 17 Mar 2023 21:35:13 +0000 Subject: [PATCH] darwin: add jakehillion-mbp-m1-13 --- flake.lock | 22 +++++++++++++++++ flake.nix | 32 +++++++++++++++++++++---- hosts/jakehillion-mbp-m1-13/darwin | 0 hosts/jakehillion-mbp-m1-13/default.nix | 12 ++++++++++ hosts/jakehillion-mbp-m1-13/system | 1 + 5 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 hosts/jakehillion-mbp-m1-13/darwin create mode 100644 hosts/jakehillion-mbp-m1-13/default.nix create mode 100644 hosts/jakehillion-mbp-m1-13/system diff --git a/flake.lock b/flake.lock index 7c6741e..c809532 100644 --- a/flake.lock +++ b/flake.lock @@ -43,6 +43,27 @@ "type": "github" } }, + "darwin_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -99,6 +120,7 @@ "root": { "inputs": { "agenix": "agenix", + "darwin": "darwin_2", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" diff --git a/flake.nix b/flake.nix index 54b9b57..4c802e0 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,9 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + darwin.url = "github:lnl7/nix-darwin/master"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; @@ -12,26 +15,47 @@ description = "Hillion Nix flake"; - outputs = { self, nixpkgs, nixpkgs-unstable, agenix, home-manager }@inputs: { + outputs = { self, nixpkgs, nixpkgs-unstable, agenix, home-manager, darwin, ... }@inputs: { nixosConfigurations = let fqdns = builtins.attrNames (builtins.readDir ./hosts); + isNixos = fqdn: !builtins.pathExists ./hosts/${fqdn}/darwin; mkHost = fqdn: - let system = builtins.readFile ./hosts/${fqdn}/system; in + let system = builtins.readFile ./hosts/${fqdn}/system; + in nixpkgs.lib.nixosSystem { inherit system; specialArgs = inputs; modules = [ ./hosts/${fqdn}/default.nix agenix.nixosModules.default - home-manager.nixosModule + home-manager.nixosModules.default { system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; } ]; }; in - nixpkgs.lib.genAttrs fqdns mkHost; + nixpkgs.lib.genAttrs (builtins.filter isNixos fqdns) mkHost; + + darwinConfigurations = + let + hosts = builtins.attrNames (builtins.readDir ./hosts); + isDarwin = host: builtins.pathExists ./hosts/${host}/darwin; + mkHost = host: + let system = builtins.readFile ./hosts/${host}/system; + in + darwin.lib.darwinSystem { + inherit system; + inherit inputs; + modules = [ + ./hosts/${host}/default.nix + agenix.darwinModules.default + home-manager.darwinModules.default + ]; + }; + in + nixpkgs.lib.genAttrs (builtins.filter isDarwin hosts) mkHost; formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".nixpkgs-fmt; formatter."aarch64-darwin" = nixpkgs.legacyPackages."aarch64-darwin".nixpkgs-fmt; diff --git a/hosts/jakehillion-mbp-m1-13/darwin b/hosts/jakehillion-mbp-m1-13/darwin new file mode 100644 index 0000000..e69de29 diff --git a/hosts/jakehillion-mbp-m1-13/default.nix b/hosts/jakehillion-mbp-m1-13/default.nix new file mode 100644 index 0000000..28779f5 --- /dev/null +++ b/hosts/jakehillion-mbp-m1-13/default.nix @@ -0,0 +1,12 @@ +{ pkgs, config, agenix, ... }: + +{ + config.services.nix-daemon.enable = true; + + config.environment.systemPackages = with pkgs; [ + git + htop + nix + vim + ]; +} diff --git a/hosts/jakehillion-mbp-m1-13/system b/hosts/jakehillion-mbp-m1-13/system new file mode 100644 index 0000000..793fafc --- /dev/null +++ b/hosts/jakehillion-mbp-m1-13/system @@ -0,0 +1 @@ +aarch64-darwin \ No newline at end of file