initial commit

This commit is contained in:
2026-04-12 16:10:14 -04:00
commit 6ab0e5de69
8 changed files with 426 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
result/

1
common/overlays.nix Normal file
View File

@@ -0,0 +1 @@
prev: final: {}

86
flake.lock generated Normal file
View File

@@ -0,0 +1,86 @@
{
"nodes": {
"flake-schemas": {
"locked": {
"lastModified": 1775244557,
"narHash": "sha256-iYXRXIX9eafJmwJFAhqT3YxvvpNRuPFSLRCSpvGh8Ic=",
"rev": "15edbeeaf77e42216dbcba8bfd907fdeabb75a2b",
"revCount": 132,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.4.2/019d5cf2-ee3c-7313-964e-f3f83c35d509/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1775425411,
"narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.11",
"repo": "home-manager",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1772129556,
"narHash": "sha256-Utk0zd8STPsUJPyjabhzPc5BpPodLTXrwkpXBHYnpeg=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "ebec37af18215214173c98cf6356d0aca24a2585",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "nix-darwin-25.11",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1775811116,
"narHash": "sha256-t+HZK42pB6N+i5RGbuy7Xluez/VvWbembBdvzsc23Ss=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "54170c54449ea4d6725efd30d719c5e505f1c10e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-schemas": "flake-schemas",
"home-manager": "home-manager",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

97
flake.nix Normal file
View File

@@ -0,0 +1,97 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:lnl7/nix-darwin/nix-darwin-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*";
};
outputs = inputs @ {
self,
nixpkgs,
home-manager,
nix-darwin,
flake-schemas,
}: let
# set username, hostname, email, and time zone (TZ identifier) here as variables
userName = "username";
userEmail = "user@user.me";
hostName = "hostname";
timeZone = "America/Detroit";
# needed if you are going to utilize home-manager
extraSpecialArgs = {
inherit userName hostName userEmail timeZone;
};
# for any overlay packages that you need/build
userOverlays = { ... }: {
nixpkgs.overlays = [
self.common.overlays # this is user defined but it's empty
];
};
# utilizes flake-schemas, allows modularization between platforms/systems
# currently, you are not using the full potential of flake-schemas but i included it
# in case you build upon this flake - add platforms to the list below (e.g. "x86_64-linux")
supportedSystems = [ "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in {
schemas = flake-schemas.schemas;
common = {
overlays = import ./common/overlays;
};
# a development shell where you can tailor each package to your liking
devShell = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
deadnix
nixd
];
};
});
# system configuration utilizing home-manager
darwinConfigurations.${hostName} =
nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
inherit userName hostName userEmail;
hostname = hostName;
};
modules = [
userOverlays
./machine
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = extraSpecialArgs;
home-manager.backupFileExtension = "bak";
home-manager.users.${userName} = import ./home;
}
];
};
# utilizing _just_ home-manager
homeConfigurations.${hostName} =
home-manager.lib.homeManagerConfiguration {
pkgs = forEachSupportedSystem;
extraSpecialArgs = extraSpecialArgs;
modules = [
userOverlays
./home
];
};
};
}

40
home/default.nix Normal file
View File

@@ -0,0 +1,40 @@
{ pkgs, userName, userEmail }: {
# enable home-manager
programs.home-manager.enable = true;
# install packages here (that are within nixpkgs ofc)
home.packages = with pkgs; [
tailscale
];
# this example git configuration is tied to your user, not the system!
programs.git = {
enable = true;
userName = userName;
userEmail = userEmail;
extraConfig = {
init.defaultBranch = "master";
push.autoSetupRemote = true;
pull.rebase = false;
merge.tool = "nvimdiff";
mergetool.keepBackup = false;
};
ignores = [
".DS_Store"
".direnv"
".idea"
];
aliases = { };
};
# same idea with this example zsh configuration!
programs.zsh = {
enable = true;
autosuggestions.enable = true;
enableCompletion = true;
shellAliases = { };
};
}

31
machine/apps.nix Normal file
View File

@@ -0,0 +1,31 @@
{pkgs, ...}: {
# define what packages you want here (that are within nixpkgs)
environment.systemPackages = with pkgs; [
neovim
git
mas
];
environment.variables.EDITOR = "nvim";
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "zap";
};
# install mac app store apps here (must have apps already "purchased" before you can already download them)
# use the "mas" cli tool to help you find mas identifiers!
masApps = { };
taps = [
];
brews = [
];
casks = [
];
};
}

164
machine/configuration.nix Normal file
View File

