From 850280f483654ff94652b742844a4bda2b808dbc Mon Sep 17 00:00:00 2001 From: reo101 Date: Tue, 22 Nov 2022 23:36:10 +0200 Subject: [PATCH] feat(nix-darwin): add config for `apavel-a01` --- flake.lock | 138 +++++++++++++++++++++++- flake.nix | 19 ++++ nix-darwin/apavel-a01/configuration.nix | 19 ++++ 3 files changed, 175 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 8129c7e..20d46b6 100644 --- a/flake.lock +++ b/flake.lock @@ -46,6 +46,57 @@ "type": "github" } }, + "flake-utils_3": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "zls-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -67,6 +118,22 @@ "type": "github" } }, + "known-folders": { + "flake": false, + "locked": { + "lastModified": 1659425144, + "narHash": "sha256-xMgdOKwWqBmw7avcioqQQrrPU1MjzlBMtNjqPfOEtDQ=", + "owner": "ziglibs", + "repo": "known-folders", + "rev": "24845b0103e611c108d6bc334231c464e699742c", + "type": "github" + }, + "original": { + "owner": "ziglibs", + "repo": "known-folders", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils", @@ -113,6 +180,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1668784520, + "narHash": "sha256-gGgVAMwYPPmrfnvnoRi6OkEB5KRsNTb9uYzEceLdO/g=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "6349b99bc2b96ded34d068a88c7c5ced406b7f7f", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "nix-formatter-pack": { "inputs": { "nixpkgs": [ @@ -230,9 +318,11 @@ "inputs": { "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", + "nix-darwin": "nix-darwin", "nix-on-droid": "nix-on-droid", "nixpkgs": "nixpkgs", - "zig-overlay": "zig-overlay" + "zig-overlay": "zig-overlay", + "zls-overlay": "zls-overlay" } }, "zig-overlay": { @@ -255,6 +345,52 @@ "repo": "zig-overlay", "type": "github" } + }, + "zig-overlay_2": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "zls-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1667477360, + "narHash": "sha256-EE1UMXQr4FkQFGoOHDslqi3Q7V2BUkLMrOBeV/UJYoE=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "c8900204fcd5c09ab0c9b7bb7f4d04dacab3c462", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + }, + "zls-overlay": { + "inputs": { + "flake-utils": "flake-utils_3", + "gitignore": "gitignore", + "known-folders": "known-folders", + "nixpkgs": [ + "nixpkgs" + ], + "zig-overlay": "zig-overlay_2" + }, + "locked": { + "lastModified": 1669054884, + "narHash": "sha256-W78MKkuv/G0thIMDTqQT3+jM+CPKiGj3juAnW8EeTLg=", + "owner": "zigtools", + "repo": "zls", + "rev": "ea2caee3ad92c3c2f13ec392f751c12e1d02f4bd", + "type": "github" + }, + "original": { + "owner": "zigtools", + "repo": "zls", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 41482f3..f80697c 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,12 @@ inputs.home-manager.follows = "home-manager"; }; + # Nix Darwin + nix-darwin = { + url = "github:lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # Home Manager home-manager = { url = "github:nix-community/home-manager/release-22.05"; @@ -49,6 +55,7 @@ outputs = { self , nixpkgs , nix-on-droid + , nix-darwin , home-manager # , hardware # , nix-colors @@ -121,6 +128,18 @@ default = cheetah; }; + darwinConfigurations = + let mkHost = system: hostname: nix-darwin.lib.darwinSystem { + inherit system; + modules = [ + ./nix-darwin/${hostname}/configuration.nix + ] ++ (builtins.attrValues nixDarwinModules); + inputs = { inherit inputs outputs darwin nixpkgs; }; + }; + in rec { + apavel-a01 = mkHost "x86_64-darwin" "apavel-a01"; + }; + homeConfigurations = { # "nix-on-droid@cheetah" = home-manager.lib.homeManagerConfiguration { # pkgs = nixpkgs.legacyPackages.x86_64-linux; diff --git a/nix-darwin/apavel-a01/configuration.nix b/nix-darwin/apavel-a01/configuration.nix index e69de29..62fdaa5 100644 --- a/nix-darwin/apavel-a01/configuration.nix +++ b/nix-darwin/apavel-a01/configuration.nix @@ -0,0 +1,19 @@ +{ inputs, outputs, lib, config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; []; + + # environment.darwinConfig = builtins.toString ./configuration.nix; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + + nix.package = pkgs.nix; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + + # Used for backwards compatibility, please read the changelog before changing. + # > darwin-rebuild changelog + system.stateVersion = 4; +}