From 96305f635e7a664edc554f799e8538679a31b6a8 Mon Sep 17 00:00:00 2001 From: reo101 Date: Fri, 25 Nov 2022 14:51:29 +0200 Subject: [PATCH] feat(darwin): enable home-manager support Add `home-manager` config for `apavel` Add some `configuration.nix` options for `apavel-a01`: - `FiraCode` nerdfont - Basic keyboard config - TouchID for `sudo` --- flake.nix | 21 +++++++-- nix-darwin/apavel-a01/configuration.nix | 13 ++++++ nix-darwin/apavel-a01/home/apavel.nix | 62 +++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 nix-darwin/apavel-a01/home/apavel.nix diff --git a/flake.nix b/flake.nix index 41c31eb..2c8e50d 100644 --- a/flake.nix +++ b/flake.nix @@ -129,16 +129,29 @@ }; darwinConfigurations = - let mkHost = system: hostname: nix-darwin.lib.darwinSystem { + let mkHost = system: hostname: users: nix-darwin.lib.darwinSystem { inherit system; modules = [ ./nix-darwin/${hostname}/configuration.nix + home-manager.darwinModules.home-manager + { + home-manager = { + useGlobalPkgs = false; + useUserPackages = true; + users = nixpkgs.lib.attrsets.genAttrs + users + (user: import ./nix-darwin/${hostname}/home/${user}.nix); + + extraSpecialArgs = { inherit inputs; }; + }; + } ] ++ (builtins.attrValues nixDarwinModules); inputs = { inherit inputs outputs nix-darwin nixpkgs; }; }; - in rec { - apavel-a01 = mkHost "x86_64-darwin" "apavel-a01"; - }; + in + rec { + apavel-a01 = mkHost "x86_64-darwin" "apavel-a01" [ "apavel" ]; + }; homeConfigurations = { # "nix-on-droid@cheetah" = home-manager.lib.homeManagerConfiguration { diff --git a/nix-darwin/apavel-a01/configuration.nix b/nix-darwin/apavel-a01/configuration.nix index 62fdaa5..1e17424 100644 --- a/nix-darwin/apavel-a01/configuration.nix +++ b/nix-darwin/apavel-a01/configuration.nix @@ -13,6 +13,19 @@ # Create /etc/zshrc that loads the nix-darwin environment. programs.zsh.enable = true; # default shell on catalina + # Fonts + fonts.fontDir.enable = true; + fonts.fonts = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; + + # Keyboard + system.keyboard.enableKeyMapping = true; + system.keyboard.remapCapsLockToEscape = true; + + # Add ability to used TouchID for sudo authentication + security.pam.enableSudoTouchIdAuth = true; + # Used for backwards compatibility, please read the changelog before changing. # > darwin-rebuild changelog system.stateVersion = 4; diff --git a/nix-darwin/apavel-a01/home/apavel.nix b/nix-darwin/apavel-a01/home/apavel.nix new file mode 100644 index 0000000..52b54fb --- /dev/null +++ b/nix-darwin/apavel-a01/home/apavel.nix @@ -0,0 +1,62 @@ +{ inputs, lib, config, pkgs, ... }: + +{ + home = { + # username = "apavel"; + # homeDirectory = "/Users/apavel"; + stateVersion = "22.05"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.packages = with pkgs; [ + # Dhall + dhall + dhall-lsp-server + + # Nix + rnix-lsp + nil + + # Zig + zigpkgs.master + inputs.zls-overlay.packages.x86_64-darwin.default + ]; + + nixpkgs = { + overlays = [ + inputs.zig-overlay.overlays.default + ]; + + config.allowUnfree = true; + }; + + programs.git = { + enable = true; + userName = "apavel"; + userEmail = "apavel@vmware.com"; + signing = { + signByDefault = true; + key = "0x52F3E1D376F692C0"; + }; + }; + + # services.gpg-agent = { + # enable = true; + # defaultCacheTtl = 1800; + # enableSshSupport = true; + # }; + + # home.file.".stack/config.yaml".text = lib.generators.toYAML {} { + # templates = { + # scm-init = "git"; + # params = with config.programs.git; { + # author-name = userName; + # author-email = userEmail; + # github-username = userName; + # }; + # }; + # nix.enable = true; + # }; +}