add home-manager config

This commit is contained in:
Stephen Bryant
2025-01-04 22:49:34 -05:00
parent de7ccf78d7
commit 68c1faf38c
7 changed files with 929 additions and 961 deletions

View File

@@ -1,103 +0,0 @@
{
description = "Example Darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
configuration = { pkgs, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
[
pkgs.vim
# pkgs._1password-cli
# pkgs._1password-gui
pkgs.homebrew = {
enable = true;
packages = with pkgs; [
# homebrew packages
"1password-cli"
"1password"
];
};
];
nix.extraOptions = ''
extra-platforms = x86_64-darwin aarch64-darwin
'';
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
services.tailscale = {
enable = true;
};
security.pam.enableSudoTouchIdAuth = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Create /etc/zshrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
# Enable 1password plugins on interactive shell init
programs.bash.interactiveShellInit = ''
source /home/stephen/.config/op/plugins.sh
'';
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
system.defaults = {
dock.autohide = true;
dock.mru-spaces = false;
finder.AppleShowAllExtensions = true;
finder.FXPreferredViewStyle = "clmv";
loginwindow.LoginwindowText = "swaphb-mba";
screencapture.location = "~/Pictures/screenshots";
screensaver.askForPasswordDelay = 10;
};
# 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 = "aarch64-darwin";
nixpkgs.config = {
allowUnfree = true;
allowBroken = true;
# homebrew = {
# enable = true;
# packages = with pkgs; [
# # homebrew packages
# "1password-cli"
# "1password"
# ];
# };
# allowAliases = true;
# packageOverrides = pkgs: {
# # Add a package to the set.
# _1password-cli = pkgs.callPackage ./pkgs/1password-cli { };
# _1password-gui = pkgs.callPackage ./pkgs/1password-gui { };
# };
};
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#swaphb-mba
darwinConfigurations."swaphb-mba" = nix-darwin.lib.darwinSystem {
modules = [ configuration ];
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations."swaphb-mba".pkgs;
};
}

21
flake.lock generated
View File

@@ -17,6 +17,26 @@
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1736013363,
"narHash": "sha256-P4lsS2Y5GzBfC8OfXtD/xWEucX6oHGTjOzjEjEJbXfc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0d7908bd09165db6699908b7e3970f137327cbf0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"homebrew-bundle": {
"flake": false,
"locked": {
@@ -170,6 +190,7 @@
},
"root": {
"inputs": {
"home-manager": "home-manager",
"homebrew-bundle": "homebrew-bundle",
"homebrew-cask": "homebrew-cask",
"homebrew-core": "homebrew-core",

View File

@@ -20,20 +20,47 @@
url = "github:homebrew/homebrew-bundle";
flake = false;
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nix-darwin, nix-homebrew, homebrew-core, homebrew-cask, homebrew-bundle, ... }:
outputs = inputs@{ self, nix-darwin, nix-homebrew, homebrew-core, homebrew-cask, homebrew-bundle, home-manager, ... }:
let
configuration = { pkgs, lib, inputs, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
#####################
### Nix Packages ###
#####################
environment.systemPackages =
[
pkgs.vim
pkgs.lens
];
################
### Homebrew ###
################
homebrew = {
enable = true;
# onActivation.cleanup = "uninstall";
taps = [];
brews = [
"cowsay"
"git"
];
casks = [];
};
################
### Nix-Darwin ###
################
nix.extraOptions = ''
extra-platforms = x86_64-darwin aarch64-darwin
experimental-features = nix-command flakes
'';
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
@@ -104,6 +131,22 @@
allowBroken = true;
};
};
homeconfig = {pkgs, lib, ...}: {
# this is internal compatibility configuration
# for home-manager, don't change this!
home.stateVersion = "24.05";
# Let home-manager install and manage itself.
programs.home-manager.enable = true;
home.packages = with pkgs; [];
home.sessionVariables = {
EDITOR = "nano";
};
home.homeDirectory = lib.mkForce "/Users/stephen"; # Update this line
};
in
{
# Build darwin flake using:
@@ -126,6 +169,13 @@
mutableTaps = false;
};
}
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.verbose = true;
home-manager.users.stephen = homeconfig;
}
];
};

