adding modifed files from nixos-wsl-starter
This commit is contained in:
@@ -1,3 +1,155 @@
|
||||
# nixos-config
|
||||
# nixos-wsl-starter
|
||||
|
||||
My configuration for nixos
|
||||
This repository is intended to be a sane, batteries-included starter template
|
||||
for running a [JeezyVim](https://github.com/LGUG2Z/JeezyVim)-powered NixOS
|
||||
development environment on WSL.
|
||||
|
||||
If you don't want to dig into NixOS too much right now, the only file you need
|
||||
to concern yourself with is [home.nix](home.nix). This is where you can add and
|
||||
remove binaries to your global `$PATH`.
|
||||
|
||||
Go to [https://search.nixos.org](https://search.nixos.org/packages) to find the
|
||||
correct package names, though usually they will be what you expect them to be
|
||||
in other package managers.
|
||||
|
||||
`unstable-packages` is for packages that you want to always keep at the latest
|
||||
released versions, and `stable-packages` is for packages that you want to track
|
||||
with the current release of NixOS (currently 24.05).
|
||||
|
||||
If you want to update the versions of the available `unstable-packages`, run
|
||||
`nix flake update` to pull the latest version of the Nixpkgs repository and
|
||||
then apply the changes.
|
||||
|
||||
Make sure to look at all the `FIXME` notices in the various files which are
|
||||
intended to direct you to places where you may want to make configuration
|
||||
tweaks.
|
||||
|
||||
If you found this starter template useful, please consider
|
||||
[sponsoring](https://github.com/sponsors/LGUG2Z) and [subscribing to my YouTube
|
||||
channel](https://www.youtube.com/channel/UCeai3-do-9O4MNy9_xjO6mg?sub_confirmation=1).
|
||||
|
||||
## What Is Included
|
||||
|
||||
This starter is a lightly-opinionated take on a productive terminal-driven
|
||||
development environment based on my own preferences. However, it is trivial to
|
||||
customize to your liking both by removing and adding tools that you prefer.
|
||||
|
||||
- The default editor is [JeezyVim](https://github.com/LGUG2Z/JeezyVim)
|
||||
- `win32yank` is used to ensure perfect bi-directional copying and pasting to
|
||||
and from Windows GUI applications and LunarVim running in WSL
|
||||
- The default shell is `fish`
|
||||
- Native `docker` (ie. Linux, not Windows) is enabled by default
|
||||
- The prompt is [Starship](https://starship.rs/)
|
||||
- [`fzf`](https://github.com/junegunn/fzf),
|
||||
[`lsd`](https://github.com/lsd-rs/lsd),
|
||||
[`zoxide`](https://github.com/ajeetdsouza/zoxide), and
|
||||
[`broot`](https://github.com/Canop/broot) are integrated into `fish` by
|
||||
default
|
||||
- These can all be disabled easily by setting `enable = false` in
|
||||
[home.nix](home.nix), or just removing the lines all together
|
||||
- [`direnv`](https://github.com/direnv/direnv) is integrated into `fish` by
|
||||
default
|
||||
- `git` config is generated in [home.nix](home.nix) with options provided to
|
||||
enable private HTTPS clones with secret tokens
|
||||
- `fish` config is generated in [home.nix](home.nix) and includes git aliases,
|
||||
useful WSL aliases
|
||||
|
||||
### win32yank
|
||||
|
||||
There have been some recent changes in WSL2 that make running `win32yank`
|
||||
within WSL2 very slow. You should install this on Windows by running `scoop
|
||||
install win32yank` or compiling it from source, and then adding it to your `$PATH`:
|
||||
|
||||
```nix
|
||||
{
|
||||
programs.fish = {
|
||||
interactiveShellInit = ''
|
||||
fish_add_path --append /mnt/c/Users/<Your Windows Username>/scoop/apps/win32yank/0.1.1
|
||||
'';
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Quickstart
|
||||
|
||||
[](https://www.youtube.com/watch?v=ZuVQds2hncs)
|
||||
|
||||
- Get the [latest
|
||||
release](https://github.com/LGUG2Z/nixos-wsl-starter/releases)
|
||||
- Install it (tweak the command to your desired paths):
|
||||
|
||||
```powershell
|
||||
wsl --import NixOS .\NixOS\ .\nixos-wsl.tar.gz --version 2
|
||||
```
|
||||
|
||||
- Enter the distro:
|
||||
|
||||
```powershell
|
||||
wsl -d NixOS
|
||||
```
|
||||
|
||||
- Get a copy of this repo (you'll probably want to fork it eventually):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/LGUG2Z/nixos-wsl-starter.git /tmp/configuration
|
||||
cd /tmp/configuration
|
||||
```
|
||||
|
||||
- Change the username to your desired username in `flake.nix` with `nvim` (or
|
||||
whichever editor you prefer)
|
||||
- Install `win32yank` with `scoop` and add it to your `$PATH` in NixOS
|
||||
- Apply the configuration and shutdown the WSL2 VM
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake /tmp/configuration && sudo shutdown -h now
|
||||
```
|
||||
|
||||
- Reconnect to the WSL2 VM
|
||||
|
||||
```bash
|
||||
wsl -d NixOS
|
||||
```
|
||||
|
||||
- `cd ~` and then `pwd` should now show `/home/<YOUR_USERNAME>`
|
||||
- Move the configuration to your new home directory
|
||||
|
||||
```bash
|
||||
mv /tmp/configuration ~/configuration
|
||||
```
|
||||
|
||||
- Go through all the `FIXME:` notices in `~/configuration` and make changes
|
||||
wherever you want
|
||||
- Apply the configuration
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake ~/configuration
|
||||
```
|
||||
|
||||
Note: If developing in Rust, you'll still be managing your toolchains and
|
||||
components like `rust-analyzer` with `rustup`!
|
||||
|
||||
## Project Layout
|
||||
|
||||
In order to keep the template as approachable as possible for new NixOS users,
|
||||
this project uses a flat layout without any nesting or modularization.
|
||||
|
||||
- `flake.nix` is where dependencies are specified
|
||||
- `nixpkgs` is the current release of NixOS
|
||||
- `nixpkgs-unstable` is the current trunk branch of NixOS (ie. all the
|
||||
latest packages)
|
||||
- `home-manager` is used to manage everything related to your home
|
||||
directory (dotfiles etc.)
|
||||
- `nur` is the community-maintained [Nix User
|
||||
Repositories](https://nur.nix-community.org/) for packages that may not
|
||||
be available in the NixOS repository
|
||||
- `nixos-wsl` exposes important WSL-specific configuration options
|
||||
- `nix-index-database` tells you how to install a package when you run a
|
||||
command which requires a binary not in the `$PATH`
|
||||
- `wsl.nix` is where the VM is configured
|
||||
- The hostname is set here
|
||||
- The default shell is set here
|
||||
- User groups are set here
|
||||
- WSL configuration options are set here
|
||||
- NixOS options are set here
|
||||
- `home.nix` is where packages, dotfiles, terminal tools, environment variables
|
||||
and aliases are configured
|
||||
|
||||
Generated
+419
@@ -0,0 +1,419 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1733328505,
|
||||
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1743550720,
|
||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_2": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"jeezyvim",
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1743550720,
|
||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_3": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nur",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1733312601,
|
||||
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1778401693,
|
||||
"narHash": "sha256-OVHdCqXXUF5UdGkH+FF2ZL06OLZjj2kvP2dIUmzVWoo=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "389b83002efc26f1145e89a6a8e6edc5a6435948",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-25.11",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ixx": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"jeezyvim",
|
||||
"nixvim",
|
||||
"nuschtosSearch",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"jeezyvim",
|
||||
"nixvim",
|
||||
"nuschtosSearch",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737371634,
|
||||
"narHash": "sha256-fTVAWzT1UMm1lT+YxHuVPtH+DATrhYfea3B0MxG/cGw=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "ixx",
|
||||
"rev": "a1176e2a10ce745ff8f63e4af124ece8fe0b1648",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NuschtOS",
|
||||
"ref": "v0.0.7",
|
||||
"repo": "ixx",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"jeezyvim": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixvim": "nixvim"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745771357,
|
||||
"narHash": "sha256-dtMExSTyOSD6txin/pQeXuyNhKROTbtbk9GlyH4FQZ4=",
|
||||
"owner": "LGUG2Z",
|
||||
"repo": "JeezyVim",
|
||||
"rev": "016dbad13d79b499fa957e13da199e302b47f1c6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LGUG2Z",
|
||||
"repo": "JeezyVim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-index-database": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745725746,
|
||||
"narHash": "sha256-iR+idGZJ191cY6NBXyVjh9QH8GVWTkvZw/w+1Igy45A=",
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "187524713d0d9b2d2c6f688b81835114d4c2a7c6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-index-database",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1744290088,
|
||||
"narHash": "sha256-/X9XVEl0EiyisNbF5srrxXRSVoRqdwExuqyspYqqEjQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "60b4904a1390ac4c89e93d95f6ed928975e525ed",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1745526057,
|
||||
"narHash": "sha256-ITSpPDwvLBZBnPRS2bUcHY3gZSwis/uTe255QgMtTLA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f771eb401a46846c1aebd20552521b233dd7e18b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1743296961,
|
||||
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1745526057,
|
||||
"narHash": "sha256-ITSpPDwvLBZBnPRS2bUcHY3gZSwis/uTe255QgMtTLA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f771eb401a46846c1aebd20552521b233dd7e18b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1745377448,
|
||||
"narHash": "sha256-jhZDfXVKdD7TSEGgzFJQvEEZ2K65UMiqW5YJ2aIqxMA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "507b63021ada5fee621b6ca371c4fca9ca46f52c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1778003029,
|
||||
"narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0c88e1f2bdb93d5999019e99cb0e61e1fe2af4c5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1745526057,
|
||||
"narHash": "sha256-ITSpPDwvLBZBnPRS2bUcHY3gZSwis/uTe255QgMtTLA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f771eb401a46846c1aebd20552521b233dd7e18b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixvim": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts_2",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nuschtosSearch": "nuschtosSearch"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745697134,
|
||||
"narHash": "sha256-WvozW6IXhuRfGlDy7S777S5fjZeGSOEIRRbo2eK6K5o=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "8d8a8568968f0e77b90749929c4683633d1ebdf6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts_3",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745771698,
|
||||
"narHash": "sha256-1/87FqzayivqtFS/yFqHNBsSlY3hP6CTcsq8Wj9qDrI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "f33c7bc8d22cbbc2fa932e283746eacd05944b17",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nuschtosSearch": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"ixx": "ixx",
|
||||
"nixpkgs": [
|
||||
"jeezyvim",
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745046075,
|
||||
"narHash": "sha256-8v4y6k16Ra/fiecb4DxhsoOGtzLKgKlS+9/XJ9z0T2I=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"rev": "066afe8643274470f4a294442aadd988356a478f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"jeezyvim": "jeezyvim",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"nur": "nur"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nur",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1733222881,
|
||||
"narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "49717b5af6f80172275d47a418c9719a31a78b53",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
description = "NixOS configuration";
|
||||
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
inputs.nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
inputs.home-manager.url = "github:nix-community/home-manager/release-25.11";
|
||||
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
inputs.nur.url = "github:nix-community/NUR";
|
||||
|
||||
inputs.nixos-wsl.url = "github:nix-community/NixOS-WSL";
|
||||
inputs.nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
inputs.nix-index-database.url = "github:Mic92/nix-index-database";
|
||||
inputs.nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
inputs.jeezyvim.url = "github:LGUG2Z/JeezyVim";
|
||||
|
||||
outputs = inputs:
|
||||
with inputs; let
|
||||
secrets = builtins.fromJSON (builtins.readFile "${self}/secrets.json");
|
||||
|
||||
nixpkgsWithOverlays = system: (import nixpkgs rec {
|
||||
inherit system;
|
||||
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [
|
||||
# FIXME:: add any insecure packages you absolutely need here
|
||||
];
|
||||
};
|
||||
|
||||
overlays = [
|
||||
nur.overlays.default
|
||||
jeezyvim.overlays.default
|
||||
|
||||
(_final: prev: {
|
||||
unstable = import nixpkgs-unstable {
|
||||
inherit (prev) system;
|
||||
inherit config;
|
||||
};
|
||||
})
|
||||
];
|
||||
});
|
||||
|
||||
configurationDefaults = args: {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "hm-backup";
|
||||
home-manager.extraSpecialArgs = args;
|
||||
};
|
||||
|
||||
argDefaults = {
|
||||
inherit secrets inputs self nix-index-database;
|
||||
channels = {
|
||||
inherit nixpkgs nixpkgs-unstable;
|
||||
};
|
||||
};
|
||||
|
||||
mkNixosConfiguration = {
|
||||
system ? "x86_64-linux",
|
||||
hostname,
|
||||
username,
|
||||
args ? {},
|
||||
modules,
|
||||
}: let
|
||||
specialArgs = argDefaults // {inherit hostname username;} // args;
|
||||
in
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system specialArgs;
|
||||
pkgs = nixpkgsWithOverlays system;
|
||||
modules =
|
||||
[
|
||||
(configurationDefaults specialArgs)
|
||||
home-manager.nixosModules.home-manager
|
||||
]
|
||||
++ modules;
|
||||
};
|
||||
in {
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
|
||||
|
||||
nixosConfigurations.nixos = mkNixosConfiguration {
|
||||
hostname = "nixos";
|
||||
username = "scott"; # FIXME: replace with your own username!
|
||||
modules = [
|
||||
nixos-wsl.nixosModules.wsl
|
||||
./wsl.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
{
|
||||
# FIXME: uncomment the next line if you want to reference your GitHub/GitLab access tokens and other secrets
|
||||
# secrets,
|
||||
pkgs,
|
||||
username,
|
||||
nix-index-database,
|
||||
...
|
||||
}: let
|
||||
unstable-packages = with pkgs.unstable; [
|
||||
# FIXME: select your core binaries that you always want on the bleeding-edge
|
||||
bat
|
||||
bottom
|
||||
coreutils
|
||||
curl
|
||||
du-dust
|
||||
fd
|
||||
findutils
|
||||
fx
|
||||
git
|
||||
git-crypt
|
||||
htop
|
||||
jq
|
||||
killall
|
||||
mosh
|
||||
procs
|
||||
ripgrep
|
||||
sd
|
||||
tmux
|
||||
tree
|
||||
unzip
|
||||
vim
|
||||
wget
|
||||
zip
|
||||
];
|
||||
|
||||
stable-packages = with pkgs; [
|
||||
# FIXME: customize these stable packages to your liking for the languages that you use
|
||||
|
||||
# FIXME: you can add plugins, change keymaps etc using (jeezyvim.nixvimExtend {})
|
||||
# https://github.com/LGUG2Z/JeezyVim#extending
|
||||
jeezyvim
|
||||
|
||||
# key tools
|
||||
gh # for bootstrapping
|
||||
just
|
||||
|
||||
# core languages
|
||||
rustup
|
||||
|
||||
# rust stuff
|
||||
cargo-cache
|
||||
cargo-expand
|
||||
|
||||
# local dev stuf
|
||||
mkcert
|
||||
httpie
|
||||
|
||||
# treesitter
|
||||
tree-sitter
|
||||
|
||||
# language servers
|
||||
nodePackages.vscode-langservers-extracted # html, css, json, eslint
|
||||
nodePackages.yaml-language-server
|
||||
nil # nix
|
||||
|
||||
# formatters and linters
|
||||
alejandra # nix
|
||||
deadnix # nix
|
||||
nodePackages.prettier
|
||||
shellcheck
|
||||
shfmt
|
||||
statix # nix
|
||||
];
|
||||
in {
|
||||
imports = [
|
||||
nix-index-database.hmModules.nix-index
|
||||
];
|
||||
|
||||
home.stateVersion = "25.11";
|
||||
|
||||
home = {
|
||||
username = "${username}";
|
||||
homeDirectory = "/home/${username}";
|
||||
|
||||
sessionVariables.EDITOR = "nvim";
|
||||
# FIXME: set your preferred $SHELL
|
||||
sessionVariables.SHELL = "/etc/profiles/per-user/${username}/bin/fish";
|
||||
};
|
||||
|
||||
home.packages =
|
||||
stable-packages
|
||||
++ unstable-packages
|
||||
++
|
||||
# FIXME: you can add anything else that doesn't fit into the above two lists in here
|
||||
[
|
||||
# pkgs.some-package
|
||||
# pkgs.unstable.some-other-package
|
||||
];
|
||||
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
nix-index.enable = true;
|
||||
nix-index.enableFishIntegration = true;
|
||||
nix-index-database.comma.enable = true;
|
||||
|
||||
# FIXME: disable this if you don't want to use the starship prompt
|
||||
starship.enable = true;
|
||||
starship.settings = {
|
||||
aws.disabled = true;
|
||||
gcloud.disabled = true;
|
||||
kubernetes.disabled = false;
|
||||
git_branch.style = "242";
|
||||
directory.style = "blue";
|
||||
directory.truncate_to_repo = false;
|
||||
directory.truncation_length = 8;
|
||||
python.disabled = true;
|
||||
ruby.disabled = true;
|
||||
hostname.ssh_only = false;
|
||||
hostname.style = "bold green";
|
||||
};
|
||||
|
||||
# FIXME: disable whatever you don't want
|
||||
fzf.enable = true;
|
||||
fzf.enableFishIntegration = true;
|
||||
lsd.enable = true;
|
||||
#lsd.enableAliases = true;
|
||||
|
||||
zoxide.enable = true;
|
||||
zoxide.enableFishIntegration = true;
|
||||
zoxide.options = ["--cmd cd"];
|
||||
broot.enable = true;
|
||||
broot.enableFishIntegration = true;
|
||||
direnv.enable = true;
|
||||
direnv.nix-direnv.enable = true;
|
||||
|
||||
git = {
|
||||
enable = true;
|
||||
package = pkgs.unstable.git;
|
||||
delta.enable = true;
|
||||
delta.options = {
|
||||
line-numbers = true;
|
||||
side-by-side = true;
|
||||
navigate = true;
|
||||
};
|
||||
userEmail = "scott.sorell@gmail.com"; # FIXME: set your git email
|
||||
userName = "Scott Sorell"; #FIXME: set your git username
|
||||
extraConfig = {
|
||||
# FIXME: uncomment the next lines if you want to be able to clone private https repos
|
||||
# url = {
|
||||
# "https://oauth2:${secrets.github_token}@github.com" = {
|
||||
# insteadOf = "https://github.com";
|
||||
# };
|
||||
# "https://oauth2:${secrets.gitlab_token}@gitlab.com" = {
|
||||
# insteadOf = "https://gitlab.com";
|
||||
# };
|
||||
# };
|
||||
push = {
|
||||
default = "current";
|
||||
autoSetupRemote = true;
|
||||
};
|
||||
merge = {
|
||||
conflictstyle = "diff3";
|
||||
};
|
||||
diff = {
|
||||
colorMoved = "default";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# FIXME: This is my fish config - you can fiddle with it if you want
|
||||
fish = {
|
||||
enable = true;
|
||||
# FIXME: run 'scoop install win32yank' on Windows, then add this line with your Windows username to the bottom of interactiveShellInit
|
||||
# fish_add_path --append /mnt/c/Users/<Your Windows Username>/scoop/apps/win32yank/0.1.1
|
||||
interactiveShellInit = ''
|
||||
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
|
||||
|
||||
${pkgs.lib.strings.fileContents (pkgs.fetchFromGitHub {
|
||||
owner = "rebelot";
|
||||
repo = "kanagawa.nvim";
|
||||
rev = "de7fb5f5de25ab45ec6039e33c80aeecc891dd92";
|
||||
sha256 = "sha256-f/CUR0vhMJ1sZgztmVTPvmsAgp0kjFov843Mabdzvqo=";
|
||||
}
|
||||
+ "/extras/kanagawa.fish")}
|
||||
|
||||
set -U fish_greeting
|
||||
'';
|
||||
functions = {
|
||||
refresh = "source $HOME/.config/fish/config.fish";
|
||||
take = ''mkdir -p -- "$1" && cd -- "$1"'';
|
||||
ttake = "cd $(mktemp -d)";
|
||||
show_path = "echo $PATH | tr ' ' '\n'";
|
||||
posix-source = ''
|
||||
for i in (cat $argv)
|
||||
set arr (echo $i |tr = \n)
|
||||
set -gx $arr[1] $arr[2]
|
||||
end
|
||||
'';
|
||||
};
|
||||
shellAbbrs =
|
||||
{
|
||||
gc = "nix-collect-garbage --delete-old";
|
||||
}
|
||||
# navigation shortcuts
|
||||
// {
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../../";
|
||||
"...." = "cd ../../../";
|
||||
"....." = "cd ../../../../";
|
||||
}
|
||||
# git shortcuts
|
||||
// {
|
||||
gapa = "git add --patch";
|
||||
grpa = "git reset --patch";
|
||||
gst = "git status";
|
||||
gdh = "git diff HEAD";
|
||||
gp = "git push";
|
||||
gph = "git push -u origin HEAD";
|
||||
gco = "git checkout";
|
||||
gcob = "git checkout -b";
|
||||
gcm = "git checkout master";
|
||||
gcd = "git checkout develop";
|
||||
gsp = "git stash push -m";
|
||||
gsa = "git stash apply stash^{/";
|
||||
gsl = "git stash list";
|
||||
};
|
||||
shellAliases = {
|
||||
jvim = "nvim";
|
||||
lvim = "nvim";
|
||||
pbcopy = "/mnt/c/Windows/System32/clip.exe";
|
||||
pbpaste = "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -command 'Get-Clipboard'";
|
||||
explorer = "/mnt/c/Windows/explorer.exe";
|
||||
|
||||
# To use code as the command, uncomment the line below. Be sure to replace [my-user] with your username.
|
||||
# If your code binary is located elsewhere, adjust the path as needed.
|
||||
# code = "/mnt/c/Users/[my-user]/AppData/Local/Programs/'Microsoft VS Code'/bin/code";
|
||||
};
|
||||
plugins = [
|
||||
{
|
||||
inherit (pkgs.fishPlugins.autopair) src;
|
||||
name = "autopair";
|
||||
}
|
||||
{
|
||||
inherit (pkgs.fishPlugins.done) src;
|
||||
name = "done";
|
||||
}
|
||||
{
|
||||
inherit (pkgs.fishPlugins.sponge) src;
|
||||
name = "sponge";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"github_token": "your github token",
|
||||
"gitlab_token": "your gitlab token"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
disabled = ["repeated_keys"]
|
||||
nix_version = '2.4'
|
||||
ignore = ['.direnv']
|
||||
@@ -0,0 +1,121 @@
|
||||
{
|
||||
# FIXME: uncomment the next line if you want to reference your GitHub/GitLab access tokens and other secrets
|
||||
# secrets,
|
||||
username,
|
||||
hostname,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
# FIXME: change to your tz! look it up with "timedatectl list-timezones"
|
||||
time.timeZone = "America/Los_Angeles";
|
||||
|
||||
networking.hostName = "${hostname}";
|
||||
|
||||
# FIXME: change your shell here if you don't want fish
|
||||
programs.fish.enable = true;
|
||||
environment.pathsToLink = ["/share/fish"];
|
||||
environment.shells = [pkgs.fish];
|
||||
|
||||
environment.enableAllTerminfo = true;
|
||||
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
|
||||
# FIXME: uncomment the next line to enable SSH
|
||||
# services.openssh.enable = true;
|
||||
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
# FIXME: change your shell here if you don't want fish
|
||||
shell = pkgs.fish;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
# FIXME: uncomment the next line if you want to run docker without sudo
|
||||
# "docker"
|
||||
];
|
||||
# FIXME: add your own hashed password
|
||||
# hashedPassword = "";
|
||||
# FIXME: add your own ssh public key
|
||||
# openssh.authorizedKeys.keys = [
|
||||
# "ssh-rsa ..."
|
||||
# ];
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
imports = [
|
||||
./home.nix
|
||||
];
|
||||
};
|
||||
|
||||
system.stateVersion = "22.05";
|
||||
|
||||
wsl = {
|
||||
enable = true;
|
||||
wslConf.automount.root = "/mnt";
|
||||
wslConf.interop.appendWindowsPath = false;
|
||||
wslConf.network.generateHosts = false;
|
||||
defaultUser = username;
|
||||
startMenuLaunchers = true;
|
||||
|
||||
# Enable integration with Docker Desktop (needs to be installed)
|
||||
docker-desktop.enable = false;
|
||||
};
|
||||
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
enableOnBoot = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
|
||||
# FIXME: uncomment the next block to make vscode running in Windows "just work" with NixOS on WSL
|
||||
# solution adapted from: https://github.com/K900/vscode-remote-workaround
|
||||
# more information: https://github.com/nix-community/NixOS-WSL/issues/238 and https://github.com/nix-community/NixOS-WSL/issues/294
|
||||
# systemd.user = {
|
||||
# paths.vscode-remote-workaround = {
|
||||
# wantedBy = ["default.target"];
|
||||
# pathConfig.PathChanged = "%h/.vscode-server/bin";
|
||||
# };
|
||||
# services.vscode-remote-workaround.script = ''
|
||||
# for i in ~/.vscode-server/bin/*; do
|
||||
# if [ -e $i/node ]; then
|
||||
# echo "Fixing vscode-server in $i..."
|
||||
# ln -sf ${pkgs.nodejs_18}/bin/node $i/node
|
||||
# fi
|
||||
# done
|
||||
# '';
|
||||
# };
|
||||
|
||||
nix = {
|
||||
settings = {
|
||||
trusted-users = [username];
|
||||
# FIXME: use your access tokens from secrets.json here to be able to clone private repos on GitHub and GitLab
|
||||
# access-tokens = [
|
||||
# "github.com=${secrets.github_token}"
|
||||
# "gitlab.com=OAuth2:${secrets.gitlab_token}"
|
||||
# ];
|
||||
|
||||
accept-flake-config = true;
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
|
||||
registry = {
|
||||
nixpkgs = {
|
||||
flake = inputs.nixpkgs;
|
||||
};
|
||||
};
|
||||
|
||||
nixPath = [
|
||||
"nixpkgs=${inputs.nixpkgs.outPath}"
|
||||
"nixos-config=/etc/nixos/configuration.nix"
|
||||
"/nix/var/nix/profiles/per-user/root/channels"
|
||||
];
|
||||
|
||||
package = pkgs.nixVersions.stable;
|
||||
extraOptions = ''experimental-features = nix-command flakes'';
|
||||
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user