feat(nix): move Nix configuration to root level

This commit is contained in:
Stefan Imhoff
2024-07-31 12:46:55 +02:00
parent ec67a98313
commit c5be8e73b6
224 changed files with 62 additions and 67 deletions

View File

@@ -1,17 +1,66 @@
# Dotfiles
# Nix Dotfiles
These are my Dotfiles, a collection of [Neovim](https://neovim.io/), [tmux](https://tmux.github.io/), [zsh](http://zsh.sourceforge.net/), [Hammerspoon](http://www.hammerspoon.org/), and other tools.
This is my dotfile setup, using [Nix](https://nixos.org/), [nix-darwin](https://github.com/LnL7/nix-darwin), and [home-manager](https://github.com/nix-community/home-manager).
## Initial Setup and Installation
> [!WARNING]
> This is a work in progress and I am still learning Nix, so expect things to be broken.
## Install Dependencies
First, install the Xcode command-line tools:
```sh
xcode-select --install
```
## Install Nix
Install Nix using the [Determinate Systems installer](https://github.com/DeterminateSystems/nix-installer):
```sh
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
## Install the Nix Flake
### First-time Installation
#### Install from GitHub
To install and use this configuration directly from GitHub without cloning:
```sh
nix run nix-darwin -- switch --flake github:kogakure/dotfiles
```
#### Clone and Install
Clone the repository:
```sh
git clone git@github.com:kogakure/dotfiles.git ~/.dotfiles
cd ~/.dotfiles/
./install
```
Dotbot will create symlinks from all necessary files in the folder.
For the initial setup, run:
## Setting Up a New Computer
```sh
nix run nix-darwin -- switch --flake ~/.dotfiles
```
The project includes a `setup` folder that has install scripts for everything I need on a new computer. You can run the scripts individually or all at once by running `./setup/init.sh`.
This command installs nix-darwin and applies your configuration.
### Selecting a Specific Configuration
By default the `$hostname` that matches the current machine is used, but it is possible to manually load one by running:
```sh
nix run nix-darwin -- switch --flake ~/.dotfiles#mac-mini
```
## Updating Configuration
After making changes to your configuration, apply them with:
```sh
darwin-rebuild switch --flake ~/.dotfiles
```

View File

View File

@@ -47,7 +47,7 @@
in
{
# Build darwin flake using:
# $ darwin-rebuild switch --flake ~/.dotfiles/nix/.#mac-mini
# $ darwin-rebuild switch --flake ~/.dotfiles/.#mac-mini
darwinConfigurations = {
"mac-mini" = mkDarwinConfig {
system = "aarch64-darwin";

View File

@@ -151,6 +151,7 @@ in
nixpkgs-fmt # Nix code formatter
openai-whisper-cpp # Port of OpenAI's Whisper model in C/C++
openssl # A cryptographic library that implements the SSL and TLS protocols
phrase-cli # PhraseApp API v2 Command Line Client
pngpaste # Paste image files from clipboard to file on MacOS
pnpm # Fast, disk space efficient package manager for JavaScript
prettierd # Prettier, as a daemon, for improved formatting speed

View File

@@ -2,7 +2,7 @@
{
xdg.configFile.nvim = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/nix/home/neovim/nvim";
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/home/neovim/nvim";
recursive = true;
};

View File

@@ -15,7 +15,7 @@ return {
},
config = function()
local home = vim.fn.expand("$HOME")
local file_path = home .. "/.dotfiles/nix/home/neovim/nvim/lua/plugins/chatgpg.txt.gpg"
local file_path = home .. "/.dotfiles/home/neovim/nvim/lua/plugins/chatgpg.txt.gpg"
require("chatgpt").setup({
api_key_cmd = "gpg --decrypt --use-agent " .. file_path,
})

Some files were not shown because too many files have changed in this diff Show More