@@ -0,0 +1,164 @@
{
pkgs,
userName,
hostName,
timeZone,
...
}: {
system = {
# activationScripts.postUserActivation.text = ''
# /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
# '';
primaryUser = userName;
defaults = {
# menuExtraClock.Show24Hour = true;
#
# dock = {
# autohide = true;
# };
#
# finder = {
# _FXShowPosixPathInTitle = true; # show full path in finder title
# AppleShowAllExtensions = true; # show all file extensions
# FXEnableExtensionChangeWarning = false; # disable warning when changing file extension
# QuitMenuItem = true; # enable quit menu item
# ShowPathbar = true; # show path bar
# ShowStatusBar = true; # show status bar
# };
# trackpad = {
# Clicking = true; # enable tap to click
# TrackpadRightClick = true; # enable two finger right click
# TrackpadThreeFingerDrag = true; # enable three finger drag
# };
# # customize settings that not supported by nix-darwin directly
# # Incomplete list of macOS `defaults` commands :
# # https://github.com/yannbertrand/macos-defaults
# NSGlobalDomain = {
# # `defaults read NSGlobalDomain "xxx"`
# "com.apple.swipescrolldirection" = true; # enable natural scrolling(default to true)
# "com.apple.sound.beep.feedback" = 0; # disable beep sound when pressing volume up/down key
# AppleInterfaceStyle = "Dark"; # dark mode
# AppleKeyboardUIMode = 3; # Mode 3 enables full keyboard control.
# ApplePressAndHoldEnabled = true; # enable press and hold
# # If you press and hold certain keyboard keys when in a text area, the keys character begins to repeat.
# # This is very useful for vim users, they use `hjkl` to move cursor.
# # sets how long it takes before it starts repeating.
# InitialKeyRepeat = 15; # normal minimum is 15 (225 ms), maximum is 120 (1800 ms)
# # sets how fast it repeats once it starts.
# KeyRepeat = 3; # normal minimum is 2 (30 ms), maximum is 120 (1800 ms)
# NSAutomaticCapitalizationEnabled = false; # disable auto capitalization
# NSAutomaticDashSubstitutionEnabled = false; # disable auto dash substitution
# NSAutomaticPeriodSubstitutionEnabled = false; # disable auto period substitution
# NSAutomaticQuoteSubstitutionEnabled = false; # disable auto quote substitution
# NSAutomaticSpellingCorrectionEnabled = false; # disable auto spelling correction
# NSNavPanelExpandedStateForSaveMode = true; # expand save panel by default
# NSNavPanelExpandedStateForSaveMode2 = true;
# };
# # Customize settings that not supported by nix-darwin directly
# # see the source code of this project to get more undocumented options:
# # https://github.com/rgcr/m-cli
# #
# # All custom entries can be found by running `defaults read` command.
# # or `defaults read xxx` to read a specific domain.
# CustomUserPreferences = {
# ".GlobalPreferences" = {
# # automatically switch to a new space when switching to the application
# AppleSpacesSwitchOnActivate = true;
# };
# NSGlobalDomain = {
# # Add a context menu item for showing the Web Inspector in web views
# WebKitDeveloperExtras = true;
# };
# "com.apple.finder" = {
# ShowExternalHardDrivesOnDesktop = true;
# ShowHardDrivesOnDesktop = true;
# ShowMountedServersOnDesktop = true;
# ShowRemovableMediaOnDesktop = true;
# _FXSortFoldersFirst = true;
# # When performing a search, search the current folder by default
# FXDefaultSearchScope = "SCcf";
# };
# "com.apple.desktopservices" = {
# # Avoid creating .DS_Store files on network or USB volumes
# DSDontWriteNetworkStores = true;
# DSDontWriteUSBStores = true;
# };
# "com.apple.spaces" = {
# "spans-displays" = 0; # Display have seperate spaces
# };
# "com.apple.WindowManager" = {
# EnableStandardClickToShowDesktop = 0; # Click wallpaper to reveal desktop
# StandardHideDesktopIcons = 0; # Show items on desktop
# HideDesktop = 0; # Do not hide items on desktop & stage manager
# StageManagerHideWidgets = 0;
# StandardHideWidgets = 0;
# };
# "com.apple.screensaver" = {
# # Require password immediately after sleep or screen saver begins
# askForPassword = 1;
# askForPasswordDelay = 0;
# };
# "com.apple.screencapture" = {
# location = "~/Desktop";
# type = "png";
# };
# "com.apple.AdLib" = {
# allowApplePersonalizedAdvertising = false;
# };
# # Prevent Photos from opening automatically when devices are plugged in
# "com.apple.ImageCapture".disableHotPlug = true;
# };
# loginwindow = {
# GuestEnabled = false; # disable guest user
# SHOWFULLNAME = true; # show full name in login window
# };
};
# keyboard settings is not very useful on macOS
# the most important thing is to remap option key to alt key globally,
# but it's not supported by macOS yet.
# keyboard = {
# enableKeyMapping = true; # enable key mapping so that we can use `option` as `control`
# NOTE: do NOT support remap capslock to both control and escape at the same time
# remapCapsLockToControl = false; # remap caps lock to control, useful for emac users
# remapCapsLockToEscape = true; # remap caps lock to escape, useful for vim users
# # swap left command and left alt
# # so it matches common keyboard layout: `ctrl | command | alt`
# #
# # disabled, caused only problems!
# swapLeftCommandAndLeftAlt = false;
# };
};
networking.hostName = hostName;
networking.computerName = hostName;
# networking.firewall.enable = true; # VERY important, do not touch
# networking.firewall.allowedTCPPorts = [];
# networking.firewall.allowedUDPPorts = [];
system.defaults.smb.NetBIOSName = hostName;
# Add ability to used TouchID for sudo authentication
security.pam.services.sudo_local.touchIdAuth = true;
# Create /etc/zshrc that loads the nix-darwin environment.
# this is required if you want to use darwin's default shell - zsh
programs.zsh.enable = true;
environment.shells = [
pkgs.zsh
pkgs.bash
];
system.stateVersion = 5;
# Set your time zone.
time.timeZone = timeZone;
}

6
machine/default.nix Normal file
View File

@@ -0,0 +1,6 @@
{ ... }: {
import = [
./apps.nix
./configuration.nix
];
}