View File

@@ -1,19 +1,19 @@
{ pkgs, ... }: {
home = {
stateVersion = "23.11";
username = "emiliazapata";
homeDirectory = "/Users/emiliazapata";
# Then we add the packages we want in the array using pkgs.<name>
packages = [
pkgs.git
pkgs.neovim
];
};
# This is to ensure programs are using ~/.config rather than
# /Users/<username/Library/whatever
xdg.enable = true;
# { pkgs, ... }: {
# home = {
# stateVersion = "23.11";
# username = "emiliazapata";
# homeDirectory = "/Users/emiliazapata";
# # Then we add the packages we want in the array using pkgs.<name>
# packages = [
# pkgs.git
# pkgs.neovim
# ];
# };
# # This is to ensure programs are using ~/.config rather than
# # /Users/<username/Library/whatever
# xdg.enable = true;
programs.home-manager.enable = true;
# programs.fish.enable = true;
programs.zsh.enable = true;
}
# programs.home-manager.enable = true;
# # programs.fish.enable = true;
# programs.zsh.enable = true;
# }

View File

@@ -1,50 +1,50 @@
{ username, ... }:
{
home-manager.users.${username} = {
home.file = {
# Configuration for 1password SSH Agent.
".ssh/config".text = ''
Host *
IdentityAgent ~/.1password/agent.sock
# { username, ... }:
# {
# home-manager.users.${username} = {
# home.file = {
# # Configuration for 1password SSH Agent.
# ".ssh/config".text = ''
# Host *
# IdentityAgent ~/.1password/agent.sock
# Host git.swaphb.dev
# HostName swaphb.dev
# Port 23231
# '';
# # Host git.swaphb.dev
# # HostName swaphb.dev
# # Port 23231
# # '';
# Configure 1password to handle SSH commit signing
".gitconfig".text = ''
[user]
name = "Stephen Bryant"
email = s@swaphb.com
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx0WMlfx+AwcROXFO+/all/WkLvBKpEkjwRY15tjSiB
# # Configure 1password to handle SSH commit signing
# ".gitconfig".text = ''
# [user]
# name = "Stephen Bryant"
# email = s@swaphb.com
# signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx0WMlfx+AwcROXFO+/all/WkLvBKpEkjwRY15tjSiB
[gpg]
format = ssh
# [gpg]
# format = ssh
[gpg "ssh"]
program = "/run/current-system/sw/bin/op-ssh-sign"
# [gpg "ssh"]
# program = "/run/current-system/sw/bin/op-ssh-sign"
[commit]
gpgsign = true
'';
};
};
# [commit]
# gpgsign = true
# '';
# };
# };
# Enable 1password plugins on interactive shell init
programs.bash.interactiveShellInit = ''
source /home/${username}/.config/op/plugins.sh
'';
# # Enable 1password plugins on interactive shell init
# programs.bash.interactiveShellInit = ''
# source /home/${username}/.config/op/plugins.sh
# '';
# Enable 1password and the CLI
programs = {
_1password.enable = true;
_1password-gui = {
enable = true;
polkitPolicyOwners = [ "${username}" ];
};
};
# # Enable 1password and the CLI
# programs = {
# _1password.enable = true;
# _1password-gui = {
# enable = true;
# polkitPolicyOwners = [ "${username}" ];
# };
# };
# Enable 1password to open with gnomekeyring
security.pam.services."1password".enableGnomeKeyring = true;
}
# # Enable 1password to open with gnomekeyring
# security.pam.services."1password".enableGnomeKeyring = true;
# }

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +1,2 @@
#bin/bash
darwin-rebuild switch --flake .
darwin-rebuild switch --flake .#swaphb-mba