nix darwin config
This commit is contained in:
103
flake-snapshot.nix
Normal file
103
flake-snapshot.nix
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
48
flake.lock
generated
Normal file
48
flake.lock
generated
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735685839,
|
||||
"narHash": "sha256-62xAPSs5VRZoPH7eRanUn5S5vZEd+8vM4bD5I+zxokc=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "6a1fdb2a1204c0de038847b601cff5012e162b5e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1735821806,
|
||||
"narHash": "sha256-cuNapx/uQeCgeuhUhdck3JKbgpsml259sjUQnWM7zW8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d6973081434f88088e5321f83ebafe9a1167c367",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
97
flake.nix
Normal file
97
flake.nix
Normal file
@@ -0,0 +1,97 @@
|
||||
{
|
||||
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";
|
||||
# home-manager.url = "github:nix-community/home-manager";
|
||||
# home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nix-darwin, nixpkgs }:
|
||||
let
|
||||
configuration = { pkgs, ... }: {
|
||||
# List packages installed in system profile. To search by name, run:
|
||||
# $ nix-env -qaP | grep wget
|
||||
environment.systemPackages =
|
||||
[
|
||||
pkgs.vim
|
||||
];
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
19
home.nix
Normal file
19
home.nix
Normal file
@@ -0,0 +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;
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
# programs.fish.enable = true;
|
||||
programs.zsh.enable = true;
|
||||
}
|
||||
BIN
modules/apps/.DS_Store
vendored
Normal file
BIN
modules/apps/.DS_Store
vendored
Normal file
Binary file not shown.
50
modules/apps/1password/default.nix
Normal file
50
modules/apps/1password/default.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{ 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
|
||||
# '';
|
||||
|
||||
# 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 "ssh"]
|
||||
program = "/run/current-system/sw/bin/op-ssh-sign"
|
||||
|
||||
[commit]
|
||||
gpgsign = true
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# 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 to open with gnomekeyring
|
||||
security.pam.services."1password".enableGnomeKeyring = true;
|
||||
}
|
||||
0
modules/environment/default.nix
Normal file
0
modules/environment/default.nix
Normal file
2
rebuild.sh
Normal file
2
rebuild.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#bin/bash
|
||||
darwin-rebuild switch --flake .
|
||||
Reference in New Issue
Block a user