···11+{ self, pkgs, pkgs-unstable, ... }: {
22+ # List packages installed in system profile. To search by name, run:
33+ # $ nix-env -qaP | grep wget
44+ environment.systemPackages =
55+ [
66+ pkgs.brave
77+ pkgs.fzf
88+ pkgs.tmux
99+ pkgs.tree
1010+ pkgs.vim
1111+ # I don't want to touch this due to current neovim settings.
1212+ # remove it when lux.nvim is out
1313+ (pkgs-unstable.lua5_1.withPackages (ps: with ps; [luarocks]))
1414+ ];
1515+1616+ # Necessary for using flakes on this system.
1717+ nix.settings.experimental-features = "nix-command flakes";
1818+ # Enable rosetta binaries
1919+ nix.settings.extra-platforms = "x86_64-darwin aarch64-darwin";
2020+2121+ # Enable alternative shell support in nix-darwin.
2222+ # programs.fish.enable = true;
2323+2424+ # Set Git commit hash for darwin-version.
2525+ system.configurationRevision = self.rev or self.dirtyRev or null;
2626+2727+ # Used for backwards compatibility, please read the changelog before changing.
2828+ # $ darwin-rebuild changelog
2929+ system.stateVersion = 5;
3030+3131+ # The platform the configuration will be used on.
3232+ nixpkgs.hostPlatform = "aarch64-darwin";
3333+3434+ system.defaults.finder = {
3535+ FXRemoveOldTrashItems = true;
3636+ ShowPathbar = true;
3737+ ShowStatusBar = true;
3838+ };
3939+4040+ system.defaults.dock = {
4141+ autohide = true;
4242+ autohide-delay = 0.0;
4343+ autohide-time-modifier = 0.6;
4444+ mru-spaces = false;
4545+ show-recents = false;
4646+ # Disable bottom-right corner action
4747+ wvous-br-corner = 1;
4848+ # persistent-apps = [];
4949+ };
5050+5151+ system.defaults.NSGlobalDomain = {
5252+ AppleShowAllExtensions = true;
5353+ # default minimum is 15 (225ms)
5454+ InitialKeyRepeat = 10;
5555+ # default minimum is 2 (30ms)
5656+ KeyRepeat = 1;
5757+ };
5858+5959+ # reference https://medium.com/@zmre/nix-darwin-quick-tip-activate-your-preferences-f69942a93236
6060+ # for more
6161+ # https://gist.github.com/ChristopherA/98628f8cd00c94f11ee6035d53b0d3c6
6262+ # is also cool
6363+ system.defaults.CustomUserPreferences = {
6464+ # see https://apple.stackexchange.com/a/429820
6565+ "com.apple.Safari.SandboxBroker" = {
6666+ ShowDevelopMenu = true;
6767+ };
6868+ "com.apple.Safari" = {
6969+ IncludeDevelopMenu = true;
7070+ IncludeInternalDebugMenu = true;
7171+ SearchProviderIdentifier = "com.duckduckgo";
7272+ ShowFullURLInSmartSearchField = true;
7373+ # preview url on bottom left corner when hover links
7474+ ShowOverlayStatusBar = true;
7575+ WebAutomaticSpellingCorrectionEnabled = false;
7676+ WebContinuousSpellCheckingEnabled = true;
7777+ WebKitDeveloperExtrasEnabledPreferenceKey = true;
7878+ };
7979+ # Tried to set Mission Control keyboard shortcuts... but failed
8080+ # "com.apple.symbolichotkeys" = {
8181+ # AppleSymbolicHotKeys = {
8282+ # "79" = {
8383+ # enabled = 1;
8484+ # value = {
8585+ # parameters = [65535 123 8650752];
8686+ # type = "standard";
8787+ # };
8888+ # };
8989+ # "80" = {
9090+ # enabled = 1;
9191+ # value = {
9292+ # parameters = [65535 123 8781824];
9393+ # type = "standard";
9494+ # };
9595+ # };
9696+ # "81" = {
9797+ # enabled = 1;
9898+ # value = {
9999+ # parameters = [65535 124 8650752];
100100+ # type = "standard";
101101+ # };
102102+ # };
103103+ # "82" = {
104104+ # enabled = 1;
105105+ # value = {
106106+ # parameters = [65535 124 8781824];
107107+ # type = "standard";
108108+ # };
109109+ # };
110110+ # "118" = {
111111+ # enabled = 1;
112112+ # value = {
113113+ # parameters = [65535 18 262144];
114114+ # type = "standard";
115115+ # };
116116+ # };
117117+ # # 119 = {
118118+ # # enabled = 1;
119119+ # # value = {
120120+ # # parameters = [65535, 19, 262144];
121121+ # # type = "standard";
122122+ # # };
123123+ # # };
124124+ # # 120 = {
125125+ # # enabled = 1;
126126+ # # value = {
127127+ # # parameters = [65535, 20, 262144];
128128+ # # type = "standard";
129129+ # # };
130130+ # # };
131131+ # # 121 = {
132132+ # # enabled = 1;
133133+ # # value = {
134134+ # # parameters = [65535, 21, 262144];
135135+ # # type = "standard";
136136+ # # };
137137+ # # };
138138+ # # 122 = {
139139+ # # enabled = 1;
140140+ # # value = {
141141+ # # parameters = [65535, 23, 262144];
142142+ # # type = "standard";
143143+ # # };
144144+ # # };
145145+ # };
146146+ # };
147147+ };
148148+149149+ # NOTE: put SaneSideButtons (installed via homebrew cask) to Login Items
150150+ # reference: https://discourse.nixos.org/t/automatically-launching-macos-applications-on-login/19823/2
151151+ # TODO: package this into single nix package with SaneSideButtons itself. See pkgs.sensible-side-buttons as a reference
152152+ system.activationScripts.extraActivation.text = ''
153153+ osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/SaneSideButtons.app", hidden:false}'
154154+ '';
155155+156156+ # # Enable Touch ID support
157157+ # security.pam.enableSudoTouchIdAuth = true;
158158+159159+ homebrew = {
160160+ enable = true;
161161+ casks = [
162162+ "discord"
163163+ "ghostty"
164164+ "raycast"
165165+ # there are also pkgs.sensible-side-buttons (original version) which is unfree license
166166+ # this one is foked version of it: "SaneSideButtons"
167167+ # NOTE: I should put this on Login Items manually. See: https://github.com/thealpa/SaneSideButtons
168168+ "sanesidebuttons"
169169+ ];
170170+ masApps = {
171171+ Things3 = 904280696;
172172+ };
173173+ };
174174+}
+38-41
nix/flake.nix
···11{
22- description = "Example nix-darwin system flake";
22+ description = "nix-darwin system flake";
3344 inputs = {
55- nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
66- nix-darwin.url = "github:LnL7/nix-darwin/master";
55+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
66+ nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
77+88+ nix-darwin.url = "github:nix-darwin/nix-darwin/nix-darwin-24.11";
79 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
88- home-manager.url = "github:nix-community/home-manager/release-24.11";
99- home-manager.inputs.nixpkgs.follows = "nixpkgs";
1010 };
11111212- outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager }:
1212+ outputs = inputs@{
1313+ self,
1414+ nix-darwin,
1515+ nixpkgs,
1616+ nixpkgs-unstable
1717+ }:
1318 let
1414- configuration = { pkgs, ... }: {
1515- # List packages installed in system profile. To search by name, run:
1616- # $ nix-env -qaP | grep wget
1717- environment.systemPackages =
1818- with pkgs; [
1919- vim
2020- typescript-language-server
2121- (pkgs.lua5_1.withPackages (ps: with ps; [luarocks]))
2222- ];
2323-2424- # Necessary for using flakes on this system.
2525- nix.settings.experimental-features = "nix-command flakes";
2626- nix.settings.extra-platforms = "x86_64-darwin aarch64-darwin";
2727-2828- # Enable alternative shell support in nix-darwin.
2929- # programs.fish.enable = true;
3030-3131- # Set Git commit hash for darwin-version.
3232- system.configurationRevision = self.rev or self.dirtyRev or null;
3333-3434- # Used for backwards compatibility, please read the changelog before changing.
3535- # $ darwin-rebuild changelog
3636- system.stateVersion = 6;
3737-3838- # The platform the configuration will be used on.
3939- nixpkgs.hostPlatform = "aarch64-darwin";
4040- };
1919+ system = "aarch64-darwin";
2020+ pkgs = nixpkgs.legacyPackages.${system};
2121+ pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
4122 in
4223 {
4324 # Build darwin flake using:
4444- # $ darwin-rebuild build --flake .#simple
4545- darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem {
4646- # system = "aarch64-darwin";
2525+ # $ darwin-rebuild build --flake ~/.config/nix
2626+ # $ darwin-rebuild switch --flake ~/.config/nix
2727+ darwinConfigurations."boltless-MacBook-Air" = nix-darwin.lib.darwinSystem {
4728 modules = [
4848- # home-manager.darwinModules.home-manager
4949- configuration
2929+ ./darwin.nix
5030 ];
3131+ specialArgs = {
3232+ inherit self pkgs-unstable;
3333+ };
5134 };
5252- homeConfigurations."ubuntu" = home-manager.lib.homeManagerConfiguration {
5353- pkgs = nixpkgs.legacyPackages."aarch64-linux";
5454- modules = [ ./home.nix ];
3535+ # based on https://zaynetro.com/post/2024-you-dont-need-home-manager-nix
3636+ # $ nix profile install .
3737+ # $ nix profile upgrade nix
3838+ packages.${system}.default = pkgs.buildEnv {
3939+ name = "my-env";
4040+ paths = [
4141+ pkgs.btop
4242+ pkgs.gh
4343+ pkgs.hello
4444+ pkgs.janet
4545+ pkgs.meld
4646+ pkgs.sumneko-lua-language-server
4747+ pkgs.unixtools.watch
4848+ pkgs-unstable.jujutsu
4949+ pkgs-unstable.neovim
5050+ ];
5551 };
5652 };
5753}
5454+# vim: et:ts=2
-97
nix/home.nix
···11-{ config, pkgs, ... }:
22-33-# NOTE: I use nix as a package manager, not to make revisions for my entire dotfiles
44-# I want nix to organize files and automate symlinking
55-66-{
77- # Home Manager needs a bit of information about you and the paths it should
88- # manage.
99- home.username = "ubuntu";
1010- home.homeDirectory = "/home/ubuntu";
1111-1212- # This value determines the Home Manager release that your configuration is
1313- # compatible with. This helps avoid breakage when a new Home Manager release
1414- # introduces backwards incompatible changes.
1515- #
1616- # You should not change this value, even if you update Home Manager. If you do
1717- # want to update the value, then make sure to first check the Home Manager
1818- # release notes.
1919- home.stateVersion = "24.05"; # Please read the comment before changing.
2020-2121- # The home.packages option allows you to install Nix packages into your
2222- # environment.
2323- home.packages = [
2424- # # Adds the 'hello' command to your environment. It prints a friendly
2525- # # "Hello, world!" when run.
2626- # pkgs.hello
2727- # pkgs.neovim
2828- pkgs.sumneko-lua-language-server
2929- pkgs.janet
3030- # pkgs.jpm
3131- pkgs.cachix
3232- pkgs.helix
3333- # pkgs.emscripten
3434- # pkgs.neovim-nightly
3535-3636- # # It is sometimes useful to fine-tune packages, for example, by applying
3737- # # overrides. You can do that directly here, just don't forget the
3838- # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
3939- # # fonts?
4040- # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
4141-4242- # # You can also create simple shell scripts directly inside your
4343- # # configuration. For example, this adds a command 'my-hello' to your
4444- # # environment:
4545- # (pkgs.writeShellScriptBin "my-hello" ''
4646- # echo "Hello, ${config.home.username}!"
4747- # '')
4848- ];
4949-5050- # Home Manager is pretty good at managing dotfiles. The primary way to manage
5151- # plain files is through 'home.file'.
5252- home.file = {
5353- # # Building this configuration will create a copy of 'dotfiles/screenrc' in
5454- # # the Nix store. Activating the configuration will then make '~/.screenrc' a
5555- # # symlink to the Nix store copy.
5656- # ".screenrc".source = dotfiles/screenrc;
5757-5858- # # You can also set the file content immediately.
5959- # ".gradle/gradle.properties".text = ''
6060- # org.gradle.console=verbose
6161- # org.gradle.daemon.idletimeout=3600000
6262- # '';
6363- };
6464-6565- # Home Manager can also manage your environment variables through
6666- # 'home.sessionVariables'. These will be explicitly sourced when using a
6767- # shell provided by Home Manager. If you don't want to manage your shell
6868- # through Home Manager then you have to manually source 'hm-session-vars.sh'
6969- # located at either
7070- #
7171- # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
7272- #
7373- # or
7474- #
7575- # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
7676- #
7777- # or
7878- #
7979- # /etc/profiles/per-user/ubuntu/etc/profile.d/hm-session-vars.sh
8080- #
8181- home.sessionVariables = {
8282- # EDITOR = "nvim";
8383- # JANET_MODPATH = "${pkgs.janet}/lib/janet";
8484- # JANET_SYSPATH = "${pkgs.janet}/lib/janet";
8585- # JANET_LIBPATH = "${pkgs.janet}/lib";
8686- # JANET_HEADERPATH = "${pkgs.janet}/include/janet";
8787-8888- # JANET_MODPATH = "/home/ubuntu/.local/lib/janet";
8989- # JANET_SYSPATH = "/home/ubuntu/.local/lib/janet";
9090- # JANET_LIBPATH = "/home/ubuntu/.local/lib";
9191- # JANET_MANPATH = "/home/ubuntu/.local/man/man1";
9292- # JANET_HEADERPATH = "/home/ubuntu/.local/include/janet";
9393- };
9494-9595- # Let Home Manager install and manage itself.
9696- programs.home-manager.enable = true;
9797-}