first commit

This commit is contained in:
Sebastian Wendel 2024-09-09 22:08:49 +02:00
commit 9f2899ff0c
50 changed files with 2738 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

53
.gitignore vendored Normal file
View file

@ -0,0 +1,53 @@
.gitignore.envrc.local
.*.swo
.*.swp
.direnv
.DS_Store
.pre-commit-config.yaml
result*
*.qcow2
*.log
temp
*.pyc
TODOS.md
.devenv
# terraform
.terraform
*.tf.json
*.tfstate
# Local .terraform directories
**/.terraform/*
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc

9
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,9 @@
{
"recommendations": [
"arrterian.nix-env-selector",
"bbenoist.nix",
"jnoortheen.nix-ide",
"mikestead.dotenv",
],
"unwantedRecommendations": []
}

20
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,20 @@
{
"files.associations": {
"flake.lock": "json",
"*.hcl": "hcl",
},
"[nix]": {
"editor.defaultFormatter": "brettm12345.nixfmt-vscode",
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.codeLens": true,
"emmet.triggerExpansionOnTab": true,
"editor.quickSuggestions": {
"comments": "on",
"strings": "on"
}
},
"nix.serverPath": "nil",
"nix.enableLanguageServer": true
}

24
LICENSE.md Normal file
View file

@ -0,0 +1,24 @@
# The MIT License (MIT)
Copyright © 2024 Sebastian Wendel
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

90
README.md Normal file
View file

@ -0,0 +1,90 @@
# NixOS WSL Flake
This is my personal, opinionated configuration of NixOS WSL when I need to use Microsoft Windows as my primary operating system. It is intended to give developers and DevOps engineers an insight into the potential of Nix. If you're interested in more Nix-related topics, you can check out my other [Projects](https://code.srx.digital/explore/repos) or follow me on [Github](https://github.com/SebastianWendel).
Dies ist meine persönliche Konfiguration von NixOS WSL, wenn ich MS Windows als mein primäres Betriebssystem verwenden muss. Sie soll mein System Konfiguration dokumentieren, reproduzierbar halten und anderen einen Einblick in das Potential von Nix geben.
Wenn du an weiteren Nix-bezogenen Themen interessiert bist, kannst du dir meine anderen [Projekte](https://code.srx.digital/explore/repos) ansehen oder mir auf [Github](https://github.com/SebastianWendel) folgen.
## 🛠️ Components
- [flake-parts](https://github.com/hercules-ci/flake-parts): Simplify Nix Flakes with the module system.
- [git-hooks](https://github.com/cachix/git-hooks.nix): Seamless integration of git hooks with Nix.
- [home-manager](https://github.com/nix-community/home-manager): Manage user environments using Nix.
- [neovim](https://github.com/nix-community/nixvim)
- [yocto](https://github.com/nix-community/nix-environments/blob/master/envs/yocto/shell.nix)
## 📁 Repository layout
```txt
├── modules - Reusable NixOS modules
├── nix - Flake-parts modules
├── default.nix - Legacy support with flake-compat
├── flake.lock - Lock file for version pinning
└── flake.nix - Flakes configuration
```
## 🚀 Getting started
### 📋 Prerequisites
#### NixOS WSL
Before proceeding, ensure you have [installed the NixOS-WSL](https://nix-community.github.io/NixOS-WSL/install.html), followed the guide and have a funtional terminal envirnment.
#### Icon Fonts
To get the necessary icons in all shell applications, install a NerdFont with additional fonts by running the following Powershell command in an administrative environment:
```powershell
& ([scriptblock]::Create((iwr 'https://to.loredo.me/Install-NerdFont.ps1')))
```
To use `Cascadia Code Nerd Font`, enter the number `11`. After completing the installation, a system restart may be required. Now you can configure `Cascadia Code NF` in your editor and terminal emulator.
Further details can be found at [Microsoft Cascadia Code](https://github.com/microsoft/cascadia-code) and
### Configure NixOS
Checkout the source tree, open you're new NixOS terminal and follw the stepps:
```sh
sudo mv /etc/nixos /etc/.nixos
sudo git clone https://gitlab.i40.ifm-datalink.net/sebastian.wendel/nixos-wls /etc/nixos
```
### Test you configuration
```sh
sudo nixos-rebuild test
```
### Apply you configuration
```sh
sudo nixos-rebuild switch
```
If something fails, you can add `--show-trace` to get a more detailed output of all the expressions on the stack.
## 🚧 Reporting issues
If you experience any issues with the infrastructure, please [post a new issue to this repository]().
## Documentation
- [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/)
- [Nix Manual](https://nix.dev/manual/nix/stable/)
- [NixOS Manual](https://nixos.org/manual/nixos/stable/)
## 📚 Links
- [Nix packages search](https://search.nixos.org/packages)
- [NixOS options search](https://search.nixos.org/options)
- [NixOS & Flakes Book](https://nixos-and-flakes.thiscute.world/)
- [NixOS Wiki](https://nixos.wiki/wiki/Main_Page)
- [Awesome Nix](https://github.com/nix-communi/awesome-nix)
## 📜 License
All files in this repository are licensed under the terms of the MIT License (MIT). Please refer to the full license text in [LICENSE](LICENSE.md).

22
default.nix Normal file
View file

@ -0,0 +1,22 @@
{ system ? builtins.currentSystem
, src ? ./.
,
}:
let
inherit (lock.nodes.flake-compat.locked)
owner
repo
rev
narHash
;
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
flake-compat = fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = narHash;
};
flake = import flake-compat { inherit src system; };
in
flake.defaultNix

877
flake.lock Normal file
View file

@ -0,0 +1,877 @@
{
"nodes": {
"base16": {
"inputs": {
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1708890466,
"narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "665b3c6748534eb766c777298721cece9453fdae",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "base16.nix",
"type": "github"
}
},
"base16-fish": {
"flake": false,
"locked": {
"lastModified": 1622559957,
"narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=",
"owner": "tomyun",
"repo": "base16-fish",
"rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe",
"type": "github"
},
"original": {
"owner": "tomyun",
"repo": "base16-fish",
"type": "github"
}
},
"base16-foot": {
"flake": false,
"locked": {
"lastModified": 1696725948,
"narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=",
"owner": "tinted-theming",
"repo": "base16-foot",
"rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-foot",
"type": "github"
}
},
"base16-helix": {
"flake": false,
"locked": {
"lastModified": 1720809814,
"narHash": "sha256-numb3xigRGnr/deF7wdjBwVg7fpbTH7reFDkJ75AJkY=",
"owner": "tinted-theming",
"repo": "base16-helix",
"rev": "34f41987bec14c0f3f6b2155c19787b1f6489625",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-helix",
"type": "github"
}
},
"base16-kitty": {
"flake": false,
"locked": {
"lastModified": 1665001328,
"narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=",
"owner": "kdrag0n",
"repo": "base16-kitty",
"rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805",
"type": "github"
},
"original": {
"owner": "kdrag0n",
"repo": "base16-kitty",
"type": "github"
}
},
"base16-tmux": {
"flake": false,
"locked": {
"lastModified": 1696725902,
"narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=",
"owner": "tinted-theming",
"repo": "base16-tmux",
"rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-tmux",
"type": "github"
}
},
"base16-vim": {
"flake": false,
"locked": {
"lastModified": 1716150083,
"narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=",
"owner": "tinted-theming",
"repo": "base16-vim",
"rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-vim",
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722113426,
"narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=",
"owner": "numtide",
"repo": "devshell",
"rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1725377834,
"narHash": "sha256-tqoAO8oT6zEUDXte98cvA1saU9+1dLJQe3pMKLXv8ps=",
"owner": "nix-community",
"repo": "disko",
"rev": "e55f9a8678adc02024a4877c2a403e3f6daf24fe",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1717312683,
"narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1725234343,
"narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "567b938d64d4b4112ee253b9274472dc3a346eb6",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"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": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": [
"stylix",
"systems"
]
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"fromYaml": {
"flake": false,
"locked": {
"lastModified": 1689549921,
"narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=",
"owner": "SenchoPens",
"repo": "fromYaml",
"rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "fromYaml",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
"flake-compat"
],
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1725513492,
"narHash": "sha256-tyMUA6NgJSvvQuzB7A1Sf8+0XCHyfSPRx/b00o6K0uo=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "7570de7b9b504cfe92025dd1be797bf546f66528",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"git-hooks_2": {
"inputs": {
"flake-compat": [
"nixvim",
"flake-compat"
],
"gitignore": "gitignore_2",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1724857454,
"narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gnome-shell": {
"flake": false,
"locked": {
"lastModified": 1713702291,
"narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=",
"owner": "GNOME",
"repo": "gnome-shell",
"rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934",
"type": "github"
},
"original": {
"owner": "GNOME",
"ref": "46.1",
"repo": "gnome-shell",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1725180166,
"narHash": "sha256-fzssXuGR/mCeGbzM1ExaTqDz7QDGta3WA4jJsZyRruo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "471e3eb0a114265bcd62d11d58ba8d3421ee68eb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1724435763,
"narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1724561770,
"narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1725152544,
"narHash": "sha256-Tm344cnFM9f2YZsgWtJduvhIrvLr3Bi8J4Xc+UZDKYE=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "7f0b9e4fbd91826cb9ce6babbc11c87903191051",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-anywhere": {
"inputs": {
"disko": [
"disko"
],
"flake-parts": [
"flake-parts"
],
"nixos-images": "nixos-images",
"nixos-stable": "nixos-stable",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": [
"treefmt-nix"
]
},
"locked": {
"lastModified": 1725272324,
"narHash": "sha256-RygpChm/b3Dx2HwdM0YdCBbdQbCjA2V7960EUOHmLPQ=",
"owner": "nix-community",
"repo": "nixos-anywhere",
"rev": "69ad3f4a50cfb711048f54013404762c9a8e201e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-anywhere",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1725497951,
"narHash": "sha256-fayKyVs/9FQdYH+3SCOkQM1GCsEPPVE+lSiVGlYQ7i0=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "15a07ebf4a041bf232026263f1f96f2af390f3bc",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixos-images": {
"inputs": {
"nixos-stable": [
"nixos-anywhere",
"nixos-stable"
],
"nixos-unstable": [
"nixos-anywhere",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717994219,
"narHash": "sha256-ueTu01bYU5QXdL77psMkApYHpk339xNHg/M7ZzP3uPI=",
"owner": "nix-community",
"repo": "nixos-images",
"rev": "e2fd329c3a39a90bb43e1e2cf47c180ed57831bf",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-images",
"type": "github"
}
},
"nixos-stable": {
"locked": {
"lastModified": 1717696253,
"narHash": "sha256-1+ua0ggXlYYPLTmMl3YeYYsBXDSCqT+Gw3u6l4gvMhA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9b5328b7f761a7bbdc0e332ac4cf076a3eedb89b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1725358307,
"narHash": "sha256-su/Nzp2X8JlaD9wPYQGXeTilaVa5H06X7A3kqCLJNuo=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "8a89995f745b1a9029d654c391a0f62ca03f7fe7",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NixOS-WSL",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725103162,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1724819573,
"narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "71e91c409d1e654808b2621f28a327acfdad8dc2",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks_2",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs_2",
"nuschtosSearch": "nuschtosSearch",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1725499492,
"narHash": "sha256-IjpbYl4ljZ6gffzfH/n2qYbtu7PZ1KM2LW+cVL6w1bk=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "e48da949cf41597d43f8e3880fc1389129ad7427",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1725864675,
"narHash": "sha256-VkHgZJ0D32wFAyWaBb2hXZSyc4UrTu4XOM9/vJeDPek=",
"owner": "nix-community",
"repo": "NUR",
"rev": "65eda9f4b5b4841d1afbd29bbe6a2c6b5e038476",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1724584782,
"narHash": "sha256-7FfHv7b1jwMPSu9SPY9hdxStk8E6EeSwzqdvV69U4BM=",
"owner": "NuschtOS",
"repo": "search",
"rev": "5a08d691de30b6fc28d58ce71a5e420f2694e087",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"home-manager": "home-manager",
"nixos-anywhere": "nixos-anywhere",
"nixos-generators": "nixos-generators",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"nur": "nur",
"stylix": "stylix",
"treefmt-nix": "treefmt-nix_2"
}
},
"stylix": {
"inputs": {
"base16": "base16",
"base16-fish": "base16-fish",
"base16-foot": "base16-foot",
"base16-helix": "base16-helix",
"base16-kitty": "base16-kitty",
"base16-tmux": "base16-tmux",
"base16-vim": "base16-vim",
"flake-compat": [
"flake-compat"
],
"flake-utils": "flake-utils_3",
"gnome-shell": "gnome-shell",
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_3"
},
"locked": {
"lastModified": 1725290973,
"narHash": "sha256-+jwXF9KI0HfvDgpsoJGvOdfOGGSKOrID1wQB79zjUbo=",
"owner": "danth",
"repo": "stylix",
"rev": "ef81ad9e85e60420cc83d4642619c14b57139d33",
"type": "github"
},
"original": {
"owner": "danth",
"repo": "stylix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"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": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1724833132,
"narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "3ffd842a5f50f435d3e603312eefa4790db46af5",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1725271838,
"narHash": "sha256-VcqxWT0O/gMaeWTTjf1r4MOyG49NaNxW4GHTO3xuThE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "9fb342d14b69aefdf46187f6bb80a4a0d97007cd",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

110
flake.nix Normal file
View file

@ -0,0 +1,110 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-anywhere = {
url = "github:nix-community/nixos-anywhere";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
disko.follows = "disko";
treefmt-nix.follows = "treefmt-nix";
};
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat.url = "github:nix-community/flake-compat";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
};
};
nixvim.url = "github:nix-community/nixvim";
stylix = {
url = "github:danth/stylix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
home-manager.follows = "home-manager";
};
};
nur.url = "github:nix-community/NUR";
};
outputs =
{ self, nixpkgs, flake-parts, ... } @ inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
imports = [
./nix/devshell.nix
./nix/pre-commit.nix
./nix/treefmt.nix
];
perSystem = { pkgs, system, ... }: {
_module.args = {
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config = {
allowUnfree = true;
allowAliases = true;
};
};
};
};
flake = {
overlays.default = nixpkgs.lib.composeManyExtensions [
inputs.nixvim.overlays.default
inputs.nur.overlay
];
nixosConfigurations."ifm10n32359" = nixpkgs.lib.nixosSystem {
modules = with inputs; [
nixos-wsl.nixosModules.default
nixvim.nixosModules.nixvim
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
./modules
];
};
};
};
}

32
modules/default.nix Normal file
View file

@ -0,0 +1,32 @@
{
imports = [
./hardware.nix
./home-manager.nix
./stylix.nix
./users.nix
./fonts.nix
./nix.nix
./podman.nix
./neovim
./programs.nix
./packages.nix
./documentation.nix
];
system.stateVersion = "24.11";
nixpkgs.hostPlatform = "x86_64-linux";
time.timeZone = "Europe/Berlin";
wsl = {
enable = true;
defaultUser = "dewendse";
wslConf = {
automount.ldconfig = true;
automount.mountFsTab = true;
};
useWindowsDriver = true;
startMenuLaunchers = true;
};
}

10
modules/documentation.nix Normal file
View file

@ -0,0 +1,10 @@
{ lib, ... }:
{
documentation = {
enable = lib.mkForce true;
nixos.enable = lib.mkForce true;
doc.enable = lib.mkForce true;
man.enable = lib.mkForce true;
info.enable = lib.mkForce true;
};
}

36
modules/fonts.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
fonts = {
fontDir.enable = true;
fontconfig.enable = true;
enableDefaultPackages = true;
packages = with pkgs;[
fira-code
fira-code-symbols
material-design-icons
material-symbols
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
roboto-mono
source-code-pro
twitter-color-emoji
(nerdfonts.override {
fonts = [
"JetBrainsMono"
"FiraCode"
"Hack"
"Meslo"
];
})
manrope
martian-mono
];
};
}

8
modules/hardware.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
hardware.keyboard.qmk.enable = true;
services.udev.packages = with pkgs; [
via
];
}

7
modules/home-manager.nix Normal file
View file

@ -0,0 +1,7 @@
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
};
}

9
modules/home/ansible.nix Normal file
View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
ansible
ansible-lint
ansible-doctor
ansible-language-server
];
}

176
modules/home/default.nix Normal file
View file

@ -0,0 +1,176 @@
{ config, ... }:
{
imports = [
# system
./zsh.nix
./xdg.nix
./stylix.nix
./packages.nix
# auth
./gpg.nix
./ssh.nix
./pass.nix
# terminal
./fish.nix
./starship.nix
# development
./git.nix
./python.nix
./rust.nix
./nodejs.nix
./ansible.nix
# gui
./firefox.nix
];
programs = {
home-manager.enable = true;
bat.enable = true;
dircolors.enable = true;
broot = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
};
nix-index = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
};
htop = {
enable = true;
settings =
{
delay = 10;
show_program_path = false;
show_cpu_frequency = true;
show_cpu_temperature = true;
hide_kernel_threads = true;
}
// (
with config.lib.htop;
leftMeters [
(bar "AllCPUs2")
(bar "Memory")
(bar "Swap")
]
)
// (
with config.lib.htop;
rightMeters [
(text "Hostname")
(text "Tasks")
(text "LoadAverage")
(text "Uptime")
(text "Systemd")
]
);
};
btop = {
enable = true;
settings.vim_keys = true;
};
eza = {
enable = true;
icons = true;
enableZshIntegration = true;
enableBashIntegration = true;
extraOptions = [
"--group-directories-first"
"--header"
];
};
fd.enable = true;
fzf = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
};
lsd = {
enable = true;
enableAliases = true;
settings = {
layout = "grid";
hyperlink = "auto";
sorting.dir-grouping = "first";
};
};
lf = {
enable = true;
settings = {
number = true;
ratios = [ 1 1 2 ];
tabstop = 4;
preview = true;
hidden = true;
drawbox = true;
icons = true;
ignorecase = true;
};
commands = {
get-mime-type = ''%xdg-mime query filetype "$f"'';
};
};
jq.enable = true;
tmux = {
enable = true;
aggressiveResize = true;
clock24 = true;
escapeTime = 0;
historyLimit = 10000;
newSession = false;
secureSocket = false;
};
ripgrep = {
enable = true;
arguments = [
"--max-columns-preview"
"--colors=line:style:bold"
];
};
yazi = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
settings = {
manager = {
show_hidden = false;
sort_dir_first = true;
};
};
};
zoxide = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
options = [ "--cmd cd" ];
};
thefuck = {
enable = true;
enableInstantMode = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
};
}

237
modules/home/firefox.nix Normal file
View file

@ -0,0 +1,237 @@
{ pkgs, ... }:
{
programs.firefox = {
enable = true;
profiles = {
default = {
isDefault = true;
settings = {
# https://kb.mozillazine.org/About:config_entries
"app.update.auto" = false;
"browser.newtab.url" = "about:blank";
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.newtabpage.pinned" = [
{
title = "NixOS";
url = "https://nixos.org";
}
];
"browser.ping-centre.telemetry" = false;
"browser.search.isUS" = false;
"browser.search.region" = "DE";
"browser.shell.checkDefaultBrowser" = false;
"browser.startup.homepage" = "about:blank";
"browser.uidensity" = 0;
"distribution.searchplugins.defaultLocale" = "en-GB";
"dom.security.https_only_mode_ever_enabled" = true;
"dom.security.https_only_mode" = true;
"experiments.activeExperiment" = false;
"experiments.enabled" = false;
"experiments.supported" = false;
"extensions.pocket.api" = "";
"extensions.pocket.enabled" = false;
"extensions.pocket.oAuthConsumerKey" = "";
"extensions.pocket.showHome" = false;
"extensions.pocket.site" = "";
"general.smoothScroll" = true;
"general.useragent.locale" = "en-GB";
"gnomeTheme.normalWidthTabs" = true;
"gnomeTheme.tabsAsHeaderbar" = true;
"network.allow-experiments" = false;
"policies.PasswordManagerEnabled" = true;
"privacy.donottrackheader.enabled" = true;
"privacy.partition.network_state.ocsp_cache" = true;
"privacy.resistFingerprinting" = false;
"privacy.trackingprotection.enabled" = true;
"privacy.trackingprotection.socialtracking.enabled" = true;
"signon.rememberSignons" = false;
"svg.content-properties.content.enabled" = true;
"svg.context-properties.content.enabled" = true;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.hybridContent.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.reportingpolicy.firstRun" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"webgl.disabled" = true;
};
extraConfig = ''
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
user_pref("full-screen-api.ignore-widgets", true);
user_pref("media.ffmpeg.vaapi.enabled", true);
user_pref("media.rdd-vpx.enabled", true);
'';
search = {
force = true;
default = "Google";
engines = {
"NixOS Options" = {
urls = [
{
template = "https://search.nixos.org/options";
params = [
{
name = "type";
value = "options";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@no" ];
};
"NixOS Wiki" = {
urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@nw" ];
};
"Nix Home Options" = {
urls = [
{
template = "https://mipmip.github.io/home-manager-option-search";
params = [
{
name = "type";
value = "options";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@nh" ];
};
"Nix Packages" = {
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"Nix Reference Manual" = {
urls = [{ template = "https://nixos.org/manual/nix/stable/?search={searchTerms}"; }];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@nm" ];
};
"OpenWRT Packages" = {
urls = [{ template = "https://openwrt.org/packages/pkgdata/{searchTerms}"; }];
iconUpdateURL = "https://openwrt.org/_media/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@ow" ];
};
"OpenWRT Wiki" = {
urls = [{ template = "https://openwrt.org/de/start?do=search&q={searchTerms}"; }];
iconUpdateURL = "https://openwrt.org/_media/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@ow" ];
};
"Zephyr Documentation" = {
urls = [{ template = "https://docs.zephyrproject.org/latest/search.html?q={searchTerms}"; }];
iconUpdateURL = "https://zephyrproject.org/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@zd" ];
};
"Zephyr Config" = {
urls = [{
template = "https://docs.zephyrproject.org/latest/kconfig.html?type=kconfig&query={searchTerms}";
}];
iconUpdateURL = "https://zephyrproject.org/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@zc" ];
};
"Docker Image" = {
urls = [{ template = "https://hub.docker.com/search?q={searchTerms}"; }];
iconUpdateURL = "https://hub.docker.com/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@di" ];
};
"Python Package" = {
urls = [{ template = "https://pypi.org/search/?q={searchTerms}"; }];
iconUpdateURL = "https://pypi.org/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@pip" ];
};
"Rust Crates" = {
urls = [{ template = "https://crates.io/search?q={searchTerms}"; }];
iconUpdateURL = "https://www.rust-lang.org/static/images/favicon-32x32.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@rc" ];
};
"Rust Book" = {
urls = [{ template = "https://doc.rust-lang.org/beta/book/index.html?search={searchTerms}"; }];
iconUpdateURL = "https://www.rust-lang.org/static/images/favicon-32x32.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@rb" ];
};
};
};
# extensions = with firefox-addons.packages; [
# block-origin
# bitwarden
# gopass-bridge
# react-devtools
# I-still-dont-care-about-cookies
# dnssec
# ];
};
};
};
xdg.mimeApps = {
enable = true;
defaultApplications = {
"application/xhtml+xml" = "firefox.desktop";
"text/html" = "firefox.desktop";
"text/xml" = "firefox.desktop";
"x-scheme-handler/ftp" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/about" = "firefox.desktop";
"x-scheme-handler/unknown" = "firefox.desktop";
};
};
}

24
modules/home/fish.nix Normal file
View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
programs.fish = {
enable = true;
interactiveShellInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
set -U fish_greeting
'';
plugins = [
{
inherit (pkgs.fishPlugins.autopair) src;
name = "autopair";
}
{
inherit (pkgs.fishPlugins.done) src;
name = "done";
}
{
inherit (pkgs.fishPlugins.sponge) src;
name = "sponge";
}
];
};
}

95
modules/home/git.nix Normal file
View file

@ -0,0 +1,95 @@
{ pkgs, lib, ... }:
{
home.packages = with pkgs; [ glab ];
programs = {
git = {
enable = true;
package = pkgs.gitFull;
userName = "Sebastian Wendel";
userEmail = "sebastian.wendel@ifm.com";
aliases = {
amend = "commit --amend -C HEAD";
authors =
''!"${pkgs.git}/bin/git log --pretty=format:%aN''
+ " | ${pkgs.coreutils}/bin/sort"
+ " | ${pkgs.coreutils}/bin/uniq -c"
+ " | ${pkgs.coreutils}/bin/sort -rn\"";
b = "branch --color -v";
ca = "commit --amend";
changes = "diff --name-status -r";
clone = "clone --recursive";
co = "checkout";
cp = "cherry-pick";
dc = "diff --cached";
dh = "diff HEAD";
ds = "diff --staged";
from = "!${pkgs.git}/bin/git bisect start && ${pkgs.git}/bin/git bisect bad HEAD && ${pkgs.git}/bin/git bisect good";
ls-ignored = "ls-files --exclude-standard --ignored --others";
rc = "rebase --continue";
rh = "reset --hard";
ri = "rebase --interactive";
rs = "rebase --skip";
ru = "remote update --prune";
snap = "!${pkgs.git}/bin/git stash" + " && ${pkgs.git}/bin/git stash apply";
snaplog =
"!${pkgs.git}/bin/git log refs/snapshots/refs/heads/" + "$(${pkgs.git}/bin/git rev-parse HEAD)";
spull =
"!${pkgs.git}/bin/git stash" + " && ${pkgs.git}/bin/git pull" + " && ${pkgs.git}/bin/git stash pop";
su = "submodule update --init --recursive";
undo = "reset --soft HEAD^";
w = "status -sb";
wdiff = "diff --color-words";
l =
"log --graph --pretty=format:'%Cred%h%Creset"
+ " %Cblue%d%Creset %s %Cgreen(%cr)%Creset'"
+ " --abbrev-commit --date=relative --show-notes=*";
};
extraConfig = {
core = {
editr = "${lib.getExe pkgs.vscodium-fhs} --wait";
pager = "${lib.getExe pkgs.bat}";
trustctime = false;
logAllRefUpdates = true;
precomposeunicode = false;
whitespace = "trailing-space,space-before-tab";
};
branch.autosetupmerge = true;
credential.helper = "${pkgs.pass-git-helper}/bin/pass-git-helper";
ghi.token = "!${pkgs.pass}/bin/pass show api.github.com | head -1";
github.user = "SebastianWendel";
hub.protocol = "${pkgs.openssh}/bin/ssh";
init.defaultBranch = "main";
mergetool.keepBackup = true;
pull.rebase = true;
rebase.autosquash = true;
rerere.enabled = true;
color = {
status = "auto";
diff = "auto";
branch = "auto";
interactive = "auto";
ui = "auto";
sh = "auto";
};
};
};
gitui.enable = true;
};
programs.lazygit = {
enable = true;
settings = {
keybindings = {
universal = {
nextTab = "l";
prevTab = "h";
"nextBlock-alt" = false;
"prevBlock-alt" = false;
};
};
};
};
}

18
modules/home/gpg.nix Normal file
View file

@ -0,0 +1,18 @@
{
services.gpg-agent = {
enable = true;
enableScDaemon = true;
enableSshSupport = true;
enableExtraSocket = true;
defaultCacheTtl = 34560000;
maxCacheTtl = 34560000;
};
programs.gpg = {
enable = true;
settings = {
keyserver = "hkps://keys.openpgp.org";
keyserver-options = "no-honor-keyserver-url";
};
};
}

18
modules/home/nodejs.nix Normal file
View file

@ -0,0 +1,18 @@
{ pkgs
, ...
}:
{
home = {
packages = with pkgs; [ nodejs ];
sessionVariables = {
NODE_EXTRA_CA_CERTS = "/etc/ssl/certs/Cloudflare_CA.pem";
};
};
programs.bun = {
enable = true;
settings = {
telemetry = false;
};
};
}

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
meld
appimage-run
filezilla
unzip
];
}

15
modules/home/pass.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
services.pass-secret-service.enable = true;
programs.password-store = {
enable = true;
settings.PASSWORD_STORE_DIR = "$HOME/.password-store";
};
home.packages = with pkgs; [
gopass
gopass-jsonapi
qtpass
];
}

8
modules/home/python.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(python3.withPackages (p: [
p.pytz
]))
];
}

11
modules/home/rust.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs
, ...
}:
{
home.packages = with pkgs; [
cargo
rustc
gcc
rustfmt
];
}

6
modules/home/ssh.nix Normal file
View file

@ -0,0 +1,6 @@
{
programs.ssh = {
enable = true;
forwardAgent = true;
};
}

63
modules/home/starship.nix Normal file
View file

@ -0,0 +1,63 @@
{ lib, ... }:
{
programs.starship = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
settings = {
add_newline = true;
scan_timeout = 10;
status = {
map_symbol = true;
pipestatus = true;
};
format = lib.concatStrings [
"$all"
"$line_break"
"$character"
];
character = {
success_symbol = " [λ](bold green)";
error_symbol = " [λ](bold red)";
};
nix_shell.symbol = " ";
aws.disabled = true;
directory = {
style = "cyan";
read_only = " 🔒";
};
battery = {
charging_symbol = "";
display = [
{
threshold = 10;
style = "bold red";
}
];
};
cmd_duration.show_notifications = true;
git_metrics = {
format = "[+$added]($added_style)/[-$deleted]($deleted_style)";
};
git_status = {
ahead = ''''${count}'';
diverged = ''''${ahead_count}''${behind_count}'';
behind = ''''${count}'';
};
shlvl = {
symbol = " ";
};
};
};
}

23
modules/home/stylix.nix Normal file
View file

@ -0,0 +1,23 @@
{
stylix = {
enable = true;
fonts = {
sizes = {
desktop = 12;
applications = 12;
terminal = 12;
popups = 12;
};
};
opacity = {
terminal = 0.9;
applications = 0.9;
popups = 0.9;
desktop = 0.9;
};
targets.gnome.enable = true;
};
}

6
modules/home/xdg.nix Normal file
View file

@ -0,0 +1,6 @@
{
xdg.userDirs = {
enable = true;
createDirectories = true;
};
}

70
modules/home/zsh.nix Normal file
View file

@ -0,0 +1,70 @@
{ pkgs, lib, ... }:
{
home.file.".config/btop/themes/catppuccin.theme" = {
source = builtins.fetchurl {
url = "https://raw.githubusercontent.com/catppuccin/btop/main/themes/catppuccin_mocha.theme";
sha256 = "0i263xwkkv8zgr71w13dnq6cv10bkiya7b06yqgjqa6skfmnjx2c";
};
};
programs.zsh =
let
mkZshPlugin =
{ pkg
, file ? "${pkg.pname}.plugin.zsh"
,
}:
{
name = pkg.pname;
inherit (pkg) src;
inherit file;
};
in
{
enable = lib.mkForce true;
autocd = true;
autosuggestion.enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
enableVteIntegration = true;
plugins = with pkgs; [
(mkZshPlugin { pkg = zsh-z; })
(mkZshPlugin { pkg = zsh-abbr; })
(mkZshPlugin { pkg = zsh-fzf-tab; })
(mkZshPlugin { pkg = zsh-autoenv; })
(mkZshPlugin { pkg = zsh-autopair; })
(mkZshPlugin { pkg = zsh-nix-shell; })
(mkZshPlugin { pkg = zsh-completions; })
(mkZshPlugin { pkg = zsh-you-should-use; })
(mkZshPlugin { pkg = zsh-autosuggestions; })
(mkZshPlugin { pkg = zsh-navigation-tools; })
(mkZshPlugin { pkg = zsh-fzf-history-search; })
(mkZshPlugin { pkg = zsh-fast-syntax-highlighting; })
(mkZshPlugin { pkg = zsh-history-substring-search; })
];
oh-my-zsh = {
enable = true;
plugins = [
"direnv"
"git"
"golang"
"httpie"
"pass"
"ssh-agent"
"systemd"
"terraform"
];
};
history = {
extended = true;
ignoreDups = true;
expireDuplicatesFirst = true;
};
};
}

View file

@ -0,0 +1,11 @@
{
programs.nixvim.autoCmd = [
{
event = [ "TextYankPost" ];
pattern = "*";
callback = {
__raw = "function() vim.highlight.on_yank() end";
};
}
];
}

View file

@ -0,0 +1,42 @@
{
programs.nixvim.plugins = {
# enable vscode snippets
friendly-snippets.enable = true;
luasnip = {
enable = true;
fromVscode = [{ }];
};
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
{ name = "luasnip"; }
];
formatting.fields = [
"kind"
"abbr"
"menu"
];
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
};
};
};
};
}

View file

@ -0,0 +1,33 @@
{
programs.nixvim.plugins.dap = {
enable = true;
signs = {
dapBreakpoint = {
text = "";
texthl = "DapBreakpoint";
};
dapBreakpointCondition = {
text = "";
texthl = "DapBreakpointCondition";
};
dapLogPoint = {
text = "";
texthl = "DapLogPoint";
};
};
extensions = {
dap-python.enable = true;
dap-ui = {
enable = true;
floating.mappings = {
close = [ "<ESC>" "q" ];
};
};
dap-virtual-text.enable = true;
};
};
}

View file

@ -0,0 +1,90 @@
{
imports = [
#./keymaps.nix
./lsp.nix
./format.nix
./options.nix
./autocmd.nix
./completion.nix
./debugger.nix
./term.nix
./surround.nix
./git.nix
];
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
plugins = {
bufferline.enable = true;
comment.enable = true;
direnv.enable = true;
edgy.enable = true;
headlines.enable = true;
indent-blankline.enable = true;
lualine.enable = true;
markdown-preview.enable = true;
navic.enable = true;
nix.enable = true;
nvim-autopairs.enable = true;
oil.enable = true;
persistence.enable = true;
scope.enable = true;
transparent.enable = true;
treesitter-textobjects.enable = true;
treesitter.enable = true;
trouble.enable = true;
which-key.enable = true;
lint = {
enable = true;
lintersByFt = {
text = [ "vale" ];
json = [ "jsonlint" ];
markdown = [ "vale" ];
rst = [ "vale" ];
terraform = [ "tflint" ];
};
};
notify = {
enable = true;
fps = 60;
render = "default";
timeout = 500;
topDown = true;
};
noice = {
enable = true;
presets = {
lsp_doc_border = true;
};
};
mini = {
enable = true;
modules = {
pairs = { };
ai = { };
};
};
telescope = {
enable = true;
extensions = {
file-browser.enable = true;
fzf-native.enable = true;
};
settings.defaults = {
layout_config.horizontal.prompt_position = "top";
sorting_strategy = "ascending";
};
};
};
};
}

29
modules/neovim/format.nix Normal file
View file

@ -0,0 +1,29 @@
{ pkgs, ... }:
{
programs.nixvim = {
extraPackages = with pkgs; [
nixfmt-rfc-style
prettierd
];
plugins.conform-nvim = {
enable = true;
settings = {
notify_on_error = true;
formatters_by_ft = {
javascript = [ "prettierd" ];
typescript = [ "prettierd" ];
json = [ "prettierd" ];
yaml = [ "prettierd" ];
nix = [ "nixfmt" ];
};
format_on_save = {
lspFallback = true;
timeoutMs = 500;
};
};
};
};
}

32
modules/neovim/git.nix Normal file
View file

@ -0,0 +1,32 @@
{
programs.nixvim.plugins = {
gitsigns = {
enable = true;
settings = {
signcolumn = true;
numhl = true;
current_line_blame = false;
current_line_blame_opts = {
delay = 0;
};
watch_gitdir.follow_files = true;
signs = {
add.text = "";
change.text = "";
changedelete.text = "";
delete.text = "";
topdelete.text = "";
untracked.text = "";
};
};
};
lazygit = {
enable = true;
gitPackage = null;
lazygitPackage = null;
};
};
}

View file

@ -0,0 +1,59 @@
let
bind = key: action: {
inherit key action;
options.silent = true;
};
nmap = key: action: bind key action // { mode = "n"; };
in
{
programs.nixvim = {
globals.mapleader = " ";
keymaps = [
# quick commands
(bind ";" ":")
# navigation
(bind "H" "^")
(bind "L" "$")
(bind "K" "gg")
(bind "J" "G")
# surround
(nmap "s" "ys")
(nmap "S" "yS")
# delete and change
(nmap "dH" "d^")
(nmap "dL" "d$")
(nmap "cH" "c^")
(nmap "cL" "c$")
# redo
(nmap "U" "<c-r>")
# git
(nmap "<leader>g" ":LazyGit<cr>")
(nmap "<leader>B" ":Gitsigns toggle_current_line_blame<cr>")
(nmap "<leader>h" ":Gitsigns preview_hunk<cr>")
];
plugins.lsp.keymaps = {
silent = true;
diagnostic = {
"[d" = "goto_prev";
"]d" = "goto_next";
};
lspBuf = {
gd = "definition";
gr = "references";
gi = "implementation";
gt = "type_definition";
"<leader>a" = "code_action";
"<leader>k" = "hover";
"<leader>r" = "rename";
};
};
};
}

42
modules/neovim/lsp.nix Normal file
View file

@ -0,0 +1,42 @@
_:
{
programs.nixvim.plugins = {
lspkind = {
enable = true;
cmp.enable = true;
};
lsp-format.enable = true;
lsp-status.enable = true;
lsp = {
enable = true;
servers = {
#tsserver.enable = true;
tsserver.enable = true;
eslint.enable = true;
clangd.enable = true;
gopls.enable = true;
jsonls.enable = true;
jsonnet-ls.enable = true;
yamlls.enable = true;
html.enable = true;
nil-ls = {
enable = true;
settings.nix = {
#flake.autoEvalInputs = false;
maxMemoryMB = null;
};
};
rust-analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
};
};
};
}

View file

@ -0,0 +1,43 @@
{
programs.nixvim.opts = {
hlsearch = true;
wrap = false;
breakindent = true;
undofile = true;
updatetime = 250;
timeoutlen = 300;
completeopt = "menuone,noselect";
termguicolors = true;
# Line numbers
number = true;
relativenumber = true;
# Always show the signcolumn, otherwise text would be shifted when displaying error icons
signcolumn = "yes";
# Search
ignorecase = true;
smartcase = true;
# Tab defaults (might get overwritten by an LSP server)
tabstop = 4;
shiftwidth = 4;
softtabstop = 0;
expandtab = true;
smarttab = true;
# System clipboard support, needs xclip/wl-clipboard
clipboard = "unnamedplus";
# Highlight the current line
cursorline = true;
# Show line and column when searching
ruler = true;
# Global substitution by default
gdefault = true;
};
}

View file

@ -0,0 +1,3 @@
{
programs.nixvim.plugins.surround.enable = true;
}

8
modules/neovim/term.nix Normal file
View file

@ -0,0 +1,8 @@
{
programs.nixvim.plugins.toggleterm = {
enable = true;
settings = {
size = 20;
};
};
}

21
modules/nix.nix Normal file
View file

@ -0,0 +1,21 @@
{ pkgs, ... }:
{
nix = {
package = pkgs.nixVersions.git;
settings = {
accept-flake-config = true;
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
};
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
};
}

40
modules/packages.nix Normal file
View file

@ -0,0 +1,40 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
(pkgs.writeShellScriptBin "xdg-open" "exec -a $0 ${pkgs.wsl-open}/bin/wsl-open $@")
curl
ddrescue
direnv
dnsutils
git
gotop
gtop
htop
httpie
iftop
inetutils
iotop
ipcalc
jq
killall
lsof
mc
mtr
nmap
pstree
ranger
reptyr
ripgrep
screen
sshfs
sysstat
tree
tshark
via
wget
whois
xclip
yq
kitty
];
}

28
modules/podman.nix Normal file
View file

@ -0,0 +1,28 @@
{ pkgs, ... }:
{
virtualisation = {
oci-containers.backend = "podman";
containers = {
enable = true;
registries.search = [
"docker.io"
"quay.io"
];
};
podman = {
enable = true;
autoPrune.enable = true;
dockerCompat = true;
dockerSocket.enable = true;
};
};
environment = {
variables.PODMAN_IGNORE_CGROUPSV1_WARNING = "true";
systemPackages = with pkgs; [
docker-compose
];
};
}

26
modules/programs.nix Normal file
View file

@ -0,0 +1,26 @@
{ pkgs, ... }:
{
programs = {
nix-ld = {
enable = true;
package = pkgs.nix-ld-rs;
};
neovim = {
viAlias = true;
vimAlias = true;
};
zsh = {
enable = true;
enableCompletion = true;
autosuggestions.enable = true;
interactiveShellInit = "source '${pkgs.grml-zsh-config}/etc/zsh/zshrc'";
};
wireshark = {
enable = true;
package = pkgs.wireshark;
};
};
}

16
modules/stylix.nix Normal file
View file

@ -0,0 +1,16 @@
{ lib, pkgs, ... }:
{
stylix = {
enable = true;
base16Scheme = "${pkgs.base16-schemes}/share/themes/material-palenight.yaml";
image = pkgs.fetchurl {
url = "https://media.githubusercontent.com/media/lovesegfault/nix-config/bda48ceaf8112a8b3a50da782bf2e65a2b5c4708/users/bemeurer/assets/walls/plants-00.jpg";
hash = "sha256-n8EQgzKEOIG6Qq7og7CNqMMFliWM5vfi2zNILdpmUfI=";
};
autoEnable = true;
polarity = lib.mkDefault "dark";
};
}

54
modules/users.nix Normal file
View file

@ -0,0 +1,54 @@
{ lib
, pkgs
, config
, ...
}:
{
users = {
groups.${config.wsl.defaultUser}.gid = config.users.users.${config.wsl.defaultUser}.uid;
users.${config.wsl.defaultUser} = {
isNormalUser = true;
uid = 1000;
group = config.wsl.defaultUser;
createHome = true;
extraGroups = [
"users"
"wheel"
"dialout"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB6vk3k1p6YMsGLFQ/xABLYK/VJicywkf1MJawnN7oXU"
];
shell = lib.mkIf config.programs.zsh.enable pkgs.zsh;
};
};
home-manager.users.${config.wsl.defaultUser} = {
imports = [ ./home ];
home = {
username = config.wsl.defaultUser;
inherit (config.system) stateVersion;
sessionVariables = {
MANPAGER = "nvim +Man!";
EDITOR = "nvim";
VISUAL = "nvim";
};
shellAliases = {
x = "${pkgs.yt-dlp}/bin/yt-dlp";
vip = "${pkgs.curl}/bin/curl -s https://am.i.mullvad.net/json | jq";
mip = "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1";
tp = "${pkgs.libressl}/bin/nc termbin.com 9999";
};
};
xdg.userDirs = {
enable = true;
createDirectories = true;
};
};
nix.settings.trusted-users = [ config.wsl.defaultUser ];
}

24
nix/devshell.nix Normal file
View file

@ -0,0 +1,24 @@
{
perSystem =
{ pkgs, config, ... }:
{
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
deadnix
git
git-lfs
ipcalc
nil
shellcheck
statix
treefmt
];
shellHook = ''
${config.pre-commit.installationScript}
'';
};
};
};
}

27
nix/pre-commit.nix Normal file
View file

@ -0,0 +1,27 @@
{ inputs, ... }:
{
imports = with inputs; [
git-hooks.flakeModule
];
perSystem =
{ pkgs, ... }:
{
pre-commit = {
inherit pkgs;
check.enable = true;
settings = {
hooks = {
treefmt.enable = true;
nil.enable = true;
statix.enable = true;
deadnix.enable = true;
shellcheck.enable = true;
};
excludes = [ "flake.lock" ];
};
};
};
}

23
nix/treefmt.nix Normal file
View file

@ -0,0 +1,23 @@
{ inputs, ... }:
{
imports = with inputs; [
treefmt-nix.flakeModule
];
perSystem =
{ config, ... }:
{
formatter = config.treefmt.build.wrapper;
treefmt = {
projectRootFile = "flake.nix";
programs = {
deadnix.enable = true;
deadnix.no-lambda-pattern-names = true;
statix.enable = true;
nixpkgs-fmt.enable = true;
};
};
};
}