mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 20:25:30 +00:00
feat(nix): add a first nix, nix-darwin, and home-manager setup
This commit is contained in:
@@ -35,12 +35,10 @@
|
|||||||
~/.config/ranger: ranger
|
~/.config/ranger: ranger
|
||||||
~/.config/sesh: sesh
|
~/.config/sesh: sesh
|
||||||
~/.config/sketchybar: sketchybar
|
~/.config/sketchybar: sketchybar
|
||||||
~/.config/skhd: skhd
|
|
||||||
~/.config/starship.toml: prompt/starship.toml
|
~/.config/starship.toml: prompt/starship.toml
|
||||||
~/.config/superfile: superfile
|
~/.config/superfile: superfile
|
||||||
~/.config/tmux/tmux-nerd-font-window-name.yml: tmux/tmux-nerd-font-window-name.yml
|
~/.config/tmux/tmux-nerd-font-window-name.yml: tmux/tmux-nerd-font-window-name.yml
|
||||||
~/.config/tmuxinator: tmuxinator
|
~/.config/tmuxinator: tmuxinator
|
||||||
~/.config/yabai: yabai
|
|
||||||
~/.config/zed/settings.json: zed/settings.json
|
~/.config/zed/settings.json: zed/settings.json
|
||||||
~/.ctags: search/ctags
|
~/.ctags: search/ctags
|
||||||
~/.curlrc: url/curlrc
|
~/.curlrc: url/curlrc
|
||||||
|
|||||||
22
nix/README.md
Normal file
22
nix/README.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Nix Dotfiles
|
||||||
|
|
||||||
|
This is my folder where I migrate my current dotfile setup to [Nix](https://nixos.org/), [nix-darwin](https://github.com/LnL7/nix-darwin), and [home-manager](https://github.com/nix-community/home-manager).
|
||||||
|
|
||||||
|
> [!DANGER] Warning
|
||||||
|
> This is a work in progress and I am still learning Nix, so expect things to be broken.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# First time install
|
||||||
|
nix run nix-darwin -- switch --flake ~/.config/nix-darwin
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure this is added to your path:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export PATH="/run/current-system/sw/bin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Switch to new configuration
|
||||||
|
darwin-rebuild switch --flake ~/.dotfiles/nix
|
||||||
|
```
|
||||||
32
nix/darwin/default.nix
Normal file
32
nix/darwin/default.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{ pkgs, config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
homebrew = import ./homebrew.nix // { enable = true; };
|
||||||
|
|
||||||
|
# Auto upgrade nix package and the daemon service.
|
||||||
|
services.nix-daemon.enable = true;
|
||||||
|
services.karabiner-elements.enable = true;
|
||||||
|
|
||||||
|
# Necessary for using flakes on this system.
|
||||||
|
nix.settings.experimental-features = "nix-command flakes";
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||||
|
programs.zsh.enable = true; # default shell on catalina
|
||||||
|
# programs.fish.enable = true;
|
||||||
|
|
||||||
|
# Used for backwards compatibility, please read the changelog before changing.
|
||||||
|
# $ darwin-rebuild changelog
|
||||||
|
system.stateVersion = 4;
|
||||||
|
|
||||||
|
system.defaults.NSGlobalDomain.ApplePressAndHoldEnabled = false;
|
||||||
|
system.defaults.dock.autohide = true;
|
||||||
|
|
||||||
|
system.defaults.NSGlobalDomain.InitialKeyRepeat = 15;
|
||||||
|
system.defaults.NSGlobalDomain.KeyRepeat = 2;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||||
|
|
||||||
|
services.skhd.enable = true;
|
||||||
|
services.yabai.enable = true;
|
||||||
|
}
|
||||||
8
nix/darwin/homebrew.nix
Normal file
8
nix/darwin/homebrew.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
# TODO: Activate after migration is complete
|
||||||
|
# onActivation.cleanup = "uninstall";
|
||||||
|
taps = [ ];
|
||||||
|
brews = [ ];
|
||||||
|
casks = [ "raycast" ];
|
||||||
|
masApps = { };
|
||||||
|
}
|
||||||
171
nix/flake.lock
generated
Normal file
171
nix/flake.lock
generated
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"cl-nix-lite": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1717972076,
|
||||||
|
"narHash": "sha256-hnZEsDInTcsVSL5LBGDAZegAxVLBus/wiJh+sNM15zU=",
|
||||||
|
"owner": "hraban",
|
||||||
|
"repo": "cl-nix-lite",
|
||||||
|
"rev": "cc920bfb0a6402d3871f470c98d65266126973e4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hraban",
|
||||||
|
"repo": "cl-nix-lite",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1697816753,
|
||||||
|
"narHash": "sha256-40to80AEIyKCQI0xMKCeF5ePoIKTYgjVVCZeu4CnTxM=",
|
||||||
|
"owner": "hraban",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "6025bade1336a36014639bc3f67eacc853dab78f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hraban",
|
||||||
|
"ref": "fixed-output",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "flake-utils",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1719438532,
|
||||||
|
"narHash": "sha256-/Vmso2ZMoFE3M7d1MRsQ2K5sR8CVKnrM6t1ys9Xjpz4=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "1a4f12ae0bda877ec4099b429cf439aad897d7e9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mac-app-util": {
|
||||||
|
"inputs": {
|
||||||
|
"cl-nix-lite": "cl-nix-lite",
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1718893255,
|
||||||
|
"narHash": "sha256-NdSDGdz5eU/EcnGn8ECP1V+mn5hyGOZQ4ybv2bWTpuk=",
|
||||||
|
"owner": "hraban",
|
||||||
|
"repo": "mac-app-util",
|
||||||
|
"rev": "1857b26aceaf64c2b6a357eb83cf34139b6365cc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hraban",
|
||||||
|
"repo": "mac-app-util",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1719128254,
|
||||||
|
"narHash": "sha256-I7jMpq0CAOZA/i70+HDQO/ulLttyQu/K70cSESiMX7A=",
|
||||||
|
"owner": "LnL7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "50581970f37f06a4719001735828519925ef8310",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "LnL7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1717868076,
|
||||||
|
"narHash": "sha256-c83Y9t815Wa34khrux81j8K8ET94ESmCuwORSKm2bQY=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "cd18e2ae9ab8e2a0a8d715b60c91b54c0ac35ff9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "cd18e2ae9ab8e2a0a8d715b60c91b54c0ac35ff9",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1719254875,
|
||||||
|
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"mac-app-util": "mac-app-util",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
39
nix/flake.nix
Normal file
39
nix/flake.nix
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
description = "My Darwin and home-manager dotfiles";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
|
|
||||||
|
nix-darwin = {
|
||||||
|
url = "github:LnL7/nix-darwin";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
mac-app-util.url = "github:hraban/mac-app-util";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nix-darwin, home-manager, nixpkgs, mac-app-util }: {
|
||||||
|
# Build darwin flake using:
|
||||||
|
# $ darwin-rebuild switch --flake ~/.dotfiles/nix/.#mac-mini
|
||||||
|
darwinConfigurations."mac-mini" = nix-darwin.lib.darwinSystem {
|
||||||
|
modules = [
|
||||||
|
./hosts/mac-mini/configuration.nix
|
||||||
|
|
||||||
|
mac-app-util.darwinModules.default
|
||||||
|
|
||||||
|
home-manager.darwinModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.verbose = true;
|
||||||
|
home-manager.users.kogakure.imports = [ ./hosts/mac-mini/home.nix mac-app-util.homeManagerModules.default ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
33
nix/home/default.nix
Normal file
33
nix/home/default.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{ pkgs, config, lib, home-manager, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
isDarwin = pkgs.stdenv.isDarwin;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# https://nix-community.github.io/home-manager/options.html
|
||||||
|
imports = [
|
||||||
|
./skhd
|
||||||
|
./yabai
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
home.stateVersion = "23.05";
|
||||||
|
|
||||||
|
# Let Home Manager install and manage itself.
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
# TODO: First migrate all fonts
|
||||||
|
# fonts.fontconfig.enable = true;
|
||||||
|
|
||||||
|
# The home.packages option allows you to install Nix packages into your
|
||||||
|
# environment.
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
nixpkgs-fmt
|
||||||
|
ripgrep
|
||||||
|
];
|
||||||
|
|
||||||
|
home.sessionVariables = {
|
||||||
|
EDITOR = "vim";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
16
nix/home/skhd/default.nix
Normal file
16
nix/home/skhd/default.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{ pkgs, config, lib, home-manager, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.services.skhd = {
|
||||||
|
enable = lib.mkEnableOption "skhd";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
home.file.".config/skhd/skhdrc" = lib.mkIf
|
||||||
|
config.services.skhd.enable
|
||||||
|
{
|
||||||
|
source = ./skhdrc;
|
||||||
|
onChange = "${pkgs.killall}/bin/killall skhd";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
16
nix/home/yabai/default.nix
Normal file
16
nix/home/yabai/default.nix
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.services.yabai = {
|
||||||
|
enable = lib.mkEnableOption "yabai";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
home.file.".config/yabai/yabairc" = lib.mkIf
|
||||||
|
config.services.yabai.enable
|
||||||
|
{
|
||||||
|
source = ./yabairc;
|
||||||
|
onChange = "${pkgs.killall}/bin/killall yabai";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
0
yabai/yabairc → nix/home/yabai/yabairc
Executable file → Normal file
0
yabai/yabairc → nix/home/yabai/yabairc
Executable file → Normal file
12
nix/hosts/mac-mini/configuration.nix
Normal file
12
nix/hosts/mac-mini/configuration.nix
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{ pkgs, config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../darwin
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.kogakure = {
|
||||||
|
name = "kogakure";
|
||||||
|
home = "/Users/kogakure";
|
||||||
|
};
|
||||||
|
}
|
||||||
10
nix/hosts/mac-mini/home.nix
Normal file
10
nix/hosts/mac-mini/home.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../home
|
||||||
|
];
|
||||||
|
|
||||||
|
services.yabai.enable = true;
|
||||||
|
services.skhd.enable = true;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user