Compare commits
No commits in common. "master" and "top-level-wip-bao" have entirely different histories.
master
...
top-level-
20
.envrc
20
.envrc
|
@ -1,16 +1,6 @@
|
||||||
#! /bin/sh
|
# If nix-shell available, then nix is installed. We're going to use nix-direnv.
|
||||||
|
if command -v nix-shell &> /dev/null
|
||||||
source "$(
|
then
|
||||||
nix eval \
|
use flake
|
||||||
--no-update-lock-file \
|
fi
|
||||||
--no-write-lock-file \
|
|
||||||
--no-warn-dirty \
|
|
||||||
--accept-flake-config \
|
|
||||||
.#__std.direnv_lib 2>/dev/null \
|
|
||||||
|| nix eval .#__std.direnv_lib # show the errors
|
|
||||||
)"
|
|
||||||
# FIXME: This should check if $USER is in userShells, if not,
|
|
||||||
# fall back to `use nix`
|
|
||||||
use std nix "//repo/userShells:${USER}"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
result
|
|
||||||
.direnv
|
|
16
.sops.yaml
16
.sops.yaml
|
@ -1,16 +0,0 @@
|
||||||
keys:
|
|
||||||
- &htran-mbp age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay
|
|
||||||
- &htran age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng
|
|
||||||
- &bao age1umzkd4k0xt6uv5de85fpc4uztrph86nsd79h5f8cpuvtpy8n6adss7q2fv
|
|
||||||
- &root_bao age1vx7e6vz9zptwqd0cakjj8erqv58cstddama8zcrppc36rqqmlvjs53x9u0
|
|
||||||
- &htran1 age1vkd39dmrft3uk5wnfqppharn38dhrh78ev6pl85u005jhcge5e9qz4lt79
|
|
||||||
creation_rules:
|
|
||||||
- path_regex: .*
|
|
||||||
key_groups:
|
|
||||||
- age:
|
|
||||||
- *htran
|
|
||||||
- *htran-mbp
|
|
||||||
- *bao
|
|
||||||
- *root_bao
|
|
||||||
- *htran1
|
|
||||||
|
|
29
README.md
29
README.md
|
@ -5,10 +5,6 @@ Contains my configurations for the software I use.
|
||||||
I'm looking to move forward to configuration with NixOS, but until I get
|
I'm looking to move forward to configuration with NixOS, but until I get
|
||||||
a bit more experiment on NixOS, I'll keep this repository as simple as possible.
|
a bit more experiment on NixOS, I'll keep this repository as simple as possible.
|
||||||
|
|
||||||
- As of 2023-06-07, I have little interest in keeping configurations
|
|
||||||
([`init.lua`](./native_configs/neovim/init.lua), [`sshconfig`](./native_configs/ssh/config),...)
|
|
||||||
to be idempotent for Nix and non-Nix targets.
|
|
||||||
|
|
||||||
## Nix
|
## Nix
|
||||||
|
|
||||||
Monorepo that contains my commonly used personal environments.
|
Monorepo that contains my commonly used personal environments.
|
||||||
|
@ -17,7 +13,8 @@ onto this repo for quick env setup (especially devel) on new machines.
|
||||||
|
|
||||||
## How do I apply these config
|
## How do I apply these config
|
||||||
|
|
||||||
- Clone and nixify
|
- I will always first clone this repository, preferably from local source before
|
||||||
|
going from the github. `git clone https://github.com/pegasust/dotfiles`
|
||||||
|
|
||||||
### neovim
|
### neovim
|
||||||
|
|
||||||
|
@ -29,6 +26,7 @@ My main text editor. It's based on `vim`, but stays loyal to `lua` ecosystem
|
||||||
#### Notes
|
#### Notes
|
||||||
|
|
||||||
- Ensure that neovim is installed and invocable by `nvim`.
|
- Ensure that neovim is installed and invocable by `nvim`.
|
||||||
|
- My config based on rather experimental version of`nvim` (>=0.7.2)
|
||||||
- For information on installing neovim, visit their [github page](https://github.com/neovim/neovim/wiki/Installing-Neovim)
|
- For information on installing neovim, visit their [github page](https://github.com/neovim/neovim/wiki/Installing-Neovim)
|
||||||
|
|
||||||
### tmux
|
### tmux
|
||||||
|
@ -42,7 +40,7 @@ from one terminal.
|
||||||
|
|
||||||
#### Notes
|
#### Notes
|
||||||
|
|
||||||
- Unsure of the minimum version of tmux. I have had an ancient HPC server
|
- Unsure if the minimum version of tmux. I have had an ancient HPC server
|
||||||
that does not respond well to one of the config lines.
|
that does not respond well to one of the config lines.
|
||||||
|
|
||||||
### zk
|
### zk
|
||||||
|
@ -59,23 +57,4 @@ text-editor agnostically.
|
||||||
- Templates: `zk/templates/`
|
- Templates: `zk/templates/`
|
||||||
- Command: `ln -s $PWD/zk/templates ~/.config/zk/templates`
|
- Command: `ln -s $PWD/zk/templates ~/.config/zk/templates`
|
||||||
|
|
||||||
Note (2023-06-07): I'm now using a mix of nvim-zk with Notion. I'm still figuring out
|
|
||||||
a centralize place to put my notes and use it to do some knowledge graph magic
|
|
||||||
|
|
||||||
## Troubleshoots
|
|
||||||
|
|
||||||
### My MacOS just updated, `nix` is no-longer here
|
|
||||||
|
|
||||||
- An easy fix is to add the following to the **bottom** of `/etc/zshrc`
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Nix {{{
|
|
||||||
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
|
||||||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
|
||||||
fi
|
|
||||||
# }}}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Otherwise, consult [`gh-gist:meeech/a_help-osx-borked-my-nix.md`](https://gist.github.com/meeech/0b97a86f235d10bc4e2a1116eec38e7e)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
credentials:
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: kv
|
|
||||||
name_unencrypted: ci@dev1.htran.egihosting.com
|
|
||||||
user_unencrypted: ci
|
|
||||||
password: ENC[AES256_GCM,data:4AIDKxX9dQncyhHe,iv:+YbvHz6GLD9unbTwE/KwcdpU/yMygFurxelOjkrFJRU=,tag:VHnzt66W2pWwcxjTH9LreQ==,type:str]
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: kv
|
|
||||||
name_unencrypted: Gitea credentials
|
|
||||||
user_unencrypted: pegasust
|
|
||||||
password: ENC[AES256_GCM,data:l472gCfek08/Z1cWL0EVtqWYYhE=,iv:TDUX4piGeHSkFSApeaGIPiXPzYAHZWxoMIuQ8G6cunw=,tag:WhCDoCNIUxe5gdxUuuYhZA==,type:str]
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: kv
|
|
||||||
name_unencrypted: Nix SSH password for hungtr
|
|
||||||
user_unencrypted: hungtr
|
|
||||||
password: ENC[AES256_GCM,data:cJpfi8l1mx/86R1Oxd8=,iv:AwYBs4/P4ICNo4B6MxIz3HrGB+hdohIRtVflGBSS/P0=,tag:SC6MO5Zn0xwDRH4TGBR2LQ==,type:str]
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: ssh
|
|
||||||
name_unencrypted: egi-htran
|
|
||||||
pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPNKyGKsVG/jVXwAmZvH8rLQPdGj8VgITMSN+/nbXTEY htran@Hung-Tran-MBP.local
|
|
||||||
privkey: ENC[AES256_GCM,data:OrurRGlutN1N1YFQvD1XbiF3thV8qO2y1ufRHi3ut1RVA/lxmqg1kYdWnYE7tOCCCITs20ZpcPFAwAjjAXZH6NaS8FgEJiPDUnJ+hg5v0VC7c4GNc+G3B8+9Taz7mggg70EL/s5QwofpuqJspr4EHrildX6eUeE6s9KwSFnw6KTBgO4r0JqBaicbbObhzxPYIYHjhxRxsbYMX4i8ADPeYryhEtL168dHEGENuz/mbw2I/5Qp3R/SwroNpYlTpq6ukGeobW4+j2KD7ZV9Nvcs/FL6/lPdaUKPxNW/bDeRhAaw9Mw3oDxHdTNisvCHJ53GHChdWcoXSMjYNH+zbgXp9YTeCLBMf9/lLnnEwtSEuD2kexcF+WR7gcbu6mdxJ1k3HBU+Xkrl6shGFuQv3hH8eSmfLhIdy+zcY/jb6tokQklrdKsrusFjuHhAuKfNl5uA93Pc0NxTZ4plxEEdbeyzz54cWwBf0HXR6ztSrjqfUtud3bQY667MNB2LHO91QBoQE7U2gUQ2CmI3VG9KVm2eh7LsXUjLoLzccYfg+kkTrQJnAfs=,iv:+4wsk7mUsIOWNe9IoV0TgrBKIsQdiJyzwVb2+hlPVTc=,tag:B9P2bHPh78JuwusZnAsC5A==,type:str]
|
|
||||||
agepub_unencrypted: age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay
|
|
||||||
agepriv: ENC[AES256_GCM,data:tE6WLw8/dHsC6rfJpek7czvySW0+S2luc470l9X6UFX+zCOwlwoQpTWpIGPIqmkOFNSaaA0cyZ4BmWnlVz1iWxizh8DYqcE5los=,iv:4jnpibK+0cE1isWu6Zl1CsajMWN9Zgw8LGX5WpkRyy8=,tag:vdi85c3Q29olLGsCwrvmcA==,type:str]
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: ssh
|
|
||||||
name_unencrypted: dev1-ssh
|
|
||||||
pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH1IiP+d2S152uiD2JjUJfADFv7AS0l3LX2NRgfMTYLe htran@htrandevbox
|
|
||||||
privkey: ENC[AES256_GCM,data:5lf+Oy0VhsxDLANpBFxtguD5unsZK9yKW/boTlxAOIzlcD1Xf4Nr0iC6YW/4nBB/eJ8xPlUiU5vhRQSLZPqnfc6nQJReqPPafzfugYb3slYBl59EeimBCqTi0qVIUHNFvRpp2agZW0wIQv4hlB3ks+WBVjKixLOdbUBQREZB22DWk6eoKawmekCr7ItDsxGWG7DtHx9A511LyPrT1n/VhAYHTuq6ycbWjDya++bJ/AkYlcqW0jEyQ/Mudo/TYkRt4TpWWDjGPDYVNrjBiwYOSpoM6IwzfRQvimCZnfqyXHrT2gzv9Vqqu9C2Vp2R0FLzbdA8dYoiXwss7opzsI5um6D4AdQv8c16TiVLFF0q0VP2xyRf3j7iqmuwQHIRlkBh2BhnsXT/s35K6cb1dUhIw0aQpFGzL/VuqMKrQW3j3S9pSiiupBuSwdLJ9s8+rkGYTO0Iw+T646L1NFW7oFMP8Fe5ZMC9UuTV/srWNtXHAQaY+L9TwMIQY36P4V0lqaVfCWAiIrBTgLhHQetnzb/Y44Ll/qTdRXHSW6D4,iv:30sivScr8WmFmZx8M/sqTEuGRg72VzJ+bc6AW847xz8=,tag:dJsH+/dhRWQoKwsGAUzqAQ==,type:str]
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: age
|
|
||||||
agepub_unencrypted: age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng
|
|
||||||
agepriv: ENC[AES256_GCM,data:f66nwYr1WLTejGI2SpHNrf8BYRJJuxpufYLSYVix1uLdBj2TfVJVjN3bLsnHrB1DoeVyaF0nUxrdcL64LhbI38zZC/fNORfXx4E=,iv:J/noycrJlL2+r1ojmUYC/6GUVMGqRFM2ondBm2C7fSE=,tag:pT5z5NQQdS30bucdbPPBng==,type:str]
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: ssh
|
|
||||||
name_unencrypted: gl-egi-htran-ed25519
|
|
||||||
privkey: ENC[AES256_GCM,data:vM5G2o/syq9YUwqpUONJk5ebwha+UQI0wUCkwkmZTTtx+nB/HTnc4kqxX/eeF9ybSE8vq7YIWuKB8aSjpizOYZjjWIV3qpWBiDmdrWkWfUIl7kDdy75azZjHNRXuXUUExbPYGVjmL7KdDMHY2u1WceDSdEvgB2sNOPw4dNiZ9lcbJ5iDpQzmxaF6zdvZ/rVoXYM2NgSMdM4oTdRtYivcOPuxwRGi39R5XgyPJYwltawSAPFPmNYofszUzYLnD7jPEJqyEQORpcI2oM2qAPab22kDrDLyd51X1F6XT/5chKuPSsidZAVjB6+v2s/yN0quqz3qcP2RTYtaZcFyeEquk6eWA/MWVwCJK8XopNoPVVo0PRppOtq3M9Fss3Z587nQAis8doCbvv9XdUunOFHFWon7k8fGu9cDDMmSOE3KGWCO7Vw0V6dYnBT+OVJnJAxlf7AsUZdXVBo3PK9Zw6+d2XF2N9Jhr0bqA1tpmGqwCygHy41FGbWtuhZBX8JimTPFE1MyT5YvptzwbayONcvps8hZED8zwKbR/64DSF7wn1DAaW0=,iv:JjO6O+FB+W1Gi216bjkVXiIFvxLmIZ4rKLCXcepOIQc=,tag:TxiwbrCZ4vFgw6WMmKrVOg==,type:str]
|
|
||||||
pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINOqM08nqvcFhcF6E//dlphXctfck83N0tjKIfil8npY htran@Hung-Tran-MBP.local
|
|
||||||
agepriv: ENC[AES256_GCM,data:Z4qRvam25nvkNr4DuZhhKtN83NIfNcBW5Wq7SGm0Nb31kAjCS25VfkTrXUtrxWIunMCZEYoIdDLiENjRQPAh/NwffGbZn94/ZKY=,iv:t3YtQvRQPdbDcXgEC/A13W1K9/IIlt6rPceR1lAl0BM=,tag:QmiriOk19fGSPOWj98doUQ==,type:str]
|
|
||||||
agepub_unencrypted: age1jz7ajxer3fs02uygr8a374jfk7vuklpnnyugrlq4equ285t7nyfqwqdreq
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: win-rdp
|
|
||||||
name_unencrypted: EGNGoat
|
|
||||||
ip: ENC[AES256_GCM,data:9/FPJM8l4hLvzDc5pg==,iv:ny1LKtgznhzMd3Bhogwu6b6bOk3/uCNarKTmlWRZAes=,tag:PsleUu2ZE4leEMEcEuJdLQ==,type:str]
|
|
||||||
user_unencrypted: EGN NOC
|
|
||||||
password: ENC[AES256_GCM,data:YOL5Sw6zaA==,iv:Cs8gySfGIQUBPivkM5N6kflZsRhp2w9xmPwtl7RrEZE=,tag:LXYKdsX++IP+jQyjL6JBrg==,type:str]
|
|
||||||
- kind:
|
|
||||||
name_unencrypted: kv
|
|
||||||
name_unencrypted: gl-deploy-token
|
|
||||||
user_unencrypted: gitlab+deploy-token-2
|
|
||||||
pass_unencrpyted: ENC[AES256_GCM,data:GcPu8JFy8JuPb3xrHKBpP196h0k=,iv:2N69xdTtnpjDLvRAbSpDWGh6+IFWpIZgHo6yVf2kE/4=,tag:L7UA7Oj/ZtekO3Cmvp2lvA==,type:str]
|
|
||||||
sops:
|
|
||||||
kms: []
|
|
||||||
gcp_kms: []
|
|
||||||
azure_kv: []
|
|
||||||
hc_vault: []
|
|
||||||
age:
|
|
||||||
- recipient: age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng
|
|
||||||
enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwdGdsRlFqU3A5S3JERDFo
|
|
||||||
RjBhaHdhSVdXbThwNkR3aWNWc2pMY2owQ0JNCjZpTFBBRWlOTTRvYUJmVzU1QjN6
|
|
||||||
ZzkwcGNjNkVmVzhuMlhLN1ZpWEJiSjgKLS0tIGNmbHF5T3dFeWd1dDFCajIvUmJX
|
|
||||||
TkpXSCtrU1V5NjRWbTBKMWhhMi9JNGsK+UCiGQtJNU0QDTG2kIqxUO9boLPj583M
|
|
||||||
ZwQXwhqBljQojqs1NwvXHCWgyrqhPqIobwYO8xhq1/3S/jMkyfzbAQ==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
- recipient: age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay
|
|
||||||
enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAxSnN3V2hXZ25mU1gxait3
|
|
||||||
TDVDQ1RqbVZYOWI2Q1BCZnlDaFVHb2NuRXdrCm8yQ0FWRytReCt0TU11byt5THM1
|
|
||||||
VWh1MjhFWVlRQ29rQXlJS2FHTUFaQlkKLS0tIExJMndaY2g3ZmlnbyswWW9Fc0RM
|
|
||||||
MFFVNGs2RHVTcUdYZWljckt0RnRFN28K4O6nmQfMaJYzaA2n4PzLAqoslyxScplr
|
|
||||||
y6b6wTL3171sA2w6DgP+8BQjJ9/oCoGOtwpyxWzs2zld0dglmP9PGA==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
- recipient: age1umzkd4k0xt6uv5de85fpc4uztrph86nsd79h5f8cpuvtpy8n6adss7q2fv
|
|
||||||
enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBmOFVCTS9HS2dITFVqV2s5
|
|
||||||
VGV5WUZlaW9JMWdNM1NUeVNmTFV3eWVzS0hFCnNVTGRlbG1aU2dsaXhFMmZFekt5
|
|
||||||
cU4wWkNpYktFcEtwYTByUDlpOW5WY1EKLS0tIENyMndiL0gxUGdlK1BtelNKd295
|
|
||||||
QThYZGM0Y1FoTmVud2MxZ2lxK1RENFUKbRkax7DamL8m8qnN0FBHjJm7iDEjI4On
|
|
||||||
+xWVpKRSZviklQTybJqCS3PS3hCAW2zVlD8kZ5ZgTF9/p3towOAJGw==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
- recipient: age1vx7e6vz9zptwqd0cakjj8erqv58cstddama8zcrppc36rqqmlvjs53x9u0
|
|
||||||
enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA3eFI3YUtGbUFQbnQ5YXZ4
|
|
||||||
VE1uNHhNdUNPeEVOY3VuaFR5UEQ3ejJqaFJRClpETnFhQ09udk5XTWRBdmxnRW5q
|
|
||||||
T0xGbFYwOVlZWWFNb2c4d0ZBNzZnREEKLS0tIGlLK1RRMllKMG9vTmxOSHZXb3dT
|
|
||||||
cWxIRyszNmlpN2twMElIL3JCcHdOcHMKMT7Xq+XsSAdkJ1CAWRqdQTrr1NhPeTUc
|
|
||||||
UT0Fa8zUCBTUZEhcmVAnZ4Crr6N2GQbtNOU2S9Jt++od1dxQ+9TjHA==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
lastmodified: "2023-02-28T17:54:36Z"
|
|
||||||
mac: ENC[AES256_GCM,data:uI84H7eyWsauw2RMysa8w/OHP4QXN+FvO/GW+orj86cTlfL521MdPgZZamtSxOeyb4+893jn09GSFUBmOdQHUOX3kGNdWNwpu7eXM1ext/cpZwCsaIDBWDyCCE6LcF69LQEKsbRlC1nDAeMW3Wn510teS/TFxgbRucNdGTnrRE0=,iv:PbjX7VTDkAi0O/pipgV70KbJD/LLJAmD/U7d2kn58DM=,tag:dMsU71CPnO8JHyXoWPcFaQ==,type:str]
|
|
||||||
pgp: []
|
|
||||||
unencrypted_suffix: _unencrypted
|
|
||||||
version: 3.7.3
|
|
18
default.nix
18
default.nix
|
@ -1,13 +1,11 @@
|
||||||
# We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix
|
# We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix
|
||||||
(
|
(import
|
||||||
import
|
|
||||||
(
|
(
|
||||||
let
|
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
fetchTarball {
|
||||||
c_ = import ./c_.nix;
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
in
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
c_.fetchTree lock.nodes.flake-compat.locked
|
}
|
||||||
)
|
)
|
||||||
{src = ./.;}
|
{ src = ./.; }
|
||||||
)
|
).defaultNix
|
||||||
.defaultNix
|
|
||||||
|
|
|
@ -4,27 +4,17 @@
|
||||||
# Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead
|
# Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead
|
||||||
#
|
#
|
||||||
# It should not contain PDE
|
# It should not contain PDE
|
||||||
{
|
{pkgs? import <nixpkgs> {}
|
||||||
pkgs ? import <nixpkgs> {},
|
,lib
|
||||||
lib,
|
,...}: pkgs.mkShell {
|
||||||
...
|
|
||||||
}:
|
|
||||||
pkgs.mkShell {
|
|
||||||
# mkShell doesn't care about the differences across nativeBuildInputs,
|
# mkShell doesn't care about the differences across nativeBuildInputs,
|
||||||
# buildInputs, or packages
|
# buildInputs, or packages
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
# shell scripts
|
# shell scripts
|
||||||
pkgs.rust4cargo
|
(lib.shellAsDrv {script = ''echo "hello world"''; pname = "hello";})
|
||||||
pkgs.sops
|
|
||||||
pkgs.ssh-to-age
|
|
||||||
pkgs.go
|
|
||||||
pkgs.gopls
|
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
# Since we need late dispatch of ~, we have to put this in shellHook.
|
|
||||||
export SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt
|
|
||||||
'';
|
|
||||||
# env vars
|
# env vars
|
||||||
lol = "hello world";
|
lol="hello world";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ documentations and defaults
|
||||||
|
|
||||||
- `nativeBuildInputs` is supposed to be built by a deployment machine (not target)
|
- `nativeBuildInputs` is supposed to be built by a deployment machine (not target)
|
||||||
|
|
||||||
- `buildInputs` gives you access during runtime (if the package goes path build filter)
|
- `buildInputs` gives you access during runtime
|
||||||
|
|
||||||
- `nativeBulidInputs` gives you access to packages during build time
|
- `nativeBulidInputs` gives you access to packages during build time
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
# Neovim: Testing cmp for color with Tailwind
|
|
||||||
|
|
||||||
- [ ] It should detect a project uses tailwind, maybe via some kind of config file
|
|
||||||
(`tailwind.config.{cjs,mjs,js,ts,json,tsx,toml,yaml}`), or just based on the
|
|
||||||
string content or via tree-stiter. Check this by `:LspInfo` and `tailwindcss-lsp`
|
|
||||||
should attach to the current buffer that has tailwind-css string
|
|
||||||
- [ ] Type in a classname `text-red-500`, just stop at somewhere and start
|
|
||||||
browsing the cmp-lsp window. It should show a color in place of `lspkind`.
|
|
||||||
This validates `tailwindcss-colorizer-cmp.nvim` is good
|
|
||||||
- [ ] Hit that autocomplete, the string should show the color red. This validates
|
|
||||||
`nvim-colorizer.lua` is properly setup.
|
|
||||||
|
|
|
@ -1,169 +0,0 @@
|
||||||
# Offset Vim Plugins onto nix packer
|
|
||||||
|
|
||||||
The current [`scripts/vim.dsl`](../scripts/vim.dsl) grabs the upstream supported vim plugins
|
|
||||||
onto a sqlite database to be stored in memory. We could perform some data exploration via this database
|
|
||||||
|
|
||||||
## Explore which plugins should be added to `neovim.nix`
|
|
||||||
|
|
||||||
Gather list of plugins need to be added. This can be done simply by adding
|
|
||||||
a print statement on `WPlug` in `../native_configs/neovim/init.lua` then run neovim
|
|
||||||
to collect it.
|
|
||||||
|
|
||||||
```lua
|
|
||||||
-- as of git://./dotfiles.git#a6c979c6
|
|
||||||
local function WPlug(plugin_path, ...)
|
|
||||||
local plugin_name = string.lower(plugin_path:match("/([^/]+)$"))
|
|
||||||
if not installed_plugins[plugin_name] then
|
|
||||||
-- NOTE: Add print statement to get which plugin is still being
|
|
||||||
-- plugged at runtime
|
|
||||||
print("Plugging "..plugin_path)
|
|
||||||
Plug(plugin_path, ...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
We can then use `vim_dsl.py`
|
|
||||||
|
|
||||||
```py
|
|
||||||
vp = VimPlugins(UPSTREAM_CSV)
|
|
||||||
need_install_plugins = """
|
|
||||||
tjdevries/nlua.nvim
|
|
||||||
yioneko/nvim-yati
|
|
||||||
nathanalderson/yang.vim
|
|
||||||
numToStr/Comment.nvim
|
|
||||||
lewis6991/gitsigns.nvim
|
|
||||||
tpope/vim-fugitive
|
|
||||||
williamboman/mason.nvim
|
|
||||||
williamboman/mason-lspconfig.nvim
|
|
||||||
TimUntersberger/neogit
|
|
||||||
folke/trouble.nvim
|
|
||||||
tpope/vim-dispatch
|
|
||||||
clojure-vim/vim-jack-in
|
|
||||||
radenling/vim-dispatch-neovim
|
|
||||||
gennaro-tedesco/nvim-jqx
|
|
||||||
kylechui/nvim-surround
|
|
||||||
simrat39/inlay-hints.nvim
|
|
||||||
gruvbox-community/gruvbox
|
|
||||||
nvim-lualine/lualine.nvim
|
|
||||||
lukas-reineke/indent-blankline.nvim
|
|
||||||
kyazdani42/nvim-web-devicons
|
|
||||||
m-demare/hlargs.nvim
|
|
||||||
folke/todo-comments.nvim
|
|
||||||
nvim-treesitter/playground
|
|
||||||
saadparwaiz1/cmp_luasnip
|
|
||||||
L3MON4D3/LuaSnip
|
|
||||||
arthurxavierx/vim-caser
|
|
||||||
~/local_repos/ts-ql
|
|
||||||
""".split()
|
|
||||||
need_install_plugins = [plugin.strip() for plugin in plugins_raw if plugin.strip()]
|
|
||||||
|
|
||||||
# Create the GitHub URL list
|
|
||||||
need_install_plugins_gh = [
|
|
||||||
f"https://github.com/{plugin}/".lower() for plugin in need_install_plugins if not plugin.startswith(("~", "."))]
|
|
||||||
|
|
||||||
# Get the values from the database
|
|
||||||
values = vp.query(f"SELECT LOWER(repo), alias from {vp.table_name()}")
|
|
||||||
|
|
||||||
# Check if the repo is in the list of plugins
|
|
||||||
need_install = [
|
|
||||||
vim_plugin_slug(alias) if alias else name_from_repo(repo) for repo, alias in values if repo in need_install_plugins_gh]
|
|
||||||
|
|
||||||
print("need_install", "\n".join(need_install))
|
|
||||||
|
|
||||||
# Check if the repo is not in the list
|
|
||||||
repos = [repo for repo, _ in values]
|
|
||||||
not_in_repo = [name_from_repo(gh) for gh in need_install_plugins_gh if gh not in repos]
|
|
||||||
print("not in repo", not_in_repo) # nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community
|
|
||||||
```
|
|
||||||
|
|
||||||
This should print out
|
|
||||||
```
|
|
||||||
need_install
|
|
||||||
cmp_luasnip
|
|
||||||
comment-nvim
|
|
||||||
gitsigns-nvim
|
|
||||||
gruvbox-community
|
|
||||||
indent-blankline-nvim
|
|
||||||
lualine-nvim
|
|
||||||
luasnip
|
|
||||||
mason-lspconfig-nvim
|
|
||||||
mason-nvim
|
|
||||||
neogit
|
|
||||||
nlua-nvim
|
|
||||||
nvim-jqx
|
|
||||||
nvim-surround
|
|
||||||
nvim-web-devicons
|
|
||||||
playground
|
|
||||||
todo-comments-nvim
|
|
||||||
trouble-nvim
|
|
||||||
vim-dispatch
|
|
||||||
vim-dispatch-neovim
|
|
||||||
vim-fugitive
|
|
||||||
vim-jack-in
|
|
||||||
not in repo ['nvim-yati', 'yang-vim', 'inlay-hints-nvim', 'hlargs-nvim', 'vim-caser']
|
|
||||||
```
|
|
||||||
|
|
||||||
Given this list, we could safely add to `neovim.nix`
|
|
||||||
|
|
||||||
```nix
|
|
||||||
programs.neovim.plugins =
|
|
||||||
let inherit (pkgs.vimPlugins)
|
|
||||||
need_install
|
|
||||||
cmp_luasnip
|
|
||||||
comment-nvim
|
|
||||||
gitsigns-nvim
|
|
||||||
gruvbox-community
|
|
||||||
indent-blankline-nvim
|
|
||||||
lualine-nvim
|
|
||||||
luasnip
|
|
||||||
mason-lspconfig-nvim
|
|
||||||
mason-nvim
|
|
||||||
neogit
|
|
||||||
nlua-nvim
|
|
||||||
nvim-jqx
|
|
||||||
nvim-surround
|
|
||||||
nvim-web-devicons
|
|
||||||
playground
|
|
||||||
todo-comments-nvim
|
|
||||||
trouble-nvim
|
|
||||||
vim-dispatch
|
|
||||||
vim-dispatch-neovim
|
|
||||||
vim-fugitive
|
|
||||||
vim-jack-in
|
|
||||||
;in [
|
|
||||||
need_install
|
|
||||||
cmp_luasnip
|
|
||||||
comment-nvim
|
|
||||||
gitsigns-nvim
|
|
||||||
gruvbox-community
|
|
||||||
indent-blankline-nvim
|
|
||||||
lualine-nvim
|
|
||||||
luasnip
|
|
||||||
mason-lspconfig-nvim
|
|
||||||
mason-nvim
|
|
||||||
neogit
|
|
||||||
nlua-nvim
|
|
||||||
nvim-jqx
|
|
||||||
nvim-surround
|
|
||||||
nvim-web-devicons
|
|
||||||
playground
|
|
||||||
todo-comments-nvim
|
|
||||||
trouble-nvim
|
|
||||||
vim-dispatch
|
|
||||||
vim-dispatch-neovim
|
|
||||||
vim-fugitive
|
|
||||||
vim-jack-in
|
|
||||||
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
- [ ] Source the plugins directly
|
|
||||||
- [ ] Add 'frozen' to each of these plugin
|
|
||||||
- [ ] Pin plugins separately from `neovim.nix`
|
|
||||||
- [ ] Find a better way to `inherit` with list comprehension
|
|
||||||
- [ ] Create alert & notification channel for this, ideally via Discord channel
|
|
||||||
- [ ] Even better, just put it in email with some labels
|
|
||||||
- [ ] Better end-to-end design that take even deeper account to gruvbox-community and such
|
|
||||||
|
|
1878
flake.lock
1878
flake.lock
File diff suppressed because it is too large
Load Diff
142
flake.nix
142
flake.nix
|
@ -1,70 +1,108 @@
|
||||||
{
|
{
|
||||||
nixConfig = {
|
|
||||||
accept-flake-config = true;
|
|
||||||
experimental-features = "nix-command flakes";
|
|
||||||
max-jobs = 12;
|
|
||||||
};
|
|
||||||
description = "My personal configuration in Nix (and some native configurations)";
|
description = "My personal configuration in Nix (and some native configurations)";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
nixpkgs-latest.url = "github:nixos/nixpkgs";
|
agenix = {
|
||||||
deploy-rs.url = "github:serokell/deploy-rs";
|
url = "github:ryantm/agenix";
|
||||||
std.url = "github:divnix/std";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
neovim-nightly-overlay = {
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
# need to pin this until darwin build is successful again.
|
nixgl.url = "path:out-of-tree/nixGL";
|
||||||
url = "github:nix-community/neovim-nightly-overlay?rev=88a6c749a7d126c49f3374f9f28ca452ea9419b8";
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
|
||||||
};
|
flake-compat = {
|
||||||
nix-boost = {
|
url = "github:edolstra/flake-compat";
|
||||||
url = "git+https://git.pegasust.com/pegasust/nix-boost?ref=bleed";
|
flake = false;
|
||||||
};
|
};
|
||||||
kpcli-py = {
|
kpcli-py = {
|
||||||
url = "github:rebkwok/kpcli";
|
url = "github:rebkwok/kpcli";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
nix-index-database = {
|
|
||||||
url = "github:mic92/nix-index-database";
|
|
||||||
# Should show the latest nixpkgs whenever possible
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs-latest";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {self, std, ...} @ inputs:
|
outputs = {
|
||||||
std.growOn
|
nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
|
||||||
{
|
,...
|
||||||
# boilerplate
|
}@_inputs: let
|
||||||
inherit inputs;
|
# Context/global stuffs to be passed down
|
||||||
# All cell blocks are under ./nix/cells/<cell>/<cellblock> as `<cellblock>.nix`
|
# NOTE: this will only read files that are within git tree
|
||||||
# or `<cellblock/default.nix`
|
# all secrets should go into secrets.nix and secrets/*.age
|
||||||
cellsFrom = ./nix/cells;
|
proj_root = let
|
||||||
# modules = ./nix/modules;
|
path = builtins.toString ./.;
|
||||||
|
in {
|
||||||
cellBlocks = let
|
inherit path;
|
||||||
inherit (std.blockTypes) devshells functions anything installables;
|
configs.path = "${path}/native_configs";
|
||||||
in [
|
scripts.path = "${path}/scripts";
|
||||||
(devshells "devshells")
|
secrets.path = "${path}/secrets";
|
||||||
(devshells "userShells")
|
testdata.path = "${path}/tests";
|
||||||
(functions "home-profiles")
|
modules.path = "${path}/modules";
|
||||||
(functions "home-modules")
|
hosts.path = "${path}/hosts";
|
||||||
(anything "home-configs")
|
users.path = "${path}/users";
|
||||||
(installables "packages")
|
};
|
||||||
(anything "lib")
|
# TODO: adapt to different platforms think about different systems later
|
||||||
|
system = "x86_64-linux";
|
||||||
|
overlays = [
|
||||||
|
rust-overlay.overlays.default
|
||||||
|
(self: pkgs@{lib,...}: {
|
||||||
|
lib = pkgs.lib // (import ./lib (_inputs // {inherit pkgs proj_root;}));
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
pkgs = import nixpkgs {
|
||||||
{
|
inherit system;
|
||||||
devShells = std.harvest self [["dotfiles" "devshells"]];
|
overlays = import ./overlays.nix _inputs;
|
||||||
# nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ];
|
config = {
|
||||||
# homeConfigurations = std.pick [ [ "dotfiles" "home" ] ];
|
allowUnfree = true;
|
||||||
homeModules = std.pick self [["repo" "home-modules"]];
|
};
|
||||||
packages = std.harvest self [["repo" "packages"]];
|
};
|
||||||
legacyPackages = std.harvest self [["repo" "home-configs"]];
|
# now, this lib is extremely powerful as it also engulfs nixpkgs.lib
|
||||||
lib = std.pick self [["repo" "lib"]];
|
# TODO: I really don't want to extend from nixpkgs.lib because it doesn't extend lib within nixosModule
|
||||||
|
lib = nixpkgs.lib.extend (self: nixpkgs_lib: (nixpkgs_lib // pkgs.lib));
|
||||||
|
inputs_w_lib = (pkgs.lib.recursiveUpdate _inputs {
|
||||||
|
inherit system proj_root pkgs lib;
|
||||||
|
});
|
||||||
|
|
||||||
# TODO: Debug only
|
modules = (import ./modules inputs_w_lib);
|
||||||
homeProfiles = std.pick self [["repo" "home-profiles"]];
|
hosts = (import ./hosts inputs_w_lib);
|
||||||
|
users = (import ./users inputs_w_lib);
|
||||||
|
|
||||||
|
# {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
|
||||||
|
# ,pkgs, lib (extended), proj_root}
|
||||||
|
final_inputs = inputs_w_lib;
|
||||||
|
|
||||||
|
# Tests: unit + integration
|
||||||
|
unit_tests = (import ./lib/test.nix final_inputs) //
|
||||||
|
{
|
||||||
|
test_example = {
|
||||||
|
expr = "names must start with 'test'";
|
||||||
|
expected = "or won't show up";
|
||||||
|
};
|
||||||
|
not_show = {
|
||||||
|
expr = "this will be ignored by lib.runTests";
|
||||||
|
expected = "for sure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
secrets = import ./secrets final_inputs;
|
||||||
|
|
||||||
|
in {
|
||||||
|
inherit (hosts) nixosConfigurations;
|
||||||
|
inherit (users) homeConfigurations;
|
||||||
|
inherit lib proj_root;
|
||||||
|
devShell."${system}" = import ./dev-shell.nix final_inputs;
|
||||||
|
templates = import ./templates final_inputs;
|
||||||
|
secrets = {
|
||||||
|
pubKeys = {
|
||||||
|
hosts = hosts.pubKeys;
|
||||||
|
users = users.pubKeys;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
unit_tests = lib.runTests unit_tests;
|
||||||
|
debug = {
|
||||||
|
inherit final_inputs hosts users modules lib unit_tests pkgs;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [];
|
{
|
||||||
boot.initrd.kernelModules = [];
|
imports = [ ];
|
||||||
boot.kernelModules = [];
|
|
||||||
boot.extraModulePackages = [];
|
boot.initrd.availableKernelModules = [ ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
## NOTE: These filesystems are mounted by a wrapper script from nix-wsl
|
## NOTE: These filesystems are mounted by a wrapper script from nix-wsl
|
||||||
|
|
||||||
|
@ -47,22 +43,25 @@
|
||||||
# fsType = "drvfs";
|
# fsType = "drvfs";
|
||||||
# };
|
# };
|
||||||
|
|
||||||
fileSystems."/mnt/c" = {
|
fileSystems."/mnt/c" =
|
||||||
|
{
|
||||||
device = "C:";
|
device = "C:";
|
||||||
fsType = "drvfs";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/d" = {
|
fileSystems."/mnt/d" =
|
||||||
|
{
|
||||||
device = "D:";
|
device = "D:";
|
||||||
fsType = "drvfs";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/f" = {
|
fileSystems."/mnt/f" =
|
||||||
|
{
|
||||||
device = "F:";
|
device = "F:";
|
||||||
fsType = "drvfs";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [];
|
swapDevices = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
{
|
{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
|
||||||
nixpkgs,
|
,pkgs, lib, proj_root}: {
|
||||||
agenix,
|
|
||||||
home-manager,
|
}
|
||||||
flake-utils,
|
|
||||||
nixgl,
|
|
||||||
rust-overlay,
|
|
||||||
flake-compat,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
proj_root,
|
|
||||||
}: {}
|
|
||||||
|
|
|
@ -1,39 +1,33 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||||
# boot.initrd.kernelModules = [ "amdgpu" ];
|
# boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [];
|
||||||
boot.kernelModules = ["kvm-amd" "coretemp"];
|
boot.kernelModules = [ "kvm-amd" "coretemp"];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" =
|
||||||
# Might be wise to use /dev/nvme0p1 instead
|
# Might be wise to use /dev/nvme0p1 instead
|
||||||
{
|
{ device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
|
||||||
device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
|
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" =
|
||||||
# Might be wise to use /dev/nvme0p2 instead
|
# Might be wise to use /dev/nvme0p2 instead
|
||||||
{
|
{ device = "/dev/disk/by-uuid/EBA6-394D";
|
||||||
device = "/dev/disk/by-uuid/EBA6-394D";
|
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [];
|
swapDevices = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
{
|
{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
|
||||||
nixpkgs,
|
,pkgs, lib, proj_root, nixosDefaultVersion? "22.05", defaultSystem? "x86_64-linux",...}@finalInputs: let
|
||||||
agenix,
|
config = {
|
||||||
home-manager,
|
|
||||||
flake-utils,
|
|
||||||
nixgl,
|
|
||||||
rust-overlay,
|
|
||||||
flake-compat,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
proj_root,
|
|
||||||
nixosDefaultVersion ? "22.05",
|
|
||||||
defaultSystem ? "x86_64-linux",
|
|
||||||
...
|
|
||||||
} @ finalInputs: let
|
|
||||||
config = {
|
|
||||||
bao.metadata = {
|
bao.metadata = {
|
||||||
# req
|
# req
|
||||||
hostName = "bao";
|
hostName = "bao";
|
||||||
|
@ -32,11 +19,8 @@
|
||||||
(import ../modules/storage.perso.sys.nix)
|
(import ../modules/storage.perso.sys.nix)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
propagate = hostConfig @ {
|
propagate = hostConfig@{metadata, nixosConfig}: let
|
||||||
metadata,
|
|
||||||
nixosConfig,
|
|
||||||
}: let
|
|
||||||
# req
|
# req
|
||||||
inherit (metadata) hostName;
|
inherit (metadata) hostName;
|
||||||
# opts
|
# opts
|
||||||
|
@ -49,14 +33,11 @@
|
||||||
hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
|
hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
|
||||||
# alias to prevent infinite recursion
|
# alias to prevent infinite recursion
|
||||||
_nixosConfig = nixosConfig;
|
_nixosConfig = nixosConfig;
|
||||||
in {
|
in {
|
||||||
inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig;
|
inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig;
|
||||||
nixosConfig =
|
nixosConfig = _nixosConfig // {
|
||||||
_nixosConfig
|
|
||||||
// {
|
|
||||||
inherit system;
|
inherit system;
|
||||||
modules =
|
modules = [
|
||||||
[
|
|
||||||
{
|
{
|
||||||
config._module.args = {
|
config._module.args = {
|
||||||
inherit proj_root;
|
inherit proj_root;
|
||||||
|
@ -75,15 +56,18 @@
|
||||||
}
|
}
|
||||||
(import "${proj_root.modules.path}/secrets.nix")
|
(import "${proj_root.modules.path}/secrets.nix")
|
||||||
(import "${proj_root.modules.path}/${preset}.sys.nix")
|
(import "${proj_root.modules.path}/${preset}.sys.nix")
|
||||||
]
|
] ++ _nixosConfig.modules;
|
||||||
++ _nixosConfig.modules;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# we are blessed by the fact that we engulfed nixpkgs.lib.* at top level
|
# we are blessed by the fact that we engulfed nixpkgs.lib.* at top level
|
||||||
mkHostFromPropagated = propagatedHostConfig @ {nixosConfig, ...}: nixpkgs.lib.nixosSystem nixosConfig;
|
mkHostFromPropagated = propagatedHostConfig@{nixosConfig,...}: nixpkgs.lib.nixosSystem nixosConfig;
|
||||||
mkHost = hostConfig: (lib.pipe [propagate mkHostFromPropagated] hostConfig);
|
<<<<<<< HEAD
|
||||||
trimNull = lib.filterAttrsRecursive (name: value: value != null);
|
mkHost = hostConfig: (lib.pipe [propagate mkHostFromPropagated] hostConfig);
|
||||||
flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey);
|
trimNull = lib.filterAttrsRecursive (name: value: value != null);
|
||||||
|
flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey);
|
||||||
|
=======
|
||||||
|
mkHost = hostConfig: (lib.pipe hostConfig [propagate mkHostFromPropagated]);
|
||||||
|
>>>>>>> 4619ea4 (rekey)
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config;
|
nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config;
|
||||||
# {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";}
|
# {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";}
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
||||||
terminal_input serial;
|
terminal_input serial;
|
||||||
|
@ -23,15 +20,17 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
|
{
|
||||||
device = "/dev/sda";
|
device = "/dev/sda";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[{ device = "/dev/sdb"; }];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
||||||
terminal_input serial;
|
terminal_input serial;
|
||||||
|
@ -23,15 +19,17 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
device = "/dev/sda";
|
{ device = "/dev/sda";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[ { device = "/dev/sdb"; }
|
||||||
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
{
|
{nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
|
||||||
nixpkgs,
|
,pkgs, lib, proj_root}: {
|
||||||
agenix,
|
|
||||||
home-manager,
|
}
|
||||||
flake-utils,
|
|
||||||
nixgl,
|
|
||||||
rust-overlay,
|
|
||||||
flake-compat,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
proj_root,
|
|
||||||
}: {}
|
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
||||||
terminal_input serial;
|
terminal_input serial;
|
||||||
|
@ -23,8 +20,8 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/" = {
|
"/" = {
|
||||||
|
@ -38,7 +35,8 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[{ device = "/dev/sdb"; }];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = ["console=ttyS0,19200n8"];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
|
@ -26,12 +22,14 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
device = "/dev/sda";
|
{ device = "/dev/sda";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[ { device = "/dev/sdb"; }
|
||||||
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
{pkgs
|
||||||
|
# ,nixpkgs
|
||||||
|
,proj_root
|
||||||
|
# ,agenix
|
||||||
|
,nixosDefaultVersion? "22.05"
|
||||||
|
,defaultSystem? "x86_64-linux"
|
||||||
|
,...}@inputs: let
|
||||||
|
lib = pkgs.lib;
|
||||||
|
inputs_w_lib = (inputs // {inherit lib;});
|
||||||
|
serde = import ./serde.nix inputs_w_lib;
|
||||||
|
shellAsDrv = {script, pname}: (pkgs.callPackage (
|
||||||
|
# just a pattern that we must remember: args to this are children of pkgs.
|
||||||
|
{writeShellScriptBin}: writeShellScriptBin pname script
|
||||||
|
) {});
|
||||||
|
trimNull = lib.filterAttrs (name: value: value != null);
|
||||||
|
# ssh
|
||||||
|
flattenPubkey = lib.mapAttrs (_identity: meta_config: lib.attrByPath ["metadata" "ssh_pubkey"] null meta_config);
|
||||||
|
getPubkey = config: (lib.pipe config [flattenPubkey trimNull]);
|
||||||
|
# procedure =
|
||||||
|
in {
|
||||||
|
# short-hand to create a shell derivation
|
||||||
|
# NOTE: this is pure. This means, env vars from devShells might not
|
||||||
|
# be accessible unless MAYBE they are `export`ed
|
||||||
|
inherit shellAsDrv trimNull flattenPubkey getPubkey;
|
||||||
|
ssh = {
|
||||||
|
inherit flattenPubkey getPubkey;
|
||||||
|
};
|
||||||
|
# Configures hosts as nixosConfiguration
|
||||||
|
# mkHost = {hostName
|
||||||
|
# , nixosBareConfiguration
|
||||||
|
# , finalInputs
|
||||||
|
# , users ? {}
|
||||||
|
# , nixosVersion? nixosDefaultVersion
|
||||||
|
# , system? defaultSystem
|
||||||
|
# , preset? "base"}: # base | minimal
|
||||||
|
# let
|
||||||
|
# hardwareConfig = hostname: import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
|
||||||
|
# in nixpkgs.lib.nixosSystem (nixosBareConfiguration // {
|
||||||
|
# inherit system;
|
||||||
|
# modules = [
|
||||||
|
# {
|
||||||
|
# system.stateVersion = nixosVersion;
|
||||||
|
# networking.hostName = hostName;
|
||||||
|
# users.users = users;
|
||||||
|
# }
|
||||||
|
# {
|
||||||
|
# _module.args = finalInputs;
|
||||||
|
# }
|
||||||
|
# import "${proj_root.modules.path}/secrets.nix"
|
||||||
|
# import "${proj_root.modules.path}/${preset}.sys.nix"
|
||||||
|
# ] ++ nixosBareConfiguration.modules;
|
||||||
|
# lib = finalInputs.lib;
|
||||||
|
# });
|
||||||
|
inherit serde;
|
||||||
|
inherit (serde) fromYaml fromYamlPath;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Takes care of serializing and deserializing to some formats
|
||||||
|
# Blame: Pegasust<pegasucksgg@gmail.com>
|
||||||
|
# TODO: Add to* formats from pkgs.formats.*
|
||||||
|
{ pkgs
|
||||||
|
, lib
|
||||||
|
,...
|
||||||
|
} @ inputs:
|
||||||
|
let
|
||||||
|
yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage
|
||||||
|
({ runCommand }:
|
||||||
|
# runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33
|
||||||
|
runCommand outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; }
|
||||||
|
# run yq which outputs '.' (no filter) on file at yamlPath
|
||||||
|
# note that $out is passed onto the bash/sh script for execution
|
||||||
|
''
|
||||||
|
echo "$yamlContent" | yq >$out
|
||||||
|
'')
|
||||||
|
{ };
|
||||||
|
in {
|
||||||
|
# Takes in a yaml string and produces a derivation with translated JSON at $outputPath
|
||||||
|
# similar to builtins.fromJSON, turns a YAML string to nix attrset
|
||||||
|
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
|
||||||
|
fromYamlPath = yamlPath: builtins.fromJSON (
|
||||||
|
builtins.readFile (
|
||||||
|
yamlToJsonDrv (
|
||||||
|
builtins.readFile yamlPath)
|
||||||
|
"any-output.json"));
|
||||||
|
# TODO: fromToml?
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{lib,...}: {
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
imports = [./gpu.sys.nix];
|
imports = [./gpu.sys.nix];
|
||||||
boot.initrd.kernelModules = ["amdgpu"];
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
services.xserver.enable = true;
|
services.xserver.enable = true;
|
||||||
services.xserver.videoDrivers = ["amdgpu"];
|
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{pkgs
|
||||||
pkgs,
|
,lib
|
||||||
lib,
|
,proj_root
|
||||||
proj_root,
|
,...
|
||||||
...
|
}:{
|
||||||
}: {
|
|
||||||
imports = [
|
imports = [
|
||||||
./minimal.sys.nix
|
./minimal.sys.nix
|
||||||
./mosh.sys.nix
|
./mosh.sys.nix
|
||||||
|
@ -12,4 +11,5 @@
|
||||||
];
|
];
|
||||||
environment.systemPackages = [pkgs.lm_sensors];
|
environment.systemPackages = [pkgs.lm_sensors];
|
||||||
time.timeZone = "America/Phoenix";
|
time.timeZone = "America/Phoenix";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{pkgs, ...}: {
|
{ pkgs, ... }: {
|
||||||
environment.systemPackages = [pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools];
|
environment.systemPackages = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ];
|
||||||
hardware.opengl = {
|
hardware.opengl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraPackages = [pkgs.rocm-opencl-icd pkgs.rocm-opencl-runtime];
|
extraPackages = [ pkgs.rocm-opencl-icd pkgs.rocm-opencl-runtime ];
|
||||||
# Vulkan
|
# Vulkan
|
||||||
driSupport = true;
|
driSupport = true;
|
||||||
driSupport32Bit = true;
|
driSupport32Bit = true;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{ pkgs
|
||||||
pkgs,
|
, my-lib
|
||||||
my-lib,
|
,...
|
||||||
...
|
|
||||||
}: {
|
}: {
|
||||||
environment.noXlibs = my-lib.mkForce false;
|
environment.noXlibs = my-lib.mkForce false;
|
||||||
# TODO: wireless networking
|
# TODO: wireless networking
|
||||||
|
@ -12,9 +11,8 @@
|
||||||
services.xserver.displayManager.sddm.enable = true;
|
services.xserver.displayManager.sddm.enable = true;
|
||||||
services.xserver.desktopManager.plasma5 = {
|
services.xserver.desktopManager.plasma5 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
excludePackages = let
|
excludePackages = let plasma5 = pkgs.libsForQt5; in
|
||||||
plasma5 = pkgs.libsForQt5;
|
[
|
||||||
in [
|
|
||||||
plasma5.elisa # audio viewer
|
plasma5.elisa # audio viewer
|
||||||
plasma5.konsole # I use alacritty instaed
|
plasma5.konsole # I use alacritty instaed
|
||||||
plasma5.plasma-browser-integration
|
plasma5.plasma-browser-integration
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
{
|
{pkgs
|
||||||
pkgs,
|
,lib
|
||||||
lib,
|
,proj_root
|
||||||
proj_root,
|
,modulesPath
|
||||||
modulesPath,
|
,...
|
||||||
...
|
}:{
|
||||||
}: {
|
|
||||||
imports = ["${modulesPath}/profiles/minimal.nix"];
|
imports = ["${modulesPath}/profiles/minimal.nix"];
|
||||||
# prune old builds after a while
|
# prune old builds after a while
|
||||||
nix.settings.auto-optimise-store = true;
|
nix.settings.auto-optimise-store = true;
|
||||||
|
|
|
@ -1,28 +1,13 @@
|
||||||
{
|
{pkgs
|
||||||
pkgs,
|
,lib
|
||||||
lib,
|
,config
|
||||||
config,
|
,...
|
||||||
...
|
}: {
|
||||||
}: let
|
|
||||||
cfg = config.mod.mosh;
|
|
||||||
in {
|
|
||||||
options.mod.mosh = {
|
|
||||||
enable = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
description = "enable mosh";
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
environment.systemPackages = [pkgs.mosh];
|
environment.systemPackages = [pkgs.mosh];
|
||||||
networking.firewall = lib.mkIf config.networking.firewall.enable {
|
networking.firewall = lib.mkIf config.networking.firewall.enable {
|
||||||
allowedUDPPortRanges = [
|
allowedUDPPortRanges = [
|
||||||
{
|
{ from = 60000; to = 61000; } # mosh
|
||||||
from = 60000;
|
|
||||||
to = 61000;
|
|
||||||
} # mosh
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{config, ...}: {
|
{config,...}: {
|
||||||
imports = [./gpu.sys.nix];
|
imports = [./gpu.sys.nix];
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
services.xserver.enable = true;
|
services.xserver.enable = true;
|
||||||
services.xserver.videoDrivers = ["nvidia"];
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
}: let
|
|
||||||
gpu_pkgs = [pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools];
|
|
||||||
gpu_conf = {
|
|
||||||
# openCL
|
|
||||||
hardware.opengl = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = let
|
|
||||||
inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
|
|
||||||
in [rocm-opencl-icd rocm-opencl-runtime];
|
|
||||||
# Vulkan
|
|
||||||
driSupport = true;
|
|
||||||
driSupport32Bit = true;
|
|
||||||
package = pkgs.mesa.drivers;
|
|
||||||
package32 = pkgs.pkgsi686Linux.mesa.drivers;
|
|
||||||
};
|
|
||||||
environment.systemPackages = gpu_pkgs;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
gpu_conf
|
|
|
@ -1,4 +1,5 @@
|
||||||
{proj_root, ...}: {
|
{proj_root
|
||||||
|
,...}: {
|
||||||
age.secrets.s3fs = {
|
age.secrets.s3fs = {
|
||||||
file = "${proj_root.secrets.path}/s3fs.age";
|
file = "${proj_root.secrets.path}/s3fs.age";
|
||||||
# mode = "600"; # owner + group only
|
# mode = "600"; # owner + group only
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
# Personal configuration on storage solution
|
# Personal configuration on storage solution
|
||||||
{
|
{ pkgs, config, lib,... }: {
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.s3fs
|
pkgs.s3fs
|
||||||
pkgs.cifs-utils
|
pkgs.cifs-utils
|
||||||
|
@ -14,7 +9,8 @@
|
||||||
# HACK: need to store secret somewhere so that root can access this
|
# HACK: need to store secret somewhere so that root can access this
|
||||||
# because autofs may run as root for now, we enforce putting the secret in this monorepo
|
# because autofs may run as root for now, we enforce putting the secret in this monorepo
|
||||||
# TODO: make this configuration nix-less to show that it's 100% data
|
# TODO: make this configuration nix-less to show that it's 100% data
|
||||||
services.autofs = let
|
services.autofs =
|
||||||
|
let
|
||||||
# confToBackendArg {lol="what"; empty=""; name_only=null;} -> "lol=what,empty=,name_only"
|
# confToBackendArg {lol="what"; empty=""; name_only=null;} -> "lol=what,empty=,name_only"
|
||||||
# TODO: change null -> true/false. This allows overriding & better self-documentation
|
# TODO: change null -> true/false. This allows overriding & better self-documentation
|
||||||
confToBackendArg = conf: (lib.concatStringsSep ","
|
confToBackendArg = conf: (lib.concatStringsSep ","
|
||||||
|
@ -28,14 +24,35 @@
|
||||||
# backend_args, so just put the bucket name here
|
# backend_args, so just put the bucket name here
|
||||||
#
|
#
|
||||||
#-> "${mount_dest} ${formatted_args} ${s3fs-bin}#${bucket}"
|
#-> "${mount_dest} ${formatted_args} ${s3fs-bin}#${bucket}"
|
||||||
autofs-s3fs_entry = {
|
autofs-s3fs_entry =
|
||||||
mount_dest,
|
{ mount_dest
|
||||||
backend_args ? {"-fstype" = "fuse";},
|
, backend_args ? { "-fstype" = "fuse"; }
|
||||||
bucket,
|
, bucket
|
||||||
} @ inputs: let
|
}@inputs:
|
||||||
|
let
|
||||||
s3fs-exec = "${pkgs.s3fs}/bin/s3fs";
|
s3fs-exec = "${pkgs.s3fs}/bin/s3fs";
|
||||||
in "${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}";
|
in
|
||||||
|
"${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}";
|
||||||
personalStorage = [
|
personalStorage = [
|
||||||
|
# hungtr-hot @ phoenix is broken :)
|
||||||
|
# (autofs-s3fs_entry {
|
||||||
|
# mount_dest = "hot";
|
||||||
|
# backend_args = {
|
||||||
|
# "-fstype" = "fuse";
|
||||||
|
# use_cache = "/tmp";
|
||||||
|
# del_cache = null;
|
||||||
|
# allow_other = null;
|
||||||
|
# url = ''"https://f5i0.ph.idrivee2-32.com"'';
|
||||||
|
# # TODO: builtins.readFile requires a Git-controlled file
|
||||||
|
# passwd_file = config.age.secrets.s3fs.path;
|
||||||
|
# dbglevel = "debug"; # enable this for better debugging info in journalctl
|
||||||
|
# uid = "1000"; # default user
|
||||||
|
# gid = "100"; # users
|
||||||
|
# umask="003"; # others read only, fully shared for users group
|
||||||
|
# # _netdev = null; # ignored by s3fs (https://github.com/s3fs-fuse/s3fs-fuse/blob/master/src/s3fs.cpp#L4910)
|
||||||
|
# };
|
||||||
|
# bucket = "hungtr-hot";
|
||||||
|
# })
|
||||||
(autofs-s3fs_entry {
|
(autofs-s3fs_entry {
|
||||||
mount_dest = "garden";
|
mount_dest = "garden";
|
||||||
backend_args = {
|
backend_args = {
|
||||||
|
@ -53,8 +70,7 @@
|
||||||
bucket = "digital-garden";
|
bucket = "digital-garden";
|
||||||
})
|
})
|
||||||
(
|
(
|
||||||
let
|
let args = {
|
||||||
args = {
|
|
||||||
"-fstype" = "cifs";
|
"-fstype" = "cifs";
|
||||||
credentials = config.age.secrets._nhitrl_cred.path;
|
credentials = config.age.secrets._nhitrl_cred.path;
|
||||||
user = null;
|
user = null;
|
||||||
|
@ -66,8 +82,7 @@
|
||||||
in "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d"
|
in "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d"
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
let
|
let args = {
|
||||||
args = {
|
|
||||||
"-fstype" = "cifs";
|
"-fstype" = "cifs";
|
||||||
credentials = config.age.secrets._nhitrl_cred.path;
|
credentials = config.age.secrets._nhitrl_cred.path;
|
||||||
user = null;
|
user = null;
|
||||||
|
@ -80,7 +95,8 @@
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage);
|
persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage);
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
# Creates /perso directory with every subdirectory declared by ${personalStorage}
|
# Creates /perso directory with every subdirectory declared by ${personalStorage}
|
||||||
# as of now (might be stale), /perso/hot is the only mount accessible
|
# as of now (might be stale), /perso/hot is the only mount accessible
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
{
|
{pkgs
|
||||||
pkgs,
|
,config
|
||||||
config,
|
,lib
|
||||||
lib,
|
,...}: {
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.mod.tailscale;
|
|
||||||
in {
|
|
||||||
options.mod.tailscale = {
|
|
||||||
enable = lib.mkEnableOption "tailscale";
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
environment.systemPackages = [pkgs.tailscale];
|
environment.systemPackages = [pkgs.tailscale];
|
||||||
services.tailscale.enable = true;
|
services.tailscale.enable = true;
|
||||||
|
|
||||||
|
@ -17,9 +9,9 @@ in {
|
||||||
description = "Automatically connects to Tailscale";
|
description = "Automatically connects to Tailscale";
|
||||||
|
|
||||||
# make sure tailscale is running before trying to connect to tailscale
|
# make sure tailscale is running before trying to connect to tailscale
|
||||||
after = ["network-pre.target" "tailscale.service"];
|
after = [ "network-pre.target" "tailscale.service" ];
|
||||||
wants = ["network-pre.target" "tailscale.service"];
|
wants = [ "network-pre.target" "tailscale.service" ];
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
# set this service as a oneshot job
|
# set this service as a oneshot job
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
|
@ -53,5 +45,4 @@ in {
|
||||||
];
|
];
|
||||||
checkReversePath = "loose";
|
checkReversePath = "loose";
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{config, ...}: {
|
{config,...}: {
|
||||||
networking.wireless.enable = true;
|
networking.wireless.enable = true;
|
||||||
networking.wireless.environmentFile = config.age.secrets."wifi.env";
|
networking.wireless.environmentFile = config.age.secrets."wifi.env";
|
||||||
networking.wireless.networks = {
|
networking.wireless.networks = {
|
||||||
|
|
|
@ -1,17 +1,3 @@
|
||||||
# Native configs
|
# Native configs
|
||||||
|
|
||||||
Contains all configurations that are written in their native configuration language.
|
Contains all configurations that are written in their native language
|
||||||
|
|
||||||
## Why native language?
|
|
||||||
|
|
||||||
- Easier portability
|
|
||||||
- Syntax highlighting and robust checking without needing to realize derivation
|
|
||||||
- Nix can read from [JSON](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-fromJSON),
|
|
||||||
[TOML](https://nixos.org/manual/nix/stable/release-notes/rl-2.6.html#release-26-2022-01-24).
|
|
||||||
- We have also managed to hack together a [fromYaml](./../nix-conf/lib/serde/default.nix),
|
|
||||||
though it will not work for strictly pure builds or bootstrapping builds.
|
|
||||||
|
|
||||||
## When to use Nix to generate config?
|
|
||||||
|
|
||||||
- Original configuraiton language requires too much duplication that can be solved with Nix
|
|
||||||
|
|
||||||
|
|
|
@ -866,7 +866,7 @@ key_bindings:
|
||||||
#- { key: Q, mods: Command, action: Quit }
|
#- { key: Q, mods: Command, action: Quit }
|
||||||
#- { key: W, mods: Command, action: Quit }
|
#- { key: W, mods: Command, action: Quit }
|
||||||
#- { key: N, mods: Command, action: SpawnNewInstance }
|
#- { key: N, mods: Command, action: SpawnNewInstance }
|
||||||
- { key: Return, mods: Command, action: ToggleFullscreen }
|
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
|
||||||
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
|
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
|
||||||
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
|
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
|
||||||
|
|
||||||
|
|
|
@ -1,721 +0,0 @@
|
||||||
(vim.cmd "let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
|
|
||||||
let plug_path = data_dir . '/autoload/plug.vim'
|
|
||||||
if empty(glob(plug_path))
|
|
||||||
execute '!curl -fLo '.plug_path.' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
||||||
execute 'so '.plug_path
|
|
||||||
endif
|
|
||||||
")
|
|
||||||
(local Plug (. vim.fn "plug#"))
|
|
||||||
(local installed-plugins {})
|
|
||||||
(each [_ path (ipairs (vim.api.nvim_list_runtime_paths))]
|
|
||||||
(local last-folder-start (path:find "/[^/]*$"))
|
|
||||||
(when last-folder-start
|
|
||||||
(local plugin-name (path:sub (+ last-folder-start 1)))
|
|
||||||
(tset installed-plugins plugin-name true)))
|
|
||||||
(fn WPlug [plugin-path ...]
|
|
||||||
(let [plugin-name (string.lower (plugin-path:match "/([^/]+)$"))]
|
|
||||||
(when (not (. installed-plugins plugin-name)) (Plug plugin-path ...))))
|
|
||||||
(vim.call "plug#begin")
|
|
||||||
(WPlug :tjdevries/nlua.nvim)
|
|
||||||
(WPlug :nvim-treesitter/nvim-treesitter)
|
|
||||||
(WPlug :nvim-treesitter/nvim-treesitter-textobjects)
|
|
||||||
(WPlug :nvim-telescope/telescope.nvim {:branch :0.1.x})
|
|
||||||
(WPlug :nvim-telescope/telescope-fzf-native.nvim {:do "make >> /tmp/log 2>&1"})
|
|
||||||
(WPlug :nvim-telescope/telescope-file-browser.nvim)
|
|
||||||
(WPlug :neovim/nvim-lspconfig)
|
|
||||||
(WPlug :hrsh7th/cmp-nvim-lsp)
|
|
||||||
(WPlug :hrsh7th/cmp-path)
|
|
||||||
(WPlug :hrsh7th/cmp-buffer)
|
|
||||||
(WPlug :hrsh7th/cmp-cmdline)
|
|
||||||
(WPlug :hrsh7th/nvim-cmp)
|
|
||||||
(WPlug :onsails/lspkind-nvim)
|
|
||||||
(WPlug :yioneko/nvim-yati {:tag "*"})
|
|
||||||
(WPlug :nathanalderson/yang.vim)
|
|
||||||
(WPlug :windwp/nvim-autopairs)
|
|
||||||
(WPlug :windwp/nvim-ts-autotag)
|
|
||||||
(WPlug :NMAC427/guess-indent.nvim)
|
|
||||||
(WPlug :j-hui/fidget.nvim)
|
|
||||||
(WPlug :numToStr/Comment.nvim)
|
|
||||||
(WPlug :lewis6991/gitsigns.nvim)
|
|
||||||
(WPlug :tpope/vim-fugitive)
|
|
||||||
(WPlug :williamboman/mason.nvim)
|
|
||||||
(WPlug :williamboman/mason-lspconfig.nvim)
|
|
||||||
(WPlug :ThePrimeagen/harpoon)
|
|
||||||
(WPlug :TimUntersberger/neogit)
|
|
||||||
(WPlug :folke/trouble.nvim)
|
|
||||||
(WPlug :tpope/vim-dispatch)
|
|
||||||
(WPlug :clojure-vim/vim-jack-in)
|
|
||||||
(WPlug :radenling/vim-dispatch-neovim)
|
|
||||||
(WPlug :gennaro-tedesco/nvim-jqx)
|
|
||||||
(WPlug :kylechui/nvim-surround)
|
|
||||||
(WPlug :simrat39/rust-tools.nvim)
|
|
||||||
(WPlug :simrat39/inlay-hints.nvim)
|
|
||||||
(WPlug :gruvbox-community/gruvbox)
|
|
||||||
(WPlug :nvim-lualine/lualine.nvim)
|
|
||||||
(WPlug :lukas-reineke/indent-blankline.nvim)
|
|
||||||
(WPlug :kyazdani42/nvim-web-devicons)
|
|
||||||
(WPlug :m-demare/hlargs.nvim)
|
|
||||||
(WPlug :folke/todo-comments.nvim)
|
|
||||||
(WPlug :nvim-treesitter/nvim-treesitter-context)
|
|
||||||
(WPlug :nvim-treesitter/playground)
|
|
||||||
(WPlug :saadparwaiz1/cmp_luasnip)
|
|
||||||
(WPlug :L3MON4D3/LuaSnip)
|
|
||||||
(WPlug :mickael-menu/zk-nvim)
|
|
||||||
(WPlug :arthurxavierx/vim-caser)
|
|
||||||
(WPlug "~/local_repos/ts-ql")
|
|
||||||
(vim.call "plug#end")
|
|
||||||
(vim.cmd "if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
||||||
PlugInstall --sync | autocmd VimEnter * so $MYVIMRC
|
|
||||||
endif
|
|
||||||
")
|
|
||||||
(vim.api.nvim_create_autocmd [:VimEnter]
|
|
||||||
{:callback (fn []
|
|
||||||
(fn named-term [term-idx term-name]
|
|
||||||
((. (require :harpoon.term)
|
|
||||||
:gotoTerminal) term-idx)
|
|
||||||
(vim.cmd (.. ":exe \":file "
|
|
||||||
term-name
|
|
||||||
"\" | :bfirst")))
|
|
||||||
|
|
||||||
(named-term 4 "term:ctl")
|
|
||||||
(named-term 5 "term:dev")
|
|
||||||
(named-term 7 "term:repl")
|
|
||||||
(named-term 6 "term:repl2"))})
|
|
||||||
(set vim.g.gruvbox_contrast_dark :soft)
|
|
||||||
(set vim.g.gruvbox_contrast_light :soft)
|
|
||||||
(set vim.opt.ignorecase true)
|
|
||||||
(set vim.opt.smartcase true)
|
|
||||||
(set vim.opt.incsearch true)
|
|
||||||
(set vim.opt.number true)
|
|
||||||
(set vim.opt.relativenumber true)
|
|
||||||
(set vim.opt.autoindent true)
|
|
||||||
(set vim.opt.smartindent true)
|
|
||||||
(set vim.opt.expandtab true)
|
|
||||||
(set vim.opt.exrc true)
|
|
||||||
(set vim.opt.tabstop 4)
|
|
||||||
(set vim.opt.softtabstop 4)
|
|
||||||
(set vim.opt.shiftwidth 4)
|
|
||||||
(set vim.opt.scrolloff 30)
|
|
||||||
(set vim.opt.signcolumn :yes)
|
|
||||||
(set vim.opt.colorcolumn :80)
|
|
||||||
(set vim.opt.background :dark)
|
|
||||||
(vim.api.nvim_create_user_command :Dark
|
|
||||||
(fn [opts]
|
|
||||||
(let [contrast (or (and (and opts.args
|
|
||||||
(> (string.len opts.args)
|
|
||||||
0))
|
|
||||||
opts.args)
|
|
||||||
vim.g.gruvbox_contrast_dark)]
|
|
||||||
(set vim.g.gruvbox_contrast_dark contrast)
|
|
||||||
(set vim.opt.background :dark)))
|
|
||||||
{:nargs "?"})
|
|
||||||
(vim.api.nvim_create_user_command :Light
|
|
||||||
(fn [opts]
|
|
||||||
(let [contrast (or (and (and opts.args
|
|
||||||
(> (string.len opts.args)
|
|
||||||
0))
|
|
||||||
opts.args)
|
|
||||||
vim.g.gruvbox_contrast_light)]
|
|
||||||
(set vim.g.gruvbox_contrast_light
|
|
||||||
contrast)
|
|
||||||
(set vim.opt.background :light)))
|
|
||||||
{:nargs "?"})
|
|
||||||
(set vim.opt.lazyredraw true)
|
|
||||||
(set vim.opt.termguicolors true)
|
|
||||||
(set vim.opt.cursorline true)
|
|
||||||
(set vim.opt.swapfile false)
|
|
||||||
(set vim.opt.backup false)
|
|
||||||
(set vim.opt.undodir (.. (vim.fn.stdpath :state) :/.vim/undodir))
|
|
||||||
(set vim.opt.undofile true)
|
|
||||||
(set vim.opt.completeopt "menuone,noselect")
|
|
||||||
(set vim.opt.updatetime 50)
|
|
||||||
(set vim.g.mapleader " ")
|
|
||||||
(set vim.g.maplocalleader ",")
|
|
||||||
(vim.keymap.set [:n :v] :<Space> :<Nop> {:silent true})
|
|
||||||
(vim.keymap.set :t :<Esc> "<C-\\><C-n>)")
|
|
||||||
(vim.keymap.set [:n :i :v] :<c-l> :<Cmd>mode<Cr> {:desc ""})
|
|
||||||
(vim.keymap.set :n "[d" vim.diagnostic.goto_prev)
|
|
||||||
(vim.keymap.set :n "]d" vim.diagnostic.goto_next)
|
|
||||||
(vim.keymap.set :n :<leader>e vim.diagnostic.open_float)
|
|
||||||
(vim.keymap.set :n :<leader>q "<cmd>TroubleToggle loclist<cr>")
|
|
||||||
(vim.keymap.set :n :<leader>wq "<cmd>TroubleToggle workspace_diagnostics<cr>")
|
|
||||||
(vim.keymap.set :n :<leader>gg :<cmd>GuessIndent<cr>)
|
|
||||||
(vim.cmd "colorscheme gruvbox\n")
|
|
||||||
((. (require :hlargs) :setup))
|
|
||||||
((. (require :nvim-web-devicons) :setup))
|
|
||||||
((. (require :trouble) :setup))
|
|
||||||
((. (require :todo-comments) :setup))
|
|
||||||
(fn remap [mode key-cmd binded-fn opts]
|
|
||||||
(set-forcibly! opts (or opts {:remap true}))
|
|
||||||
(vim.keymap.set mode key-cmd binded-fn opts))
|
|
||||||
((. (require :Comment) :setup))
|
|
||||||
(set vim.opt.list true)
|
|
||||||
(vim.opt.listchars:append "space:⋅")
|
|
||||||
(vim.opt.listchars:append "eol:↴")
|
|
||||||
((. (require :indent_blankline) :setup) {:show_end_of_line true
|
|
||||||
:space_char_blankline " "})
|
|
||||||
(vim.api.nvim_create_user_command :HalfSpaces
|
|
||||||
(fn [opts]
|
|
||||||
(vim.api.nvim_command "set ts=2 sts=2 noet")
|
|
||||||
(vim.api.nvim_command :retab!)
|
|
||||||
(vim.api.nvim_command "set ts=1 sts=1 et")
|
|
||||||
(vim.api.nvim_command :retab)
|
|
||||||
(vim.api.nvim_command :GuessIndent))
|
|
||||||
{:nargs 0})
|
|
||||||
(vim.api.nvim_create_user_command :DoubleSpaces
|
|
||||||
(fn [opts]
|
|
||||||
(vim.api.nvim_command "set ts=2 sts=2 noet")
|
|
||||||
(vim.api.nvim_command :retab!)
|
|
||||||
(vim.api.nvim_command "set ts=4 sts=4 et")
|
|
||||||
(vim.api.nvim_command :retab)
|
|
||||||
(vim.api.nvim_command :GuessIndent))
|
|
||||||
{:nargs 0})
|
|
||||||
(local fb-actions (. (. (. (require :telescope) :extensions) :file_browser)
|
|
||||||
:actions))
|
|
||||||
((. (require :telescope) :setup) {:defaults {:mappings {:i {:<C-d> false
|
|
||||||
:<C-u> false}}}
|
|
||||||
:extensions {:file_browser {:hiject_netrw true
|
|
||||||
:mappings {:i {}
|
|
||||||
:n {:c fb-actions.create
|
|
||||||
:d fb-actions.remove
|
|
||||||
:e fb-actions.goto_home_dir
|
|
||||||
:f fb-actions.toggle_browser
|
|
||||||
:g fb-actions.goto_parent_dir
|
|
||||||
:h fb-actions.toggle_hidden
|
|
||||||
:m fb-actions.move
|
|
||||||
:o fb-actions.open
|
|
||||||
:r fb-actions.rename
|
|
||||||
:s fb-actions.toggle_all
|
|
||||||
:t fb-actions.change_cwd
|
|
||||||
:w fb-actions.goto_cwd
|
|
||||||
:y fb-actions.copy}}
|
|
||||||
:theme (. ((. (require :telescope.themes)
|
|
||||||
:get_ivy))
|
|
||||||
:theme)}
|
|
||||||
:fzf {:case_mode :smart_case
|
|
||||||
:fuzzy true
|
|
||||||
:override_file_sorter true
|
|
||||||
:override_generic_sorter true}}})
|
|
||||||
(pcall (. (require :telescope) :load_extension) :fzf)
|
|
||||||
(pcall (. (require :telescope) :load_extension) :file_browser)
|
|
||||||
(remap :n :<C-p> :<cmd>Telescope<cr> {:desc "Open Telescope general search"})
|
|
||||||
(remap :n :<leader>fm (fn []
|
|
||||||
((. (. (. (require :telescope) :extensions)
|
|
||||||
:file_browser)
|
|
||||||
:file_browser) {}))
|
|
||||||
{:desc "[F]ile [M]utation"})
|
|
||||||
(remap :n :<leader>ff
|
|
||||||
(fn []
|
|
||||||
((. (require :telescope.builtin) :find_files) {:follow false
|
|
||||||
:hidden false
|
|
||||||
:no_ignore false}))
|
|
||||||
{:desc "[F]ind [F]ile"})
|
|
||||||
(remap :n :<leader>fa
|
|
||||||
(fn []
|
|
||||||
((. (require :telescope.builtin) :find_files) {:follow true
|
|
||||||
:hidden true
|
|
||||||
:no_ignore true}))
|
|
||||||
{:desc "[F]ind [A]ll files"})
|
|
||||||
(remap :n :<leader>fg
|
|
||||||
(fn []
|
|
||||||
((. (require :telescope.builtin) :live_grep)))
|
|
||||||
{:desc "[F]ind by [G]rep"})
|
|
||||||
(remap :n :<leader>fug
|
|
||||||
(fn []
|
|
||||||
((. (require :telescope.builtin) :live_grep) {:glob_pattern "**/*"}))
|
|
||||||
{:desc "[F]ind by [u]nrestricted [G]rep"})
|
|
||||||
(remap :n :<leader>fb
|
|
||||||
(fn []
|
|
||||||
((. (require :telescope.builtin) :buffers)))
|
|
||||||
{:desc "[F]ind existing [B]uffers"})
|
|
||||||
(remap :n :<leader>fh
|
|
||||||
(fn []
|
|
||||||
((. (require :telescope.builtin) :help_tags)))
|
|
||||||
{:desc "[F]ind [H]elp"})
|
|
||||||
(remap :n :<leader>fd
|
|
||||||
(fn []
|
|
||||||
((. (require :telescope.builtin) :diagnostics)))
|
|
||||||
{:desc "[F]ind [D]iagnostics"})
|
|
||||||
(remap :n :<leader>zf
|
|
||||||
(fn []
|
|
||||||
((. (require :zk) :edit) {} {:multi_select false}))
|
|
||||||
{:desc "[Z]ettelkasten [F]iles"})
|
|
||||||
(remap :n :<leader>zg (fn [] (vim.cmd ":ZkGrep"))
|
|
||||||
{:desc "[Z]ettelkasten [G]rep"})
|
|
||||||
(for [i 1 9]
|
|
||||||
(vim.api.nvim_set_keymap :n (.. :<C-t> i) (.. ":tabn " i :<CR>)
|
|
||||||
{:noremap true :silent true}))
|
|
||||||
(set vim.o.showtabline 1)
|
|
||||||
(set vim.o.tabline "%!v:lua.my_tabline()")
|
|
||||||
(fn _G.my_tabline []
|
|
||||||
(var s "")
|
|
||||||
(for [i 1 (vim.fn.tabpagenr "$")]
|
|
||||||
(if (= i (vim.fn.tabpagenr)) (set s (.. s "%" i "T%#TabLineSel#"))
|
|
||||||
(set s (.. s "%" i "T%#TabLine#")))
|
|
||||||
(local tab (. (vim.fn.gettabinfo i) 1))
|
|
||||||
(local tabbuf tab.variables.buffers)
|
|
||||||
(var bufname :<unknown>)
|
|
||||||
(when tabbuf
|
|
||||||
(set bufname (. (. tabbuf tab.curwin) :name)))
|
|
||||||
(set s (.. s " " i " " (vim.fn.fnamemodify bufname ":t")))
|
|
||||||
(when (not= i (vim.fn.tabpagenr "$"))
|
|
||||||
(set s (.. s "%#TabLine#|%#TabLine#"))))
|
|
||||||
(.. s "%T%#TabLineFill#%="))
|
|
||||||
(vim.api.nvim_set_keymap :n :<C-t>x
|
|
||||||
":tabdo if tabpagenr() > 1 | tabclose | endif<CR>"
|
|
||||||
{:noremap true :silent true})
|
|
||||||
(require :treesitter-context)
|
|
||||||
((. (require :nvim-treesitter.configs) :setup) {:autotag {:enable true}
|
|
||||||
:highlight {:enable true
|
|
||||||
:enable_vim_regex_highlighting true}
|
|
||||||
:incremental_selection {:enable true
|
|
||||||
:keymaps {:init_selection :<C-space>
|
|
||||||
:node_decremental :<C-backspace>
|
|
||||||
:node_incremental :<C-space>
|
|
||||||
:pscope_incremental :<C-S>}}
|
|
||||||
:indent {:enable false}
|
|
||||||
:playground {:disable {}
|
|
||||||
:enable true}
|
|
||||||
:textobjects {:select {:enable true
|
|
||||||
:keymaps {:ac "@class.outer"
|
|
||||||
:af "@function.outer"
|
|
||||||
:ic "@class.inner"
|
|
||||||
:if "@function.inner"}
|
|
||||||
:lookahead true}}
|
|
||||||
:yati {:default_fallback :auto
|
|
||||||
:default_lazy true
|
|
||||||
:disable [:nix]
|
|
||||||
:enable true}})
|
|
||||||
((. (require :nvim-autopairs) :setup) {:check_ts true})
|
|
||||||
(local parser-config
|
|
||||||
((. (require :nvim-treesitter.parsers) :get_parser_configs)))
|
|
||||||
(set parser-config.tsx.filetype_to_parsername [:javascript :typescript.tsx])
|
|
||||||
(set parser-config.astro.filetype_to_parsername
|
|
||||||
[:javascript :typescript.tsx :astro])
|
|
||||||
((. (require :guess-indent) :setup) {:auto_cmd true
|
|
||||||
:filetype_exclude [:netrw :tutor]})
|
|
||||||
(remap :n :<leader>m
|
|
||||||
(fn []
|
|
||||||
((. (require :harpoon.mark) :add_file)))
|
|
||||||
{:desc "[H]arpoon [M]ark"})
|
|
||||||
(fn harpoon-nav [key nav-file-index lead-keybind]
|
|
||||||
(set-forcibly! lead-keybind (or lead-keybind :<leader>h))
|
|
||||||
(assert (= (type key) :string) "expect key to be string(keybind)")
|
|
||||||
(assert (and (= (type nav-file-index) :number) (>= nav-file-index 1))
|
|
||||||
"expect 1-indexed number for file index")
|
|
||||||
(remap :n (.. lead-keybind key)
|
|
||||||
(fn []
|
|
||||||
((. (require :harpoon.ui) :nav_file) nav-file-index))
|
|
||||||
{:desc (.. "[H]arpoon navigate " (tostring nav-file-index))}))
|
|
||||||
(harpoon-nav :f 1)
|
|
||||||
(harpoon-nav :j 2)
|
|
||||||
(harpoon-nav :d 3)
|
|
||||||
(harpoon-nav :k 4)
|
|
||||||
(remap :n :<leader>hh
|
|
||||||
(fn []
|
|
||||||
((. (require :harpoon.ui) :toggle_quick_menu))))
|
|
||||||
(for [i 1 10]
|
|
||||||
(harpoon-nav (tostring (% i 10)) i)
|
|
||||||
(remap :n (.. :<leader>t (tostring (% i 10)))
|
|
||||||
(fn []
|
|
||||||
((. (require :harpoon.term) :gotoTerminal) i))))
|
|
||||||
((. (require :neogit) :setup) {})
|
|
||||||
(remap :n :<leader>gs (fn []
|
|
||||||
((. (require :neogit) :open) {}))
|
|
||||||
{:desc "[G]it [S]tatus"})
|
|
||||||
((. (require :inlay-hints) :setup) {:eol {:right_align false}
|
|
||||||
:only_current_line false})
|
|
||||||
(fn on-attach [client bufnr]
|
|
||||||
(fn nmap [keys func desc]
|
|
||||||
(when desc (set-forcibly! desc (.. "LSP: " desc)))
|
|
||||||
(vim.keymap.set :n keys func {:buffer bufnr : desc :noremap true}))
|
|
||||||
|
|
||||||
(nmap :<leader>rn vim.lsp.buf.rename "[R]e[n]ame")
|
|
||||||
(nmap :<leader>ca vim.lsp.buf.code_action "[C]ode [A]ction")
|
|
||||||
(vim.api.nvim_buf_set_option bufnr :omnifunc "v:lua.vim.lsp.omnifunc")
|
|
||||||
(nmap :<leader>df (fn [] (vim.lsp.buf.format {:async true}))
|
|
||||||
"[D]ocument [F]ormat")
|
|
||||||
(nmap :gd vim.lsp.buf.definition "[G]oto [D]efinition")
|
|
||||||
(nmap :gi vim.lsp.buf.implementation "[G]oto [I]mplementation")
|
|
||||||
(nmap :gr (. (require :telescope.builtin) :lsp_references))
|
|
||||||
(nmap :<leader>ds (. (require :telescope.builtin) :lsp_document_symbols)
|
|
||||||
"[D]ocument [S]ymbols")
|
|
||||||
(nmap :<leader>ws (. (require :telescope.builtin)
|
|
||||||
:lsp_dynamic_workspace_symbols)
|
|
||||||
"[W]orkspace [S]ymbols")
|
|
||||||
(nmap :K vim.lsp.buf.hover "Hover Documentation")
|
|
||||||
(nmap :<C-k> vim.lsp.buf.signature_help "Signature Documentation")
|
|
||||||
(nmap :gD vim.lsp.buf.declaration "[G]oto [D]eclaration")
|
|
||||||
(nmap :gtd vim.lsp.buf.type_definition "[G]oto [T]ype [D]efinition")
|
|
||||||
(nmap :<leader>D vim.lsp.buf.type_definition "Type [D]efinition")
|
|
||||||
(nmap :<leader>wa vim.lsp.buf.add_workspace_folder "[W]orkspace [A]dd Folder")
|
|
||||||
(nmap :<leader>wr vim.lsp.buf.remove_workspace_folder
|
|
||||||
"[W]orkspace [R]emove Folder")
|
|
||||||
(nmap :<leader>wl
|
|
||||||
(fn []
|
|
||||||
(print (vim.inspect (vim.lsp.buf.list_workspace_folders))))
|
|
||||||
"[W]orkspace [L]ist Folders")
|
|
||||||
((. (require :inlay-hints) :on_attach) client bufnr))
|
|
||||||
(local cmp (require :cmp))
|
|
||||||
(local luasnip (require :luasnip))
|
|
||||||
(local lspkind (require :lspkind))
|
|
||||||
(local source-mapping {:buffer "[Buffer]"
|
|
||||||
:nvim_lsp "[LSP]"
|
|
||||||
:nvim_lua "[Lua]"
|
|
||||||
:path "[Path]"})
|
|
||||||
(cmp.event:on :confirm_done ((. (require :nvim-autopairs.completion.cmp)
|
|
||||||
:on_confirm_done)))
|
|
||||||
(cmp.setup {:formatting {:format (fn [entry vim-item]
|
|
||||||
(set vim-item.kind
|
|
||||||
(lspkind.symbolic vim-item.kind
|
|
||||||
{:mode :symbol}))
|
|
||||||
(set vim-item.menu
|
|
||||||
(. source-mapping entry.source_name))
|
|
||||||
(local maxwidth 80)
|
|
||||||
(set vim-item.abbr
|
|
||||||
(string.sub vim-item.abbr 1 maxwidth))
|
|
||||||
vim-item)}
|
|
||||||
:mapping (cmp.mapping.preset.insert {:<C-d> (cmp.mapping.scroll_docs 4)
|
|
||||||
:<C-space> (cmp.mapping.complete)
|
|
||||||
:<C-u> (cmp.mapping.scroll_docs (- 4))
|
|
||||||
:<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace
|
|
||||||
:select true})
|
|
||||||
:<S-Tab> (cmp.mapping (fn [fallback]
|
|
||||||
(if (cmp.visible)
|
|
||||||
(cmp.select_prev_item)
|
|
||||||
(luasnip.jumpable (- 1))
|
|
||||||
(luasnip.jump (- 1))
|
|
||||||
(fallback)))
|
|
||||||
[:i :s])
|
|
||||||
:<Tab> (cmp.mapping (fn [fallback]
|
|
||||||
(if (cmp.visible)
|
|
||||||
(cmp.select_next_item)
|
|
||||||
(luasnip.expand_or_jumpable)
|
|
||||||
(luasnip.expand_or_jump)
|
|
||||||
(fallback)))
|
|
||||||
[:i :s])})
|
|
||||||
:snippet {:expand (fn [args] (luasnip.lsp_expand args.body))}
|
|
||||||
:sources (cmp.config.sources [{:name :nvim_lsp}
|
|
||||||
{:name :luasnip}
|
|
||||||
{:name :buffer}
|
|
||||||
{:name :path}])})
|
|
||||||
(local capabilities ((. (require :cmp_nvim_lsp) :default_capabilities)))
|
|
||||||
(local servers [:clangd
|
|
||||||
:rust_analyzer
|
|
||||||
:pyright
|
|
||||||
:tsserver
|
|
||||||
:lua_ls
|
|
||||||
:cmake
|
|
||||||
:tailwindcss
|
|
||||||
:prismals
|
|
||||||
:rnix
|
|
||||||
:eslint
|
|
||||||
:terraformls
|
|
||||||
:tflint
|
|
||||||
:svelte
|
|
||||||
:astro
|
|
||||||
:clojure_lsp
|
|
||||||
:bashls
|
|
||||||
:yamlls
|
|
||||||
:ansiblels
|
|
||||||
:jsonls
|
|
||||||
:denols
|
|
||||||
:gopls
|
|
||||||
:nickel_ls
|
|
||||||
:pylsp])
|
|
||||||
((. (require :mason) :setup) {:PATH :append
|
|
||||||
:ui {:check_outdated_packages_on_open true
|
|
||||||
:icons {:package_installed "✓"
|
|
||||||
:package_pending "➜"
|
|
||||||
:package_uninstalled "✗"}}})
|
|
||||||
((. (require :mason-lspconfig) :setup) {:automatic_installation false})
|
|
||||||
(local inlay-hint-tsjs
|
|
||||||
{:includeInlayEnumMemberValueHints true
|
|
||||||
:includeInlayFunctionLikeReturnTypeHints true
|
|
||||||
:includeInlayFunctionParameterTypeHints true
|
|
||||||
:includeInlayParameterNameHints :all
|
|
||||||
:includeInlayPropertyDeclarationTypeHints true
|
|
||||||
:includeInlayVariableTypeHints true
|
|
||||||
:inlcudeInlayParameterNameHintsWhenArgumentMatchesName false})
|
|
||||||
((. (require :mason-lspconfig) :setup_handlers) {1 (fn [server-name]
|
|
||||||
((. (. (require :lspconfig)
|
|
||||||
server-name)
|
|
||||||
:setup) {: capabilities
|
|
||||||
:on_attach on-attach}))
|
|
||||||
:denols (fn []
|
|
||||||
((. (. (require :lspconfig)
|
|
||||||
:denols)
|
|
||||||
:setup) {: capabilities
|
|
||||||
:on_attach on-attach
|
|
||||||
:root_dir ((. (require :lspconfig.util)
|
|
||||||
:root_pattern) :deno.json
|
|
||||||
:deno.jsonc)}))
|
|
||||||
:lua_ls (fn []
|
|
||||||
((. (. (require :lspconfig)
|
|
||||||
:lua_ls)
|
|
||||||
:setup) {: capabilities
|
|
||||||
:on_attach on-attach
|
|
||||||
:settings {:Lua {:diagnostics {:globals [:vim]}
|
|
||||||
:format {:defaultConfig {:indent_size 4
|
|
||||||
:indent_style :space}
|
|
||||||
:enable true}
|
|
||||||
:hint {:enable true}
|
|
||||||
:runtime {:path (vim.split package.path
|
|
||||||
";")
|
|
||||||
:version :LuaJIT}
|
|
||||||
:telemetry {:enable false}
|
|
||||||
:workspace {:library (vim.api.nvim_get_runtime_file ""
|
|
||||||
true)}}}}))
|
|
||||||
:pyright (fn []
|
|
||||||
((. (. (require :lspconfig)
|
|
||||||
:pyright)
|
|
||||||
:setup) {: capabilities
|
|
||||||
:on_attach on-attach
|
|
||||||
:settings {:pyright {:disableLanguageServices false
|
|
||||||
:disableOrganizeImports false}
|
|
||||||
:python {:analysis {:autoImportCompletions true
|
|
||||||
:autoSearchPaths true
|
|
||||||
:diagnosticMode :openFilesOnly
|
|
||||||
:extraPaths {}
|
|
||||||
:logLevel :Information
|
|
||||||
:pythonPath :python
|
|
||||||
:stubPath :typings
|
|
||||||
:typeCheckingMode :basic
|
|
||||||
:typeshedPaths {}
|
|
||||||
:useLibraryCodeForTypes false
|
|
||||||
:venvPath ""}
|
|
||||||
:linting {:mypyEnabled true}}}}))
|
|
||||||
:tsserver (fn []
|
|
||||||
((. (. (require :lspconfig)
|
|
||||||
:tsserver)
|
|
||||||
:setup) {: capabilities
|
|
||||||
:on_attach on-attach
|
|
||||||
:root_dir ((. (require :lspconfig.util)
|
|
||||||
:root_pattern) :package.json)
|
|
||||||
:settings {:javascript inlay-hint-tsjs
|
|
||||||
:typescript inlay-hint-tsjs}}))
|
|
||||||
:yamlls (fn []
|
|
||||||
((. (. (require :lspconfig)
|
|
||||||
:yamlls)
|
|
||||||
:setup) {: capabilities
|
|
||||||
:on_attach on-attach
|
|
||||||
:settings {:yaml {:keyOrdering false}}}))})
|
|
||||||
((. (require :rust-tools) :setup) {:dap {:adapter {:command :lldb-vscode
|
|
||||||
:name :rt_lldb
|
|
||||||
:type :executable}}
|
|
||||||
:server {: capabilities
|
|
||||||
:cmd [:rust-analyzer]
|
|
||||||
:on_attach (fn [client bufnr]
|
|
||||||
(fn nmap [keys
|
|
||||||
func
|
|
||||||
desc]
|
|
||||||
(when desc
|
|
||||||
(set-forcibly! desc
|
|
||||||
(.. "LSP: "
|
|
||||||
desc)))
|
|
||||||
(vim.keymap.set :n
|
|
||||||
keys
|
|
||||||
func
|
|
||||||
{:buffer bufnr
|
|
||||||
: desc
|
|
||||||
:noremap true}))
|
|
||||||
|
|
||||||
(on-attach client
|
|
||||||
bufnr)
|
|
||||||
(nmap :K
|
|
||||||
(. (. (require :rust-tools)
|
|
||||||
:hover_actions)
|
|
||||||
:hover_actions)
|
|
||||||
"Hover Documentation"))
|
|
||||||
:settings {:rust-analyzer {:cargo {:loadOutDirsFromCheck true}
|
|
||||||
:checkOnSave {:command :clippy
|
|
||||||
:extraArgs [:--all
|
|
||||||
"--"
|
|
||||||
:-W
|
|
||||||
"clippy::all"]}
|
|
||||||
:procMacro {:enable true}
|
|
||||||
:rustfmt {:extraArgs [:+nightly]}}}
|
|
||||||
:standalone true}
|
|
||||||
:tools {:crate_graph {:backend :x11
|
|
||||||
:enabled_graphviz_backends [:bmp
|
|
||||||
:cgimage
|
|
||||||
:canon
|
|
||||||
:dot
|
|
||||||
:gv
|
|
||||||
:xdot
|
|
||||||
:xdot1.2
|
|
||||||
:xdot1.4
|
|
||||||
:eps
|
|
||||||
:exr
|
|
||||||
:fig
|
|
||||||
:gd
|
|
||||||
:gd2
|
|
||||||
:gif
|
|
||||||
:gtk
|
|
||||||
:ico
|
|
||||||
:cmap
|
|
||||||
:ismap
|
|
||||||
:imap
|
|
||||||
:cmapx
|
|
||||||
:imap_np
|
|
||||||
:cmapx_np
|
|
||||||
:jpg
|
|
||||||
:jpeg
|
|
||||||
:jpe
|
|
||||||
:jp2
|
|
||||||
:json
|
|
||||||
:json0
|
|
||||||
:dot_json
|
|
||||||
:xdot_json
|
|
||||||
:pdf
|
|
||||||
:pic
|
|
||||||
:pct
|
|
||||||
:pict
|
|
||||||
:plain
|
|
||||||
:plain-ext
|
|
||||||
:png
|
|
||||||
:pov
|
|
||||||
:ps
|
|
||||||
:ps2
|
|
||||||
:psd
|
|
||||||
:sgi
|
|
||||||
:svg
|
|
||||||
:svgz
|
|
||||||
:tga
|
|
||||||
:tiff
|
|
||||||
:tif
|
|
||||||
:tk
|
|
||||||
:vml
|
|
||||||
:vmlz
|
|
||||||
:wbmp
|
|
||||||
:webp
|
|
||||||
:xlib
|
|
||||||
:x11]
|
|
||||||
:full true
|
|
||||||
:output nil}
|
|
||||||
:executor (. (require :rust-tools/executors)
|
|
||||||
:termopen)
|
|
||||||
:hover_actions {:auto_focus false
|
|
||||||
:border [["╭"
|
|
||||||
:FloatBorder]
|
|
||||||
["─"
|
|
||||||
:FloatBorder]
|
|
||||||
["╮"
|
|
||||||
:FloatBorder]
|
|
||||||
["│"
|
|
||||||
:FloatBorder]
|
|
||||||
["╯"
|
|
||||||
:FloatBorder]
|
|
||||||
["─"
|
|
||||||
:FloatBorder]
|
|
||||||
["╰"
|
|
||||||
:FloatBorder]
|
|
||||||
["│"
|
|
||||||
:FloatBorder]]}
|
|
||||||
:inlay_hints {:auto false
|
|
||||||
:highlight :NonText
|
|
||||||
:max_len_align false
|
|
||||||
:max_len_align_padding 1
|
|
||||||
:only_current_line true
|
|
||||||
:other_hints_prefix "=> "
|
|
||||||
:parameter_hints_prefix "<- "
|
|
||||||
:right_align false
|
|
||||||
:right_align_padding 7
|
|
||||||
:show_parameter_hints true}
|
|
||||||
:on_initialized (fn []
|
|
||||||
((. (require :inlay-hints)
|
|
||||||
:set_all)))
|
|
||||||
:reload_workspace_from_cargo_toml true}})
|
|
||||||
((. (require :zk) :setup) {:lsp {:auto_attach {:enable true
|
|
||||||
:filetypes [:markdown]}
|
|
||||||
:config {:cmd [:zk :lsp]
|
|
||||||
:name :zk
|
|
||||||
:on_attach on-attach}}
|
|
||||||
:picker :telescope})
|
|
||||||
((. (require :zk.commands) :add) :ZkOrphans
|
|
||||||
(fn [options]
|
|
||||||
(set-forcibly! options
|
|
||||||
(vim.tbl_extend :force
|
|
||||||
{:orphan true}
|
|
||||||
(or options
|
|
||||||
{})))
|
|
||||||
((. (require :zk) :edit) options
|
|
||||||
{:title "Zk Orphans (unlinked notes)"})))
|
|
||||||
((. (require :zk.commands) :add) :ZkGrep
|
|
||||||
(fn [match-ctor]
|
|
||||||
(var grep-str match-ctor)
|
|
||||||
(var ___match___ nil)
|
|
||||||
(if (or (= match-ctor nil) (= match-ctor ""))
|
|
||||||
(do
|
|
||||||
(vim.fn.inputsave)
|
|
||||||
(set grep-str
|
|
||||||
(vim.fn.input "Grep string: >"))
|
|
||||||
(vim.fn.inputrestore)
|
|
||||||
(set ___match___ {:match grep-str}))
|
|
||||||
(= (type match-ctor) :string)
|
|
||||||
(set ___match___ {:match grep-str}))
|
|
||||||
((. (require :zk) :edit) ___match___
|
|
||||||
{:mutli_select false
|
|
||||||
:title (.. "Grep: '"
|
|
||||||
grep-str
|
|
||||||
"'")})))
|
|
||||||
((. (require :gitsigns) :setup) {:signs {:add {:text "+"}
|
|
||||||
:change {:text "~"}
|
|
||||||
:changedelete {:text "~"}
|
|
||||||
:delete {:text "_"}
|
|
||||||
:topdelete {:text "‾"}}})
|
|
||||||
((. (require :lualine) :setup) {:inactive_sections {:lualine_a {}
|
|
||||||
:lualine_b {}
|
|
||||||
:lualine_c [{1 :filename
|
|
||||||
:file_status true
|
|
||||||
:path 1}]
|
|
||||||
:lualine_x [:location]
|
|
||||||
:lualine_y {}
|
|
||||||
:lualine_z {}}
|
|
||||||
:options {:icons_enabled true}
|
|
||||||
:sections {:lualine_a [:mode]
|
|
||||||
:lualine_b [:branch
|
|
||||||
:diff
|
|
||||||
:diagnostics]
|
|
||||||
:lualine_c [{1 :filename
|
|
||||||
:file_status true
|
|
||||||
:newfile_status false
|
|
||||||
:path 1
|
|
||||||
:symbols {:modified "[+]"
|
|
||||||
:newfile "[New]"
|
|
||||||
:readonly "[-]"
|
|
||||||
:unnamed "[Unnamed]"}}]
|
|
||||||
:lualine_x [:encoding
|
|
||||||
:fileformat
|
|
||||||
:filetype]
|
|
||||||
:lualine_y [:progress]
|
|
||||||
:lualine_z [:location]}})
|
|
||||||
((. (require :nvim-surround) :setup) {})
|
|
||||||
((. (require :tsql) :setup))
|
|
||||||
((. (require :fidget) :setup) {:align {:bottom true :right true}
|
|
||||||
:debug {:logging false :strict false}
|
|
||||||
:fmt {:fidget (fn [fidget-name spinner]
|
|
||||||
(string.format "%s %s" spinner
|
|
||||||
fidget-name))
|
|
||||||
:leftpad true
|
|
||||||
:max_width 0
|
|
||||||
:stack_upwards true
|
|
||||||
:task (fn [task-name message percentage]
|
|
||||||
(string.format "%s%s [%s]" message
|
|
||||||
(or (and percentage
|
|
||||||
(string.format " (%s%%)"
|
|
||||||
percentage))
|
|
||||||
"")
|
|
||||||
task-name))}
|
|
||||||
:sources {:* {:ignore false}}
|
|
||||||
:text {:commenced :Started
|
|
||||||
:completed :Completed
|
|
||||||
:done "✔"
|
|
||||||
:spinner :moon}
|
|
||||||
:timer {:fidget_decay 2000
|
|
||||||
:spinner_rate 125
|
|
||||||
:task_decay 1000}
|
|
||||||
:window {:blend 100
|
|
||||||
:border :none
|
|
||||||
:relative :editor
|
|
||||||
:zindex nil}})
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,6 @@
|
||||||
|
Host *
|
||||||
|
IdentityFile ~/.ssh/id_rsa
|
||||||
|
|
||||||
# felia mirror on windows
|
# felia mirror on windows
|
||||||
Host felia-win
|
Host felia-win
|
||||||
HostName felia.coati-celsius.ts.net
|
HostName felia.coati-celsius.ts.net
|
||||||
|
@ -44,99 +47,3 @@ Host mokoi
|
||||||
User ubuntu_admin
|
User ubuntu_admin
|
||||||
Port 22
|
Port 22
|
||||||
|
|
||||||
Host noami
|
|
||||||
HostName 10.100.200.230
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host sr1
|
|
||||||
HostName 10.30.76.46
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
HostKeyAlgorithms=+ssh-dss,ssh-rsa
|
|
||||||
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
|
|
||||||
|
|
||||||
Host bgp1
|
|
||||||
HostName 10.111.100.113
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
HostKeyAlgorithms=+ssh-dss,ssh-rsa
|
|
||||||
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
|
|
||||||
|
|
||||||
Host bgp2
|
|
||||||
HostName 10.111.100.114
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
HostKeyAlgorithms=+ssh-dss,ssh-rsa
|
|
||||||
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
|
|
||||||
Host d1-30
|
|
||||||
HostName 10.111.103.60
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
UserKnownHostsFile /dev/null
|
|
||||||
IdentityFile ~/.ssh/id_ed25519
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
Host d3l-3
|
|
||||||
HostName 10.111.103.65
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
UserKnownHostsFile /dev/null
|
|
||||||
IdentityFile ~/.ssh/id_ed25519
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
Host dev0
|
|
||||||
HostName 10.100.200.230
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host dev2
|
|
||||||
HostName 10.100.200.210
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host dev1
|
|
||||||
HostName 10.100.200.220
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
|
|
||||||
Host ztp-egi
|
|
||||||
HostName 10.23.27.201
|
|
||||||
User root
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host goat
|
|
||||||
HostName 10.133.32.100
|
|
||||||
User "EGN NOC"
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host portal2
|
|
||||||
HostName portal2.egihosting.com
|
|
||||||
User root
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host egn-rest-api
|
|
||||||
HostName egn-rest-api.egihosting.com
|
|
||||||
User root
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host gl-egi
|
|
||||||
HostName gitlab.egihosting.com
|
|
||||||
User git
|
|
||||||
Port 22
|
|
||||||
IdentityFile ~/.ssh/id_ed25519
|
|
||||||
|
|
||||||
Host 10.111.103.*
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
UserKnownHostsFile /dev/null
|
|
||||||
|
|
||||||
Host *
|
|
||||||
IdentityFile ~/.ssh/id_ed25519
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
[aws]
|
[aws]
|
||||||
symbol = " "
|
symbol = " "
|
||||||
|
|
||||||
[c]
|
|
||||||
disabled = false
|
|
||||||
# commands = [ [ 'cc', '--version' ], [ 'gcc', '--version' ], [ 'clang', '--version' ] ]
|
|
||||||
detect_extensions = ["c", "h", "cc", "cpp", "hh", "hpp"]
|
|
||||||
|
|
||||||
[conda]
|
[conda]
|
||||||
symbol = " "
|
symbol = " "
|
||||||
|
|
||||||
|
|
|
@ -14,19 +14,7 @@ setw -g pane-base-index 1
|
||||||
set-option -g renumber-windows on
|
set-option -g renumber-windows on
|
||||||
|
|
||||||
# status bar
|
# status bar
|
||||||
# set -g status-style 'bg=#333333 fg=#5eacd3'
|
set -g status-style 'bg=#333333 fg=#5eacd3'
|
||||||
# set -g status-interval 60
|
|
||||||
# set -g status-right-style 'bg=#333333 fg=#5eacd3'
|
|
||||||
# set -g status-right-length 50
|
|
||||||
# set -g status-left " "
|
|
||||||
|
|
||||||
# Keybinds
|
# Keybinds
|
||||||
# Enter copy mode with 'v' in vi mode
|
|
||||||
bind-key -Tcopy-mode-vi v send-keys -X begin-selection
|
|
||||||
|
|
||||||
# Copy selection with 'y' in vi mode
|
|
||||||
bind-key -Tcopy-mode-vi y send-keys -X copy-selection-and-cancel
|
|
||||||
set-window-option -g mode-keys vi
|
set-window-option -g mode-keys vi
|
||||||
|
|
||||||
# # Log
|
|
||||||
# set-option -g history-file /tmp/.tmux.log
|
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
{
|
{ config
|
||||||
config,
|
, proj_root
|
||||||
proj_root,
|
, myLib
|
||||||
myLib,
|
, ...
|
||||||
...
|
}:
|
||||||
}: let
|
let
|
||||||
inherit (myLib) fromYaml;
|
inherit (myLib) fromYaml;
|
||||||
actualConfig = fromYaml (builtins.readFile "${proj_root.config.path}//alacritty/alacritty.yml");
|
actualConfig = fromYaml (builtins.readFile "${proj_root.config.path}//alacritty/alacritty.yml");
|
||||||
cfg = config.base.alacritty;
|
cfg = config.base.alacritty;
|
||||||
in {
|
in
|
||||||
options.base.alacritty = {
|
{
|
||||||
|
options.base.alacritty =
|
||||||
|
{
|
||||||
font.family = myLib.mkOption {
|
font.family = myLib.mkOption {
|
||||||
type = myLib.types.singleLineStr;
|
type = myLib.types.singleLineStr;
|
||||||
default = actualConfig.font.normal.family;
|
default = actualConfig.font.normal.family;
|
||||||
|
@ -17,14 +19,6 @@ in {
|
||||||
'';
|
'';
|
||||||
example = "DroidSansMono NF";
|
example = "DroidSansMono NF";
|
||||||
};
|
};
|
||||||
font.size = myLib.mkOption {
|
|
||||||
type = myLib.types.number;
|
|
||||||
default = actualConfig.font.size;
|
|
||||||
description = ''
|
|
||||||
The default font size for Alacritty. This is probably measured in px.
|
|
||||||
'';
|
|
||||||
example = 7.0;
|
|
||||||
};
|
|
||||||
enable = myLib.mkOption {
|
enable = myLib.mkOption {
|
||||||
type = myLib.types.bool;
|
type = myLib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -51,7 +45,6 @@ in {
|
||||||
enable = cfg.enable;
|
enable = cfg.enable;
|
||||||
settings = myLib.recursiveUpdate actualConfig {
|
settings = myLib.recursiveUpdate actualConfig {
|
||||||
font.normal.family = cfg.font.family;
|
font.normal.family = cfg.font.family;
|
||||||
font.size = cfg.font.size;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
# This patch exists since Darwin's search bar requires solid apps and not
|
|
||||||
# symlinked
|
|
||||||
# TODO: QA
|
|
||||||
# - [x] works for base case
|
|
||||||
# - [x] works for repeated case
|
|
||||||
# - [ ] works after base case, then removed
|
|
||||||
# - [ ] works for repeated case, then removed
|
|
||||||
|
|
||||||
# Copy GUI apps to "~/Applications/Home Manager Apps"
|
|
||||||
# Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334
|
|
||||||
home.activation.patch-spotlight =
|
|
||||||
if pkgs.stdenv.isDarwin
|
|
||||||
then let
|
|
||||||
apps = pkgs.buildEnv {
|
|
||||||
name = "home-manager-applications";
|
|
||||||
paths = config.home.packages;
|
|
||||||
pathsToLink = "/Applications";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
lib.hm.dag.entryAfter ["linkGeneration"] ''
|
|
||||||
# Install MacOS applications to the user environment.
|
|
||||||
HM_APPS="$HOME/Applications/Home Manager Apps"
|
|
||||||
# Reset current state
|
|
||||||
if [ -e "$HM_APPS" ]; then
|
|
||||||
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
|
|
||||||
fi
|
|
||||||
$DRY_RUN_CMD mkdir -p "$HM_APPS"
|
|
||||||
# .app dirs need to be actual directories for Finder to detect them as Apps.
|
|
||||||
# In the env of Apps we build, the .apps are symlinks. We pass all of them as
|
|
||||||
# arguments to cp and make it dereference those using -H
|
|
||||||
$DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS"
|
|
||||||
$DRY_RUN_CMD chmod +w -R "$HM_APPS"
|
|
||||||
''
|
|
||||||
else "";
|
|
||||||
# We need this in case upstream home-manager changes the behavior of linking
|
|
||||||
# applications
|
|
||||||
home.activation.remove-patch-spotlight =
|
|
||||||
if pkgs.stdenv.isDarwin
|
|
||||||
then
|
|
||||||
lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
|
||||||
HM_APPS="$HOME/Applications/Home Manager Apps"
|
|
||||||
# Reset current state
|
|
||||||
if [ -e "$HM_APPS" ]; then
|
|
||||||
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
|
|
||||||
fi
|
|
||||||
''
|
|
||||||
else "";
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
{nix-index-database, ...} @ inputs: {
|
{
|
||||||
mkModuleArgs = import ./mkModuleArgs.nix;
|
mkModuleArgs = import ./mkModuleArgs.nix;
|
||||||
modules = [
|
modules = [
|
||||||
./alacritty.nix
|
./alacritty.nix
|
||||||
|
@ -8,6 +8,5 @@
|
||||||
{
|
{
|
||||||
config.programs.home-manager.enable = true;
|
config.programs.home-manager.enable = true;
|
||||||
}
|
}
|
||||||
nix-index-database.hmModules.nix-index
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{ config
|
||||||
config,
|
, myLib
|
||||||
myLib,
|
, ...
|
||||||
...
|
}:
|
||||||
}: let
|
let
|
||||||
cfg = config.base.git;
|
cfg = config.base.git;
|
||||||
baseAliases = {
|
baseAliases = {
|
||||||
a = "add";
|
a = "add";
|
||||||
|
@ -15,11 +15,12 @@
|
||||||
co = "checkout";
|
co = "checkout";
|
||||||
b = "branch";
|
b = "branch";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.base.git = {
|
options.base.git = {
|
||||||
aliases = myLib.mkOption {
|
aliases = myLib.mkOption {
|
||||||
type = myLib.types.attrs;
|
type = myLib.types.attrs;
|
||||||
default = {};
|
default = { };
|
||||||
example = baseAliases;
|
example = baseAliases;
|
||||||
description = ''
|
description = ''
|
||||||
Additional git aliases. This settings comes with base configuration.
|
Additional git aliases. This settings comes with base configuration.
|
||||||
|
@ -43,13 +44,12 @@ in {
|
||||||
default = [
|
default = [
|
||||||
".vscode" # vscode settings
|
".vscode" # vscode settings
|
||||||
".direnv" # .envrc cached outputs
|
".direnv" # .envrc cached outputs
|
||||||
".DS_Store" # MacOS users, amrite
|
|
||||||
];
|
];
|
||||||
description = ''
|
description = ''
|
||||||
.gitignore patterns that are applied in every repository.
|
.gitignore patterns that are applied in every repository.
|
||||||
This is useful for IDE-specific settings.
|
This is useful for IDE-specific settings.
|
||||||
'';
|
'';
|
||||||
example = [".direnv" "node_modules"];
|
example = [ ".direnv" "node_modules" ];
|
||||||
};
|
};
|
||||||
enable = myLib.mkOption {
|
enable = myLib.mkOption {
|
||||||
type = myLib.types.bool;
|
type = myLib.types.bool;
|
||||||
|
@ -66,7 +66,7 @@ in {
|
||||||
example = 3000;
|
example = 3000;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# TODO : anyway to override configuration?
|
# TODO : anyway to override configuration?
|
||||||
config.programs.git = {
|
config.programs.git = {
|
||||||
inherit (cfg) enable ignores;
|
inherit (cfg) enable ignores;
|
||||||
userName = cfg.name;
|
userName = cfg.name;
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
{
|
{ pkgs, config, lib, ... }:
|
||||||
pkgs,
|
let
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.base.graphics;
|
cfg = config.base.graphics;
|
||||||
cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != null);
|
cfgEnable = cfg.enable or cfg.useNixGLPackage != null;
|
||||||
types = lib.types;
|
types = lib.types;
|
||||||
in {
|
in
|
||||||
imports = [./shells.nix];
|
{
|
||||||
|
imports = [ ./shells.nix ];
|
||||||
options.base.graphics = {
|
options.base.graphics = {
|
||||||
enable = lib.mkEnableOption "graphics";
|
enable = lib.mkEnableOption "graphics";
|
||||||
_enable = lib.mkOption {
|
_enable = lib.mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Whether the graphics is implicitly enabled (final)";
|
description = "Whether the graphics is implicitly enabled (final)";
|
||||||
# internal = true;
|
internal = true;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
useNixGL = {
|
useNixGL = {
|
||||||
|
@ -26,24 +23,24 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
defaultPackage = lib.mkOption {
|
defaultPackage = lib.mkOption {
|
||||||
type = types.nullOr (types.enum ["nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee"]);
|
type = types.nullOr (types.enum [ "nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee" ]);
|
||||||
description = "Which nixGL package to be aliased as `nixGL` on the shell";
|
description = "Which nixGL package to be aliased as `nixGL` on the shell";
|
||||||
default = null;
|
default = null;
|
||||||
example = "nixGLIntel";
|
example = "nixGLIntel";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# NOTE: importing shells does not mean we're enabling everything, if we do mkDefault false
|
# importing shells does not mean we're enabling everything, if we do mkDefault false
|
||||||
# but the dilemma is, if the user import BOTH graphics.nix and shells.nix
|
# but the dilemma is, if the user import BOTH graphics.nix and shells.nix
|
||||||
# they will also need to do `config.base.shells.enable`
|
# they will also need to do `config.base.shells.enable`
|
||||||
# generally, we want the behavior: import means enable
|
# generally, we want the behavior: import means enable
|
||||||
config = lib.mkIf cfgEnable {
|
config = lib.mkIf cfgEnable {
|
||||||
base.graphics._enable = lib.mkForce true;
|
base.graphics._enable = cfgEnable;
|
||||||
base.shells = {
|
base.shells = {
|
||||||
shellAliases = lib.mkIf (cfg.useNixGL.defaultPackage != null) {
|
shellAliases = lib.mkIf (cfg.useNixGL.defaultPackage != null) {
|
||||||
nixGL = cfg.useNixGL.defaultPackage;
|
nixGL = cfg.useNixGL.defaultPackage;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
home.packages = [cfg.useNixGL.package];
|
home.packages = [ cfg.useNixGL.package ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
{
|
{ config, proj_root, pkgs, lib, ... }:
|
||||||
config,
|
let
|
||||||
proj_root,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.base.keepass;
|
cfg = config.base.keepass;
|
||||||
trimNull = lib.filterAttrsRecursive (name: value: value != null);
|
trimNull = lib.filterAttrsRecursive (name: value: value != null);
|
||||||
in {
|
in
|
||||||
imports = [./graphics.nix];
|
{
|
||||||
|
imports = [ ./graphics.nix ];
|
||||||
options.base.keepass = {
|
options.base.keepass = {
|
||||||
enable = lib.mkEnableOption "keepass";
|
enable = lib.mkEnableOption "keepass";
|
||||||
use_gui = lib.mkOption {
|
use_gui = lib.mkOption {
|
||||||
|
@ -46,17 +42,11 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages =
|
home.packages = [
|
||||||
[
|
|
||||||
pkgs.kpcli-py # kp but is in cli
|
pkgs.kpcli-py # kp but is in cli
|
||||||
]
|
] ++ (if cfg.use_gui or config.base.graphics._enable then [
|
||||||
++ (
|
|
||||||
if cfg.use_gui or config.base.graphics._enable
|
|
||||||
then [
|
|
||||||
pkgs.keepass # Personal secret management
|
pkgs.keepass # Personal secret management
|
||||||
]
|
] else [ ]);
|
||||||
else []
|
|
||||||
);
|
|
||||||
home.file.".kp/config.ini".text = lib.generators.toINI {} (trimNull {
|
home.file.".kp/config.ini".text = lib.generators.toINI {} (trimNull {
|
||||||
default = {
|
default = {
|
||||||
KEEPASSDB = cfg.path;
|
KEEPASSDB = cfg.path;
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
# Turns given inputs into the standardized shape of the inputs to configure
|
{ pkgs
|
||||||
# custom base modules in this directory.
|
, lib ? pkgs.lib
|
||||||
{
|
, ...
|
||||||
pkgs,
|
}@inputs:
|
||||||
lib ? pkgs.lib,
|
let
|
||||||
...
|
|
||||||
} @ inputs: let
|
|
||||||
recursiveUpdate = lib.recursiveUpdate;
|
recursiveUpdate = lib.recursiveUpdate;
|
||||||
_lib = recursiveUpdate lib (import ../../lib {inherit pkgs lib;});
|
_lib = recursiveUpdate lib (import ../../lib { inherit pkgs lib; });
|
||||||
proj_root = builtins.toString ./../../..;
|
proj_root = builtins.toString ./../../..;
|
||||||
in
|
in
|
||||||
# TODO: Unpollute inputs
|
# TODO: Unpollute inputs
|
||||||
recursiveUpdate inputs {
|
recursiveUpdate inputs {
|
||||||
proj_root = {
|
proj_root = {
|
||||||
path = proj_root;
|
path = proj_root;
|
||||||
config.path = "${proj_root}/native_configs";
|
config.path = "${proj_root}/native_configs";
|
||||||
scripts.path = "${proj_root}/scripts";
|
scripts.path = "${proj_root}/scripts";
|
||||||
};
|
};
|
||||||
myLib = _lib;
|
myLib = _lib;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,91 +1,78 @@
|
||||||
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project TODO: just install these things, then symlink to mason's bin directory
|
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore
|
||||||
|
# incremental dependencies based on the project
|
||||||
#
|
#
|
||||||
# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop`
|
# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop`
|
||||||
# might be different from `home-manager`'s (~/.nix_profile/bin/jq)
|
# might be different from `home-manager`'s
|
||||||
{
|
{ pkgs, lib, config, proj_root, ... }:
|
||||||
pkgs,
|
let
|
||||||
lib,
|
# NOTE: Failure 1: buildInputs is pretty much ignored
|
||||||
config,
|
# my_neovim = pkgs.neovim-unwrapped.overrideDerivation (old: {
|
||||||
proj_root,
|
# # TODO: is there a more beautiful way to override propagatedBuildInputs?
|
||||||
...
|
# name = "hungtr-" + old.name;
|
||||||
}: let
|
# buildInputs = (old.buildInputs or []) ++ [
|
||||||
|
# pkgs.tree-sitter # highlighting
|
||||||
|
# rust_pkgs # for potentially rust-analyzer
|
||||||
|
# pkgs.fzf
|
||||||
|
# pkgs.ripgrep
|
||||||
|
# pkgs.zk
|
||||||
|
# pkgs.fd
|
||||||
|
# ];
|
||||||
|
# NOTE: Failure 2: propagatedBuildInputs probably only concerns dyn libs
|
||||||
|
# });
|
||||||
|
# NOTE: Failure 3: must be unwrapped neovim because home-manager does the wrapping
|
||||||
|
# my_neovim = pkgs.neovim;
|
||||||
|
|
||||||
# NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace
|
# NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace
|
||||||
# and is added to the path after wrapping.
|
# and is added to the path after wrapping.
|
||||||
# check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand`
|
# check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand`
|
||||||
# see: :/--suffix.*PATH
|
# see: :/--suffix.*PATH
|
||||||
# there should be mentions of additional packages
|
# there should be mentions of additional packages
|
||||||
my_neovim = pkgs.neovim-unwrapped;
|
my_neovim = pkgs.neovim-unwrapped;
|
||||||
rust_pkgs =
|
rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith
|
||||||
pkgs.rust-bin.selectLatestNightlyWith
|
|
||||||
(
|
(
|
||||||
toolchain:
|
toolchain:
|
||||||
toolchain.default.override {
|
toolchain.default.override {
|
||||||
extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"];
|
extensions = [ "rust-src" ];
|
||||||
}
|
}
|
||||||
);
|
));
|
||||||
nvim_pkgs =
|
nvim_pkgs = [
|
||||||
[
|
|
||||||
# pkgs.gccStdenv
|
# pkgs.gccStdenv
|
||||||
|
pkgs.gcc
|
||||||
pkgs.tree-sitter
|
pkgs.tree-sitter
|
||||||
pkgs.fzf # file name fuzzy search
|
pkgs.fzf # file name fuzzy search
|
||||||
pkgs.ripgrep # content fuzzy search
|
pkgs.ripgrep # content fuzzy search
|
||||||
pkgs.zk # Zettelkasten (limited support)
|
pkgs.zk # Zettelkasten (limited support)
|
||||||
pkgs.fd # Required by a Telescope plugin (?)
|
pkgs.fd # Required by a Telescope plugin (?)
|
||||||
pkgs.stdenv.cc.cc.lib
|
pkgs.stdenv.cc.cc.lib
|
||||||
pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo
|
|
||||||
pkgs.rust4cargo
|
|
||||||
pkgs.nickel
|
|
||||||
pkgs.nls
|
|
||||||
|
|
||||||
pkgs.go # doesn't work, Mason installs from runtime path
|
|
||||||
|
|
||||||
# Language-specific stuffs
|
# Language-specific stuffs
|
||||||
pkgs.sumneko-lua-language-server
|
pkgs.sumneko-lua-language-server
|
||||||
# pkgs.python3Packages.python-lsp-server
|
|
||||||
pkgs.nodePackages.pyright
|
|
||||||
pkgs.python3Packages.pylint
|
|
||||||
pkgs.python3Packages.flake8
|
|
||||||
# FIXME: installing ansible from here just doesn't work :/
|
|
||||||
# pkgs.ansible-lint
|
|
||||||
# pkgs.python38Packages.ansible
|
|
||||||
# pkgs.ansible-language-server
|
|
||||||
# TODO: the devShell should provide rust-analyzer so that
|
# TODO: the devShell should provide rust-analyzer so that
|
||||||
# cargo test builds binaries compatible with rust-analyzer
|
# cargo test builds binaries compatible with rust-analyzer
|
||||||
|
|
||||||
# pkgs.rust-analyzer
|
# pkgs.rust-analyzer
|
||||||
# rust_pkgs
|
# rust_pkgs
|
||||||
# pkgs.evcxr # Rust REPL for Conjure!
|
# pkgs.evcxr # Rust REPL for Conjure!
|
||||||
]
|
|
||||||
++ lib.optionals (pkgs.stdenv.isDarwin) (
|
# Python3 as alternative to bash scripts :^)
|
||||||
let
|
# (pkgs.python310Full.withPackages (pypkgs: [
|
||||||
inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation;
|
# # python-lsp-server's dependencies is absolutely astronomous
|
||||||
in [
|
# # pypkgs.python-lsp-server # python-lsp. Now we'll have to tell mason to look for this
|
||||||
System
|
# pypkgs.pynvim # nvim provider
|
||||||
CoreFoundation
|
# pypkgs.ujson # pylsp seems to rely on this. satisfy it lol
|
||||||
]
|
# ]))
|
||||||
);
|
];
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.base.neovim = {
|
options.base.neovim = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
default = true;
|
default = true;
|
||||||
description = "enable personalized neovim as default editor";
|
description = "enable personalized neovim as default editor";
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
example = false;
|
example = false;
|
||||||
f = let
|
|
||||||
adder = {
|
|
||||||
__functor = self: arg:
|
|
||||||
if builtins.isInt arg
|
|
||||||
then self // {x = self.x + arg;}
|
|
||||||
else self.x;
|
|
||||||
x = 0;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
what = adder 1 2 3 {};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = lib.mkIf config.base.neovim.enable {
|
config = lib.mkIf config.base.neovim.enable {
|
||||||
# home-manager
|
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = my_neovim;
|
package = my_neovim;
|
||||||
|
@ -93,100 +80,23 @@ in {
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
withPython3 = true;
|
withPython3 = true;
|
||||||
withNodeJs = true;
|
withNodeJs = true;
|
||||||
|
# Attempt 4: Correct way to make neovim aware of packages
|
||||||
|
# homeConfigurations.config.programs.neovim takes UNWRAPPED neovim
|
||||||
|
# and wraps it.
|
||||||
|
# Ideally, we build our own neovim and add that to config.home.packages
|
||||||
|
# to share it with nixOS. But we don't really need to share
|
||||||
extraPackages = nvim_pkgs;
|
extraPackages = nvim_pkgs;
|
||||||
extraLuaConfig = builtins.readFile "${proj_root.config.path}//neovim/init.lua";
|
# only for here for archive-documentation
|
||||||
plugins = let
|
# extraPython3Packages = (pypkgs: [
|
||||||
inherit
|
# # pypkgs.python-lsp-server
|
||||||
(pkgs.vimPlugins)
|
# pypkgs.ujson
|
||||||
plenary-nvim
|
# ]);
|
||||||
nvim-treesitter
|
# I use vim-plug, so I probably don't require packaging
|
||||||
nvim-treesitter-textobjects
|
# extraConfig actually writes to init-home-manager.vim (not lua)
|
||||||
nvim-treesitter-context
|
# https://github.com/nix-community/home-manager/pull/3287
|
||||||
telescope-fzf-native-nvim
|
# extraConfig = builtins.readFile "${proj_root}/neovim/init.lua";
|
||||||
telescope-file-browser-nvim
|
|
||||||
telescope-nvim
|
|
||||||
nvim-lspconfig
|
|
||||||
gruvbox-community
|
|
||||||
neodev-nvim
|
|
||||||
cmp-nvim-lsp
|
|
||||||
cmp-path
|
|
||||||
cmp-buffer
|
|
||||||
cmp-cmdline
|
|
||||||
nvim-cmp
|
|
||||||
lspkind-nvim
|
|
||||||
nvim-autopairs
|
|
||||||
nvim-ts-autotag
|
|
||||||
guess-indent-nvim
|
|
||||||
harpoon
|
|
||||||
zk-nvim
|
|
||||||
luasnip
|
|
||||||
fidget-nvim
|
|
||||||
rust-tools-nvim
|
|
||||||
cmp_luasnip
|
|
||||||
gitsigns-nvim
|
|
||||||
indent-blankline-nvim
|
|
||||||
lualine-nvim
|
|
||||||
mason-lspconfig-nvim
|
|
||||||
mason-nvim
|
|
||||||
neogit
|
|
||||||
nlua-nvim
|
|
||||||
nvim-jqx
|
|
||||||
nvim-surround
|
|
||||||
nvim-web-devicons
|
|
||||||
playground
|
|
||||||
todo-comments-nvim
|
|
||||||
trouble-nvim
|
|
||||||
vim-dispatch
|
|
||||||
vim-dispatch-neovim
|
|
||||||
vim-fugitive
|
|
||||||
vim-jack-in
|
|
||||||
;
|
|
||||||
in [
|
|
||||||
plenary-nvim
|
|
||||||
nvim-treesitter.withAllGrammars
|
|
||||||
nvim-treesitter-textobjects
|
|
||||||
telescope-fzf-native-nvim
|
|
||||||
telescope-file-browser-nvim
|
|
||||||
telescope-nvim
|
|
||||||
nvim-lspconfig
|
|
||||||
gruvbox-community
|
|
||||||
neodev-nvim
|
|
||||||
cmp-nvim-lsp
|
|
||||||
cmp-path
|
|
||||||
cmp-buffer
|
|
||||||
cmp-cmdline
|
|
||||||
nvim-cmp
|
|
||||||
lspkind-nvim
|
|
||||||
nvim-autopairs
|
|
||||||
nvim-ts-autotag
|
|
||||||
guess-indent-nvim
|
|
||||||
harpoon
|
|
||||||
zk-nvim
|
|
||||||
luasnip
|
|
||||||
nvim-treesitter-context
|
|
||||||
fidget-nvim
|
|
||||||
rust-tools-nvim
|
|
||||||
|
|
||||||
cmp_luasnip
|
|
||||||
gitsigns-nvim
|
|
||||||
indent-blankline-nvim
|
|
||||||
lualine-nvim
|
|
||||||
mason-lspconfig-nvim
|
|
||||||
mason-nvim
|
|
||||||
neogit
|
|
||||||
nlua-nvim
|
|
||||||
nvim-jqx
|
|
||||||
nvim-surround
|
|
||||||
nvim-web-devicons
|
|
||||||
playground
|
|
||||||
todo-comments-nvim
|
|
||||||
trouble-nvim
|
|
||||||
vim-dispatch
|
|
||||||
vim-dispatch-neovim
|
|
||||||
vim-fugitive
|
|
||||||
vim-jack-in
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
# home.packages = nvim_pkgs;
|
# home.packages = nvim_pkgs;
|
||||||
|
xdg.configFile."nvim/init.lua".source = "${proj_root.config.path}//neovim/init.lua";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
# TODO: maybe throw if base.graphics is not enabled?
|
{ config, pkgs, lib, ... }:
|
||||||
# Though, headless chromium might be possible
|
let cfg = config.base.private_chromium;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.base.private_chromium;
|
|
||||||
in {
|
|
||||||
options.base.private_chromium = {
|
options.base.private_chromium = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
|
@ -18,34 +12,30 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = lib.mkIf (cfg.enable) {
|
config = lib.mkIf cfg.enable {
|
||||||
# home.packages = [pkgs.ungoogled-chromium];
|
# home.packages = [pkgs.ungoogled-chromium];
|
||||||
programs.chromium = {
|
programs.chromium = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.ungoogled-chromium;
|
package = pkgs.ungoogled-chromium;
|
||||||
extensions = let
|
extensions =
|
||||||
# TODO: how about a chrome extension registry?
|
let
|
||||||
mkChromiumExtForVersion = browserVersion: {
|
mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }:
|
||||||
id,
|
{
|
||||||
sha256,
|
|
||||||
extVersion,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
inherit id;
|
inherit id;
|
||||||
crxPath = builtins.fetchurl {
|
crxPath = builtins.fetchurl {
|
||||||
url =
|
url = "https://clients2.google.com/service/update2/crx" +
|
||||||
"https://clients2.google.com/service/update2/crx"
|
"?response=redirect" +
|
||||||
+ "?response=redirect"
|
"&acceptformat=crx2,crx3" +
|
||||||
+ "&acceptformat=crx2,crx3"
|
"&prodversion=${browserVersion}" +
|
||||||
+ "&prodversion=${browserVersion}"
|
"&x=id%3D${id}%26installsource%3Dondemand%26uc";
|
||||||
+ "&x=id%3D${id}%26installsource%3Dondemand%26uc";
|
|
||||||
name = "${id}.crx";
|
name = "${id}.crx";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
version = extVersion;
|
version = extVersion;
|
||||||
};
|
};
|
||||||
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
|
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
|
||||||
in [
|
in
|
||||||
|
[
|
||||||
# vimium
|
# vimium
|
||||||
(mkChromiumExt {
|
(mkChromiumExt {
|
||||||
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
|
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
# A module that takes care of a GUI-ful, productive desktop environment
|
inputs@{pkgs,...}: {
|
||||||
inputs @ {pkgs, ...}: {
|
|
||||||
imports = [
|
imports = [
|
||||||
# slack
|
# slack
|
||||||
({pkgs, ...}: {
|
({pkgs,...}: {
|
||||||
home.packages = [
|
home.packages = [pkgs.slack];
|
||||||
pkgs.slack
|
|
||||||
];
|
|
||||||
})
|
})
|
||||||
./private_chromium.nix
|
./private_chromium.nix
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# Configurations for shell stuffs.
|
# Configurations for shell stuffs.
|
||||||
# Should probably be decoupled even more for each feature
|
# Should probably be decoupled even more
|
||||||
|
{ config
|
||||||
|
, proj_root
|
||||||
|
, myLib
|
||||||
|
, pkgs
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let cfg = config.base.shells;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
proj_root,
|
|
||||||
myLib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.base.shells;
|
|
||||||
in {
|
|
||||||
options.base.shells = {
|
options.base.shells = {
|
||||||
enable = myLib.mkOption {
|
enable = myLib.mkOption {
|
||||||
type = myLib.types.bool;
|
type = myLib.types.bool;
|
||||||
|
@ -30,13 +30,14 @@ in {
|
||||||
shellAliases = myLib.mkOption {
|
shellAliases = myLib.mkOption {
|
||||||
type = myLib.types.attrs;
|
type = myLib.types.attrs;
|
||||||
description = "Shell command aliases";
|
description = "Shell command aliases";
|
||||||
default = {};
|
default = { };
|
||||||
example = {
|
example = {
|
||||||
nixGL = "nixGLIntel";
|
nixGL = "nixGLIntel";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = myLib.mkIf cfg.enable {
|
config = myLib.mkIf cfg.enable {
|
||||||
|
xdg.configFile."starship.toml".source = "${proj_root.config.path}//starship/starship.toml";
|
||||||
# nix: Propagates the environment with packages and vars when enter (children of)
|
# nix: Propagates the environment with packages and vars when enter (children of)
|
||||||
# a directory with shell.nix-compatible and .envrc
|
# a directory with shell.nix-compatible and .envrc
|
||||||
programs.direnv = {
|
programs.direnv = {
|
||||||
|
@ -51,37 +52,16 @@ in {
|
||||||
};
|
};
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
|
|
||||||
plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [cpu net-speed];
|
|
||||||
extraConfig = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
|
extraConfig = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
|
||||||
};
|
};
|
||||||
xdg.configFile."tmux/tmux.conf".text = myLib.mkOrder 600 ''
|
|
||||||
set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
|
|
||||||
'';
|
|
||||||
# Colored ls
|
|
||||||
programs.exa = {
|
programs.exa = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAliases = true;
|
enableAliases = true;
|
||||||
};
|
};
|
||||||
# Make the shell look beautiful
|
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
settings = let
|
|
||||||
native = builtins.fromTOML (builtins.readFile "${proj_root.config.path}/starship/starship.toml");
|
|
||||||
patch-nix = pkgs.lib.recursiveUpdate native {
|
|
||||||
# WARNING: home-manager fails on here for some reason. Likely not at the
|
|
||||||
# validation phase (type-checking), but at evaluation phaase (stringify)
|
|
||||||
# c.commands = [
|
|
||||||
# ["nix" "run" "nixpkgs#clang" "--" "--version"]
|
|
||||||
# ["nix" "run" "nixpkgs#gcc" "--" "--version"]
|
|
||||||
# ];
|
|
||||||
c.commands = "fuk";
|
|
||||||
};
|
};
|
||||||
in
|
|
||||||
patch-nix;
|
|
||||||
};
|
|
||||||
# Fuzzy finder. `fzf` for TUI, `fzf -f '<fuzzy query>'` for UNIX piping
|
|
||||||
programs.fzf.enable = true;
|
programs.fzf.enable = true;
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -92,12 +72,10 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
enableAutosuggestions = true;
|
enableAutosuggestions = true;
|
||||||
shellAliases =
|
shellAliases = {
|
||||||
{
|
|
||||||
nix-rebuild = "sudo nixos-rebuild switch";
|
nix-rebuild = "sudo nixos-rebuild switch";
|
||||||
hm-switch = "home-manager switch --flake";
|
hm-switch = "home-manager switch --flake";
|
||||||
}
|
} // (cfg.shellAliases or { });
|
||||||
// (cfg.shellAliases or {});
|
|
||||||
history = {
|
history = {
|
||||||
size = 10000;
|
size = 10000;
|
||||||
path = "${config.xdg.dataHome}/zsh/history";
|
path = "${config.xdg.dataHome}/zsh/history";
|
||||||
|
@ -111,25 +89,21 @@ in {
|
||||||
"gitignore" # `gi list` -> `gi java >>.gitignore`
|
"gitignore" # `gi list` -> `gi java >>.gitignore`
|
||||||
"ripgrep" # adds completion for `rg`
|
"ripgrep" # adds completion for `rg`
|
||||||
"rust" # compe for rustc/cargo
|
"rust" # compe for rustc/cargo
|
||||||
"poetry" # compe for poetry - Python's cargo
|
|
||||||
# "vi-mode" # edit promps with vi motions :)
|
# "vi-mode" # edit promps with vi motions :)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
# Vim mode on the terminal
|
|
||||||
|
|
||||||
# VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true;
|
# VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true;
|
||||||
# VI_MODE_SET_CURSOR = true;
|
# VI_MODE_SET_CURSOR = true;
|
||||||
# ZVM_VI_ESCAPE_BINDKEY = "";
|
# ZVM_VI_ESCAPE_BINDKEY = "";
|
||||||
ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX";
|
ZVM_READKEY_ENGINE="$ZVM_READKEY_ENGINE_NEX";
|
||||||
ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
|
ZVM_KEYTIMEOUT=0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
|
||||||
ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
|
ZVM_ESCAPE_KEYTIMEOUT=0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
|
||||||
};
|
};
|
||||||
initExtra =
|
initExtra = (cfg.shellInitExtra or "") + ''
|
||||||
(cfg.shellInitExtra or "")
|
|
||||||
+ ''
|
|
||||||
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
{ config
|
||||||
|
, proj_root
|
||||||
|
, myLib
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let cfg = config.base.ssh;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
proj_root,
|
|
||||||
myLib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.base.ssh;
|
|
||||||
in {
|
|
||||||
options.base.ssh.enable = myLib.mkOption {
|
options.base.ssh.enable = myLib.mkOption {
|
||||||
type = myLib.types.bool;
|
type = myLib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -17,6 +17,7 @@ in {
|
||||||
config.programs.ssh = {
|
config.programs.ssh = {
|
||||||
inherit (cfg) enable;
|
inherit (cfg) enable;
|
||||||
forwardAgent = true;
|
forwardAgent = true;
|
||||||
includes = ["${proj_root.config.path}/ssh/config"];
|
extraConfig = builtins.readFile "${proj_root.config.path}/ssh/config";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
# We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix
|
(import
|
||||||
(
|
|
||||||
import
|
|
||||||
(
|
(
|
||||||
let
|
# Get corresponding version of flake-compat declared in on ./flake.lock
|
||||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||||
c_ = import ./../../c_.nix;
|
fetchTarball {
|
||||||
in
|
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
c_.fetchTree lock.nodes.flake-compat.locked
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
)
|
)
|
||||||
{src = ./.;}
|
{ src = ./.; } # calls flake.nix
|
||||||
)
|
).defaultNix
|
||||||
.defaultNix
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,112 +1,71 @@
|
||||||
{
|
{
|
||||||
nixConfig = {
|
|
||||||
accept-flake-config = true;
|
|
||||||
experimental-features = "nix-command flakes";
|
|
||||||
extra-substituters = [
|
|
||||||
"https://nix-community.cachix.org"
|
|
||||||
"https://cache.nixos.org"
|
|
||||||
];
|
|
||||||
extra-trusted-public-keys = [
|
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
||||||
];
|
|
||||||
max-jobs = 12;
|
|
||||||
};
|
|
||||||
description = "simple home-manager config";
|
description = "simple home-manager config";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-latest.url = "github:nixos/nixpkgs";
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
# url = "github:pegasust/home-manager/starship-config-type";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
follows = "nixpkgs";
|
|
||||||
};
|
};
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
nixgl.url = "path:./../../out-of-tree/nixGL";
|
nixgl.url = "path:./../../out-of-tree/nixGL";
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
|
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
|
||||||
flake-compat = {
|
flake-compat = {
|
||||||
url = "path:../../out-of-tree/flake-compat";
|
url = "github:edolstra/flake-compat";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
nix-boost.url = "git+https://git.pegasust.com/pegasust/nix-boost.git";
|
|
||||||
kpcli-py = {
|
kpcli-py = {
|
||||||
url = "github:rebkwok/kpcli";
|
url = "github:rebkwok/kpcli";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
neovim-nightly-overlay = {
|
|
||||||
url = "github:nix-community/neovim-nightly-overlay?rev=88a6c749a7d126c49f3374f9f28ca452ea9419b8";
|
|
||||||
};
|
|
||||||
nix-index-database = {
|
|
||||||
url = "github:mic92/nix-index-database";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = flake_inputs @ {
|
outputs =
|
||||||
nixpkgs,
|
flake_inputs@{ nixpkgs
|
||||||
home-manager,
|
, home-manager
|
||||||
nixgl,
|
, nixgl
|
||||||
rust-overlay,
|
, rust-overlay
|
||||||
flake-utils,
|
, flake-utils
|
||||||
kpcli-py,
|
, kpcli-py
|
||||||
neovim-nightly-overlay,
|
, ...
|
||||||
nix-boost,
|
}:
|
||||||
nixpkgs-latest,
|
let
|
||||||
...
|
system = "x86_64-linux";
|
||||||
}: let
|
overlays = import ./../../overlays.nix flake_inputs;
|
||||||
# config_fn:: system -> config
|
|
||||||
cross_platform = config_fn: {
|
|
||||||
packages =
|
|
||||||
builtins.foldl'
|
|
||||||
(prev: system:
|
|
||||||
prev
|
|
||||||
// {
|
|
||||||
"${system}" = config_fn system;
|
|
||||||
})
|
|
||||||
{}
|
|
||||||
flake-utils.lib.defaultSystems;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
cross_platform (system: let
|
|
||||||
overlays = import ./overlays.nix (flake_inputs // {inherit system;});
|
|
||||||
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
|
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system overlays;
|
inherit system overlays;
|
||||||
config = {allowUnfree = true;};
|
config = { allowUnfree = true; };
|
||||||
};
|
};
|
||||||
# lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
|
# lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
|
||||||
base = import ./base flake_inputs;
|
base = import ./base;
|
||||||
inherit (base) mkModuleArgs;
|
inherit (base) mkModuleArgs;
|
||||||
|
|
||||||
nerd_font_module = {
|
kde_module = {config, pkgs, ...}: {
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
home.packages = [
|
home.packages = [
|
||||||
# list of fonts are available at https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/data/fonts/nerdfonts/shas.nix
|
(pkgs.nerdfonts.override {fonts = ["DroidSansMono"];})
|
||||||
(pkgs.nerdfonts.override {fonts = ["Hack"];})
|
|
||||||
];
|
];
|
||||||
base.alacritty.font.family = "Hack Nerd Font Mono";
|
# For some reasons, Windows es in the font name as DroidSansMono NF
|
||||||
|
# so we need to override this
|
||||||
|
base.alacritty.font.family = "DroidSansMono Nerd Font";
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
debug = {
|
debug = {
|
||||||
inherit overlays pkgs base;
|
inherit overlays pkgs base;
|
||||||
};
|
};
|
||||||
homeConfigurations = let
|
homeConfigurations =
|
||||||
x11_wsl = ''
|
let x11_wsl = ''
|
||||||
# x11 output for WSL
|
# x11 output for WSL
|
||||||
export DISPLAY=$(ip route list default | awk '{print $3}'):0
|
export DISPLAY=$(ip route list default | awk '{print $3}'):0
|
||||||
export LIBGL_ALWAYS_INDIRECT=1
|
export LIBGL_ALWAYS_INDIRECT=1
|
||||||
'';
|
'';
|
||||||
in {
|
in
|
||||||
|
rec {
|
||||||
"hungtr" = home-manager.lib.homeManagerConfiguration {
|
"hungtr" = home-manager.lib.homeManagerConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules =
|
modules = base.modules ++ [
|
||||||
base.modules
|
|
||||||
++ [
|
|
||||||
./home.nix
|
./home.nix
|
||||||
];
|
];
|
||||||
# optionally pass inarguments to module
|
# optionally pass inarguments to module
|
||||||
|
@ -122,20 +81,10 @@
|
||||||
};
|
};
|
||||||
"hungtr@bao" = home-manager.lib.homeManagerConfiguration {
|
"hungtr@bao" = home-manager.lib.homeManagerConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules =
|
modules = base.modules ++ [
|
||||||
base.modules
|
|
||||||
++ [
|
|
||||||
./home.nix
|
./home.nix
|
||||||
nerd_font_module
|
kde_module
|
||||||
./base/productive_desktop.nix
|
./base/productive_desktop.nix
|
||||||
{
|
|
||||||
# since home.nix forces us to use keepass, and base.keepass.path
|
|
||||||
# defaults to a bad value (on purpose), we should configure a
|
|
||||||
# it to be the proper path
|
|
||||||
base.keepass.path = "/perso/garden/keepass.kdbx";
|
|
||||||
base.graphics.useNixGL.defaultPackage = "nixGLNvidia";
|
|
||||||
base.graphics.useNixGL.enable = true;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
# optionally pass inarguments to module
|
# optionally pass inarguments to module
|
||||||
# we migrate this from in-place modules to allow flexibility
|
# we migrate this from in-place modules to allow flexibility
|
||||||
|
@ -148,86 +97,14 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# Personal darwin, effectively serves as the Darwin edge channel
|
|
||||||
"hungtran" = home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules =
|
|
||||||
base.modules
|
|
||||||
++ [
|
|
||||||
./home.nix
|
|
||||||
{
|
|
||||||
base.graphics.enable = false;
|
|
||||||
# don't want to deal with GL stuffs on mac yet :/
|
|
||||||
base.graphics.useNixGL.defaultPackage = null;
|
|
||||||
# NOTE: this actually does not exist
|
|
||||||
base.keepass.path = "/Users/hungtran/keepass.kdbx";
|
|
||||||
base.alacritty.font.size = 11.0;
|
|
||||||
}
|
|
||||||
nerd_font_module
|
|
||||||
./base/productive_desktop.nix
|
|
||||||
{
|
|
||||||
base.private_chromium.enable = false;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
home.packages = [
|
|
||||||
pkgs.postman
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
|
||||||
inherit pkgs;
|
|
||||||
myHome = {
|
|
||||||
username = "hungtran";
|
|
||||||
homeDirectory = "/Users/hungtran";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# Work darwin
|
|
||||||
"htran" = home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules =
|
|
||||||
base.modules
|
|
||||||
++ [
|
|
||||||
./home.nix
|
|
||||||
./base/productive_desktop.nix
|
|
||||||
./base/darwin-spotlight.nix
|
|
||||||
{
|
|
||||||
base.private_chromium.enable = false;
|
|
||||||
}
|
|
||||||
nerd_font_module
|
|
||||||
{
|
|
||||||
base.graphics.enable = false;
|
|
||||||
# don't want to deal with GL stuffs on mac yet :/
|
|
||||||
base.graphics.useNixGL.defaultPackage = null;
|
|
||||||
base.alacritty.font.size = 11.0;
|
|
||||||
base.git.name = "Hung";
|
|
||||||
base.git.email = "htran@egihosting.com";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
home.packages = [
|
|
||||||
pkgs.postman
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{base.keepass.enable = pkgs.lib.mkForce false;}
|
|
||||||
];
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
|
||||||
inherit pkgs;
|
|
||||||
myHome = {
|
|
||||||
username = "htran";
|
|
||||||
homeDirectory = "/Users/htran";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"nixos@Felia" = home-manager.lib.homeManagerConfiguration {
|
"nixos@Felia" = home-manager.lib.homeManagerConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [
|
modules = [
|
||||||
./home.nix
|
./home.nix
|
||||||
{
|
{
|
||||||
base.shells = {
|
base.shells = {
|
||||||
shellInitExtra =
|
shellInitExtra = ''
|
||||||
''
|
'' + x11_wsl;
|
||||||
''
|
|
||||||
+ x11_wsl;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -242,12 +119,27 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# NOTE: This is never actually tested. This is for Ubuntu@Felia
|
||||||
|
# "ubuntu_admin" = home-manager.lib.homeManagerConfiguration {
|
||||||
|
# inherit pkgs;
|
||||||
|
# modules = [
|
||||||
|
# ./home.nix
|
||||||
|
# ];
|
||||||
|
# extraSpecialArgs = {
|
||||||
|
# myLib = lib;
|
||||||
|
# myHome = {
|
||||||
|
# username = "ubuntu_admin";
|
||||||
|
# homeDirectory = "/home/ubuntu_admin";
|
||||||
|
# shellInitExtra = ''
|
||||||
|
# '' + x11_wsl;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
# Personal laptop
|
# Personal laptop
|
||||||
hwtr = home-manager.lib.homeManagerConfiguration {
|
hwtr = home-manager.lib.homeManagerConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules =
|
modules = base.modules ++ [
|
||||||
base.modules
|
|
||||||
++ [
|
|
||||||
./home.nix
|
./home.nix
|
||||||
./base/graphics.nix
|
./base/graphics.nix
|
||||||
{
|
{
|
||||||
|
@ -255,7 +147,6 @@
|
||||||
base.alacritty.font.family = "BitstreamVeraSansMono Nerd Font";
|
base.alacritty.font.family = "BitstreamVeraSansMono Nerd Font";
|
||||||
base.keepass.path = "/media/homelab/f/PersistentHotStorage/keepass.kdbx";
|
base.keepass.path = "/media/homelab/f/PersistentHotStorage/keepass.kdbx";
|
||||||
}
|
}
|
||||||
./base/productive_desktop.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
extraSpecialArgs = mkModuleArgs {
|
||||||
|
@ -270,5 +161,5 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"from-yaml": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1667993008,
|
||||||
|
"narHash": "sha256-X5RWyebq+j56mUGGCmZTVcJBy6Y/QgFEMHklaz+GOt0=",
|
||||||
|
"owner": "pegasust",
|
||||||
|
"repo": "fromYaml",
|
||||||
|
"rev": "23d2616051f5a781dcfe2915a526925fd9cdd08c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "pegasust",
|
||||||
|
"repo": "fromYaml",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1667811565,
|
||||||
|
"narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "667e5581d16745bcda791300ae7e2d73f49fff25",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"from-yaml": "from-yaml",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
from-yaml ={
|
||||||
|
url = "github:pegasust/fromYaml";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
outputs = {nixpkgs,from-yaml, ...}: let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = import nixpkgs {inherit system;};
|
||||||
|
lib = {
|
||||||
|
fromYaml = import "${from-yaml}/fromYaml.nix" {lib = pkgs.lib;};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
inherit nixpkgs;
|
||||||
|
inherit from-yaml;
|
||||||
|
inherit lib;
|
||||||
|
inherit pkgs;
|
||||||
|
fromYamlFn = lib.fromYaml;
|
||||||
|
yamlCmd = str: (builtins.fromJSON(pkgs.runCommand "echo ${str} | yq"));
|
||||||
|
test_0 = ''
|
||||||
|
key_bindings:
|
||||||
|
- hello:
|
||||||
|
"N"
|
||||||
|
'';
|
||||||
|
key_bind = ''
|
||||||
|
key_bindings:
|
||||||
|
- { key: N, mods: Control, action: CreateNewWindow }
|
||||||
|
# - { key: Paste, action: Paste }
|
||||||
|
# - { key: Copy, action: Copy }
|
||||||
|
#- { key: L, mods: Control, action: ClearLogNotice }
|
||||||
|
#- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" }
|
||||||
|
#- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp }
|
||||||
|
#- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown }
|
||||||
|
#- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop }
|
||||||
|
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
|
||||||
|
|
||||||
|
# Vi Mode
|
||||||
|
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
|
||||||
|
- { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode }
|
||||||
|
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
|
||||||
|
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
|
||||||
|
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
|
||||||
|
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
|
||||||
|
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
|
||||||
|
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
|
||||||
|
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }
|
||||||
|
#- { key: G, mode: Vi|~Search, action: ScrollToTop }
|
||||||
|
#- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom }
|
||||||
|
#- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp }
|
||||||
|
#- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown }
|
||||||
|
#- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp }
|
||||||
|
#- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown }
|
||||||
|
#- { key: Y, mode: Vi|~Search, action: Copy }
|
||||||
|
#- { key: Y, mode: Vi|~Search, action: ClearSelection }
|
||||||
|
#- { key: Copy, mode: Vi|~Search, action: ClearSelection }
|
||||||
|
#- { key: V, mode: Vi|~Search, action: ToggleNormalSelection }
|
||||||
|
#- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection }
|
||||||
|
#- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection }
|
||||||
|
#- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection }
|
||||||
|
#- { key: Return, mode: Vi|~Search, action: Open }
|
||||||
|
#- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor }
|
||||||
|
#- { key: K, mode: Vi|~Search, action: Up }
|
||||||
|
#- { key: J, mode: Vi|~Search, action: Down }
|
||||||
|
#- { key: H, mode: Vi|~Search, action: Left }
|
||||||
|
#- { key: L, mode: Vi|~Search, action: Right }
|
||||||
|
#- { key: Up, mode: Vi|~Search, action: Up }
|
||||||
|
#- { key: Down, mode: Vi|~Search, action: Down }
|
||||||
|
#- { key: Left, mode: Vi|~Search, action: Left }
|
||||||
|
#- { key: Right, mode: Vi|~Search, action: Right }
|
||||||
|
#- { key: Key0, mode: Vi|~Search, action: First }
|
||||||
|
#- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last }
|
||||||
|
#- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied }
|
||||||
|
#- { key: H, mods: Shift, mode: Vi|~Search, action: High }
|
||||||
|
#- { key: M, mods: Shift, mode: Vi|~Search, action: Middle }
|
||||||
|
#- { key: L, mods: Shift, mode: Vi|~Search, action: Low }
|
||||||
|
#- { key: B, mode: Vi|~Search, action: SemanticLeft }
|
||||||
|
#- { key: W, mode: Vi|~Search, action: SemanticRight }
|
||||||
|
#- { key: E, mode: Vi|~Search, action: SemanticRightEnd }
|
||||||
|
#- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft }
|
||||||
|
#- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight }
|
||||||
|
#- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd }
|
||||||
|
#- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket }
|
||||||
|
#- { key: Slash, mode: Vi|~Search, action: SearchForward }
|
||||||
|
#- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }
|
||||||
|
#- { key: N, mode: Vi|~Search, action: SearchNext }
|
||||||
|
#- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious }
|
||||||
|
|
||||||
|
# Search Mode
|
||||||
|
#- { key: Return, mode: Search|Vi, action: SearchConfirm }
|
||||||
|
#- { key: Escape, mode: Search, action: SearchCancel }
|
||||||
|
#- { key: C, mods: Control, mode: Search, action: SearchCancel }
|
||||||
|
#- { key: U, mods: Control, mode: Search, action: SearchClear }
|
||||||
|
#- { key: W, mods: Control, mode: Search, action: SearchDeleteWord }
|
||||||
|
#- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious }
|
||||||
|
#- { key: N, mods: Control, mode: Search, action: SearchHistoryNext }
|
||||||
|
#- { key: Up, mode: Search, action: SearchHistoryPrevious }
|
||||||
|
#- { key: Down, mode: Search, action: SearchHistoryNext }
|
||||||
|
#- { key: Return, mode: Search|~Vi, action: SearchFocusNext }
|
||||||
|
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
|
||||||
|
|
||||||
|
# (Windows, Linux, and BSD only)
|
||||||
|
- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
|
||||||
|
- { key: C, mods: Control|Shift, action: Copy }
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -3,20 +3,18 @@
|
||||||
# This file represents the base settings for each machine
|
# This file represents the base settings for each machine
|
||||||
# Additional configurations goes to profiles/<user>
|
# Additional configurations goes to profiles/<user>
|
||||||
# or inlined in flake.nix
|
# or inlined in flake.nix
|
||||||
{
|
{ config # Represents the realized final configuration
|
||||||
config,
|
, pkgs # This is by default just ``= import <nixpkgs>{}`
|
||||||
# Represents the realized final configuration
|
, myHome
|
||||||
pkgs,
|
, myLib
|
||||||
# This is by default just ``= import <nixpkgs>{}`
|
, option # The options we're given, this might be useful for typesafety?
|
||||||
myHome,
|
, proj_root
|
||||||
myLib,
|
, ...
|
||||||
option,
|
}:
|
||||||
# The options we're given, this might be useful for typesafety?
|
let
|
||||||
proj_root,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (myLib) fromYaml;
|
inherit (myLib) fromYaml;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./base/neovim.nix
|
./base/neovim.nix
|
||||||
./base/keepass.nix
|
./base/keepass.nix
|
||||||
|
@ -26,8 +24,7 @@ in {
|
||||||
homeDirectory = myHome.homeDirectory;
|
homeDirectory = myHome.homeDirectory;
|
||||||
stateVersion = myHome.stateVersion or "22.05";
|
stateVersion = myHome.stateVersion or "22.05";
|
||||||
};
|
};
|
||||||
home.packages = pkgs.lib.unique (
|
home.packages = pkgs.lib.unique ([
|
||||||
[
|
|
||||||
# pkgs.ncdu
|
# pkgs.ncdu
|
||||||
pkgs.rclone # cloud file operations
|
pkgs.rclone # cloud file operations
|
||||||
pkgs.htop # system diagnostics in CLI
|
pkgs.htop # system diagnostics in CLI
|
||||||
|
@ -36,9 +33,9 @@ in {
|
||||||
pkgs.zip # compression
|
pkgs.zip # compression
|
||||||
|
|
||||||
# cool utilities
|
# cool utilities
|
||||||
pkgs.yq-go # Yaml adaptor for jq (only pretty print, little query)
|
pkgs.yq # Yaml adaptor for jq (only pretty print, little query)
|
||||||
# pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation
|
pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation
|
||||||
# pkgs.logseq # TODO: only include if have GL # Obsidian alt
|
pkgs.logseq # TODO: only include if have GL # Obsidian alt
|
||||||
pkgs.mosh # Parsec for SSH
|
pkgs.mosh # Parsec for SSH
|
||||||
# pkgs.nixops_unstable # nixops v2 # insecure for now
|
# pkgs.nixops_unstable # nixops v2 # insecure for now
|
||||||
pkgs.lynx # Web browser at your local terminal
|
pkgs.lynx # Web browser at your local terminal
|
||||||
|
@ -49,15 +46,7 @@ in {
|
||||||
# pkgs.python310.numpy
|
# pkgs.python310.numpy
|
||||||
# pkgs.python310Packages.tensorflow
|
# pkgs.python310Packages.tensorflow
|
||||||
# pkgs.python310Packages.scikit-learn
|
# pkgs.python310Packages.scikit-learn
|
||||||
]
|
] ++ (myHome.packages or [ ])
|
||||||
++ (myHome.packages or [])
|
|
||||||
++ (
|
|
||||||
if pkgs.system == "x86_64-linux"
|
|
||||||
then [
|
|
||||||
pkgs.logseq
|
|
||||||
]
|
|
||||||
else []
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
## Configs ##
|
## Configs ##
|
||||||
|
@ -67,6 +56,9 @@ in {
|
||||||
programs.jq = {
|
programs.jq = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
# not exist in home-manager
|
||||||
|
# have to do it at system level
|
||||||
|
# services.ntp.enable = true; # automatic time
|
||||||
programs.nix-index = {
|
programs.nix-index = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
accept-flake-config = true
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
post-build-hook = /etc/nix/upload-to-cache.sh
|
|
||||||
trusted-users = root htran hungtran hwtr
|
|
||||||
max-jobs = 8
|
|
||||||
cores = 12
|
|
|
@ -1,5 +1,3 @@
|
||||||
accept-flake-config = true
|
accept-flake-config = true
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
post-build-hook = /etc/nix/upload-to-cache.sh
|
|
||||||
trusted-users = root htran hungtran hwtr
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
accept-flake-config = true
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
post-build-hook = /etc/nix/upload-to-cache.sh
|
|
||||||
trusted-users = root htran hungtran hwtr
|
|
|
@ -1,71 +0,0 @@
|
||||||
flake_input @ {
|
|
||||||
kpcli-py,
|
|
||||||
nixgl,
|
|
||||||
rust-overlay,
|
|
||||||
neovim-nightly-overlay,
|
|
||||||
system,
|
|
||||||
nix-boost,
|
|
||||||
nixpkgs-latest,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
kpcli-py = final: prev: {
|
|
||||||
# use python3.9, which works because of cython somehow?
|
|
||||||
kpcli-py = final.poetry2nix.mkPoetryApplication {
|
|
||||||
projectDir = flake_input.kpcli-py;
|
|
||||||
overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: {
|
|
||||||
# tableformatter requires setuptools
|
|
||||||
tableformatter = super.tableformatter.overridePythonAttrs (
|
|
||||||
old: {
|
|
||||||
buildInputs = (old.buildInputs or []) ++ [self.setuptools self.cython_3];
|
|
||||||
src = old.src;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
kpcli = super.kpcli.overridePythonAttrs (old: {
|
|
||||||
buildInputs = (old.buildInputs or []) ++ [self.setuptools];
|
|
||||||
});
|
|
||||||
|
|
||||||
# ubersmith = super.ubersmith.overridePythonAttrs (old: {
|
|
||||||
# buildInputs = builtins.filter (x: ! builtins.elem x [ ]) ((old.buildInputs or [ ]) ++ [
|
|
||||||
# py-final.setuptools
|
|
||||||
# py-final.pip
|
|
||||||
# ]);
|
|
||||||
#
|
|
||||||
# src = final.fetchFromGitHub {
|
|
||||||
# owner = "jasonkeene";
|
|
||||||
# repo = "python-ubersmith";
|
|
||||||
# rev = "0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a";
|
|
||||||
# sha256 = "sha256-Dystt7CBtjpLkgzCsAif8WkkYYeLyh7VMehAtwoDGuM=";
|
|
||||||
# };
|
|
||||||
# });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
rust = final: prev: let
|
|
||||||
nightlyRustWithExts = exts:
|
|
||||||
final.rust-bin.selectLatestNightlyWith (
|
|
||||||
toolchain: (toolchain.minimal.override {
|
|
||||||
extensions = exts;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
# https://rust-lang.github.io/rustup/concepts/profiles.html
|
|
||||||
rust-default-components = ["rust-docs" "rustfmt" "clippy"];
|
|
||||||
rust-dev-components = rust-default-components ++ ["rust-src" "rust-analyzer" "miri"];
|
|
||||||
in {
|
|
||||||
rust4devs = nightlyRustWithExts rust-dev-components;
|
|
||||||
rust4cargo = nightlyRustWithExts [];
|
|
||||||
rust4normi = nightlyRustWithExts rust-default-components;
|
|
||||||
};
|
|
||||||
|
|
||||||
vimPlugins = final: prev: {
|
|
||||||
inherit (nixpkgs-latest.legacyPackages.${system}) vimPlugins;
|
|
||||||
};
|
|
||||||
in [
|
|
||||||
nix-boost.overlays.default
|
|
||||||
nixgl.overlays.default
|
|
||||||
rust-overlay.overlays.default
|
|
||||||
neovim-nightly-overlay.overlay
|
|
||||||
rust
|
|
||||||
kpcli-py
|
|
||||||
vimPlugins
|
|
||||||
]
|
|
|
@ -1,8 +1,5 @@
|
||||||
# main module exporter for different configuration profiles
|
# main module exporter for different configuration profiles
|
||||||
|
{pkgs, libs,...} @ inputs:
|
||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
libs,
|
|
||||||
...
|
|
||||||
} @ inputs: {
|
|
||||||
hwtr = import ./hwtr.nix;
|
hwtr = import ./hwtr.nix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
{
|
{ pkgs
|
||||||
pkgs,
|
, lib ? pkgs.lib
|
||||||
lib ? pkgs.lib,
|
, ... }@flake_import:
|
||||||
...
|
let serde = import ./serde { inherit pkgs lib; };
|
||||||
} @ flake_import: let
|
|
||||||
serde = import ./serde {inherit pkgs lib;};
|
|
||||||
recursiveUpdate = lib.recursiveUpdate;
|
recursiveUpdate = lib.recursiveUpdate;
|
||||||
in
|
in
|
||||||
recursiveUpdate (recursiveUpdate pkgs.lib lib) {
|
recursiveUpdate (recursiveUpdate pkgs.lib lib) {
|
||||||
fromYaml = serde.fromYaml;
|
fromYaml = serde.fromYaml;
|
||||||
fromYamlPath = serde.fromYamlPath;
|
fromYamlPath = serde.fromYamlPath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,28 @@
|
||||||
# Takes care of serializing and deserializing to some formats
|
# Takes care of serializing and deserializing to some formats
|
||||||
# Blame: Pegasust<pegasucksgg@gmail.com>
|
# Blame: Pegasust<pegasucksgg@gmail.com>
|
||||||
# TODO: Add to* formats from pkgs.formats.*
|
# TODO: Add to* formats from pkgs.formats.*
|
||||||
{
|
{ pkgs
|
||||||
pkgs,
|
, lib
|
||||||
lib,
|
} @ inputs:
|
||||||
} @ inputs: let
|
let
|
||||||
yamlToJsonDrv = yamlContent: outputPath:
|
yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage
|
||||||
pkgs.callPackage
|
({ runCommand }:
|
||||||
({runCommand}:
|
|
||||||
# runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33
|
# runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33
|
||||||
runCommand outputPath
|
runCommand outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; }
|
||||||
{
|
|
||||||
inherit yamlContent;
|
|
||||||
nativeBuildInputs = [pkgs.yq];
|
|
||||||
}
|
|
||||||
# run yq which outputs '.' (no filter) on file at yamlPath
|
# run yq which outputs '.' (no filter) on file at yamlPath
|
||||||
# note that $out is passed onto the bash/sh script for execution
|
# note that $out is passed onto the bash/sh script for execution
|
||||||
''
|
''
|
||||||
echo "$yamlContent" | yq >$out
|
echo "$yamlContent" | yq >$out
|
||||||
'')
|
'')
|
||||||
{};
|
{ };
|
||||||
in {
|
in {
|
||||||
# Takes in a yaml string and produces a derivation with translated JSON at $outputPath
|
# Takes in a yaml string and produces a derivation with translated JSON at $outputPath
|
||||||
# similar to builtins.fromJSON, turns a YAML string to nix attrset
|
# similar to builtins.fromJSON, turns a YAML string to nix attrset
|
||||||
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
|
fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json"));
|
||||||
fromYamlPath = yamlPath:
|
fromYamlPath = yamlPath: builtins.fromJSON (
|
||||||
builtins.fromJSON (
|
|
||||||
builtins.readFile (
|
builtins.readFile (
|
||||||
yamlToJsonDrv
|
yamlToJsonDrv (
|
||||||
(
|
builtins.readFile yamlPath)
|
||||||
builtins.readFile yamlPath
|
"any-output.json"));
|
||||||
)
|
# TODO: fromToml?
|
||||||
"any-output.json"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
fromTOML = builtins.fromTOML;
|
|
||||||
fromJSON = builtins.fromJSON;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
# This module aims to be merge (not inject/override) with top-level pkgs to provide
|
# This module aims to be merge (not inject/override) with top-level pkgs to provide
|
||||||
# personalized/custom packages
|
# personalized/custom packages
|
||||||
{
|
{ pkgs
|
||||||
pkgs,
|
, lib
|
||||||
lib,
|
, naersk # rust packages
|
||||||
naersk,
|
, ...
|
||||||
# rust packages
|
}@pkgs_input: {
|
||||||
...
|
|
||||||
} @ pkgs_input: {
|
|
||||||
# dot-hwtr = import "./dot-hwtr" pkgs_input;
|
# dot-hwtr = import "./dot-hwtr" pkgs_input;
|
||||||
cargo-bacon = pkgs.rustPlatform.buildRustPackage rec {
|
cargo-bacon = pkgs.rustPlatform.buildRustPackage rec {
|
||||||
pname = "bacon";
|
pname = "bacon";
|
||||||
|
|
|
@ -4,12 +4,10 @@
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
naersk.url = "gihub:nix-community/naersk";
|
naersk.url = "gihub:nix-community/naersk";
|
||||||
};
|
};
|
||||||
outputs = {
|
outputs = { nixpkgs, rust-overlay, naersk }:
|
||||||
nixpkgs,
|
let
|
||||||
rust-overlay,
|
pkgs = import nixpkgs { overlays = [ rust-overlay.overlays.default ]; };
|
||||||
naersk,
|
|
||||||
}: let
|
|
||||||
pkgs = import nixpkgs {overlays = [rust-overlay.overlays.default];};
|
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
in (import ./default.nix {inherit pkgs lib naersk;});
|
in
|
||||||
|
(import ./default.nix { inherit pkgs lib naersk; });
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ let
|
||||||
# stands for calculus
|
# stands for calculus
|
||||||
c_ = builtins;
|
c_ = builtins;
|
||||||
in {
|
in {
|
||||||
"system/secrets/s3fs.age".publicKeys = c_.attrValues all;
|
"system/secrets/s3fs.age".publicKeys = c_.attrValues (all);
|
||||||
"system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues all;
|
"system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all);
|
||||||
"system/secrets/_nhitrl.age".publicKeys = c_.attrValues all;
|
"system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,19 @@
|
||||||
{
|
{ lib, pkgs, config, modulesPath, specialArgs, ... }:
|
||||||
lib,
|
let
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
modulesPath,
|
|
||||||
specialArgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
hostname = specialArgs.hostname;
|
hostname = specialArgs.hostname;
|
||||||
enableSSH = specialArgs.enableSSH or true;
|
enableSSH = specialArgs.enableSSH or true;
|
||||||
_networking = lib.recursiveUpdate {hostName = hostname;} (specialArgs._networking or {});
|
_networking = lib.recursiveUpdate { hostName = hostname; } (specialArgs._networking or { });
|
||||||
_boot = specialArgs._boot or {};
|
_boot = specialArgs._boot or { };
|
||||||
_services = specialArgs._services or {};
|
_services = specialArgs._services or { };
|
||||||
includeHardware = specialArgs.includeHardware or true;
|
includeHardware = specialArgs.includeHardware or true;
|
||||||
proj_root = builtins.toString ./../..;
|
proj_root = builtins.toString ./../..;
|
||||||
in
|
in
|
||||||
with lib; {
|
with lib;
|
||||||
imports =
|
{
|
||||||
(
|
imports = (if includeHardware then [
|
||||||
if includeHardware
|
./profiles/${hostname}/hardware-configuration.nix
|
||||||
then [
|
] else [ ]) ++ [
|
||||||
"${proj_root}/hosts/${hostname}/hardware-configuration.nix"
|
|
||||||
]
|
|
||||||
else []
|
|
||||||
)
|
|
||||||
++ [
|
|
||||||
"${modulesPath}/profiles/minimal.nix"
|
"${modulesPath}/profiles/minimal.nix"
|
||||||
"${proj_root}/modules/tailscale.sys.nix"
|
|
||||||
"${proj_root}/modules/mosh.sys.nix"
|
|
||||||
];
|
];
|
||||||
boot = _boot;
|
boot = _boot;
|
||||||
|
|
||||||
|
@ -42,7 +29,7 @@ in
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
home = "/home/hungtr";
|
home = "/home/hungtr";
|
||||||
description = "pegasust/hungtr";
|
description = "pegasust/hungtr";
|
||||||
extraGroups = ["wheel" "networkmanager" "audio"];
|
extraGroups = [ "wheel" "networkmanager" "audio"];
|
||||||
};
|
};
|
||||||
users.users.root = {
|
users.users.root = {
|
||||||
# openssh runs in root, no? This is because port < 1024 requires root.
|
# openssh runs in root, no? This is because port < 1024 requires root.
|
||||||
|
@ -67,5 +54,67 @@ in
|
||||||
pkgs.inetutils # network diag
|
pkgs.inetutils # network diag
|
||||||
pkgs.mtr # network diag
|
pkgs.mtr # network diag
|
||||||
pkgs.sysstat # sys diag
|
pkgs.sysstat # sys diag
|
||||||
|
pkgs.mosh # ssh-alt; parsec-like
|
||||||
|
pkgs.tailscale # VPC
|
||||||
];
|
];
|
||||||
}
|
# tailscale is mandatory : ^)
|
||||||
|
# inherit services;
|
||||||
|
services = lib.recursiveUpdate _services {
|
||||||
|
tailscale.enable = true;
|
||||||
|
ntp.enable = true;
|
||||||
|
};
|
||||||
|
# create a oneshot job to authenticate to Tailscale
|
||||||
|
systemd.services.tailscale-autoconnect = {
|
||||||
|
description = "Automatic connection to Tailscale";
|
||||||
|
|
||||||
|
# make sure tailscale is running before trying to connect to tailscale
|
||||||
|
after = [ "network-pre.target" "tailscale.service" ];
|
||||||
|
wants = [ "network-pre.target" "tailscale.service" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
# set this service as a oneshot job
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
|
||||||
|
# have the job run this shell script
|
||||||
|
script = ''
|
||||||
|
# wait for tailscaled to settle
|
||||||
|
sleep 2
|
||||||
|
# check if we are already authenticated to tailscale
|
||||||
|
status="$(${pkgs.tailscale}/bin/tailscale status -json | ${pkgs.jq}/bin/jq -r .BackendState)"
|
||||||
|
if [ $status = "Running" ]; then # if so, then do nothing
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ${pkgs.tailscale}/bin/tailscale up # blocks, doesn't give url
|
||||||
|
# This time, configure device auth so that we authenticate from portal
|
||||||
|
# https://tailscale.com/kb/1099/device-authorization/#enable-device-authorization-for-your-network
|
||||||
|
${pkgs.tailscale}/bin/tailscale up -authkey tskey-auth-kJcgTG5CNTRL-PUVFkk31z1bThHpfq3FC5b1jcMmkW2EYW
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# Don't touch networking.firewall.enable, just configure everything else.
|
||||||
|
# inherit networking;
|
||||||
|
# inherit _networking;
|
||||||
|
networking = lib.recursiveUpdate _networking {
|
||||||
|
firewall =
|
||||||
|
if _networking ? firewall.enable && _networking.firewall.enable then {
|
||||||
|
trustedInterfaces = _networking.firewall.trustedInterfaces or [ ] ++ [
|
||||||
|
"tailscale0"
|
||||||
|
];
|
||||||
|
allowedUDPPorts = _networking.firewall.allowedUDPPorts or [ ] ++ [
|
||||||
|
config.services.tailscale.port
|
||||||
|
];
|
||||||
|
allowedTCPPorts = _networking.firewall.allowedTCPPorts or [ ] ++ [
|
||||||
|
22
|
||||||
|
];
|
||||||
|
allowedUDPPortRanges = _networking.firewall.allowedUDPPortRanges or [ ] ++ [
|
||||||
|
{ from = 60000; to = 61000; } # mosh
|
||||||
|
|
||||||
|
];
|
||||||
|
checkReversePath = "loose";
|
||||||
|
} else { enable = false; };
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.noXlibs = lib.mkForce false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,8 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = { self, nixpkgs, agenix, ... }:
|
||||||
self,
|
let
|
||||||
nixpkgs,
|
|
||||||
agenix,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
proj_root = ./../..;
|
proj_root = ./../..;
|
||||||
# TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- `
|
# TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- `
|
||||||
|
@ -20,16 +16,16 @@
|
||||||
agenix.nixosModule
|
agenix.nixosModule
|
||||||
{
|
{
|
||||||
age.secrets.s3fs = {
|
age.secrets.s3fs = {
|
||||||
file = ../../secrets/s3fs.age;
|
file = ./secrets/s3fs.age;
|
||||||
# mode = "600"; # owner + group only
|
# mode = "600"; # owner + group only
|
||||||
# owner = "hungtr";
|
# owner = "hungtr";
|
||||||
# group = "users";
|
# group = "users";
|
||||||
};
|
};
|
||||||
age.secrets."s3fs.digital-garden" = {
|
age.secrets."s3fs.digital-garden" = {
|
||||||
file = ../../secrets/s3fs.digital-garden.age;
|
file = ./secrets/s3fs.digital-garden.age;
|
||||||
};
|
};
|
||||||
age.secrets._nhitrl_cred = {
|
age.secrets._nhitrl_cred = {
|
||||||
file = ../../secrets/_nhitrl.age;
|
file = ./secrets/_nhitrl.age;
|
||||||
};
|
};
|
||||||
environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
|
environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
|
||||||
}
|
}
|
||||||
|
@ -38,9 +34,7 @@
|
||||||
# Windows with NixOS WSL
|
# Windows with NixOS WSL
|
||||||
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules =
|
modules = base_modules ++ [
|
||||||
base_modules
|
|
||||||
++ [
|
|
||||||
./wsl-configuration.nix
|
./wsl-configuration.nix
|
||||||
{
|
{
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "22.05";
|
||||||
|
@ -57,27 +51,22 @@
|
||||||
};
|
};
|
||||||
nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules =
|
modules = base_modules ++ [
|
||||||
base_modules
|
|
||||||
++ [
|
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
{
|
{
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "22.05";
|
||||||
mod.tailscale.enable = true;
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
hostname = "lizzi";
|
hostname = "lizzi";
|
||||||
_networking = {
|
_networking = {
|
||||||
interfaces.eth1.ipv4.addresses = [
|
interfaces.eth1.ipv4.addresses = [{
|
||||||
{
|
|
||||||
address = "71.0.0.1";
|
address = "71.0.0.1";
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
firewall = {
|
firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [80 443 22];
|
allowedTCPPorts = [ 80 443 22 ];
|
||||||
};
|
};
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
# required so that we get IP address from linode
|
# required so that we get IP address from linode
|
||||||
|
@ -121,9 +110,7 @@
|
||||||
# Generic machine
|
# Generic machine
|
||||||
nixosConfigurations.pixi = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.pixi = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules =
|
modules = base_modules ++ [
|
||||||
base_modules
|
|
||||||
++ [
|
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
{
|
{
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "22.05";
|
||||||
|
@ -138,7 +125,7 @@
|
||||||
# }];
|
# }];
|
||||||
firewall = {
|
firewall = {
|
||||||
enable = false;
|
enable = false;
|
||||||
allowedTCPPorts = [80 443 22];
|
allowedTCPPorts = [ 80 443 22 ];
|
||||||
};
|
};
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
# interfaces.eth0.useDHCP = true;
|
# interfaces.eth0.useDHCP = true;
|
||||||
|
@ -179,9 +166,7 @@
|
||||||
};
|
};
|
||||||
nixosConfigurations.nyx = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.nyx = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules =
|
modules = base_modules ++ [
|
||||||
base_modules
|
|
||||||
++ [
|
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
{
|
{
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "22.05";
|
||||||
|
@ -191,12 +176,10 @@
|
||||||
hostname = "nyx";
|
hostname = "nyx";
|
||||||
_networking = {
|
_networking = {
|
||||||
enableIPv6 = false;
|
enableIPv6 = false;
|
||||||
interfaces.eth1.ipv4.addresses = [
|
interfaces.eth1.ipv4.addresses = [{
|
||||||
{
|
|
||||||
address = "71.0.0.2";
|
address = "71.0.0.2";
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
firewall.enable = true;
|
firewall.enable = true;
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
interfaces.eth0.useDHCP = true;
|
interfaces.eth0.useDHCP = true;
|
||||||
|
@ -211,9 +194,7 @@
|
||||||
};
|
};
|
||||||
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules =
|
modules = base_modules ++ [
|
||||||
base_modules
|
|
||||||
++ [
|
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
{
|
{
|
||||||
system.stateVersion = "22.05";
|
system.stateVersion = "22.05";
|
||||||
|
@ -223,62 +204,45 @@
|
||||||
hostname = "nixos";
|
hostname = "nixos";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
nixosConfigurations.htran-dev = nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
modules =
|
|
||||||
base_modules
|
|
||||||
++ [
|
|
||||||
./configuration.nix
|
|
||||||
{
|
|
||||||
system.stateVersion = "22.11";
|
|
||||||
mod.tailscale.enable = false;
|
|
||||||
networking.defaultGateway = {
|
|
||||||
address = "10.100.200.1";
|
|
||||||
# interface = "ens32";
|
|
||||||
};
|
|
||||||
networking.interfaces.ens32.ipv4.addresses = [
|
|
||||||
{
|
|
||||||
address = "10.100.200.230";
|
|
||||||
prefixLength = 24;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
specialArgs = {
|
|
||||||
hostname = "htran-dev";
|
|
||||||
_networking = {
|
|
||||||
firewall.enable = true;
|
|
||||||
useDHCP = false;
|
|
||||||
interfaces.eth0.useDHCP = true;
|
|
||||||
};
|
|
||||||
_boot.loader.grub.enable = true;
|
|
||||||
_boot.loader.grub.version = 2;
|
|
||||||
_services.openssh = {
|
|
||||||
permitRootLogin = "no";
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nixosConfigurations.bao = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.bao = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs.hostname = "bao";
|
specialArgs.hostname = "bao";
|
||||||
modules =
|
modules = base_modules ++ [
|
||||||
base_modules
|
|
||||||
++ [
|
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
./../../modules/storage.perso.sys.nix
|
./../../modules/storage.perso.sys.nix
|
||||||
./../../modules/kde.sys.nix
|
|
||||||
# GPU, sound, networking stuffs
|
# GPU, sound, networking stuffs
|
||||||
./../../modules/pulseaudio.sys.nix
|
({ config, pkgs, lib, ... }:
|
||||||
./../../modules/opengl.sys.nix
|
let
|
||||||
./../../modules/nvgpu.sys.nix
|
gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ];
|
||||||
({
|
gpu_conf = {
|
||||||
config,
|
# openCL
|
||||||
pkgs,
|
hardware.opengl = {
|
||||||
lib,
|
enable = true;
|
||||||
...
|
extraPackages = let
|
||||||
}: {
|
inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime;
|
||||||
mod.tailscale.enable = true;
|
in [rocm-opencl-icd rocm-opencl-runtime];
|
||||||
|
# Vulkan
|
||||||
|
driSupport = true;
|
||||||
|
driSupport32Bit = true;
|
||||||
|
package = pkgs.mesa.drivers;
|
||||||
|
package32 = pkgs.pkgsi686Linux.mesa.drivers;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
amd_rx470 = {
|
||||||
|
# early amd gpu usage
|
||||||
|
boot.initrd.kernelModules = ["amdgpu"];
|
||||||
|
services.xserver.enable = true;
|
||||||
|
services.xserver.videoDrivers = ["amdgpu"];
|
||||||
|
};
|
||||||
|
nv_rtx3060 = {
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
services.xserver.enable = true;
|
||||||
|
services.xserver.videoDrivers = ["nvidia"];
|
||||||
|
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
};
|
||||||
|
systemPackages = [] ++ gpu_pkgs;
|
||||||
|
in
|
||||||
|
lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 {
|
||||||
# Use UEFI
|
# Use UEFI
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
|
@ -287,6 +251,26 @@
|
||||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||||
|
|
||||||
|
# Enable the X11 windowing system.
|
||||||
|
services.xserver.enable = true;
|
||||||
|
# KDE & Plasma 5
|
||||||
|
services.xserver.displayManager.sddm.enable = true;
|
||||||
|
services.xserver.desktopManager.plasma5 = {
|
||||||
|
enable = true;
|
||||||
|
excludePackages = let plasma5 = pkgs.libsForQt5; in [
|
||||||
|
plasma5.elisa # audio viewer
|
||||||
|
plasma5.konsole # I use alacritty instaed
|
||||||
|
plasma5.plasma-browser-integration
|
||||||
|
plasma5.print-manager # will enable if I need
|
||||||
|
plasma5.khelpcenter # why not just write manpages instead :(
|
||||||
|
# plasma5.ksshaskpass # pls just put prompts on my dear terminal
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# disables KDE's setting of askpassword
|
||||||
|
programs.ssh.askPassword = "";
|
||||||
|
programs.ssh.enableAskPassword = false;
|
||||||
|
|
||||||
time.timeZone = "America/Phoenix";
|
time.timeZone = "America/Phoenix";
|
||||||
# Configure keymap in X11
|
# Configure keymap in X11
|
||||||
services.xserver.layout = "us";
|
services.xserver.layout = "us";
|
||||||
|
@ -298,15 +282,55 @@
|
||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
# services.printing.enable = true;
|
# services.printing.enable = true;
|
||||||
|
|
||||||
|
# Enable sound. (pulse audio)
|
||||||
|
sound.enable = true;
|
||||||
|
programs.dconf.enable = true;
|
||||||
|
hardware.pulseaudio.enable = true;
|
||||||
|
hardware.pulseaudio.support32Bit = true;
|
||||||
|
nixpkgs.config.pulseaudio = true;
|
||||||
|
hardware.pulseaudio.extraConfig = "load-module module-combine-sink";
|
||||||
|
|
||||||
|
# Sound: pipewire
|
||||||
|
# sound.enable = false;
|
||||||
|
# hardware.pulseaudio.enable = false;
|
||||||
|
# services.pipewire = {
|
||||||
|
# enable = true;
|
||||||
|
# alsa.enable = true;
|
||||||
|
# alsa.support32Bit = true;
|
||||||
|
# pulse.enable = true;
|
||||||
|
# # Might want to use JACK in the future
|
||||||
|
# jack.enable = true;
|
||||||
|
# };
|
||||||
|
#
|
||||||
|
# security.rtkit.enable = true;
|
||||||
|
|
||||||
|
|
||||||
# Enable touchpad support (enabled default in most desktopManager).
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
# services.xserver.libinput.enable = true;
|
# services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
|
# users.users.alice = {
|
||||||
|
# isNormalUser = true;
|
||||||
|
# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||||
|
# packages = with pkgs; [
|
||||||
|
# firefox
|
||||||
|
# thunderbird
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
# Just an initial user to get this started lol
|
# Just an initial user to get this started lol
|
||||||
users.users.user = {
|
users.users.user = {
|
||||||
initialPassword = "pw123";
|
initialPassword = "pw123";
|
||||||
extraGroups = ["wheel" "networkmanager" "audio"];
|
extraGroups = [ "wheel" "networkmanager" "audio"];
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# List packages installed in system profile. To search, run:
|
||||||
|
# $ nix search wget
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
neovim
|
||||||
|
wget
|
||||||
|
] ++ systemPackages;
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
# Some programs need SUID wrappers, can be configured further or are
|
||||||
# started in user sessions.
|
# started in user sessions.
|
||||||
# programs.mtr.enable = true;
|
# programs.mtr.enable = true;
|
||||||
|
@ -320,6 +344,17 @@
|
||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
|
# accidentally delete configuration.nix.
|
||||||
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
# This value determines the NixOS release from which the default
|
||||||
# settings for stateful data, like file locations and database versions
|
# settings for stateful data, like file locations and database versions
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
@ -327,7 +362,7 @@
|
||||||
# Before changing this value read the documentation for this option
|
# Before changing this value read the documentation for this option
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
system.stateVersion = "22.11"; # Did you read the comment?
|
system.stateVersion = "22.11"; # Did you read the comment?
|
||||||
})
|
}))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
||||||
terminal_input serial;
|
terminal_input serial;
|
||||||
|
@ -23,15 +19,17 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
device = "/dev/sda";
|
{ device = "/dev/sda";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[ { device = "/dev/sdb"; }
|
||||||
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -10,5 +10,4 @@
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
src = ./.;
|
src = ./.;
|
||||||
})
|
}).defaultNix
|
||||||
.defaultNix
|
|
||||||
|
|
|
@ -11,13 +11,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||||
self,
|
|
||||||
nixpkgs,
|
|
||||||
flake-utils,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
|
|
||||||
nixosModules.wsl = {
|
nixosModules.wsl = {
|
||||||
imports = [
|
imports = [
|
||||||
./modules/build-tarball.nix
|
./modules/build-tarball.nix
|
||||||
|
@ -35,24 +31,25 @@
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
|
||||||
// flake-utils.lib.eachSystem
|
} //
|
||||||
(with flake-utils.lib.system; ["x86_64-linux" "aarch64-linux"])
|
flake-utils.lib.eachSystem
|
||||||
(
|
(with flake-utils.lib.system; [ "x86_64-linux" "aarch64-linux" ])
|
||||||
system: let
|
(system:
|
||||||
pkgs = import nixpkgs {inherit system;};
|
let
|
||||||
in {
|
pkgs = import nixpkgs { inherit system; };
|
||||||
checks.check-format =
|
in
|
||||||
pkgs.runCommand "check-format"
|
|
||||||
{
|
{
|
||||||
buildInputs = with pkgs; [nixpkgs-fmt];
|
checks.check-format = pkgs.runCommand "check-format"
|
||||||
|
{
|
||||||
|
buildInputs = with pkgs; [ nixpkgs-fmt ];
|
||||||
} ''
|
} ''
|
||||||
nixpkgs-fmt --check ${./.}
|
nixpkgs-fmt --check ${./.}
|
||||||
mkdir $out # success
|
mkdir $out # success
|
||||||
'';
|
'';
|
||||||
|
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [nixpkgs-fmt];
|
nativeBuildInputs = with pkgs; [ nixpkgs-fmt ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,24 +1,12 @@
|
||||||
{
|
{ config, pkgs, lib, ... }:
|
||||||
config,
|
with builtins; with lib;
|
||||||
pkgs,
|
let
|
||||||
lib,
|
pkgs2storeContents = l: map (x: { object = x; symlink = "none"; }) l;
|
||||||
...
|
|
||||||
}:
|
|
||||||
with builtins;
|
|
||||||
with lib; let
|
|
||||||
pkgs2storeContents = l:
|
|
||||||
map
|
|
||||||
(x: {
|
|
||||||
object = x;
|
|
||||||
symlink = "none";
|
|
||||||
})
|
|
||||||
l;
|
|
||||||
|
|
||||||
nixpkgs = lib.cleanSource pkgs.path;
|
nixpkgs = lib.cleanSource pkgs.path;
|
||||||
|
|
||||||
channelSources =
|
channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}"
|
||||||
pkgs.runCommand "nixos-${config.system.nixos.version}"
|
{ preferLocalBuild = true; }
|
||||||
{preferLocalBuild = true;}
|
|
||||||
''
|
''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -prd ${nixpkgs.outPath} $out/nixos
|
cp -prd ${nixpkgs.outPath} $out/nixos
|
||||||
|
@ -70,7 +58,10 @@ with lib; let
|
||||||
sed -i 's|import \./default\.nix|import \./nixos-wsl|' ./etc/nixos/configuration.nix
|
sed -i 's|import \./default\.nix|import \./nixos-wsl|' ./etc/nixos/configuration.nix
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
in {
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
options.wsl.tarball = {
|
options.wsl.tarball = {
|
||||||
includeConfig = mkOption {
|
includeConfig = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
@ -79,12 +70,13 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
config = mkIf config.wsl.enable {
|
config = mkIf config.wsl.enable {
|
||||||
# These options make no sense without the wsl-distro module anyway
|
# These options make no sense without the wsl-distro module anyway
|
||||||
|
|
||||||
system.build.tarball = pkgs.callPackage "${nixpkgs}/nixos/lib/make-system-tarball.nix" {
|
system.build.tarball = pkgs.callPackage "${nixpkgs}/nixos/lib/make-system-tarball.nix" {
|
||||||
# No contents, structure will be added by prepare script
|
# No contents, structure will be added by prepare script
|
||||||
contents = [];
|
contents = [ ];
|
||||||
|
|
||||||
fileName = "nixos-wsl-${pkgs.hostPlatform.system}";
|
fileName = "nixos-wsl-${pkgs.hostPlatform.system}";
|
||||||
|
|
||||||
|
@ -100,5 +92,6 @@ in {
|
||||||
compressCommand = "gzip";
|
compressCommand = "gzip";
|
||||||
compressionExtension = ".gz";
|
compressionExtension = ".gz";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
{
|
{ config, lib, pkgs, ... }:
|
||||||
config,
|
with builtins; with lib; {
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with builtins;
|
|
||||||
with lib; {
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule ["wsl" "docker"] ["wsl" "docker-desktop"])
|
(mkRenamedOptionModule [ "wsl" "docker" ] [ "wsl" "docker-desktop" ])
|
||||||
];
|
];
|
||||||
|
|
||||||
options.wsl.docker-desktop = with types; {
|
options.wsl.docker-desktop = with types; {
|
||||||
enable = mkEnableOption "Docker Desktop integration";
|
enable = mkEnableOption "Docker Desktop integration";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
cfg = config.wsl.docker-desktop;
|
cfg = config.wsl.docker-desktop;
|
||||||
in
|
in
|
||||||
mkIf (config.wsl.enable && cfg.enable) {
|
mkIf (config.wsl.enable && cfg.enable) {
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
docker
|
docker
|
||||||
docker-compose
|
docker-compose
|
||||||
|
@ -28,7 +25,7 @@ with lib; {
|
||||||
script = ''
|
script = ''
|
||||||
${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop
|
${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop
|
||||||
'';
|
'';
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "30s";
|
RestartSec = "30s";
|
||||||
|
@ -38,5 +35,7 @@ with lib; {
|
||||||
users.groups.docker.members = [
|
users.groups.docker.members = [
|
||||||
config.wsl.defaultUser
|
config.wsl.defaultUser
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
{
|
{ config, lib, pkgs, ... }:
|
||||||
config,
|
with builtins; with lib; {
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with builtins;
|
|
||||||
with lib; {
|
|
||||||
options.wsl.docker-native = with types; {
|
options.wsl.docker-native = with types; {
|
||||||
enable = mkEnableOption "Native Docker integration in NixOS.";
|
enable = mkEnableOption "Native Docker integration in NixOS.";
|
||||||
|
|
||||||
|
@ -20,13 +15,14 @@ with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
cfg = config.wsl.docker-native;
|
cfg = config.wsl.docker-native;
|
||||||
in
|
in
|
||||||
mkIf (config.wsl.enable && cfg.enable) {
|
mkIf (config.wsl.enable && cfg.enable) {
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(self: super: {
|
(self: super: {
|
||||||
docker = super.docker.override {iptables = pkgs.iptables-legacy;};
|
docker = super.docker.override { iptables = pkgs.iptables-legacy; };
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
{
|
{ config, lib, pkgs, ... }:
|
||||||
config,
|
with builtins; with lib; {
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with builtins;
|
|
||||||
with lib; {
|
|
||||||
config = mkIf config.wsl.enable (
|
config = mkIf config.wsl.enable (
|
||||||
let
|
let
|
||||||
mkTarball = pkgs.callPackage "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix";
|
mkTarball = pkgs.callPackage "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix";
|
||||||
|
|
||||||
pkgs2storeContents = map (x: {
|
pkgs2storeContents = map (x: { object = x; symlink = "none"; });
|
||||||
object = x;
|
|
||||||
symlink = "none";
|
|
||||||
});
|
|
||||||
|
|
||||||
rootfs = let tarball = config.system.build.tarball; in "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}";
|
rootfs = let tarball = config.system.build.tarball; in "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}";
|
||||||
|
|
||||||
|
@ -47,39 +39,25 @@ with lib; {
|
||||||
passwd = pkgs.writeText "passwd" ''
|
passwd = pkgs.writeText "passwd" ''
|
||||||
root:x:0:0:System administrator:/root:${installer}
|
root:x:0:0:System administrator:/root:${installer}
|
||||||
'';
|
'';
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
|
|
||||||
system.build.installer = mkTarball {
|
system.build.installer = mkTarball {
|
||||||
fileName = "nixos-wsl-installer";
|
fileName = "nixos-wsl-installer";
|
||||||
compressCommand = "gzip";
|
compressCommand = "gzip";
|
||||||
compressionExtension = ".gz";
|
compressionExtension = ".gz";
|
||||||
extraArgs = "--hard-dereference";
|
extraArgs = "--hard-dereference";
|
||||||
|
|
||||||
storeContents = with pkgs;
|
storeContents = with pkgs; pkgs2storeContents [
|
||||||
pkgs2storeContents [
|
|
||||||
installer
|
installer
|
||||||
];
|
];
|
||||||
|
|
||||||
contents = [
|
contents = [
|
||||||
{
|
{ source = config.environment.etc."wsl.conf".source; target = "/etc/wsl.conf"; }
|
||||||
source = config.environment.etc."wsl.conf".source;
|
{ source = config.environment.etc."fstab".source; target = "/etc/fstab"; }
|
||||||
target = "/etc/wsl.conf";
|
{ source = passwd; target = "/etc/passwd"; }
|
||||||
}
|
{ source = "${pkgs.busybox}/bin/busybox"; target = "/bin/sh"; }
|
||||||
{
|
{ source = "${pkgs.busybox}/bin/busybox"; target = "/bin/mount"; }
|
||||||
source = config.environment.etc."fstab".source;
|
|
||||||
target = "/etc/fstab";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
source = passwd;
|
|
||||||
target = "/etc/passwd";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
source = "${pkgs.busybox}/bin/busybox";
|
|
||||||
target = "/bin/sh";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
source = "${pkgs.busybox}/bin/busybox";
|
|
||||||
target = "/bin/mount";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
extraCommands = pkgs.writeShellScript "prepare" ''
|
extraCommands = pkgs.writeShellScript "prepare" ''
|
||||||
|
@ -88,6 +66,8 @@ with lib; {
|
||||||
ln -s /init bin/wslpath
|
ln -s /init bin/wslpath
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
|
{ lib, pkgs, config, ... }:
|
||||||
|
|
||||||
|
with builtins; with lib;
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
with builtins;
|
|
||||||
with lib; {
|
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule ["wsl" "compatibility" "interopPreserveArgvZero"] ["wsl" "interop" "preserveArgvZero"])
|
(mkRenamedOptionModule [ "wsl" "compatibility" "interopPreserveArgvZero" ] [ "wsl" "interop" "preserveArgvZero" ])
|
||||||
];
|
];
|
||||||
|
|
||||||
options.wsl.interop = with types; {
|
options.wsl.interop = with types; {
|
||||||
|
@ -36,12 +32,15 @@ with lib; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
cfg = config.wsl.interop;
|
cfg = config.wsl.interop;
|
||||||
in
|
in
|
||||||
mkIf config.wsl.enable {
|
mkIf config.wsl.enable {
|
||||||
|
|
||||||
boot.binfmt.registrations = mkIf cfg.register {
|
boot.binfmt.registrations = mkIf cfg.register {
|
||||||
WSLInterop = let
|
WSLInterop =
|
||||||
|
let
|
||||||
compat = cfg.preserveArgvZero;
|
compat = cfg.preserveArgvZero;
|
||||||
|
|
||||||
# WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable
|
# WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable
|
||||||
|
@ -62,17 +61,12 @@ with lib; {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# use the autodetect hack if unset, otherwise call /init directly
|
# use the autodetect hack if unset, otherwise call /init directly
|
||||||
interpreter =
|
interpreter = if compat == null then compatWrapper else "/init";
|
||||||
if compat == null
|
|
||||||
then compatWrapper
|
|
||||||
else "/init";
|
|
||||||
|
|
||||||
# enable for the wrapper and autodetect hack
|
# enable for the wrapper and autodetect hack
|
||||||
preserveArgvZero =
|
preserveArgvZero = if compat == false then false else true;
|
||||||
if compat == false
|
in
|
||||||
then false
|
{
|
||||||
else true;
|
|
||||||
in {
|
|
||||||
magicOrExtension = "MZ";
|
magicOrExtension = "MZ";
|
||||||
fixBinary = true;
|
fixBinary = true;
|
||||||
wrapInterpreterInShell = false;
|
wrapInterpreterInShell = false;
|
||||||
|
@ -83,9 +77,12 @@ with lib; {
|
||||||
# Include Windows %PATH% in Linux $PATH.
|
# Include Windows %PATH% in Linux $PATH.
|
||||||
environment.extraInit = mkIf cfg.includePath ''PATH="$PATH:$WSLPATH"'';
|
environment.extraInit = mkIf cfg.includePath ''PATH="$PATH:$WSLPATH"'';
|
||||||
|
|
||||||
warnings = let
|
warnings =
|
||||||
|
let
|
||||||
registrations = config.boot.binfmt.registrations;
|
registrations = config.boot.binfmt.registrations;
|
||||||
in
|
in
|
||||||
optional (!(registrations ? WSLInterop) && (length (attrNames config.boot.binfmt.registrations)) != 0) "Having any binfmt registrations without re-registering WSLInterop (wsl.interop.register) will break running .exe files from WSL2";
|
optional (!(registrations ? WSLInterop) && (length (attrNames config.boot.binfmt.registrations)) != 0) "Having any binfmt registrations without re-registering WSLInterop (wsl.interop.register) will break running .exe files from WSL2";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
|
{ lib, pkgs, config, ... }:
|
||||||
|
|
||||||
|
with builtins; with lib;
|
||||||
{
|
{
|
||||||
lib,
|
options.wsl = with types;
|
||||||
pkgs,
|
let
|
||||||
config,
|
coercedToStr = coercedTo (oneOf [ bool path int ]) (toString) str;
|
||||||
...
|
in
|
||||||
}:
|
{
|
||||||
with builtins;
|
|
||||||
with lib; {
|
|
||||||
options.wsl = with types; let
|
|
||||||
coercedToStr = coercedTo (oneOf [bool path int]) toString str;
|
|
||||||
in {
|
|
||||||
enable = mkEnableOption "support for running NixOS as a WSL distribution";
|
enable = mkEnableOption "support for running NixOS as a WSL distribution";
|
||||||
automountPath = mkOption {
|
automountPath = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
|
@ -27,20 +25,18 @@ with lib; {
|
||||||
};
|
};
|
||||||
startMenuLaunchers = mkEnableOption "shortcuts for GUI applications in the windows start menu";
|
startMenuLaunchers = mkEnableOption "shortcuts for GUI applications in the windows start menu";
|
||||||
wslConf = mkOption {
|
wslConf = mkOption {
|
||||||
type = attrsOf (attrsOf (oneOf [string int bool]));
|
type = attrsOf (attrsOf (oneOf [ string int bool ]));
|
||||||
description = "Entries that are added to /etc/wsl.conf";
|
description = "Entries that are added to /etc/wsl.conf";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
cfg = config.wsl;
|
cfg = config.wsl;
|
||||||
syschdemd = import ../syschdemd.nix {
|
syschdemd = import ../syschdemd.nix { inherit lib pkgs config; inherit (cfg) automountPath defaultUser; defaultUserHome = config.users.users.${cfg.defaultUser}.home; };
|
||||||
inherit lib pkgs config;
|
|
||||||
inherit (cfg) automountPath defaultUser;
|
|
||||||
defaultUserHome = config.users.users.${cfg.defaultUser}.home;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
|
|
||||||
wsl.wslConf = {
|
wsl.wslConf = {
|
||||||
automount = {
|
automount = {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
|
@ -61,8 +57,9 @@ with lib; {
|
||||||
hardware.opengl.enable = true; # Enable GPU acceleration
|
hardware.opengl.enable = true; # Enable GPU acceleration
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
|
|
||||||
etc = {
|
etc = {
|
||||||
"wsl.conf".text = generators.toINI {} cfg.wslConf;
|
"wsl.conf".text = generators.toINI { } cfg.wslConf;
|
||||||
|
|
||||||
# DNS settings are managed by WSL
|
# DNS settings are managed by WSL
|
||||||
hosts.enable = !config.wsl.wslConf.network.generateHosts;
|
hosts.enable = !config.wsl.wslConf.network.generateHosts;
|
||||||
|
@ -70,7 +67,7 @@ with lib; {
|
||||||
};
|
};
|
||||||
|
|
||||||
systemPackages = [
|
systemPackages = [
|
||||||
(pkgs.runCommand "wslpath" {} ''
|
(pkgs.runCommand "wslpath" { } ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
ln -s /init $out/bin/wslpath
|
ln -s /init $out/bin/wslpath
|
||||||
'')
|
'')
|
||||||
|
@ -82,13 +79,13 @@ with lib; {
|
||||||
users.users.${cfg.defaultUser} = {
|
users.users.${cfg.defaultUser} = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
uid = 1000;
|
uid = 1000;
|
||||||
extraGroups = ["wheel"]; # Allow the default user to use sudo
|
extraGroups = [ "wheel" ]; # Allow the default user to use sudo
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.root = {
|
users.users.root = {
|
||||||
shell = "${syschdemd}/bin/syschdemd";
|
shell = "${syschdemd}/bin/syschdemd";
|
||||||
# Otherwise WSL fails to login as root with "initgroups failed 5"
|
# Otherwise WSL fails to login as root with "initgroups failed 5"
|
||||||
extraGroups = ["root"];
|
extraGroups = [ "root" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
security.sudo = {
|
security.sudo = {
|
||||||
|
@ -100,7 +97,7 @@ with lib; {
|
||||||
|
|
||||||
system.activationScripts = {
|
system.activationScripts = {
|
||||||
copy-launchers = mkIf cfg.startMenuLaunchers (
|
copy-launchers = mkIf cfg.startMenuLaunchers (
|
||||||
stringAfter [] ''
|
stringAfter [ ] ''
|
||||||
for x in applications icons; do
|
for x in applications icons; do
|
||||||
echo "Copying /usr/share/$x"
|
echo "Copying /usr/share/$x"
|
||||||
mkdir -p /usr/share/$x
|
mkdir -p /usr/share/$x
|
||||||
|
@ -108,7 +105,7 @@ with lib; {
|
||||||
done
|
done
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
populateBin = stringAfter [] ''
|
populateBin = stringAfter [ ] ''
|
||||||
echo "setting up /bin..."
|
echo "setting up /bin..."
|
||||||
ln -sf /init /bin/wslpath
|
ln -sf /init /bin/wslpath
|
||||||
ln -sf ${pkgs.bashInteractive}/bin/bash /bin/sh
|
ln -sf ${pkgs.bashInteractive}/bin/bash /bin/sh
|
||||||
|
@ -137,6 +134,6 @@ with lib; {
|
||||||
enableEmergencyMode = false;
|
enableEmergencyMode = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
warnings = optional (config.systemd.services.systemd-resolved.enable && config.wsl.wslConf.network.generateResolvConf) "systemd-resolved is enabled, but resolv.conf is managed by WSL";
|
warnings = (optional (config.systemd.services.systemd-resolved.enable && config.wsl.wslConf.network.generateResolvConf) "systemd-resolved is enabled, but resolv.conf is managed by WSL");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
{
|
{ lib
|
||||||
lib,
|
, pkgs
|
||||||
pkgs,
|
, config
|
||||||
config,
|
, automountPath
|
||||||
automountPath,
|
, defaultUser
|
||||||
defaultUser,
|
, defaultUserHome ? "/home/${defaultUser}"
|
||||||
defaultUserHome ? "/home/${defaultUser}",
|
, ...
|
||||||
...
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
pkgs.substituteAll {
|
pkgs.substituteAll {
|
||||||
name = "syschdemd";
|
name = "syschdemd";
|
||||||
src = ./syschdemd.sh;
|
src = ./syschdemd.sh;
|
||||||
dir = "bin";
|
dir = "bin";
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
|
|
||||||
buildInputs = with pkgs; [daemonize];
|
buildInputs = with pkgs; [ daemonize ];
|
||||||
|
|
||||||
inherit defaultUser defaultUserHome;
|
inherit defaultUser defaultUserHome;
|
||||||
inherit (pkgs) daemonize;
|
inherit (pkgs) daemonize;
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [];
|
{
|
||||||
boot.initrd.kernelModules = [];
|
imports = [ ];
|
||||||
boot.kernelModules = [];
|
|
||||||
boot.extraModulePackages = [];
|
boot.initrd.availableKernelModules = [ ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
## NOTE: These filesystems are mounted by a wrapper script from nix-wsl
|
## NOTE: These filesystems are mounted by a wrapper script from nix-wsl
|
||||||
|
|
||||||
|
@ -47,22 +43,25 @@
|
||||||
# fsType = "drvfs";
|
# fsType = "drvfs";
|
||||||
# };
|
# };
|
||||||
|
|
||||||
fileSystems."/mnt/c" = {
|
fileSystems."/mnt/c" =
|
||||||
|
{
|
||||||
device = "C:";
|
device = "C:";
|
||||||
fsType = "drvfs";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/d" = {
|
fileSystems."/mnt/d" =
|
||||||
|
{
|
||||||
device = "D:";
|
device = "D:";
|
||||||
fsType = "drvfs";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/f" = {
|
fileSystems."/mnt/f" =
|
||||||
|
{
|
||||||
device = "F:";
|
device = "F:";
|
||||||
fsType = "drvfs";
|
fsType = "drvfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [];
|
swapDevices = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,38 +1,32 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||||
# boot.initrd.kernelModules = [ "amdgpu" ];
|
# boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [];
|
||||||
boot.kernelModules = ["kvm-amd" "coretemp"];
|
boot.kernelModules = [ "kvm-amd" "coretemp"];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" =
|
||||||
# Might be wise to use /dev/nvme0p1 instead
|
# Might be wise to use /dev/nvme0p1 instead
|
||||||
{
|
{ device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
|
||||||
device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
|
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" =
|
||||||
# Might be wise to use /dev/nvme0p2 instead
|
# Might be wise to use /dev/nvme0p2 instead
|
||||||
{
|
{ device = "/dev/disk/by-uuid/EBA6-394D";
|
||||||
device = "/dev/disk/by-uuid/EBA6-394D";
|
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [];
|
swapDevices = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
||||||
terminal_input serial;
|
terminal_input serial;
|
||||||
|
@ -23,15 +20,17 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
|
{
|
||||||
device = "/dev/sda";
|
device = "/dev/sda";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[{ device = "/dev/sdb"; }];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
||||||
terminal_input serial;
|
terminal_input serial;
|
||||||
|
@ -23,15 +19,17 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
device = "/dev/sda";
|
{ device = "/dev/sda";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[ { device = "/dev/sdb"; }
|
||||||
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
||||||
terminal_input serial;
|
terminal_input serial;
|
||||||
|
@ -23,8 +20,8 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/" = {
|
"/" = {
|
||||||
|
@ -38,7 +35,8 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[{ device = "/dev/sdb"; }];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
imports =
|
||||||
lib,
|
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
|
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
boot.kernelParams = ["console=ttyS0,19200n8"];
|
||||||
boot.loader.grub.extraConfig = ''
|
boot.loader.grub.extraConfig = ''
|
||||||
|
@ -26,12 +22,14 @@
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
fileSystems."/" = {
|
fileSystems."/" =
|
||||||
device = "/dev/sda";
|
{ device = "/dev/sda";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/sdb";}];
|
swapDevices =
|
||||||
|
[ { device = "/dev/sdb"; }
|
||||||
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{lib, ...}:
|
{ lib, ... }:
|
||||||
with lib; let
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
nixos-wsl = import ./nixos-wsl;
|
nixos-wsl = import ./nixos-wsl;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
nixos-wsl.nixosModules.wsl
|
nixos-wsl.nixosModules.wsl
|
||||||
|
@ -18,7 +21,9 @@ in {
|
||||||
|
|
||||||
# Enable integration with Docker Desktop (needs to be installed)
|
# Enable integration with Docker Desktop (needs to be installed)
|
||||||
docker-desktop.enable = true;
|
docker-desktop.enable = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
# users.users.<defaultUser>.uid = 1000;
|
# users.users.<defaultUser>.uid = 1000;
|
||||||
# networking.hostName = "nixos";
|
# networking.hostName = "nixos";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
{
|
|
||||||
inputs,
|
|
||||||
cell,
|
|
||||||
}: let
|
|
||||||
inherit (inputs) std nixpkgs;
|
|
||||||
in {
|
|
||||||
default = std.lib.dev.mkShell {
|
|
||||||
name = "default";
|
|
||||||
imports = [inputs.std.std.devshellProfiles.default];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
inputs,
|
|
||||||
cell,
|
|
||||||
}: let
|
|
||||||
inherit (inputs.nixpkgs) system;
|
|
||||||
inherit (inputs.nix-boost.pkgs."${system}".mypkgs) poetry2nix;
|
|
||||||
inherit (poetry2nix) mkPoetryApplication defaultPoetryOverrides;
|
|
||||||
in {
|
|
||||||
kpcli-py = mkPoetryApplication {
|
|
||||||
projectDir = inputs.kpcli-py;
|
|
||||||
overrides = defaultPoetryOverrides.extend (self: super: {
|
|
||||||
# TODO: add this to upstream poetry2nix
|
|
||||||
tableformatter = super.tableformatter.overridePythonAttrs (old: {
|
|
||||||
buildInputs = (old.buildInputs or []) ++ [self.setuptools self.cython_3];
|
|
||||||
src = old.src;
|
|
||||||
});
|
|
||||||
|
|
||||||
kpcli = super.kpcli.overridePythonAttrs (old: {
|
|
||||||
buildInputs = (old.buildInputs or []) ++ [self.setuptools];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
# TODO: this should use winnow with a fair matching of supported systems
|
|
||||||
{
|
|
||||||
inputs,
|
|
||||||
cell,
|
|
||||||
}: let
|
|
||||||
inherit (cell) home-profiles home-modules;
|
|
||||||
inherit (inputs) home-manager;
|
|
||||||
pkgs = inputs.nixpkgs;
|
|
||||||
|
|
||||||
# hm is derivation that is compatible with homeConfigurations
|
|
||||||
home-config = {supported_systems, hm, tested_systems ? []}:
|
|
||||||
hm // {
|
|
||||||
_supported_systems = supported_systems;
|
|
||||||
_tested_systems = tested_systems;
|
|
||||||
};
|
|
||||||
|
|
||||||
base-modules = [
|
|
||||||
home-profiles.alacritty
|
|
||||||
# home-profiles.git
|
|
||||||
home-profiles.ssh
|
|
||||||
home-profiles.shells
|
|
||||||
({config.programs.home-manager.enable = true;})
|
|
||||||
home-profiles.nix-index
|
|
||||||
home-profiles.neovim
|
|
||||||
];
|
|
||||||
in {
|
|
||||||
homeConfigurations.htran = home-config {
|
|
||||||
supported_systems = ["aarch64-darwin" "x86_64-darwin"];
|
|
||||||
tested_systems = ["aarch64-darwin"];
|
|
||||||
hm = home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = base-modules ++ [
|
|
||||||
home-profiles.nerd_font_module
|
|
||||||
home-profiles.git-htran
|
|
||||||
home-profiles.dev-packages
|
|
||||||
home-profiles.zk
|
|
||||||
home-modules.darwin-spotlight
|
|
||||||
|
|
||||||
({
|
|
||||||
home.username = "htran";
|
|
||||||
home.homeDirectory = "/Users/htran";
|
|
||||||
home.stateVersion = "23.11";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,250 +0,0 @@
|
||||||
# This is an interface for home-profiles and should not contain opinionated
|
|
||||||
# configurations. It should provide alternative configurations, aggregates
|
|
||||||
# or new configurations
|
|
||||||
_imports@{ inputs, cell }:
|
|
||||||
let
|
|
||||||
namespace = "repo";
|
|
||||||
imports = _imports // { inherit namespace; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
git = { config, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config."${namespace}".git;
|
|
||||||
baseAliases = {
|
|
||||||
a = "add";
|
|
||||||
c = "commit";
|
|
||||||
ca = "commit --amend";
|
|
||||||
cm = "commit -m";
|
|
||||||
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
|
||||||
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
|
||||||
sts = "status";
|
|
||||||
co = "checkout";
|
|
||||||
b = "branch";
|
|
||||||
};
|
|
||||||
default-user = "Pegasust";
|
|
||||||
default-email = "pegasucksgg@gmail.com";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options."${namespace}".git = {
|
|
||||||
aliases = lib.mkOption {
|
|
||||||
type = lib.types.attrs;
|
|
||||||
default = { };
|
|
||||||
example = baseAliases;
|
|
||||||
description = ''
|
|
||||||
Additional git aliases. This settings comes with base configuration.
|
|
||||||
Redeclaring the base config will override the values.
|
|
||||||
''; # TODO: Add baseAliases as string here (builtins.toString doesn't work)
|
|
||||||
};
|
|
||||||
name = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = default-user;
|
|
||||||
description = "Git username that appears on commits";
|
|
||||||
example = default-user;
|
|
||||||
};
|
|
||||||
email = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = default-email;
|
|
||||||
example = default-email;
|
|
||||||
description = "Git email that appears on commits";
|
|
||||||
};
|
|
||||||
ignores = lib.mkOption {
|
|
||||||
type = lib.types.listOf lib.types.str;
|
|
||||||
default = [
|
|
||||||
".vscode" # vscode settings
|
|
||||||
".direnv" # .envrc cached outputs
|
|
||||||
".DS_Store" # MacOS users, amrite
|
|
||||||
];
|
|
||||||
description = ''
|
|
||||||
.gitignore patterns that are applied in every "${namespace}"sitory.
|
|
||||||
This is useful for IDE-specific settings.
|
|
||||||
'';
|
|
||||||
example = [ ".direnv" "node_modules" ];
|
|
||||||
};
|
|
||||||
enable = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Enables git
|
|
||||||
'';
|
|
||||||
example = false;
|
|
||||||
};
|
|
||||||
credentialCacheTimeoutSeconds = lib.mkOption {
|
|
||||||
type = lib.types.int;
|
|
||||||
default = 3000;
|
|
||||||
description = "Credential cache (in-memory store) for Git in seconds.";
|
|
||||||
example = 3000;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# TODO : anyway to override configuration?
|
|
||||||
# idk wtf I was thinking about. there is no context in this question
|
|
||||||
config.programs.git = {
|
|
||||||
inherit (cfg) enable ignores;
|
|
||||||
userName = cfg.name;
|
|
||||||
userEmail = cfg.email;
|
|
||||||
aliases = baseAliases // cfg.aliases;
|
|
||||||
extraConfig = {
|
|
||||||
# TODO: in the case of darwin, git always open up the built-in keychain.
|
|
||||||
# possibly something we can't really control since we don't have access to `nix-darwin`
|
|
||||||
credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}";
|
|
||||||
};
|
|
||||||
lfs.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
alacritty = { config, lib, ... }:
|
|
||||||
let
|
|
||||||
inherit (inputs.cells.repo.lib) fromYAML;
|
|
||||||
cfg = config."${namespace}".alacritty;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options."${namespace}".alacritty = {
|
|
||||||
font.family = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.singleLineStr;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
The font family for Alacritty
|
|
||||||
'';
|
|
||||||
example = "DroidSansMono NF";
|
|
||||||
};
|
|
||||||
font.size = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.number;
|
|
||||||
default = 11.0;
|
|
||||||
description = ''
|
|
||||||
The default font size for Alacritty. This is probably measured in px.
|
|
||||||
'';
|
|
||||||
example = 7.0;
|
|
||||||
};
|
|
||||||
enable = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = false;
|
|
||||||
description = ''
|
|
||||||
Enables alacritty
|
|
||||||
'';
|
|
||||||
example = true;
|
|
||||||
};
|
|
||||||
config-path = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "Path to alacritty yaml";
|
|
||||||
default = null;
|
|
||||||
example = "./config/alacritty.yaml";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config.programs.alacritty = {
|
|
||||||
enable = cfg.enable;
|
|
||||||
settings =
|
|
||||||
let
|
|
||||||
actualConfig =
|
|
||||||
if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { };
|
|
||||||
in
|
|
||||||
lib.recursiveUpdate actualConfig {
|
|
||||||
font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family;
|
|
||||||
font.size = lib.mkIf (cfg.font.size != null) cfg.font.size;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: chromium is not really supported on darwin
|
|
||||||
private_chromium = { config, pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config."${namespace}".private_chromium;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options."${namespace}".private_chromium = {
|
|
||||||
enable = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
Enable extremely lightweight chromium with vimium plugin
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf (cfg.enable) {
|
|
||||||
# home.packages = [pkgs.ungoogled-chromium];
|
|
||||||
programs.chromium = {
|
|
||||||
enable = true;
|
|
||||||
package = pkgs.ungoogled-chromium;
|
|
||||||
extensions =
|
|
||||||
let
|
|
||||||
# TODO: how about a chrome extension registry?
|
|
||||||
mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }:
|
|
||||||
{
|
|
||||||
inherit id;
|
|
||||||
crxPath = builtins.fetchurl {
|
|
||||||
url = "https://clients2.google.com/service/update2/crx" +
|
|
||||||
"?response=redirect" +
|
|
||||||
"&acceptformat=crx2,crx3" +
|
|
||||||
"&prodversion=${browserVersion}" +
|
|
||||||
"&x=id%3D${id}%26installsource%3Dondemand%26uc";
|
|
||||||
name = "${id}.crx";
|
|
||||||
inherit sha256;
|
|
||||||
};
|
|
||||||
version = extVersion;
|
|
||||||
};
|
|
||||||
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
|
|
||||||
in
|
|
||||||
[
|
|
||||||
# vimium
|
|
||||||
(mkChromiumExt {
|
|
||||||
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
|
|
||||||
sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic";
|
|
||||||
extVersion = "1.67.4";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
darwin-spotlight = { lib, pkgs, config, ... }: {
|
|
||||||
# This patch exists since Darwin's search bar requires solid apps and not
|
|
||||||
# symlinked
|
|
||||||
# TODO: QA
|
|
||||||
# - [x] works for base case
|
|
||||||
# - [x] works for repeated case
|
|
||||||
# - [ ] works after base case, then removed
|
|
||||||
# - [ ] works for repeated case, then removed
|
|
||||||
|
|
||||||
# Copy GUI apps to "~/Applications/Home Manager Apps"
|
|
||||||
# Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334
|
|
||||||
home.activation.patch-spotlight =
|
|
||||||
if pkgs.stdenv.isDarwin then
|
|
||||||
let
|
|
||||||
apps = pkgs.buildEnv {
|
|
||||||
name = "home-manager-applications";
|
|
||||||
paths = config.home.packages;
|
|
||||||
pathsToLink = "/Applications";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
lib.hm.dag.entryAfter [ "linkGeneration" ] ''
|
|
||||||
# Install MacOS applications to the user environment.
|
|
||||||
HM_APPS="$HOME/Applications/Home Manager Apps"
|
|
||||||
# Reset current state
|
|
||||||
if [ -e "$HM_APPS" ]; then
|
|
||||||
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
|
|
||||||
fi
|
|
||||||
$DRY_RUN_CMD mkdir -p "$HM_APPS"
|
|
||||||
# .app dirs need to be actual directories for Finder to detect them as Apps.
|
|
||||||
# In the env of Apps we build, the .apps are symlinks. We pass all of them as
|
|
||||||
# arguments to cp and make it dereference those using -H
|
|
||||||
$DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS"
|
|
||||||
$DRY_RUN_CMD chmod +w -R "$HM_APPS"
|
|
||||||
''
|
|
||||||
else
|
|
||||||
"";
|
|
||||||
# We need this in case upstream home-manager changes the behavior of linking
|
|
||||||
# applications
|
|
||||||
home.activation.remove-patch-spotlight =
|
|
||||||
if pkgs.stdenv.isDarwin then
|
|
||||||
lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
|
|
||||||
HM_APPS="$HOME/Applications/Home Manager Apps"
|
|
||||||
# Reset current state
|
|
||||||
if [ -e "$HM_APPS" ]; then
|
|
||||||
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
|
|
||||||
fi
|
|
||||||
''
|
|
||||||
else
|
|
||||||
"";
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
{
|
|
||||||
inputs,
|
|
||||||
cell,
|
|
||||||
namespace,
|
|
||||||
}: {
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config."${namespace}".graphics;
|
|
||||||
cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != null);
|
|
||||||
types = lib.types;
|
|
||||||
in {
|
|
||||||
imports = [./shells.nix];
|
|
||||||
options."${namespace}".nixgl = {
|
|
||||||
enable = lib.mkEnableOption "nixgl";
|
|
||||||
useNixGL = {
|
|
||||||
package = lib.mkPackageOption pkgs "nixGL package" {
|
|
||||||
default = [
|
|
||||||
"nixgl"
|
|
||||||
"auto"
|
|
||||||
"nixGLDefault"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
defaultPackage = lib.mkOption {
|
|
||||||
type = types.nullOr (types.enum ["nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee"]);
|
|
||||||
description = "Which nixGL package to be aliased as `nixGL` on the shell";
|
|
||||||
default = null;
|
|
||||||
example = "nixGLIntel";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# NOTE: importing shells does not mean we're enabling everything, if we do mkDefault false
|
|
||||||
# but the dilemma is, if the user import BOTH graphics.nix and shells.nix
|
|
||||||
# they will also need to do `config."${namespace}".shells.enable`
|
|
||||||
# generally, we want the behavior: import means enable
|
|
||||||
config = lib.mkIf cfgEnable {
|
|
||||||
"${namespace}".graphics._enable = lib.mkForce true;
|
|
||||||
"${namespace}".shells = {
|
|
||||||
shellAliases = lib.mkIf (cfg.useNixGL.defaultPackage != null) {
|
|
||||||
nixGL = cfg.useNixGL.defaultPackage;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
home.packages = [cfg.useNixGL.package];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,200 +0,0 @@
|
||||||
# This creates a layer that is specific to some profiles, but may require
|
|
||||||
# some variants in environment like username/email, work-oriented or personal
|
|
||||||
# and many more
|
|
||||||
_imports @ {
|
|
||||||
inputs,
|
|
||||||
cell,
|
|
||||||
}: let
|
|
||||||
# TODO: I don't think abstracting namespace away is a good idea in this case
|
|
||||||
namespace = "repo";
|
|
||||||
imports = _imports // {inherit namespace;};
|
|
||||||
inherit (cell) home-modules;
|
|
||||||
in {
|
|
||||||
neovim = import ./neovim.nix imports;
|
|
||||||
nerd_font_module = {
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
config.fonts.fontconfig.enable = true;
|
|
||||||
config.home.packages = [
|
|
||||||
(pkgs.nerdfonts.override {fonts = ["Hack"];})
|
|
||||||
];
|
|
||||||
config."${namespace}".alacritty.font.family = "Hack Nerd Font Mono";
|
|
||||||
};
|
|
||||||
|
|
||||||
secrets = {
|
|
||||||
age.secrets.s3fs = {
|
|
||||||
file = "${inputs.self}/secrets/s3fs.age";
|
|
||||||
# mode = "600"; # owner + group only
|
|
||||||
# owner = "hungtr";
|
|
||||||
# group = "users";
|
|
||||||
};
|
|
||||||
age.secrets."s3fs.digital-garden" = {
|
|
||||||
file = "${inputs.self}/secrets/s3fs.digital-garden.age";
|
|
||||||
};
|
|
||||||
age.secrets._nhitrl_cred = {
|
|
||||||
file = "${inputs.self}/secrets/_nhitrl.age";
|
|
||||||
};
|
|
||||||
age.secrets."wifi.env" = {
|
|
||||||
file = "${inputs.self}/secrets/wifi.env.age";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
ssh = {
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config."${namespace}".ssh;
|
|
||||||
in {
|
|
||||||
options."${namespace}".ssh.enable = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
Enables SSH
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
config.programs.ssh = {
|
|
||||||
inherit (cfg) enable;
|
|
||||||
forwardAgent = true;
|
|
||||||
includes = ["${inputs.self}/native_configs/ssh/config"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
alacritty = {
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config."${namespace}".alacritty;
|
|
||||||
in {
|
|
||||||
imports = [
|
|
||||||
inputs.cells.repo.home-modules.alacritty
|
|
||||||
];
|
|
||||||
config."${namespace}".alacritty = {
|
|
||||||
enable = true;
|
|
||||||
config-path = "${inputs.self}//native_configs/alacritty/alacritty.yml";
|
|
||||||
font.size = 11.0;
|
|
||||||
font.family = "Hack Nerd Font Mono";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
shells = import ./shells.nix imports;
|
|
||||||
|
|
||||||
git = {
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
baseAliases = {
|
|
||||||
a = "add";
|
|
||||||
c = "commit";
|
|
||||||
ca = "commit --amend";
|
|
||||||
cm = "commit -m";
|
|
||||||
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
|
|
||||||
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
|
|
||||||
sts = "status";
|
|
||||||
co = "checkout";
|
|
||||||
b = "branch";
|
|
||||||
};
|
|
||||||
cfg = config."${namespace}".profile.git;
|
|
||||||
in {
|
|
||||||
imports = [
|
|
||||||
home-modules.git
|
|
||||||
];
|
|
||||||
options."${namespace}".profile.git = {
|
|
||||||
aliases = lib.mkOption {
|
|
||||||
type = lib.types.attrs;
|
|
||||||
default = {};
|
|
||||||
example = baseAliases;
|
|
||||||
description = ''
|
|
||||||
Additional git aliases. This config is merged on top of base aliases.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
name = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "Pegasust";
|
|
||||||
description = "Git username that appears on commits";
|
|
||||||
example = "Pegasust";
|
|
||||||
};
|
|
||||||
email = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "pegasucksgg@gmail.com";
|
|
||||||
example = "peagsucksgg@gmail.com";
|
|
||||||
description = "Git email that appears on commits";
|
|
||||||
};
|
|
||||||
ignores = lib.mkOption {
|
|
||||||
type = lib.types.listOf lib.types.str;
|
|
||||||
default = [
|
|
||||||
".vscode" # vscode settings
|
|
||||||
".direnv" # .envrc cached outputs
|
|
||||||
".DS_Store" # MacOS users, amrite
|
|
||||||
];
|
|
||||||
description = ''
|
|
||||||
.gitignore patterns that are applied in every repository.
|
|
||||||
This is useful for IDE-specific or environment-specific settings.
|
|
||||||
'';
|
|
||||||
example = [".direnv" "node_modules"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# WARNING: This should be completed wtf
|
|
||||||
config."${namespace}".git = {
|
|
||||||
inherit (cfg) name email ignores aliases;
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
git-htran = {
|
|
||||||
imports = [inputs.cells.repo.home-profiles.git];
|
|
||||||
config."${namespace}".profile.git = {
|
|
||||||
name = "htran";
|
|
||||||
email = "htran@egihosting.com";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
git-pegasust = {
|
|
||||||
imports = [inputs.cells.repo.home-profiles.git];
|
|
||||||
config."${namespace}".profile.git = {
|
|
||||||
email = "pegasucksgg@gmail.com";
|
|
||||||
name = "pegasust";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
dev-packages = let pkgs = inputs.nixpkgs; in {
|
|
||||||
programs.jq.enable = true;
|
|
||||||
home.packages = [
|
|
||||||
pkgs.htop
|
|
||||||
pkgs.ripgrep
|
|
||||||
pkgs.unzip
|
|
||||||
pkgs.zip
|
|
||||||
|
|
||||||
pkgs.yq-go
|
|
||||||
pkgs.mosh
|
|
||||||
pkgs.python310
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Local nixpkgs search and fallback if command not found to search from nixpkgs
|
|
||||||
nix-index = {
|
|
||||||
imports = [
|
|
||||||
inputs.nix-index-database.hmModules.nix-index
|
|
||||||
];
|
|
||||||
config.programs.nix-index = {
|
|
||||||
enable = true;
|
|
||||||
enableBashIntegration = true;
|
|
||||||
enableZshIntegration = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# digital garden stack
|
|
||||||
zk = {
|
|
||||||
config.xdg.configFile."zk/config.toml".source = "${inputs.self}/native_configs/zk/config.toml";
|
|
||||||
# NB: this is done with lib.mkMerge
|
|
||||||
config.home.packages = [
|
|
||||||
inputs.nixpkgs.zk
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,178 +0,0 @@
|
||||||
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project TODO: just install these things, then symlink to mason's bin directory
|
|
||||||
#
|
|
||||||
# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop`
|
|
||||||
# might be different from `home-manager`'s (~/.nix_profile/bin/jq)
|
|
||||||
{
|
|
||||||
inputs,
|
|
||||||
cell,
|
|
||||||
namespace,
|
|
||||||
}: {
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
# NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace
|
|
||||||
# and is added to the path after wrapping.
|
|
||||||
# check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand`
|
|
||||||
# see: :/--suffix.*PATH
|
|
||||||
# there should be mentions of additional packages
|
|
||||||
my_neovim = pkgs.neovim-unwrapped;
|
|
||||||
inherit (inputs.nixpkgs) system;
|
|
||||||
nvim_pkgs =
|
|
||||||
[
|
|
||||||
# pkgs.gccStdenv
|
|
||||||
pkgs.tree-sitter
|
|
||||||
pkgs.fzf # file name fuzzy search
|
|
||||||
pkgs.ripgrep # content fuzzy search
|
|
||||||
pkgs.zk # Zettelkasten (limited support)
|
|
||||||
pkgs.fd # Required by a Telescope plugin (?)
|
|
||||||
pkgs.stdenv.cc.cc.lib
|
|
||||||
pkgs.nil # oxalica's better nix language server
|
|
||||||
inputs.nix-boost.packages."${system}".rust4cargo
|
|
||||||
pkgs.nickel
|
|
||||||
pkgs.nls
|
|
||||||
|
|
||||||
pkgs.go # doesn't work, Mason installs from runtime path
|
|
||||||
|
|
||||||
# Language-specific stuffs
|
|
||||||
pkgs.sumneko-lua-language-server
|
|
||||||
# pkgs.python3Packages.python-lsp-server
|
|
||||||
pkgs.nodePackages.pyright
|
|
||||||
pkgs.python3Packages.pylint
|
|
||||||
pkgs.python3Packages.flake8
|
|
||||||
# FIXME: installing ansible from here just doesn't work :/
|
|
||||||
# pkgs.ansible-lint
|
|
||||||
# pkgs.python38Packages.ansible
|
|
||||||
# pkgs.ansible-language-server
|
|
||||||
# TODO: the devShell should provide rust-analyzer so that
|
|
||||||
# cargo test builds binaries compatible with rust-analyzer
|
|
||||||
|
|
||||||
# pkgs.rust-analyzer
|
|
||||||
# rust_pkgs
|
|
||||||
# pkgs.evcxr # Rust REPL for Conjure!
|
|
||||||
]
|
|
||||||
++ lib.optionals (pkgs.stdenv.isDarwin) (
|
|
||||||
let
|
|
||||||
inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation;
|
|
||||||
in [
|
|
||||||
System
|
|
||||||
CoreFoundation
|
|
||||||
]
|
|
||||||
);
|
|
||||||
in {
|
|
||||||
options.base.neovim = {
|
|
||||||
enable = lib.mkOption {
|
|
||||||
default = true;
|
|
||||||
description = "enable personalized neovim as default editor";
|
|
||||||
type = lib.types.bool;
|
|
||||||
example = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf config.base.neovim.enable {
|
|
||||||
# home-manager
|
|
||||||
programs.neovim = {
|
|
||||||
enable = true;
|
|
||||||
package = my_neovim;
|
|
||||||
viAlias = true;
|
|
||||||
vimAlias = true;
|
|
||||||
withPython3 = true;
|
|
||||||
withNodeJs = true;
|
|
||||||
# NOTE: this adds path to the wrapped version of neovim
|
|
||||||
extraPackages = nvim_pkgs;
|
|
||||||
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
|
|
||||||
plugins = let
|
|
||||||
inherit
|
|
||||||
(inputs.nixpkgs-latest.legacyPackages.${system}.vimPlugins)
|
|
||||||
plenary-nvim
|
|
||||||
nvim-treesitter
|
|
||||||
nvim-treesitter-textobjects
|
|
||||||
nvim-treesitter-context
|
|
||||||
telescope-fzf-native-nvim
|
|
||||||
telescope-file-browser-nvim
|
|
||||||
telescope-nvim
|
|
||||||
nvim-lspconfig
|
|
||||||
gruvbox-community
|
|
||||||
neodev-nvim
|
|
||||||
cmp-nvim-lsp
|
|
||||||
cmp-path
|
|
||||||
cmp-buffer
|
|
||||||
cmp-cmdline
|
|
||||||
nvim-cmp
|
|
||||||
lspkind-nvim
|
|
||||||
nvim-autopairs
|
|
||||||
nvim-ts-autotag
|
|
||||||
guess-indent-nvim
|
|
||||||
harpoon
|
|
||||||
zk-nvim
|
|
||||||
luasnip
|
|
||||||
fidget-nvim
|
|
||||||
rust-tools-nvim
|
|
||||||
cmp_luasnip
|
|
||||||
gitsigns-nvim
|
|
||||||
indent-blankline-nvim
|
|
||||||
lualine-nvim
|
|
||||||
mason-lspconfig-nvim
|
|
||||||
mason-nvim
|
|
||||||
neogit
|
|
||||||
nlua-nvim
|
|
||||||
nvim-jqx
|
|
||||||
nvim-surround
|
|
||||||
nvim-web-devicons
|
|
||||||
playground
|
|
||||||
todo-comments-nvim
|
|
||||||
trouble-nvim
|
|
||||||
vim-dispatch
|
|
||||||
vim-dispatch-neovim
|
|
||||||
vim-fugitive
|
|
||||||
vim-jack-in
|
|
||||||
;
|
|
||||||
in [
|
|
||||||
plenary-nvim
|
|
||||||
nvim-treesitter.withAllGrammars
|
|
||||||
nvim-treesitter-textobjects
|
|
||||||
telescope-fzf-native-nvim
|
|
||||||
telescope-file-browser-nvim
|
|
||||||
telescope-nvim
|
|
||||||
nvim-lspconfig
|
|
||||||
gruvbox-community
|
|
||||||
neodev-nvim
|
|
||||||
cmp-nvim-lsp
|
|
||||||
cmp-path
|
|
||||||
cmp-buffer
|
|
||||||
cmp-cmdline
|
|
||||||
nvim-cmp
|
|
||||||
lspkind-nvim
|
|
||||||
nvim-autopairs
|
|
||||||
nvim-ts-autotag
|
|
||||||
guess-indent-nvim
|
|
||||||
harpoon
|
|
||||||
zk-nvim
|
|
||||||
luasnip
|
|
||||||
nvim-treesitter-context
|
|
||||||
fidget-nvim
|
|
||||||
rust-tools-nvim
|
|
||||||
|
|
||||||
cmp_luasnip
|
|
||||||
gitsigns-nvim
|
|
||||||
indent-blankline-nvim
|
|
||||||
lualine-nvim
|
|
||||||
mason-lspconfig-nvim
|
|
||||||
mason-nvim
|
|
||||||
neogit
|
|
||||||
nlua-nvim
|
|
||||||
nvim-jqx
|
|
||||||
nvim-surround
|
|
||||||
nvim-web-devicons
|
|
||||||
playground
|
|
||||||
todo-comments-nvim
|
|
||||||
trouble-nvim
|
|
||||||
vim-dispatch
|
|
||||||
vim-dispatch-neovim
|
|
||||||
vim-fugitive
|
|
||||||
vim-jack-in
|
|
||||||
];
|
|
||||||
};
|
|
||||||
# home.packages = nvim_pkgs;
|
|
||||||
};
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue