Compare commits
5 Commits
150534c512
...
d7a5a2a380
Author | SHA1 | Date |
---|---|---|
Pegasust | d7a5a2a380 | |
Pegasust | ba18afbaf2 | |
Pegasust | e76eba2e7a | |
Pegasust | 29e5db764d | |
Pegasust | 00e7a15b19 |
60
README.md
60
README.md
|
@ -1,60 +0,0 @@
|
||||||
# dotfiles
|
|
||||||
|
|
||||||
Contains my configurations for the software I use.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Nix
|
|
||||||
|
|
||||||
Monorepo that contains my commonly used personal environments.
|
|
||||||
I hope to incorporate my configs at [gh:pegasust/dotfiles](https://github.com/pegasust/dotfiles)
|
|
||||||
onto this repo for quick env setup (especially devel) on new machines.
|
|
||||||
|
|
||||||
## How do I apply these config
|
|
||||||
|
|
||||||
- I will always first clone this repository, preferably from local source before
|
|
||||||
going from the github. `git clone https://github.com/pegasust/dotfiles`
|
|
||||||
|
|
||||||
### neovim
|
|
||||||
|
|
||||||
My main text editor. It's based on `vim`, but stays loyal to `lua` ecosystem
|
|
||||||
|
|
||||||
- Config file: `./nvim/init.lua`
|
|
||||||
- Command: `ln [-s] $PWD/nvim/init.lua ~/.config/nvim`
|
|
||||||
|
|
||||||
#### Notes
|
|
||||||
|
|
||||||
- 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)
|
|
||||||
|
|
||||||
### tmux
|
|
||||||
|
|
||||||
Terminal multiplexor. Allows creating persistent sessions and multiple terminal windows
|
|
||||||
from one terminal.
|
|
||||||
|
|
||||||
- Config file: `./tmux/tmux.conf`
|
|
||||||
- Command: `ln [-s] $PWD/tmux/tmux.conf ~/.tmux.conf`
|
|
||||||
- Or `ln [-s] $PWD/tmux/tmux.conf ~/.config/tmux/tmux.conf` (hardcoded, `$XDG_CONFIG_HOME` is ignored)
|
|
||||||
|
|
||||||
#### Notes
|
|
||||||
|
|
||||||
- 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.
|
|
||||||
|
|
||||||
### zk
|
|
||||||
|
|
||||||
Zettelkasten notebook. This is how I document my learning and reflect on myself
|
|
||||||
via writing and typing.
|
|
||||||
|
|
||||||
I am in the process of moving away from Obsidian so that I can write ZK notes
|
|
||||||
text-editor agnostically.
|
|
||||||
|
|
||||||
- Config file: `zk/config.toml`
|
|
||||||
- Command: `ln [-s] $PWD/zk/config.toml ~/.config/zk/config.toml`
|
|
||||||
|
|
||||||
- Templates: `zk/templates/`
|
|
||||||
- Command: `ln -s $PWD/zk/templates ~/.config/zk/templates`
|
|
||||||
|
|
||||||
|
|
100
c_.nix
100
c_.nix
|
@ -1,100 +0,0 @@
|
||||||
# a small helper that only builds on top of builtins functions
|
|
||||||
{src}@inputs:
|
|
||||||
builtins // (let
|
|
||||||
formatSecondsSinceEpoch = t:
|
|
||||||
let
|
|
||||||
rem = x: y: x - x / y * y;
|
|
||||||
days = t / 86400;
|
|
||||||
secondsInDay = rem t 86400;
|
|
||||||
hours = secondsInDay / 3600;
|
|
||||||
minutes = (rem secondsInDay 3600) / 60;
|
|
||||||
seconds = rem t 60;
|
|
||||||
|
|
||||||
# Courtesy of https://stackoverflow.com/a/32158604.
|
|
||||||
z = days + 719468;
|
|
||||||
era = (if z >= 0 then z else z - 146096) / 146097;
|
|
||||||
doe = z - era * 146097;
|
|
||||||
yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
|
|
||||||
y = yoe + era * 400;
|
|
||||||
doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
|
||||||
mp = (5 * doy + 2) / 153;
|
|
||||||
d = doy - (153 * mp + 2) / 5 + 1;
|
|
||||||
m = mp + (if mp < 10 then 3 else -9);
|
|
||||||
y' = y + (if m <= 2 then 1 else 0);
|
|
||||||
|
|
||||||
pad = s: if builtins.stringLength s < 2 then "0" + s else s;
|
|
||||||
in "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}"
|
|
||||||
+ "${pad (toString minutes)}${pad (toString seconds)}";
|
|
||||||
|
|
||||||
fetchTree =
|
|
||||||
# this is the value of flake.lock#lock.nodes.${input_name}.locked
|
|
||||||
{type
|
|
||||||
, host? ""
|
|
||||||
, owner? ""
|
|
||||||
, repo? ""
|
|
||||||
, rev? ""
|
|
||||||
, submodules? ""
|
|
||||||
, path? ""
|
|
||||||
, narHash? null
|
|
||||||
, lastModified? 0
|
|
||||||
}@info:
|
|
||||||
if info.type == "github" then
|
|
||||||
{ outPath =
|
|
||||||
fetchTarball
|
|
||||||
({ url = "https://api.${info.host or "github.com"}/repos/"
|
|
||||||
+ "${info.owner}/${info.repo}/tarball/${info.rev}"; }
|
|
||||||
// (if info ? narHash then { sha256 = info.narHash; } else {})
|
|
||||||
);
|
|
||||||
rev = info.rev;
|
|
||||||
shortRev = builtins.substring 0 7 info.rev;
|
|
||||||
lastModified = info.lastModified;
|
|
||||||
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
|
|
||||||
narHash = info.narHash;
|
|
||||||
}
|
|
||||||
else if info.type == "git" then
|
|
||||||
{ outPath =
|
|
||||||
builtins.fetchGit
|
|
||||||
({ url = info.url; }
|
|
||||||
// (if info ? rev then { inherit (info) rev; } else {})
|
|
||||||
// (if info ? ref then { inherit (info) ref; } else {})
|
|
||||||
// (if info ? submodules then { inherit (info) submodules; } else {})
|
|
||||||
);
|
|
||||||
lastModified = info.lastModified;
|
|
||||||
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
|
|
||||||
narHash = info.narHash;
|
|
||||||
} // (if info ? rev then {
|
|
||||||
rev = info.rev;
|
|
||||||
shortRev = builtins.substring 0 7 info.rev;
|
|
||||||
} else {
|
|
||||||
})
|
|
||||||
else if info.type == "path" then
|
|
||||||
{ outPath = builtins.path {
|
|
||||||
path = if builtins.substring 0 1 info.path != "/"
|
|
||||||
then src + ("/" + info.path) # make this absolute path by prepending ./
|
|
||||||
else info.path; # it's already an absolute path
|
|
||||||
};
|
|
||||||
narHash = info.narHash;
|
|
||||||
}
|
|
||||||
else if info.type == "tarball" then
|
|
||||||
{ outPath =
|
|
||||||
fetchTarball
|
|
||||||
({ inherit (info) url; }
|
|
||||||
// (if info ? narHash then { sha256 = info.narHash; } else {})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if info.type == "gitlab" then
|
|
||||||
{ inherit (info) rev narHash lastModified;
|
|
||||||
outPath =
|
|
||||||
fetchTarball
|
|
||||||
({ url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; }
|
|
||||||
// (if info ? narHash then { sha256 = info.narHash; } else {})
|
|
||||||
);
|
|
||||||
shortRev = builtins.substring 0 7 info.rev;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# FIXME: add Mercurial, tarball inputs.
|
|
||||||
throw "flake input has unsupported input type '${info.type}'";
|
|
||||||
in {
|
|
||||||
inherit fetchTree;
|
|
||||||
})
|
|
||||||
|
|
11
default.nix
11
default.nix
|
@ -1,11 +1,12 @@
|
||||||
# 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 {src = ./.;};
|
url = "https://git.pegasust.com/pegasust/boost/archive/${lock.nodes.boost.locked.rev}.tar.gz";
|
||||||
in
|
sha256 = lock.nodes.boost.locked.narHash;
|
||||||
c_.fetchTree lock.nodes.flake-compat.locked
|
}.flake-compat
|
||||||
)
|
)
|
||||||
{ src = ./.; }
|
{ src = ./.; }
|
||||||
).defaultNix
|
).defaultNix
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
# Ideally, this should contain the barebone necessary for building/interacting
|
|
||||||
# with tech used in this project
|
|
||||||
#
|
|
||||||
# Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead
|
|
||||||
#
|
|
||||||
# It should not contain PDE
|
|
||||||
{ pkgs ? import <nixpkgs> { }
|
|
||||||
, lib
|
|
||||||
, ...
|
|
||||||
}: pkgs.mkShell {
|
|
||||||
# mkShell doesn't care about the differences across nativeBuildInputs,
|
|
||||||
# buildInputs, or packages
|
|
||||||
buildInputs = [
|
|
||||||
# shell scripts
|
|
||||||
(lib.shellAsDrv { script = ''echo "hello world"''; pname = "hello"; })
|
|
||||||
# TODO: decompose hm-switch.sh with a base version (where HOME_MANAGER_BIN is injected)
|
|
||||||
# (lib.shellAsDrv {script = builtins.readFile ./scripts/hm-switch.sh; pname = "hm-switch";})
|
|
||||||
pkgs.rust4cargo
|
|
||||||
];
|
|
||||||
|
|
||||||
# env vars
|
|
||||||
lol = "hello world";
|
|
||||||
}
|
|
||||||
|
|
36
docs/DEV.md
36
docs/DEV.md
|
@ -1,36 +0,0 @@
|
||||||
# Journal on development
|
|
||||||
|
|
||||||
This contains information dump to record thoughts as I design this repo
|
|
||||||
|
|
||||||
## Nix as first-class citizen instead of native config
|
|
||||||
|
|
||||||
- Nix can export JSON and other object serialization formats
|
|
||||||
|
|
||||||
- Still allows native config, so that Neovim, for example, which uses Turing-complete
|
|
||||||
config language, to make full use of its native LSP.
|
|
||||||
|
|
||||||
## Design pattern emerges from unstructured code
|
|
||||||
|
|
||||||
### Modules
|
|
||||||
|
|
||||||
- Main thing for the first big refactor of codebase
|
|
||||||
|
|
||||||
- nixpkgs and home-manager has their own interface for modules
|
|
||||||
|
|
||||||
- The main benefit is to provide (runtime) type-safety on options, along with
|
|
||||||
documentations and defaults
|
|
||||||
|
|
||||||
## Nitpicky details
|
|
||||||
|
|
||||||
### `nativeBuildInputs` vs `buildInputs`
|
|
||||||
|
|
||||||
- `nativeBuildInputs` is available **before** `buildInputs`.
|
|
||||||
|
|
||||||
- `nativeBuildInputs` is supposed to be built by a deployment machine (not target)
|
|
||||||
|
|
||||||
- `buildInputs` gives you access during runtime
|
|
||||||
|
|
||||||
- `nativeBulidInputs` gives you access to packages during build time
|
|
||||||
|
|
||||||
- `mkShell` doesn't care about `packages`, `nativeBuildInputs`, `buildInputs`
|
|
||||||
|
|
96
flake.lock
96
flake.lock
|
@ -1,23 +1,30 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"agenix": {
|
"boost": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"flake-compat": "flake-compat",
|
||||||
"nixpkgs"
|
"flake-utils": "flake-utils",
|
||||||
]
|
"home-manager": "home-manager",
|
||||||
|
"kpcli-py": "kpcli-py",
|
||||||
|
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||||
|
"nix-index-database": "nix-index-database",
|
||||||
|
"nixgl": "nixgl",
|
||||||
|
"nixlib": "nixlib",
|
||||||
|
"nixpkgs": "nixpkgs_3",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673301561,
|
"lastModified": 1675701358,
|
||||||
"narHash": "sha256-gRUWHbBAtMuPDJQXotoI8u6+3DGBIUZHkyQWpIv7WpM=",
|
"narHash": "sha256-FRMT9DSmXubyHCtPYA/j5uGcQAupRw819zidxZkXnws=",
|
||||||
"owner": "ryantm",
|
"ref": "refs/heads/master",
|
||||||
"repo": "agenix",
|
"rev": "02a999700b09eed24118d7e426903090b6b68f78",
|
||||||
"rev": "42d371d861a227149dc9a7e03350c9ab8b8ddd68",
|
"revCount": 17,
|
||||||
"type": "github"
|
"type": "git",
|
||||||
|
"url": "https://git.pegasust.com/pegasust/boost-nix.git"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "ryantm",
|
"type": "git",
|
||||||
"repo": "agenix",
|
"url": "https://git.pegasust.com/pegasust/boost-nix.git"
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
|
@ -36,11 +43,11 @@
|
||||||
"flake-compat_2": {
|
"flake-compat_2": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1668681692,
|
"lastModified": 1673956053,
|
||||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -112,16 +119,17 @@
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
"boost",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"utils": "utils"
|
"utils": "utils"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673948101,
|
"lastModified": 1675462931,
|
||||||
"narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=",
|
"narHash": "sha256-JiOUSERBtA1lN/s9YTKGZoZ3XUicHDwr+C8swaPSh3M=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a",
|
"rev": "e2c1756e3ae001ca8696912016dd31cb1503ccf3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -150,17 +158,18 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils_2",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
"boost",
|
||||||
"neovim-nightly-overlay",
|
"neovim-nightly-overlay",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "contrib",
|
"dir": "contrib",
|
||||||
"lastModified": 1673937267,
|
"lastModified": 1675418037,
|
||||||
"narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=",
|
"narHash": "sha256-vJtNMkMtFiXXqGdC8woiqhGcnf/7SW1lasbf3Z6peaw=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "2093e574c6c934a718f96d0a173aa965d3958a8b",
|
"rev": "964ae205a583807127eda75d9876fb6dfda6065c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -177,11 +186,11 @@
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673943288,
|
"lastModified": 1675498400,
|
||||||
"narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=",
|
"narHash": "sha256-CKYP1FWntgxb5A0H8b+szRgZlropddRQv2O+BFleyak=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "neovim-nightly-overlay",
|
"repo": "neovim-nightly-overlay",
|
||||||
"rev": "3c0bb335936754a2683a84ddf081594ddb567a89",
|
"rev": "b6b35bcfb1048390aafb3d4cc9d9e3b9bdc36dd8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -193,15 +202,16 @@
|
||||||
"nix-index-database": {
|
"nix-index-database": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
"boost",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673752441,
|
"lastModified": 1675567746,
|
||||||
"narHash": "sha256-/g4ImZWV05CrXRWTSJsda6ztIp7LAPxs2L6RCrbQ66U=",
|
"narHash": "sha256-huugg+7ok2VjmoLhkT+mAcw6iVK+hOqrYV0jMMD4EpQ=",
|
||||||
"owner": "mic92",
|
"owner": "mic92",
|
||||||
"repo": "nix-index-database",
|
"repo": "nix-index-database",
|
||||||
"rev": "391180f77505c1c8cdd45fe1a59dc89d3e40300a",
|
"rev": "3880fa89727c622ae4674a2b6169c81112b43cf4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -228,11 +238,11 @@
|
||||||
},
|
},
|
||||||
"nixlib": {
|
"nixlib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673743903,
|
"lastModified": 1675558495,
|
||||||
"narHash": "sha256-sloY6KYyVOozJ1CkbgJPpZ99TKIjIvM+04V48C04sMQ=",
|
"narHash": "sha256-7jwOfNefWeqUk5i8yOVRWrm4klglVOubtGXU11ZId2o=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "7555e2dfcbac1533f047021f1744ac8871150f9f",
|
"rev": "c8c50fd1c544dad4f590c3b91c5d65c5ba6aff77",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -274,11 +284,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673631141,
|
"lastModified": 1675454231,
|
||||||
"narHash": "sha256-AprpYQ5JvLS4wQG/ghm2UriZ9QZXvAwh1HlgA/6ZEVQ=",
|
"narHash": "sha256-5rgcWq1nFWlbR3NsLqY7i/7358uhkSeMQJ/LEHk3BWA=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "befc83905c965adfd33e5cae49acb0351f6e0404",
|
"rev": "06999209d7a0043d4372e38f57cffae00223d592",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -305,17 +315,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"boost": "boost"
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"home-manager": "home-manager",
|
|
||||||
"kpcli-py": "kpcli-py",
|
|
||||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
|
||||||
"nix-index-database": "nix-index-database",
|
|
||||||
"nixgl": "nixgl",
|
|
||||||
"nixlib": "nixlib",
|
|
||||||
"nixpkgs": "nixpkgs_3",
|
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
@ -324,11 +324,11 @@
|
||||||
"nixpkgs": "nixpkgs_4"
|
"nixpkgs": "nixpkgs_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673922364,
|
"lastModified": 1675564291,
|
||||||
"narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=",
|
"narHash": "sha256-mJ9ISIElFGCPYRDBYVv2AWPwYSsbTCEJg2E9n4ALxwc=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7",
|
"rev": "3bf0a253c07b4ddea8a5f0fb805e2a412cc7c7d4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
176
flake.nix
176
flake.nix
|
@ -1,178 +1,20 @@
|
||||||
{
|
{
|
||||||
|
description = "Start your Nix cluster here";
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
accept-flake-config = true;
|
accept-flake-config = true;
|
||||||
experimental-features = "nix-command flakes";
|
experimental-features = "nix-command flakes";
|
||||||
# for darwin's browser
|
# for darwin's browser
|
||||||
allowUnsupportedSystem = true;
|
allowUnsupportedSystem = true;
|
||||||
};
|
};
|
||||||
description = "My personal configuration in Nix (and some native configurations)";
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
boost.url = "git+https://git.pegasust.com/pegasust/boost-nix.git";
|
||||||
# continously merged & rebased lightweight .lib. Basically a huge extension to c_.
|
|
||||||
nixlib.url = "github:nix-community/nixpkgs.lib";
|
|
||||||
agenix = {
|
|
||||||
url = "github:ryantm/agenix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
home-manager = {
|
|
||||||
url = "github:nix-community/home-manager";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
nixgl.url = "path:out-of-tree/nixGL";
|
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
||||||
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
|
|
||||||
flake-compat = {
|
|
||||||
url = "path:out-of-tree/flake-compat";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
kpcli-py = {
|
|
||||||
url = "github:rebkwok/kpcli";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
neovim-nightly-overlay = {
|
|
||||||
url = "github:nix-community/neovim-nightly-overlay";
|
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
|
|
||||||
};
|
|
||||||
nix-index-database = {
|
|
||||||
url = "github:mic92/nix-index-database";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs = {boost, ...}@flakes: let
|
||||||
{ nixpkgs
|
inherit (boost) lib overlays pkgs;
|
||||||
, agenix
|
inherit (lib) forEachSystem stdx sys utils;
|
||||||
, home-manager
|
in utils.repos.mkConfigurations {
|
||||||
, flake-utils
|
users = utils.user.mkConfigurations [];
|
||||||
, nixgl
|
hosts = utils.host.mkConfigurations [];
|
||||||
, rust-overlay
|
};
|
||||||
, flake-compat
|
|
||||||
, neovim-nightly-overlay
|
|
||||||
, nix-index-database
|
|
||||||
, nixlib
|
|
||||||
, ...
|
|
||||||
}@_inputs:
|
|
||||||
let
|
|
||||||
# config_fn:: system -> config
|
|
||||||
# this function should take simple exports of homeConfigurations.${profile},
|
|
||||||
# nixosConfigurations.${profile}, devShells.${profile}, packages.${profile}
|
|
||||||
# and correctly produce
|
|
||||||
cross_platform = config_fn: let
|
|
||||||
# nixosConfigurations.${profile} -> nixosConfigurations.${system}.${profile}
|
|
||||||
# pass in: path.to.exports.nixosConfigurations
|
|
||||||
# get out: nixosConfigurations.${system} = {...}
|
|
||||||
strat_sandwich = field_name: config_field: system: {
|
|
||||||
"${field_name}"."${system}" = config_field;
|
|
||||||
};
|
|
||||||
# homeConfigurations.${profile} -> packages.${system}.homeConfigurations.${profile}
|
|
||||||
# pass in: path.to.exports.homeConfigurations
|
|
||||||
# get: packages.${system}.homeConfigurations
|
|
||||||
strat_wrap_packages = field_name: config_field: system: {
|
|
||||||
packages."${system}"."${field_name}" = config_field;
|
|
||||||
};
|
|
||||||
strat_noop = field_name: config_field: system: {"${field_name}" = config_field;};
|
|
||||||
strategyMap = {
|
|
||||||
nixosConfigurations = strat_sandwich;
|
|
||||||
templates = strat_noop;
|
|
||||||
devShells = strat_sandwich;
|
|
||||||
devShell = strat_sandwich;
|
|
||||||
formatter = strat_sandwich;
|
|
||||||
homeConfigurations = strat_wrap_packages;
|
|
||||||
lib = strat_noop;
|
|
||||||
proj_root = strat_noop;
|
|
||||||
unit_tests = strat_noop;
|
|
||||||
secrets = strat_noop;
|
|
||||||
debug = strat_noop;
|
|
||||||
};
|
|
||||||
# takes in {homeConfigurations = ...; nixosConfigurations = ...}
|
|
||||||
# -> {packages.$system.homeConfigurations}
|
|
||||||
mapConfig = config: system: (builtins.foldl'
|
|
||||||
(acc: confName: (strategyMap."${confName}" confName config."${confName}" system))
|
|
||||||
{} (builtins.attrNames config));
|
|
||||||
in builtins.foldl' nixlib.lib.recursiveUpdate {} (
|
|
||||||
builtins.map (system: (mapConfig (config_fn system) system)) flake-utils.lib.defaultSystems
|
|
||||||
);
|
|
||||||
in cross_platform (system:
|
|
||||||
let
|
|
||||||
# Context/global stuffs to be passed down
|
|
||||||
# NOTE: this will only read files that are within git tree
|
|
||||||
# all secrets should go into secrets.nix and secrets/*.age
|
|
||||||
proj_root =
|
|
||||||
let
|
|
||||||
path = builtins.toString ./.;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit path;
|
|
||||||
configs.path = "${path}/native_configs";
|
|
||||||
scripts.path = "${path}/scripts";
|
|
||||||
secrets.path = "${path}/secrets";
|
|
||||||
testdata.path = "${path}/tests";
|
|
||||||
modules.path = "${path}/modules";
|
|
||||||
hosts.path = "${path}/hosts";
|
|
||||||
users.path = "${path}/users";
|
|
||||||
};
|
|
||||||
overlays = import ./overlays.nix (_inputs // {inherit system;});
|
|
||||||
pkgs = import nixpkgs {
|
|
||||||
inherit system overlays;
|
|
||||||
config = {
|
|
||||||
allowUnfree = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# now, this lib is extremely powerful as it also engulfs nixpkgs.lib
|
|
||||||
# lib = nixpkgs.lib // pkgs.lib;
|
|
||||||
lib = (builtins.foldl' (lhs: rhs: (nixpkgs.lib.recursiveUpdate lhs rhs)) { } [
|
|
||||||
nixpkgs.lib
|
|
||||||
pkgs.lib
|
|
||||||
(import ./lib {
|
|
||||||
inherit proj_root pkgs overlays system;
|
|
||||||
inherit (pkgs) lib;
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
inputs_w_lib = (pkgs.lib.recursiveUpdate _inputs {
|
|
||||||
inherit system proj_root pkgs lib;
|
|
||||||
});
|
|
||||||
|
|
||||||
modules = (import ./modules inputs_w_lib);
|
|
||||||
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;
|
|
||||||
devShells = 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 inputs_w_lib unit_tests pkgs nixpkgs nixlib;
|
|
||||||
};
|
|
||||||
formatter."${system}" = pkgs.nixpkgs-fmt;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ ];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
## NOTE: These filesystems are mounted by a wrapper script from nix-wsl
|
|
||||||
|
|
||||||
# fileSystems."/" =
|
|
||||||
# {
|
|
||||||
# device = "/dev/sdc";
|
|
||||||
# fsType = "ext4";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/mnt/wsl" =
|
|
||||||
# {
|
|
||||||
# device = "tmpfs";
|
|
||||||
# fsType = "tmpfs";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/mnt/wsl/docker-desktop/shared-sockets/guest-services" =
|
|
||||||
# {
|
|
||||||
# device = "none";
|
|
||||||
# fsType = "tmpfs";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/usr/lib/wsl/drivers" =
|
|
||||||
# {
|
|
||||||
# device = "drivers";
|
|
||||||
# fsType = "drvfs";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/usr/lib/wsl/lib" =
|
|
||||||
# {
|
|
||||||
# device = "lib";
|
|
||||||
# fsType = "drvfs";
|
|
||||||
# };
|
|
||||||
|
|
||||||
fileSystems."/mnt/c" =
|
|
||||||
{
|
|
||||||
device = "C:";
|
|
||||||
fsType = "drvfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/mnt/d" =
|
|
||||||
{
|
|
||||||
device = "D:";
|
|
||||||
fsType = "drvfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/mnt/f" =
|
|
||||||
{
|
|
||||||
device = "F:";
|
|
||||||
fsType = "drvfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.bond0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.bonding_masters.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.dummy0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eth0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.sit0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.tunl0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{ nixpkgs
|
|
||||||
, agenix
|
|
||||||
, home-manager
|
|
||||||
, flake-utils
|
|
||||||
, nixgl
|
|
||||||
, rust-overlay
|
|
||||||
, flake-compat
|
|
||||||
, pkgs
|
|
||||||
, lib
|
|
||||||
, proj_root
|
|
||||||
}: { }
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
|
||||||
# boot.initrd.kernelModules = [ "amdgpu" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-amd" "coretemp" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
# Might be wise to use /dev/nvme0p1 instead
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
# Might be wise to use /dev/nvme0p2 instead
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-uuid/EBA6-394D";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
{ nixpkgs
|
|
||||||
, agenix
|
|
||||||
, 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 = {
|
|
||||||
# req
|
|
||||||
hostName = "bao";
|
|
||||||
# opts
|
|
||||||
ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs";
|
|
||||||
nixosVersion = "22.11";
|
|
||||||
system = "x86_64-linux";
|
|
||||||
preset = "base";
|
|
||||||
};
|
|
||||||
# TODO: add override so that we can add wsl config on top
|
|
||||||
bao.nixosConfig = {
|
|
||||||
modules = [
|
|
||||||
(import ../modules/nvgpu.sys.nix)
|
|
||||||
(import ../modules/kde.sys.nix)
|
|
||||||
(import ../modules/pulseaudio.sys.nix)
|
|
||||||
(import ../modules/storage.perso.sys.nix)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
propagate = hostConfig@{ metadata, nixosConfig }:
|
|
||||||
let
|
|
||||||
# req
|
|
||||||
inherit (metadata) hostName;
|
|
||||||
# opts
|
|
||||||
ssh_pubkey = lib.attrByPath [ "ssh_pubkey" ] null metadata; # metadata.ssh_pubkey??undefined
|
|
||||||
users = lib.attrByPath [ "users" ] { } metadata;
|
|
||||||
nixosVersion = lib.attrByPath [ "nixosVersion" ] nixosDefaultVersion metadata;
|
|
||||||
system = lib.attrByPath [ "system" ] defaultSystem metadata;
|
|
||||||
preset = lib.attrByPath [ "preset" ] "base" metadata;
|
|
||||||
# infer
|
|
||||||
hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix";
|
|
||||||
# alias to prevent infinite recursion
|
|
||||||
_nixosConfig = nixosConfig;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig;
|
|
||||||
nixosConfig = _nixosConfig // {
|
|
||||||
inherit system;
|
|
||||||
modules = [
|
|
||||||
{
|
|
||||||
config._module.args = {
|
|
||||||
inherit proj_root;
|
|
||||||
my-lib = finalInputs.lib;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
hardwareConfig
|
|
||||||
{
|
|
||||||
system.stateVersion = nixosVersion;
|
|
||||||
networking.hostName = hostName;
|
|
||||||
users.users = users;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
imports = [ agenix.nixosModule ];
|
|
||||||
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
|
|
||||||
}
|
|
||||||
(import "${proj_root.modules.path}/secrets.nix")
|
|
||||||
(import "${proj_root.modules.path}/${preset}.sys.nix")
|
|
||||||
] ++ _nixosConfig.modules;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# we are blessed by the fact that we engulfed nixpkgs.lib.* at top level
|
|
||||||
mkHostFromPropagated = propagatedHostConfig@{ nixosConfig, ... }: nixpkgs.lib.nixosSystem nixosConfig;
|
|
||||||
mkHost = hostConfig: (lib.pipe [ propagate mkHostFromPropagated ] hostConfig);
|
|
||||||
trimNull = lib.filterAttrsRecursive (name: value: value != null);
|
|
||||||
flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey);
|
|
||||||
in
|
|
||||||
{
|
|
||||||
nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config;
|
|
||||||
# {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";}
|
|
||||||
pubKeys = lib.getPubkey config;
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
|
||||||
boot.loader.grub.extraConfig = ''
|
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
|
||||||
terminal_input serial;
|
|
||||||
terminal_output serial
|
|
||||||
'';
|
|
||||||
boot.loader.grub.forceInstall = true;
|
|
||||||
boot.loader.grub.device = "nodev";
|
|
||||||
boot.loader.timeout = 10;
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{
|
|
||||||
device = "/dev/sda";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[{ device = "/dev/sdb"; }];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
|
||||||
boot.loader.grub.extraConfig = ''
|
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
|
||||||
terminal_input serial;
|
|
||||||
terminal_output serial
|
|
||||||
'';
|
|
||||||
boot.loader.grub.forceInstall = true;
|
|
||||||
boot.loader.grub.device = "nodev";
|
|
||||||
boot.loader.timeout = 10;
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{
|
|
||||||
device = "/dev/sda";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[{ device = "/dev/sdb"; }];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
{ nixpkgs
|
|
||||||
, agenix
|
|
||||||
, home-manager
|
|
||||||
, flake-utils
|
|
||||||
, nixgl
|
|
||||||
, rust-overlay
|
|
||||||
, flake-compat
|
|
||||||
, pkgs
|
|
||||||
, lib
|
|
||||||
, proj_root
|
|
||||||
}: { }
|
|
|
@ -1,49 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
|
||||||
boot.loader.grub.extraConfig = ''
|
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
|
||||||
terminal_input serial;
|
|
||||||
terminal_output serial
|
|
||||||
'';
|
|
||||||
boot.loader.grub.forceInstall = true;
|
|
||||||
boot.loader.grub.device = "nodev";
|
|
||||||
boot.loader.timeout = 10;
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems = {
|
|
||||||
"/" = {
|
|
||||||
device = "/dev/sda";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
# Assume Linode volume "gitea" exists, mount it to '/gitea"'
|
|
||||||
"/gitea" = {
|
|
||||||
device = "/dev/disk/by-id/scsi-0Linode_Volume_gitea";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[{ device = "/dev/sdb"; }];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
|
||||||
boot.loader.grub.extraConfig = ''
|
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
|
||||||
terminal_input serial;
|
|
||||||
terminal_output serial;
|
|
||||||
'';
|
|
||||||
boot.loader.grub.forceInstall = true;
|
|
||||||
boot.loader.grub.device = "nodev";
|
|
||||||
boot.loader.timeout = 10;
|
|
||||||
fileSystems."/" =
|
|
||||||
{
|
|
||||||
device = "/dev/sda";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[{ device = "/dev/sdb"; }];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
{ 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;
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
# 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?
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
{ lib, ... }: { }
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
imports = [ ./gpu.sys.nix ];
|
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
||||||
services.xserver.enable = true;
|
|
||||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
{ pkgs
|
|
||||||
, lib
|
|
||||||
, proj_root
|
|
||||||
, ...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
./minimal.sys.nix
|
|
||||||
./mosh.sys.nix
|
|
||||||
./tailscale.sys.nix
|
|
||||||
./ssh.sys.nix
|
|
||||||
];
|
|
||||||
environment.systemPackages = [ pkgs.lm_sensors ];
|
|
||||||
time.timeZone = "America/Phoenix";
|
|
||||||
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
inputs: { }
|
|
|
@ -1,12 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
environment.systemPackages = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ];
|
|
||||||
hardware.opengl = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = [ pkgs.rocm-opencl-icd pkgs.rocm-opencl-runtime ];
|
|
||||||
# Vulkan
|
|
||||||
driSupport = true;
|
|
||||||
driSupport32Bit = true;
|
|
||||||
package = pkgs.mesa.drivers;
|
|
||||||
package32 = pkgs.pkgsi686Linux.mesa.drivers;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
{ pkgs
|
|
||||||
, my-lib
|
|
||||||
, ...
|
|
||||||
}: {
|
|
||||||
environment.noXlibs = my-lib.mkForce false;
|
|
||||||
# TODO: wireless networking
|
|
||||||
|
|
||||||
# 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;
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
{ pkgs
|
|
||||||
, lib
|
|
||||||
, proj_root
|
|
||||||
, modulesPath
|
|
||||||
, ...
|
|
||||||
}: {
|
|
||||||
imports = [ "${modulesPath}/profiles/minimal.nix" ];
|
|
||||||
# prune old builds after a while
|
|
||||||
nix.settings.auto-optimise-store = true;
|
|
||||||
nix.package = pkgs.nixFlakes; # nix flakes
|
|
||||||
nix.extraOptions = ''
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
'';
|
|
||||||
programs.neovim = {
|
|
||||||
enable = true;
|
|
||||||
defaultEditor = true;
|
|
||||||
};
|
|
||||||
programs.git.enable = true;
|
|
||||||
environment.systemPackages = [
|
|
||||||
pkgs.gnumake
|
|
||||||
pkgs.wget
|
|
||||||
pkgs.inetutils # network diag
|
|
||||||
pkgs.mtr # network diag
|
|
||||||
pkgs.sysstat # sys diag
|
|
||||||
];
|
|
||||||
users.users.root = {
|
|
||||||
# openssh runs in root, no? This is because port < 1024 requires root.
|
|
||||||
openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile "${proj_root.configs.path}/ssh/authorized_keys");
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
{ pkgs
|
|
||||||
, lib
|
|
||||||
, 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 ];
|
|
||||||
networking.firewall = lib.mkIf config.networking.firewall.enable {
|
|
||||||
allowedUDPPortRanges = [
|
|
||||||
{ from = 60000; to = 61000; } # mosh
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
{ config, ... }: {
|
|
||||||
imports = [ ./gpu.sys.nix ];
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
services.xserver.enable = true;
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
||||||
}
|
|
|
@ -1,21 +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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
;
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
# 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;
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
# 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";
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
{ proj_root
|
|
||||||
, ...
|
|
||||||
}: {
|
|
||||||
age.secrets.s3fs = {
|
|
||||||
file = "${proj_root.secrets.path}/s3fs.age";
|
|
||||||
# mode = "600"; # owner + group only
|
|
||||||
# owner = "hungtr";
|
|
||||||
# group = "users";
|
|
||||||
};
|
|
||||||
age.secrets."s3fs.digital-garden" = {
|
|
||||||
file = "${proj_root.secrets.path}/s3fs.digital-garden.age";
|
|
||||||
};
|
|
||||||
age.secrets._nhitrl_cred = {
|
|
||||||
file = "${proj_root.secrets.path}/_nhitrl.age";
|
|
||||||
};
|
|
||||||
age.secrets."wifi.env" = {
|
|
||||||
file = "${proj_root.secrets.path}/wifi.env.age";
|
|
||||||
};
|
|
||||||
# environment.systemPackages = [agenix.defaultPackage.x86_64-linux];
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
services.openssh = {
|
|
||||||
enable = true;
|
|
||||||
permitRootLogin = "no";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
# Personal configuration on storage solution
|
|
||||||
{ pkgs, config, lib, ... }: {
|
|
||||||
environment.systemPackages = [
|
|
||||||
pkgs.s3fs
|
|
||||||
pkgs.cifs-utils
|
|
||||||
];
|
|
||||||
|
|
||||||
# Sadly, autofs uses systemd, so we can't put it in home-manager
|
|
||||||
# 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
|
|
||||||
# TODO: make this configuration nix-less to show that it's 100% data
|
|
||||||
services.autofs =
|
|
||||||
let
|
|
||||||
# confToBackendArg {lol="what"; empty=""; name_only=null;} -> "lol=what,empty=,name_only"
|
|
||||||
# TODO: change null -> true/false. This allows overriding & better self-documentation
|
|
||||||
confToBackendArg = conf: (lib.concatStringsSep ","
|
|
||||||
(lib.mapAttrsToList (name: value: "${name}${lib.optionalString (value != null) "=${value}"}") conf));
|
|
||||||
|
|
||||||
# mount_dest: path ("wow")
|
|
||||||
# backend_args: nix attrs representing the arguments to be passed to s3fs
|
|
||||||
# ({"-fstype" = "fuse"; "use_cache" = "/tmp";})
|
|
||||||
# bucket: bucket name (hungtr-hot)
|
|
||||||
# NOTE: s3 custom provider will be provided inside
|
|
||||||
# backend_args, so just put the bucket name here
|
|
||||||
#
|
|
||||||
#-> "${mount_dest} ${formatted_args} ${s3fs-bin}#${bucket}"
|
|
||||||
autofs-s3fs_entry =
|
|
||||||
{ mount_dest
|
|
||||||
, backend_args ? { "-fstype" = "fuse"; }
|
|
||||||
, bucket
|
|
||||||
}@inputs:
|
|
||||||
let
|
|
||||||
s3fs-exec = "${pkgs.s3fs}/bin/s3fs";
|
|
||||||
in
|
|
||||||
"${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}";
|
|
||||||
personalStorage = [
|
|
||||||
(autofs-s3fs_entry {
|
|
||||||
mount_dest = "garden";
|
|
||||||
backend_args = {
|
|
||||||
"-fstype" = "fuse";
|
|
||||||
use_cache = "/tmp";
|
|
||||||
del_cache = null;
|
|
||||||
allow_other = null;
|
|
||||||
url = "https://v5h5.la11.idrivee2-14.com";
|
|
||||||
passwd_file = config.age.secrets."s3fs.digital-garden".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
|
|
||||||
};
|
|
||||||
bucket = "digital-garden";
|
|
||||||
})
|
|
||||||
(
|
|
||||||
let
|
|
||||||
args = {
|
|
||||||
"-fstype" = "cifs";
|
|
||||||
credentials = config.age.secrets._nhitrl_cred.path;
|
|
||||||
user = null;
|
|
||||||
uid = "1001";
|
|
||||||
gid = "100";
|
|
||||||
dir_mode = "0777";
|
|
||||||
file_mode = "0777";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
"felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d"
|
|
||||||
)
|
|
||||||
(
|
|
||||||
let
|
|
||||||
args = {
|
|
||||||
"-fstype" = "cifs";
|
|
||||||
credentials = config.age.secrets._nhitrl_cred.path;
|
|
||||||
user = null;
|
|
||||||
uid = "1001";
|
|
||||||
gid = "100";
|
|
||||||
dir_mode = "0777";
|
|
||||||
file_mode = "0777";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
"felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f"
|
|
||||||
)
|
|
||||||
];
|
|
||||||
persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage);
|
|
||||||
in
|
|
||||||
{
|
|
||||||
enable = true;
|
|
||||||
# Creates /perso directory with every subdirectory declared by ${personalStorage}
|
|
||||||
# as of now (might be stale), /perso/hot is the only mount accessible
|
|
||||||
# that is also managed by s3fs
|
|
||||||
autoMaster = ''
|
|
||||||
/perso file:${persoConf}
|
|
||||||
'';
|
|
||||||
timeout = 30; # default: 600, 600 seconds (10 mins) of inactivity => unmount
|
|
||||||
# debug = true; # writes to more to journalctl
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
{ pkgs
|
|
||||||
, config
|
|
||||||
, lib
|
|
||||||
, ...
|
|
||||||
}: let cfg = config.mod.tailscale; in {
|
|
||||||
options.mod.tailscale = {
|
|
||||||
enable = lib.mkEnableOption "tailscale";
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
environment.systemPackages = [ pkgs.tailscale ];
|
|
||||||
services.tailscale.enable = true;
|
|
||||||
|
|
||||||
systemd.services.tailscale-autoconnect = {
|
|
||||||
description = "Automatically connects 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
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall = lib.mkIf config.networking.firewall.enable {
|
|
||||||
trustedInterfaces = [
|
|
||||||
"tailscale0"
|
|
||||||
];
|
|
||||||
allowedUDPPorts = [
|
|
||||||
config.services.tailscale.port
|
|
||||||
];
|
|
||||||
allowedTCPPorts = [
|
|
||||||
22
|
|
||||||
];
|
|
||||||
checkReversePath = "loose";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
{ config, ... }: {
|
|
||||||
networking.wireless.enable = true;
|
|
||||||
networking.wireless.environmentFile = config.age.secrets."wifi.env";
|
|
||||||
networking.wireless.networks = {
|
|
||||||
"Hoang Sa".psk = "@DESERT_PSK@";
|
|
||||||
"Truong Sa".psk = "@DESERT_PSK@";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Native configs
|
|
||||||
|
|
||||||
Contains all configurations that are written in their native language
|
|
|
@ -1,895 +0,0 @@
|
||||||
# Configuration for Alacritty, the GPU enhanced terminal emulator.
|
|
||||||
|
|
||||||
# Import additional configuration files
|
|
||||||
#
|
|
||||||
# Imports are loaded in order, skipping all missing files, with the importing
|
|
||||||
# file being loaded last. If a field is already present in a previous import, it
|
|
||||||
# will be replaced.
|
|
||||||
#
|
|
||||||
# All imports must either be absolute paths starting with `/`, or paths relative
|
|
||||||
# to the user's home directory starting with `~/`.
|
|
||||||
#import:
|
|
||||||
# - /path/to/alacritty.yml
|
|
||||||
|
|
||||||
# Any items in the `env` entry below will be added as
|
|
||||||
# environment variables. Some entries may override variables
|
|
||||||
# set by alacritty itself.
|
|
||||||
#env:
|
|
||||||
# TERM variable
|
|
||||||
#
|
|
||||||
# This value is used to set the `$TERM` environment variable for
|
|
||||||
# each instance of Alacritty. If it is not present, alacritty will
|
|
||||||
# check the local terminfo database and use `alacritty` if it is
|
|
||||||
# available, otherwise `xterm-256color` is used.
|
|
||||||
#TERM: alacritty
|
|
||||||
|
|
||||||
#window:
|
|
||||||
# Window dimensions (changes require restart)
|
|
||||||
#
|
|
||||||
# Number of lines/columns (not pixels) in the terminal. Both lines and columns
|
|
||||||
# must be non-zero for this to take effect. The number of columns must be at
|
|
||||||
# least `2`, while using a value of `0` for columns and lines will fall back
|
|
||||||
# to the window manager's recommended size
|
|
||||||
#dimensions:
|
|
||||||
# columns: 0
|
|
||||||
# lines: 0
|
|
||||||
|
|
||||||
# Window position (changes require restart)
|
|
||||||
#
|
|
||||||
# Specified in number of pixels.
|
|
||||||
# If the position is not set, the window manager will handle the placement.
|
|
||||||
#position:
|
|
||||||
# x: 0
|
|
||||||
# y: 0
|
|
||||||
|
|
||||||
# Window padding (changes require restart)
|
|
||||||
#
|
|
||||||
# Blank space added around the window in pixels. This padding is scaled
|
|
||||||
# by DPI and the specified value is always added at both opposing sides.
|
|
||||||
#padding:
|
|
||||||
# x: 0
|
|
||||||
# y: 0
|
|
||||||
|
|
||||||
# Spread additional padding evenly around the terminal content.
|
|
||||||
#dynamic_padding: false
|
|
||||||
|
|
||||||
# Window decorations
|
|
||||||
#
|
|
||||||
# Values for `decorations`:
|
|
||||||
# - full: Borders and title bar
|
|
||||||
# - none: Neither borders nor title bar
|
|
||||||
#
|
|
||||||
# Values for `decorations` (macOS only):
|
|
||||||
# - transparent: Title bar, transparent background and title bar buttons
|
|
||||||
# - buttonless: Title bar, transparent background and no title bar buttons
|
|
||||||
#decorations: full
|
|
||||||
|
|
||||||
# Background opacity
|
|
||||||
#
|
|
||||||
# Window opacity as a floating point number from `0.0` to `1.0`.
|
|
||||||
# The value `0.0` is completely transparent and `1.0` is opaque.
|
|
||||||
#opacity: 1.0
|
|
||||||
|
|
||||||
# Startup Mode (changes require restart)
|
|
||||||
#
|
|
||||||
# Values for `startup_mode`:
|
|
||||||
# - Windowed
|
|
||||||
# - Maximized
|
|
||||||
# - Fullscreen
|
|
||||||
#
|
|
||||||
# Values for `startup_mode` (macOS only):
|
|
||||||
# - SimpleFullscreen
|
|
||||||
#startup_mode: Windowed
|
|
||||||
|
|
||||||
# Window title
|
|
||||||
#title: Alacritty
|
|
||||||
|
|
||||||
# Allow terminal applications to change Alacritty's window title.
|
|
||||||
#dynamic_title: true
|
|
||||||
|
|
||||||
# Window class (Linux/BSD only):
|
|
||||||
#class:
|
|
||||||
# Application instance name
|
|
||||||
#instance: Alacritty
|
|
||||||
# General application class
|
|
||||||
#general: Alacritty
|
|
||||||
|
|
||||||
# Decorations theme variant (Linux/BSD only)
|
|
||||||
#
|
|
||||||
# Override the variant of the GTK theme/Wayland client side decorations.
|
|
||||||
# Commonly supported values are `dark` and `light`. Set this to `None` to use
|
|
||||||
# the default theme variant.
|
|
||||||
#decorations_theme_variant: None
|
|
||||||
|
|
||||||
#scrolling:
|
|
||||||
# Maximum number of lines in the scrollback buffer.
|
|
||||||
# Specifying '0' will disable scrolling.
|
|
||||||
#history: 10000
|
|
||||||
|
|
||||||
# Scrolling distance multiplier.
|
|
||||||
#multiplier: 3
|
|
||||||
|
|
||||||
# Font configuration
|
|
||||||
font:
|
|
||||||
# Normal (roman) font face
|
|
||||||
normal:
|
|
||||||
# Font family
|
|
||||||
#
|
|
||||||
# Default:
|
|
||||||
# - (macOS) Menlo
|
|
||||||
# - (Linux/BSD) monospace
|
|
||||||
# - (Windows) Consolas
|
|
||||||
family: DroidSansMono NF
|
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
|
||||||
#style: Regular
|
|
||||||
|
|
||||||
# Bold font face
|
|
||||||
#bold:
|
|
||||||
# Font family
|
|
||||||
#
|
|
||||||
# If the bold family is not specified, it will fall back to the
|
|
||||||
# value specified for the normal font.
|
|
||||||
#family: monospace
|
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
|
||||||
#style: Bold
|
|
||||||
|
|
||||||
# Italic font face
|
|
||||||
#italic:
|
|
||||||
# Font family
|
|
||||||
#
|
|
||||||
# If the italic family is not specified, it will fall back to the
|
|
||||||
# value specified for the normal font.
|
|
||||||
#family: monospace
|
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
|
||||||
#style: Italic
|
|
||||||
|
|
||||||
# Bold italic font face
|
|
||||||
#bold_italic:
|
|
||||||
# Font family
|
|
||||||
#
|
|
||||||
# If the bold italic family is not specified, it will fall back to the
|
|
||||||
# value specified for the normal font.
|
|
||||||
#family: monospace
|
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
|
||||||
#style: Bold Italic
|
|
||||||
|
|
||||||
# Point size
|
|
||||||
size: 7.0
|
|
||||||
|
|
||||||
# Offset is the extra space around each character. `offset.y` can be thought
|
|
||||||
# of as modifying the line spacing, and `offset.x` as modifying the letter
|
|
||||||
# spacing.
|
|
||||||
#offset:
|
|
||||||
# x: 0
|
|
||||||
# y: 0
|
|
||||||
|
|
||||||
# Glyph offset determines the locations of the glyphs within their cells with
|
|
||||||
# the default being at the bottom. Increasing `x` moves the glyph to the
|
|
||||||
# right, increasing `y` moves the glyph upward.
|
|
||||||
#glyph_offset:
|
|
||||||
# x: 0
|
|
||||||
# y: 0
|
|
||||||
|
|
||||||
# Use built-in font for box drawing characters.
|
|
||||||
#
|
|
||||||
# If `true`, Alacritty will use a custom built-in font for box drawing
|
|
||||||
# characters (Unicode points 2500 - 259f).
|
|
||||||
#
|
|
||||||
#builtin_box_drawing: true
|
|
||||||
|
|
||||||
# If `true`, bold text is drawn using the bright color variants.
|
|
||||||
#draw_bold_text_with_bright_colors: false
|
|
||||||
|
|
||||||
# Colors (Tomorrow Night)
|
|
||||||
#colors:
|
|
||||||
# Default colors
|
|
||||||
#primary:
|
|
||||||
# background: '#1d1f21'
|
|
||||||
# foreground: '#c5c8c6'
|
|
||||||
|
|
||||||
# Bright and dim foreground colors
|
|
||||||
#
|
|
||||||
# The dimmed foreground color is calculated automatically if it is not
|
|
||||||
# present. If the bright foreground color is not set, or
|
|
||||||
# `draw_bold_text_with_bright_colors` is `false`, the normal foreground
|
|
||||||
# color will be used.
|
|
||||||
#dim_foreground: '#828482'
|
|
||||||
#bright_foreground: '#eaeaea'
|
|
||||||
|
|
||||||
# Cursor colors
|
|
||||||
#
|
|
||||||
# Colors which should be used to draw the terminal cursor.
|
|
||||||
#
|
|
||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
|
||||||
#cursor:
|
|
||||||
# text: CellBackground
|
|
||||||
# cursor: CellForeground
|
|
||||||
|
|
||||||
# Vi mode cursor colors
|
|
||||||
#
|
|
||||||
# Colors for the cursor when the vi mode is active.
|
|
||||||
#
|
|
||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
|
||||||
#vi_mode_cursor:
|
|
||||||
# text: CellBackground
|
|
||||||
# cursor: CellForeground
|
|
||||||
|
|
||||||
# Search colors
|
|
||||||
#
|
|
||||||
# Colors used for the search bar and match highlighting.
|
|
||||||
#search:
|
|
||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
|
||||||
#matches:
|
|
||||||
# foreground: '#000000'
|
|
||||||
# background: '#ffffff'
|
|
||||||
#focused_match:
|
|
||||||
# foreground: '#ffffff'
|
|
||||||
# background: '#000000'
|
|
||||||
|
|
||||||
# Keyboard hints
|
|
||||||
#hints:
|
|
||||||
# First character in the hint label
|
|
||||||
#
|
|
||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
|
||||||
#start:
|
|
||||||
# foreground: '#1d1f21'
|
|
||||||
# background: '#e9ff5e'
|
|
||||||
|
|
||||||
# All characters after the first one in the hint label
|
|
||||||
#
|
|
||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
|
||||||
#end:
|
|
||||||
# foreground: '#e9ff5e'
|
|
||||||
# background: '#1d1f21'
|
|
||||||
|
|
||||||
# Line indicator
|
|
||||||
#
|
|
||||||
# Color used for the indicator displaying the position in history during
|
|
||||||
# search and vi mode.
|
|
||||||
#
|
|
||||||
# By default, these will use the opposing primary color.
|
|
||||||
#line_indicator:
|
|
||||||
# foreground: None
|
|
||||||
# background: None
|
|
||||||
|
|
||||||
# Footer bar
|
|
||||||
#
|
|
||||||
# Color used for the footer bar on the bottom, used by search regex input,
|
|
||||||
# hyperlink URI preview, etc.
|
|
||||||
#
|
|
||||||
#footer_bar:
|
|
||||||
# background: '#c5c8c6'
|
|
||||||
# foreground: '#1d1f21'
|
|
||||||
|
|
||||||
# Selection colors
|
|
||||||
#
|
|
||||||
# Colors which should be used to draw the selection area.
|
|
||||||
#
|
|
||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
|
||||||
#selection:
|
|
||||||
# text: CellBackground
|
|
||||||
# background: CellForeground
|
|
||||||
|
|
||||||
# Normal colors
|
|
||||||
#normal:
|
|
||||||
# black: '#1d1f21'
|
|
||||||
# red: '#cc6666'
|
|
||||||
# green: '#b5bd68'
|
|
||||||
# yellow: '#f0c674'
|
|
||||||
# blue: '#81a2be'
|
|
||||||
# magenta: '#b294bb'
|
|
||||||
# cyan: '#8abeb7'
|
|
||||||
# white: '#c5c8c6'
|
|
||||||
|
|
||||||
# Bright colors
|
|
||||||
#bright:
|
|
||||||
# black: '#666666'
|
|
||||||
# red: '#d54e53'
|
|
||||||
# green: '#b9ca4a'
|
|
||||||
# yellow: '#e7c547'
|
|
||||||
# blue: '#7aa6da'
|
|
||||||
# magenta: '#c397d8'
|
|
||||||
# cyan: '#70c0b1'
|
|
||||||
# white: '#eaeaea'
|
|
||||||
|
|
||||||
# Dim colors
|
|
||||||
#
|
|
||||||
# If the dim colors are not set, they will be calculated automatically based
|
|
||||||
# on the `normal` colors.
|
|
||||||
#dim:
|
|
||||||
# black: '#131415'
|
|
||||||
# red: '#864343'
|
|
||||||
# green: '#777c44'
|
|
||||||
# yellow: '#9e824c'
|
|
||||||
# blue: '#556a7d'
|
|
||||||
# magenta: '#75617b'
|
|
||||||
# cyan: '#5b7d78'
|
|
||||||
# white: '#828482'
|
|
||||||
|
|
||||||
# Indexed Colors
|
|
||||||
#
|
|
||||||
# The indexed colors include all colors from 16 to 256.
|
|
||||||
# When these are not set, they're filled with sensible defaults.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# `- { index: 16, color: '#ff00ff' }`
|
|
||||||
#
|
|
||||||
#indexed_colors: []
|
|
||||||
|
|
||||||
# Transparent cell backgrounds
|
|
||||||
#
|
|
||||||
# Whether or not `window.opacity` applies to all cell backgrounds or only to
|
|
||||||
# the default background. When set to `true` all cells will be transparent
|
|
||||||
# regardless of their background color.
|
|
||||||
#transparent_background_colors: false
|
|
||||||
|
|
||||||
# Bell
|
|
||||||
#
|
|
||||||
# The bell is rung every time the BEL control character is received.
|
|
||||||
#bell:
|
|
||||||
# Visual Bell Animation
|
|
||||||
#
|
|
||||||
# Animation effect for flashing the screen when the visual bell is rung.
|
|
||||||
#
|
|
||||||
# Values for `animation`:
|
|
||||||
# - Ease
|
|
||||||
# - EaseOut
|
|
||||||
# - EaseOutSine
|
|
||||||
# - EaseOutQuad
|
|
||||||
# - EaseOutCubic
|
|
||||||
# - EaseOutQuart
|
|
||||||
# - EaseOutQuint
|
|
||||||
# - EaseOutExpo
|
|
||||||
# - EaseOutCirc
|
|
||||||
# - Linear
|
|
||||||
#animation: EaseOutExpo
|
|
||||||
|
|
||||||
# Duration of the visual bell flash in milliseconds. A `duration` of `0` will
|
|
||||||
# disable the visual bell animation.
|
|
||||||
#duration: 0
|
|
||||||
|
|
||||||
# Visual bell animation color.
|
|
||||||
#color: '#ffffff'
|
|
||||||
|
|
||||||
# Bell Command
|
|
||||||
#
|
|
||||||
# This program is executed whenever the bell is rung.
|
|
||||||
#
|
|
||||||
# When set to `command: None`, no command will be executed.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# command:
|
|
||||||
# program: notify-send
|
|
||||||
# args: ["Hello, World!"]
|
|
||||||
#
|
|
||||||
#command: None
|
|
||||||
|
|
||||||
#selection:
|
|
||||||
# This string contains all characters that are used as separators for
|
|
||||||
# "semantic words" in Alacritty.
|
|
||||||
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
|
|
||||||
|
|
||||||
# When set to `true`, selected text will be copied to the primary clipboard.
|
|
||||||
#save_to_clipboard: false
|
|
||||||
|
|
||||||
#cursor:
|
|
||||||
# Cursor style
|
|
||||||
#style:
|
|
||||||
# Cursor shape
|
|
||||||
#
|
|
||||||
# Values for `shape`:
|
|
||||||
# - ▇ Block
|
|
||||||
# - _ Underline
|
|
||||||
# - | Beam
|
|
||||||
#shape: Block
|
|
||||||
|
|
||||||
# Cursor blinking state
|
|
||||||
#
|
|
||||||
# Values for `blinking`:
|
|
||||||
# - Never: Prevent the cursor from ever blinking
|
|
||||||
# - Off: Disable blinking by default
|
|
||||||
# - On: Enable blinking by default
|
|
||||||
# - Always: Force the cursor to always blink
|
|
||||||
#blinking: Off
|
|
||||||
|
|
||||||
# Vi mode cursor style
|
|
||||||
#
|
|
||||||
# If the vi mode cursor style is `None` or not specified, it will fall back to
|
|
||||||
# the style of the active value of the normal cursor.
|
|
||||||
#
|
|
||||||
# See `cursor.style` for available options.
|
|
||||||
#vi_mode_style: None
|
|
||||||
|
|
||||||
# Cursor blinking interval in milliseconds.
|
|
||||||
#blink_interval: 750
|
|
||||||
|
|
||||||
# Time after which cursor stops blinking, in seconds.
|
|
||||||
#
|
|
||||||
# Specifying '0' will disable timeout for blinking.
|
|
||||||
#blink_timeout: 5
|
|
||||||
|
|
||||||
# If this is `true`, the cursor will be rendered as a hollow box when the
|
|
||||||
# window is not focused.
|
|
||||||
#unfocused_hollow: true
|
|
||||||
|
|
||||||
# Thickness of the cursor relative to the cell width as floating point number
|
|
||||||
# from `0.0` to `1.0`.
|
|
||||||
#thickness: 0.15
|
|
||||||
|
|
||||||
# Live config reload (changes require restart)
|
|
||||||
#live_config_reload: true
|
|
||||||
|
|
||||||
# Shell
|
|
||||||
#
|
|
||||||
# You can set `shell.program` to the path of your favorite shell, e.g.
|
|
||||||
# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the
|
|
||||||
# shell.
|
|
||||||
#
|
|
||||||
# Default:
|
|
||||||
# - (Linux/BSD/macOS) `$SHELL` or the user's login shell, if `$SHELL` is unset
|
|
||||||
# - (Windows) powershell
|
|
||||||
#shell:
|
|
||||||
# program: /bin/bash
|
|
||||||
# args:
|
|
||||||
# - --login
|
|
||||||
|
|
||||||
# Startup directory
|
|
||||||
#
|
|
||||||
# Directory the shell is started in. If this is unset, or `None`, the working
|
|
||||||
# directory of the parent process will be used.
|
|
||||||
#working_directory: None
|
|
||||||
|
|
||||||
# Send ESC (\x1b) before characters when alt is pressed.
|
|
||||||
#alt_send_esc: true
|
|
||||||
|
|
||||||
# Offer IPC using `alacritty msg` (unix only)
|
|
||||||
# ipc_socket: true
|
|
||||||
|
|
||||||
#mouse:
|
|
||||||
# Click settings
|
|
||||||
#
|
|
||||||
# The `double_click` and `triple_click` settings control the time
|
|
||||||
# alacritty should wait for accepting multiple clicks as one double
|
|
||||||
# or triple click.
|
|
||||||
#double_click: { threshold: 300 }
|
|
||||||
#triple_click: { threshold: 300 }
|
|
||||||
|
|
||||||
# If this is `true`, the cursor is temporarily hidden when typing.
|
|
||||||
#hide_when_typing: false
|
|
||||||
|
|
||||||
# Hints
|
|
||||||
#
|
|
||||||
# Terminal hints can be used to find text or hyperlink in the visible part of
|
|
||||||
# the terminal and pipe it to other applications.
|
|
||||||
#hints:
|
|
||||||
# Keys used for the hint labels.
|
|
||||||
#alphabet: "jfkdls;ahgurieowpq"
|
|
||||||
|
|
||||||
# List with all available hints
|
|
||||||
#
|
|
||||||
# Each hint must have any of `regex` or `hyperlinks` field and either an
|
|
||||||
# `action` or a `command` field. The fields `mouse`, `binding` and
|
|
||||||
# `post_processing` are optional.
|
|
||||||
#
|
|
||||||
# The `hyperlinks` option will cause OSC 8 escape sequence hyperlinks to be
|
|
||||||
# highlighted.
|
|
||||||
#
|
|
||||||
# The fields `command`, `binding.key`, `binding.mods`, `binding.mode` and
|
|
||||||
# `mouse.mods` accept the same values as they do in the `key_bindings` section.
|
|
||||||
#
|
|
||||||
# The `mouse.enabled` field controls if the hint should be underlined while
|
|
||||||
# the mouse with all `mouse.mods` keys held or the vi mode cursor is above it.
|
|
||||||
#
|
|
||||||
# If the `post_processing` field is set to `true`, heuristics will be used to
|
|
||||||
# shorten the match if there are characters likely not to be part of the hint
|
|
||||||
# (e.g. a trailing `.`). This is most useful for URIs and applies only to
|
|
||||||
# `regex` matches.
|
|
||||||
#
|
|
||||||
# Values for `action`:
|
|
||||||
# - Copy
|
|
||||||
# Copy the hint's text to the clipboard.
|
|
||||||
# - Paste
|
|
||||||
# Paste the hint's text to the terminal or search.
|
|
||||||
# - Select
|
|
||||||
# Select the hint's text.
|
|
||||||
# - MoveViModeCursor
|
|
||||||
# Move the vi mode cursor to the beginning of the hint.
|
|
||||||
#enabled:
|
|
||||||
# - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\
|
|
||||||
# [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"
|
|
||||||
# hyperlinks: true
|
|
||||||
# command: xdg-open
|
|
||||||
# post_processing: true
|
|
||||||
# mouse:
|
|
||||||
# enabled: true
|
|
||||||
# mods: None
|
|
||||||
# binding:
|
|
||||||
# key: U
|
|
||||||
# mods: Control|Shift
|
|
||||||
|
|
||||||
# Mouse bindings
|
|
||||||
#
|
|
||||||
# Mouse bindings are specified as a list of objects, much like the key
|
|
||||||
# bindings further below.
|
|
||||||
#
|
|
||||||
# To trigger mouse bindings when an application running within Alacritty
|
|
||||||
# captures the mouse, the `Shift` modifier is automatically added as a
|
|
||||||
# requirement.
|
|
||||||
#
|
|
||||||
# Each mouse binding will specify a:
|
|
||||||
#
|
|
||||||
# - `mouse`:
|
|
||||||
#
|
|
||||||
# - Middle
|
|
||||||
# - Left
|
|
||||||
# - Right
|
|
||||||
# - Numeric identifier such as `5`
|
|
||||||
#
|
|
||||||
# - `action` (see key bindings for actions not exclusive to mouse mode)
|
|
||||||
#
|
|
||||||
# - Mouse exclusive actions:
|
|
||||||
#
|
|
||||||
# - ExpandSelection
|
|
||||||
# Expand the selection to the current mouse cursor location.
|
|
||||||
#
|
|
||||||
# And optionally:
|
|
||||||
#
|
|
||||||
# - `mods` (see key bindings)
|
|
||||||
#mouse_bindings:
|
|
||||||
# - { mouse: Right, action: ExpandSelection }
|
|
||||||
# - { mouse: Right, mods: Control, action: ExpandSelection }
|
|
||||||
# - { mouse: Middle, mode: ~Vi, action: PasteSelection }
|
|
||||||
|
|
||||||
# Key bindings
|
|
||||||
#
|
|
||||||
# Key bindings are specified as a list of objects. For example, this is the
|
|
||||||
# default paste binding:
|
|
||||||
#
|
|
||||||
# `- { key: V, mods: Control|Shift, action: Paste }`
|
|
||||||
#
|
|
||||||
# Each key binding will specify a:
|
|
||||||
#
|
|
||||||
# - `key`: Identifier of the key pressed
|
|
||||||
#
|
|
||||||
# - A-Z
|
|
||||||
# - F1-F24
|
|
||||||
# - Key0-Key9
|
|
||||||
#
|
|
||||||
# A full list with available key codes can be found here:
|
|
||||||
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
|
|
||||||
#
|
|
||||||
# Instead of using the name of the keys, the `key` field also supports using
|
|
||||||
# the scancode of the desired key. Scancodes have to be specified as a
|
|
||||||
# decimal number. This command will allow you to display the hex scancodes
|
|
||||||
# for certain keys:
|
|
||||||
#
|
|
||||||
# `showkey --scancodes`.
|
|
||||||
#
|
|
||||||
# Then exactly one of:
|
|
||||||
#
|
|
||||||
# - `chars`: Send a byte sequence to the running application
|
|
||||||
#
|
|
||||||
# The `chars` field writes the specified string to the terminal. This makes
|
|
||||||
# it possible to pass escape sequences. To find escape codes for bindings
|
|
||||||
# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside
|
|
||||||
# of tmux. Note that applications use terminfo to map escape sequences back
|
|
||||||
# to keys. It is therefore required to update the terminfo when changing an
|
|
||||||
# escape sequence.
|
|
||||||
#
|
|
||||||
# - `action`: Execute a predefined action
|
|
||||||
#
|
|
||||||
# - ToggleViMode
|
|
||||||
# - SearchForward
|
|
||||||
# Start searching toward the right of the search origin.
|
|
||||||
# - SearchBackward
|
|
||||||
# Start searching toward the left of the search origin.
|
|
||||||
# - Copy
|
|
||||||
# - Paste
|
|
||||||
# - IncreaseFontSize
|
|
||||||
# - DecreaseFontSize
|
|
||||||
# - ResetFontSize
|
|
||||||
# - ScrollPageUp
|
|
||||||
# - ScrollPageDown
|
|
||||||
# - ScrollHalfPageUp
|
|
||||||
# - ScrollHalfPageDown
|
|
||||||
# - ScrollLineUp
|
|
||||||
# - ScrollLineDown
|
|
||||||
# - ScrollToTop
|
|
||||||
# - ScrollToBottom
|
|
||||||
# - ClearHistory
|
|
||||||
# Remove the terminal's scrollback history.
|
|
||||||
# - Hide
|
|
||||||
# Hide the Alacritty window.
|
|
||||||
# - Minimize
|
|
||||||
# Minimize the Alacritty window.
|
|
||||||
# - Quit
|
|
||||||
# Quit Alacritty.
|
|
||||||
# - ToggleFullscreen
|
|
||||||
# - SpawnNewInstance
|
|
||||||
# Spawn a new instance of Alacritty.
|
|
||||||
# - CreateNewWindow
|
|
||||||
# Create a new Alacritty window from the current process.
|
|
||||||
# - ClearLogNotice
|
|
||||||
# Clear Alacritty's UI warning and error notice.
|
|
||||||
# - ClearSelection
|
|
||||||
# Remove the active selection.
|
|
||||||
# - ReceiveChar
|
|
||||||
# - None
|
|
||||||
#
|
|
||||||
# - Vi mode exclusive actions:
|
|
||||||
#
|
|
||||||
# - Open
|
|
||||||
# Perform the action of the first matching hint under the vi mode cursor
|
|
||||||
# with `mouse.enabled` set to `true`.
|
|
||||||
# - ToggleNormalSelection
|
|
||||||
# - ToggleLineSelection
|
|
||||||
# - ToggleBlockSelection
|
|
||||||
# - ToggleSemanticSelection
|
|
||||||
# Toggle semantic selection based on `selection.semantic_escape_chars`.
|
|
||||||
# - CenterAroundViCursor
|
|
||||||
# Center view around vi mode cursor
|
|
||||||
#
|
|
||||||
# - Vi mode exclusive cursor motion actions:
|
|
||||||
#
|
|
||||||
# - Up
|
|
||||||
# One line up.
|
|
||||||
# - Down
|
|
||||||
# One line down.
|
|
||||||
# - Left
|
|
||||||
# One character left.
|
|
||||||
# - Right
|
|
||||||
# One character right.
|
|
||||||
# - First
|
|
||||||
# First column, or beginning of the line when already at the first column.
|
|
||||||
# - Last
|
|
||||||
# Last column, or beginning of the line when already at the last column.
|
|
||||||
# - FirstOccupied
|
|
||||||
# First non-empty cell in this terminal row, or first non-empty cell of
|
|
||||||
# the line when already at the first cell of the row.
|
|
||||||
# - High
|
|
||||||
# Top of the screen.
|
|
||||||
# - Middle
|
|
||||||
# Center of the screen.
|
|
||||||
# - Low
|
|
||||||
# Bottom of the screen.
|
|
||||||
# - SemanticLeft
|
|
||||||
# Start of the previous semantically separated word.
|
|
||||||
# - SemanticRight
|
|
||||||
# Start of the next semantically separated word.
|
|
||||||
# - SemanticLeftEnd
|
|
||||||
# End of the previous semantically separated word.
|
|
||||||
# - SemanticRightEnd
|
|
||||||
# End of the next semantically separated word.
|
|
||||||
# - WordLeft
|
|
||||||
# Start of the previous whitespace separated word.
|
|
||||||
# - WordRight
|
|
||||||
# Start of the next whitespace separated word.
|
|
||||||
# - WordLeftEnd
|
|
||||||
# End of the previous whitespace separated word.
|
|
||||||
# - WordRightEnd
|
|
||||||
# End of the next whitespace separated word.
|
|
||||||
# - Bracket
|
|
||||||
# Character matching the bracket at the cursor's location.
|
|
||||||
# - SearchNext
|
|
||||||
# Beginning of the next match.
|
|
||||||
# - SearchPrevious
|
|
||||||
# Beginning of the previous match.
|
|
||||||
# - SearchStart
|
|
||||||
# Start of the match to the left of the vi mode cursor.
|
|
||||||
# - SearchEnd
|
|
||||||
# End of the match to the right of the vi mode cursor.
|
|
||||||
#
|
|
||||||
# - Search mode exclusive actions:
|
|
||||||
# - SearchFocusNext
|
|
||||||
# Move the focus to the next search match.
|
|
||||||
# - SearchFocusPrevious
|
|
||||||
# Move the focus to the previous search match.
|
|
||||||
# - SearchConfirm
|
|
||||||
# - SearchCancel
|
|
||||||
# - SearchClear
|
|
||||||
# Reset the search regex.
|
|
||||||
# - SearchDeleteWord
|
|
||||||
# Delete the last word in the search regex.
|
|
||||||
# - SearchHistoryPrevious
|
|
||||||
# Go to the previous regex in the search history.
|
|
||||||
# - SearchHistoryNext
|
|
||||||
# Go to the next regex in the search history.
|
|
||||||
#
|
|
||||||
# - macOS exclusive actions:
|
|
||||||
# - ToggleSimpleFullscreen
|
|
||||||
# Enter fullscreen without occupying another space.
|
|
||||||
#
|
|
||||||
# - Linux/BSD exclusive actions:
|
|
||||||
#
|
|
||||||
# - CopySelection
|
|
||||||
# Copy from the selection buffer.
|
|
||||||
# - PasteSelection
|
|
||||||
# Paste from the selection buffer.
|
|
||||||
#
|
|
||||||
# - `command`: Fork and execute a specified command plus arguments
|
|
||||||
#
|
|
||||||
# The `command` field must be a map containing a `program` string and an
|
|
||||||
# `args` array of command line parameter strings. For example:
|
|
||||||
# `{ program: "alacritty", args: ["-e", "vttest"] }`
|
|
||||||
#
|
|
||||||
# And optionally:
|
|
||||||
#
|
|
||||||
# - `mods`: Key modifiers to filter binding actions
|
|
||||||
#
|
|
||||||
# - Command
|
|
||||||
# - Control
|
|
||||||
# - Option
|
|
||||||
# - Super
|
|
||||||
# - Shift
|
|
||||||
# - Alt
|
|
||||||
#
|
|
||||||
# Multiple `mods` can be combined using `|` like this:
|
|
||||||
# `mods: Control|Shift`.
|
|
||||||
# Whitespace and capitalization are relevant and must match the example.
|
|
||||||
#
|
|
||||||
# - `mode`: Indicate a binding for only specific terminal reported modes
|
|
||||||
#
|
|
||||||
# This is mainly used to send applications the correct escape sequences
|
|
||||||
# when in different modes.
|
|
||||||
#
|
|
||||||
# - AppCursor
|
|
||||||
# - AppKeypad
|
|
||||||
# - Search
|
|
||||||
# - Alt
|
|
||||||
# - Vi
|
|
||||||
#
|
|
||||||
# A `~` operator can be used before a mode to apply the binding whenever
|
|
||||||
# the mode is *not* active, e.g. `~Alt`.
|
|
||||||
#
|
|
||||||
# Bindings are always filled by default, but will be replaced when a new
|
|
||||||
# binding with the same triggers is defined. To unset a default binding, it can
|
|
||||||
# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for
|
|
||||||
# a no-op if you do not wish to receive input characters for that binding.
|
|
||||||
#
|
|
||||||
# If the same trigger is assigned to multiple actions, all of them are executed
|
|
||||||
# in the order they were defined in.
|
|
||||||
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 }
|
|
||||||
- { key: Return, mods: Alt, action: ToggleFullscreen }
|
|
||||||
#- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward }
|
|
||||||
#- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward }
|
|
||||||
#- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection }
|
|
||||||
#- { key: Insert, mods: Shift, action: PasteSelection }
|
|
||||||
#- { key: Key0, mods: Control, action: ResetFontSize }
|
|
||||||
#- { key: Equals, mods: Control, action: IncreaseFontSize }
|
|
||||||
#- { key: Plus, mods: Control, action: IncreaseFontSize }
|
|
||||||
#- { key: NumpadAdd, mods: Control, action: IncreaseFontSize }
|
|
||||||
#- { key: Minus, mods: Control, action: DecreaseFontSize }
|
|
||||||
#- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }
|
|
||||||
|
|
||||||
# (macOS only)
|
|
||||||
#- { key: K, mods: Command, mode: ~Vi|~Search, chars: "\x0c" }
|
|
||||||
#- { key: K, mods: Command, mode: ~Vi|~Search, action: ClearHistory }
|
|
||||||
#- { key: Key0, mods: Command, action: ResetFontSize }
|
|
||||||
#- { key: Equals, mods: Command, action: IncreaseFontSize }
|
|
||||||
#- { key: Plus, mods: Command, action: IncreaseFontSize }
|
|
||||||
#- { key: NumpadAdd, mods: Command, action: IncreaseFontSize }
|
|
||||||
#- { key: Minus, mods: Command, action: DecreaseFontSize }
|
|
||||||
#- { key: NumpadSubtract, mods: Command, action: DecreaseFontSize }
|
|
||||||
#- { key: V, mods: Command, action: Paste }
|
|
||||||
#- { key: C, mods: Command, action: Copy }
|
|
||||||
#- { key: C, mods: Command, mode: Vi|~Search, action: ClearSelection }
|
|
||||||
#- { key: H, mods: Command, action: Hide }
|
|
||||||
#- { key: H, mods: Command|Alt, action: HideOtherApplications }
|
|
||||||
#- { key: M, mods: Command, action: Minimize }
|
|
||||||
#- { key: Q, mods: Command, action: Quit }
|
|
||||||
#- { key: W, mods: Command, action: Quit }
|
|
||||||
#- { key: N, mods: Command, action: SpawnNewInstance }
|
|
||||||
- { key: Return, mods: Command, action: ToggleFullscreen }
|
|
||||||
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
|
|
||||||
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
|
|
||||||
|
|
||||||
#debug:
|
|
||||||
# Display the time it takes to redraw each frame.
|
|
||||||
#render_timer: false
|
|
||||||
|
|
||||||
# Keep the log file after quitting Alacritty.
|
|
||||||
#persistent_logging: false
|
|
||||||
|
|
||||||
# Log level
|
|
||||||
#
|
|
||||||
# Values for `log_level`:
|
|
||||||
# - Off
|
|
||||||
# - Error
|
|
||||||
# - Warn
|
|
||||||
# - Info
|
|
||||||
# - Debug
|
|
||||||
# - Trace
|
|
||||||
#log_level: Warn
|
|
||||||
|
|
||||||
# Print all received window events.
|
|
||||||
#print_events: false
|
|
||||||
|
|
||||||
# Highlight window damage information.
|
|
||||||
#highlight_damage: false
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# This file installs dependencies needed for the Neovim plugins
|
|
||||||
echo "Please run this in sudo mode for sudo apt* commands"
|
|
||||||
|
|
||||||
# Pip and Python3
|
|
||||||
if [ ! python3 --version ] ; then
|
|
||||||
PYTHON_3=${PYTHON_3:-"python3.10"}
|
|
||||||
apt install $PYTHON_3
|
|
||||||
$PYTHON_3 -m ensurepip --upgrade
|
|
||||||
$PYTHON_3 -m pip install --upgrade pip
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Neovim vim-plug
|
|
||||||
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
|
||||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH0Z5noQn3mHy5yiN3n6YyOKRhlQT6fx4NLmI/3d4vY6 root@Fel
|
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClSDhyOeehUOIMdRonTDD9h7kBbzC3c/QG650S7vfhLE67UNt5tuUjazQg7pFj3O/5WnyqCpBOMJoPaSZ0S5gGdo4h4xatPUBAGDjMygKhg4VA0x7Lr3Tbc1CF8dyuRKVlB+aIWLIyLHHPL5wDao7tnvmuCGKDyaV8XFaKpzRZqAlpfn8svR90Y4wNFYr1V+F+Y6r8reB1Rph6A9BY4niDKY0MbFhvTj6VJQf++1ji0FziACVpYI9aqAcZ4ngReUtgWiIsnq5UMfrEk0vYBG/3KsYElaRig76Bucz1fBA16iAgQua1hthPifsw8vmaK5k6Q3c2SOdc5PGF6IlTfSGJ root@Fel
|
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD49VHCU8S6zqNsaS0SFiVqULmOWtyVOIeteYSOznzTHJ0dVjXnamuj/uVsSXRkYIIdAkABWQm9WKELUC2SBBE7DgDj+Izv3cO7QkAJ9v1cxV1P1efrTytz8XtyX++XYygxXCwZ5zyqxhSF5ZW+FO0CNRx1cNisAhF6AMzoXRsyF1dqNioitXTN0xh0xx2mR0Bb3zy1kYNZVwn1uBYyd4Hz6CBgJ7Xi6d/STXWcmc0XnEJTllNSQNEpI6vJjL62JmUPubqDjVKh4awiPRPiw9By1FGaGVtHhOZ+8AvVMTps07GNVJ+XZi1DJLmeItpiCwYsWh96HCp3lup0onLzubpP pi@raspberrypi
|
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFQN5Ia8rTalnQgcvdxH2n7UNNT1Tq9UvNdJeg9ziJtUkKaC6H4NM4ArOEZ60izANOQX1crAD8hmBmz1Go8/4P3VXTYlTb7eDyZqLyncOe/shBXeVVLxJWzhEj60RTgecnmNYdtRAm+9INbPW/Bvcj8U2KyaykIXZGdjIuZ7TPruHjITxZYR+dkDOoVkJuYJMdYzxyHZpylPh+HjgDDvUG3oNJtj4ri5JKwLAMyq5t5S1JcLx4rXivrKREizUMMG8LzWSfjeByTzF8+lHtUdP94ygG02v/6Jod/g6taUQS9Yu+NDFqkKjRH3H9jgyd/DVGsRw5akBWbR81DATtTprx ssh-key-2022-12-15
|
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgmng5xL/auvI2F8ufFAfId2Ey55ONHjgnKKSEWLVWkPMutXT3BCnSglNAuEVRLX2zfzg3beQd80AHTow+qro5QWI/rYfeL1QPNEwoThbRFcvtWLTlgzBGA4ejjpIF9sCPNp0sXrrQRfxRP7w4b23BcRJQcsDoaEtKGKJZ2GQIoOafkYypwcunANb54EAouZTfHEPKDr26Gfw8usc2Sae32G/80QLBF2jGabyexJjNE3F6hdJTwq5iiqIVdSr4ue82zo3M8jBdtCMDGaOliI5RWSa9iuX9o2scCGDU69Gkw7ma+JHOP/e9Z8sUz03TkjPbEnGi3EC3YAHEoDzmwqTi07hppCuzacLB5NZ9UZ1g5PzBIZR8TJTONngT08EQyGrkNv2sUnn0dtBqve5tHR04NuXy65ym7Iwl2DDVbAL0NlM4gKWzOGZ2CnSLT0WmkG2sQKU37NmS2pBJ8RXJBatUFe4vQVzqlFj39iRGIBV5XR0I9xcxDfCxBHFs3aIqAqE= hwtr@hwtr-prince
|
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/UzKwmFsAlLoCXvOq2lsC1sr1BRDW5uPkdcYUfQ7z4JowL/pscoTV9zjfJd1hPBvHLBvn7gs7gWt0wNnJfD1Oor26VreHjhi1PZE2kovrEzjmPoz+GqMPciV+HF9XNIRwDiHlUNFPt9qJjAJXJCFhzcmT9q0JQuPlNgJtQ6+By7RgPuJczpf17IbxpheLcXqtOFcTHyRT01KijIPhAtWRlmG5dahVuu50EfpmHRYZ8nCJJqkuJ6uRbFaPE6mYLnXLSzJUdyakYnzWbCd5phpoGAuFyQZnS503CFZUOFCnNEN8QfO2DXihp7lvrzzpI6PgcpvpotSo9kYFiEuB+DRlBQcVMWL0lUk2J1JHJH83y3CxwH0pUc7E1k6FAZE4pv4x0KEvbZSvmb8jAGWZkn4HvZCwXR5wGVi22s6RCdIHvR2PCpAy+ZSjpM+2FJIqDHpxY/vo3ktM9rpeCSwp14F/iiw6nanVq/KZBpCZ2paMcAU4WreCFZiPdGsdiixYlts= hungtr@bao
|
|
||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAW4E8L/zGkcqixJo1102ddqeexoBMHIhXRXpWR3dTmJtbaaVbo4+rHRsjHPvHif9CRfi+BQ8CHG3zmBjH7DZPZIRCVtkms1EDe1k/G3fEnfgYc6gboJfoTdLkVjNOtdStTi03dCA/riQqUKc7/v16R5ZXIAmNCnmMHelObCSDPzYg8psZAUk1ZZY//pnhp9JRPsC2JxsshN7HCNIED9aFgrJkvUt+wUVGjVHzyQwyR6J7m1yyoivTwdmYdulG7OriLeeNq8vkoDmLGgLSC+zKehzJYOZsH3EKuxuZjQ3J9tK/NseQOhsQglRHE/OvphMwT/J96gl9dZR/LQXp4S6hwLccTzFfs8rLaTOIK6CEpqBUuBonot/1vJP5j5E73hfkHwZO7TQKwfXtpRCxCl5Nm3cB2Y3kz5mArDiwWioVsX4qd0XR0F9MFtuTVTn2f4K/Gwr9P3XMkLWXU1+1KbQiWIg+Zf5DpQgBW5HWryZzsMcjyMC2I2BJCl6Q+V8ofSM= nixos@Felia
|
|
|
@ -1,54 +0,0 @@
|
||||||
Host *
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
# felia mirror on windows
|
|
||||||
Host felia-win
|
|
||||||
HostName felia.coati-celsius.ts.net
|
|
||||||
Port 2222
|
|
||||||
User _nhitrl
|
|
||||||
|
|
||||||
# Ubuntu 12c 32G-RAM
|
|
||||||
Host felia
|
|
||||||
HostName felia.coati-celsius.ts.net
|
|
||||||
User ubuntu_admin
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
# 2c 16G-RAM 200G drive
|
|
||||||
Host fel
|
|
||||||
HostName fel.coati-celsius.ts.net
|
|
||||||
User user
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
# AMZ Linux aarch64 hungtr@AMZ
|
|
||||||
Host nioma
|
|
||||||
HostName ec2.pegasust.com
|
|
||||||
User ec2-user
|
|
||||||
IdentityFile ~/.ssh/free-aws.pem
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
# NixOS Pegasust-gh@Linode
|
|
||||||
Host nyx
|
|
||||||
HostName nyx.pegasust.com
|
|
||||||
User hungtr
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host lizzi
|
|
||||||
HostName 172.105.135.218
|
|
||||||
User hungtr
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host pixi
|
|
||||||
HostName 139.144.60.254
|
|
||||||
User hungtr
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host mokoi
|
|
||||||
HostName 129.146.98.121
|
|
||||||
User ubuntu_admin
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host noami
|
|
||||||
HostName 10.100.200.230
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
|
|
|
@ -1,98 +0,0 @@
|
||||||
# ~/.config/starship.toml
|
|
||||||
|
|
||||||
[aws]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[conda]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[dart]
|
|
||||||
symbol = " "
|
|
||||||
format = "via [$symbol]($style)"
|
|
||||||
|
|
||||||
[directory]
|
|
||||||
read_only = " "
|
|
||||||
truncation_length = 1
|
|
||||||
|
|
||||||
[docker_context]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[elixir]
|
|
||||||
symbol = " "
|
|
||||||
format = 'via [$symbol]($style)'
|
|
||||||
|
|
||||||
[elm]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[git_branch]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[golang]
|
|
||||||
symbol = " "
|
|
||||||
format = 'via [$symbol]($style)'
|
|
||||||
|
|
||||||
[hg_branch]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[java]
|
|
||||||
symbol = " "
|
|
||||||
format = 'via [$symbol]($style)'
|
|
||||||
|
|
||||||
[julia]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[memory_usage]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[nim]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[nix_shell]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[nodejs]
|
|
||||||
symbol = " "
|
|
||||||
format = 'via [$symbol]($style)'
|
|
||||||
|
|
||||||
[package]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[perl]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[php]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[python]
|
|
||||||
symbol = " "
|
|
||||||
format = 'via [$symbol]($style)'
|
|
||||||
|
|
||||||
[ruby]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[rust]
|
|
||||||
format = 'via [$symbol]($style)'
|
|
||||||
|
|
||||||
[scala]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[shlvl]
|
|
||||||
symbol = " "
|
|
||||||
|
|
||||||
[swift]
|
|
||||||
symbol = "ﯣ "
|
|
||||||
format = 'via [$symbol]($style)'
|
|
||||||
|
|
||||||
[git_status]
|
|
||||||
disabled = true
|
|
||||||
|
|
||||||
[shell]
|
|
||||||
zsh_indicator = "%"
|
|
||||||
fish_indicator = ""
|
|
||||||
powershell_indicator = "_"
|
|
||||||
unknown_indicator = "mystery shell"
|
|
||||||
style = "cyan bold"
|
|
||||||
disabled = false
|
|
||||||
|
|
||||||
[username]
|
|
||||||
show_always=true
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Configuration for tmux
|
|
||||||
set -g default-terminal "screen-256color" # more colors
|
|
||||||
set -ga terminal-overrides ",xterm-256color*:Tc" # more colors
|
|
||||||
set -s escape-time 0
|
|
||||||
set -g display-time 1500
|
|
||||||
|
|
||||||
# rebind C-b to C-a; easier to type on qwerty
|
|
||||||
unbind C-b
|
|
||||||
set -g prefix C-a
|
|
||||||
|
|
||||||
# bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded at ~/.tmux.conf"
|
|
||||||
set -g base-index 1 # rebind to start from 0
|
|
||||||
setw -g pane-base-index 1
|
|
||||||
set-option -g renumber-windows on
|
|
||||||
|
|
||||||
# status bar
|
|
||||||
set -g status-style 'bg=#333333 fg=#5eacd3'
|
|
||||||
|
|
||||||
# Keybinds
|
|
||||||
set-window-option -g mode-keys vi
|
|
|
@ -1,23 +0,0 @@
|
||||||
[note] # Settings that reflect the creation of a new note
|
|
||||||
language = "en"
|
|
||||||
default-title = "Untitled"
|
|
||||||
filename = "{{format-date now 'timestamp'}}" # Loyal to my current style: 202208201345
|
|
||||||
extension = "md" # might switch to mdx
|
|
||||||
|
|
||||||
[extra]
|
|
||||||
author = "Hung Tran"
|
|
||||||
|
|
||||||
[format.markdown]
|
|
||||||
hashtags = true
|
|
||||||
multiword-tags = true
|
|
||||||
link-format = "wiki"
|
|
||||||
link-drop-extension = true
|
|
||||||
|
|
||||||
[tool]
|
|
||||||
editor = "nvim"
|
|
||||||
|
|
||||||
[lsp]
|
|
||||||
[lsp.diagnostics]
|
|
||||||
wiki-title = "hint"
|
|
||||||
dead-link = "error"
|
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
{ config
|
|
||||||
, proj_root
|
|
||||||
, myLib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (myLib) fromYaml;
|
|
||||||
actualConfig = fromYaml (builtins.readFile "${proj_root.config.path}//alacritty/alacritty.yml");
|
|
||||||
cfg = config.base.alacritty;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.base.alacritty =
|
|
||||||
{
|
|
||||||
font.family = myLib.mkOption {
|
|
||||||
type = myLib.types.singleLineStr;
|
|
||||||
default = actualConfig.font.normal.family;
|
|
||||||
description = ''
|
|
||||||
The font family for Alacritty
|
|
||||||
'';
|
|
||||||
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 {
|
|
||||||
type = myLib.types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Enables alacritty
|
|
||||||
'';
|
|
||||||
example = true;
|
|
||||||
};
|
|
||||||
_actualConfig = myLib.mkOption {
|
|
||||||
type = myLib.types.attrs;
|
|
||||||
visible = false;
|
|
||||||
default = actualConfig;
|
|
||||||
description = "underlying default config";
|
|
||||||
};
|
|
||||||
additionalConfigPath = myLib.mkOption {
|
|
||||||
type = myLib.types.nullOr myLib.types.path;
|
|
||||||
visible = false;
|
|
||||||
default = null;
|
|
||||||
description = "impurely write our alacritty.yml to this path";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config.programs.alacritty = {
|
|
||||||
enable = cfg.enable;
|
|
||||||
settings = myLib.recursiveUpdate actualConfig {
|
|
||||||
font.normal.family = cfg.font.family;
|
|
||||||
font.size = cfg.font.size;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
{nix-index-database
|
|
||||||
,...
|
|
||||||
}@inputs:{
|
|
||||||
mkModuleArgs = import ./mkModuleArgs.nix;
|
|
||||||
modules = [
|
|
||||||
./alacritty.nix
|
|
||||||
./git.nix
|
|
||||||
./ssh.nix
|
|
||||||
./shells.nix
|
|
||||||
{
|
|
||||||
config.programs.home-manager.enable = true;
|
|
||||||
}
|
|
||||||
nix-index-database.hmModules.nix-index
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
{ config
|
|
||||||
, myLib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cfg = config.base.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";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.base.git = {
|
|
||||||
aliases = myLib.mkOption {
|
|
||||||
type = myLib.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 = myLib.mkOption {
|
|
||||||
type = myLib.types.str;
|
|
||||||
default = "Pegasust";
|
|
||||||
description = "Git username that appears on commits";
|
|
||||||
example = "Pegasust";
|
|
||||||
};
|
|
||||||
email = myLib.mkOption {
|
|
||||||
type = myLib.types.str;
|
|
||||||
default = "pegasucksgg@gmail.com";
|
|
||||||
example = "peagsucksgg@gmail.com";
|
|
||||||
description = "Git email that appears on commits";
|
|
||||||
};
|
|
||||||
ignores = myLib.mkOption {
|
|
||||||
type = myLib.types.listOf myLib.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 settings.
|
|
||||||
'';
|
|
||||||
example = [ ".direnv" "node_modules" ];
|
|
||||||
};
|
|
||||||
enable = myLib.mkOption {
|
|
||||||
type = myLib.types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Enables git
|
|
||||||
'';
|
|
||||||
example = false;
|
|
||||||
};
|
|
||||||
credentialCacheTimeoutSeconds = myLib.mkOption {
|
|
||||||
type = myLib.types.int;
|
|
||||||
default = 3000;
|
|
||||||
description = "Credential cache (in-memory store) for Git in seconds.";
|
|
||||||
example = 3000;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# TODO : anyway to override configuration?
|
|
||||||
config.programs.git = {
|
|
||||||
inherit (cfg) enable ignores;
|
|
||||||
userName = cfg.name;
|
|
||||||
userEmail = cfg.email;
|
|
||||||
aliases = baseAliases // cfg.aliases;
|
|
||||||
extraConfig = {
|
|
||||||
credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}";
|
|
||||||
};
|
|
||||||
lfs.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.base.graphics;
|
|
||||||
cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != null);
|
|
||||||
types = lib.types;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [ ./shells.nix ];
|
|
||||||
options.base.graphics = {
|
|
||||||
enable = lib.mkEnableOption "graphics";
|
|
||||||
_enable = lib.mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "Whether the graphics is implicitly enabled (final)";
|
|
||||||
# internal = true;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# 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.base.shells.enable`
|
|
||||||
# generally, we want the behavior: import means enable
|
|
||||||
config = lib.mkIf cfgEnable {
|
|
||||||
base.graphics._enable = lib.mkForce true;
|
|
||||||
base.shells = {
|
|
||||||
shellAliases = lib.mkIf (cfg.useNixGL.defaultPackage != null) {
|
|
||||||
nixGL = cfg.useNixGL.defaultPackage;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
home.packages = [ cfg.useNixGL.package ];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
{ config, proj_root, pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.base.keepass;
|
|
||||||
trimNull = lib.filterAttrsRecursive (name: value: value != null);
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [ ./graphics.nix ];
|
|
||||||
options.base.keepass = {
|
|
||||||
enable = lib.mkEnableOption "keepass";
|
|
||||||
use_gui = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
description = "wheter to enable keepass GUI (the original one)";
|
|
||||||
default = false;
|
|
||||||
example = "true";
|
|
||||||
};
|
|
||||||
path = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "Path to kdbx file";
|
|
||||||
default = null;
|
|
||||||
example = "/media/homelab/f/PersistentHotStorage/keepass.kdbx";
|
|
||||||
};
|
|
||||||
keyfile_path = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.path;
|
|
||||||
description = ''
|
|
||||||
Path to key file for the database
|
|
||||||
If null, then the field is unset
|
|
||||||
'';
|
|
||||||
default = null;
|
|
||||||
example = "/path/to/mykeyfile.key";
|
|
||||||
};
|
|
||||||
store_encrypted_password = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
description = "Whether to store encrypted password for 24 hrs before re-prompt";
|
|
||||||
default = true;
|
|
||||||
example = "false";
|
|
||||||
};
|
|
||||||
copy_timeout_secs = lib.mkOption {
|
|
||||||
type = lib.types.int;
|
|
||||||
description = "Timeout (seconds) before the password is expired from clipboard";
|
|
||||||
default = 12;
|
|
||||||
example = "60";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
home.packages = [
|
|
||||||
pkgs.kpcli-py # kp but is in cli
|
|
||||||
] ++ (if cfg.use_gui or config.base.graphics._enable then [
|
|
||||||
pkgs.keepass # Personal secret management
|
|
||||||
] else [ ]);
|
|
||||||
home.file.".kp/config.ini".text = lib.generators.toINI { } (trimNull {
|
|
||||||
default = {
|
|
||||||
KEEPASSDB = cfg.path;
|
|
||||||
KEEPASSDB_KEYFILE = cfg.keyfile_path;
|
|
||||||
STORE_ENCRYPTED_PASSWORD = cfg.store_encrypted_password;
|
|
||||||
KEEPASSDB_PASSWORD = null; # No good way yet to store the password
|
|
||||||
KEEPASSDB_TIMEOUT = cfg.copy_timeout_secs;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Turns given inputs into the standardized shape of the inputs to configure
|
|
||||||
# custom base modules in this directory.
|
|
||||||
{ pkgs
|
|
||||||
, lib ? pkgs.lib
|
|
||||||
, ...
|
|
||||||
}@inputs:
|
|
||||||
let
|
|
||||||
recursiveUpdate = lib.recursiveUpdate;
|
|
||||||
_lib = recursiveUpdate lib (import ../../lib { inherit pkgs lib; });
|
|
||||||
proj_root = builtins.toString ./../../..;
|
|
||||||
in
|
|
||||||
# TODO: Unpollute inputs
|
|
||||||
recursiveUpdate inputs {
|
|
||||||
proj_root = {
|
|
||||||
path = proj_root;
|
|
||||||
config.path = "${proj_root}/native_configs";
|
|
||||||
scripts.path = "${proj_root}/scripts";
|
|
||||||
};
|
|
||||||
myLib = _lib;
|
|
||||||
}
|
|
|
@ -1,105 +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
|
|
||||||
{ pkgs, lib, config, proj_root, ... }:
|
|
||||||
let
|
|
||||||
# NOTE: Failure 1: buildInputs is pretty much ignored
|
|
||||||
# my_neovim = pkgs.neovim-unwrapped.overrideDerivation (old: {
|
|
||||||
# # TODO: is there a more beautiful way to override propagatedBuildInputs?
|
|
||||||
# name = "hungtr-" + old.name;
|
|
||||||
# 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
|
|
||||||
# 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;
|
|
||||||
rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith
|
|
||||||
(
|
|
||||||
toolchain:
|
|
||||||
toolchain.default.override {
|
|
||||||
extensions = [ "rust-src" ];
|
|
||||||
}
|
|
||||||
));
|
|
||||||
nvim_pkgs = [
|
|
||||||
# pkgs.gccStdenv
|
|
||||||
pkgs.gcc
|
|
||||||
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.rnix-lsp # doesn't work, Mason just installs it using cargo
|
|
||||||
pkgs.rust4cargo
|
|
||||||
|
|
||||||
|
|
||||||
# Language-specific stuffs
|
|
||||||
pkgs.sumneko-lua-language-server
|
|
||||||
# pkgs.python3Packages.python-lsp-server
|
|
||||||
pkgs.nodePackages.pyright
|
|
||||||
pkgs.python3Packages.pylint
|
|
||||||
pkgs.python3Packages.flake8
|
|
||||||
# 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!
|
|
||||||
];
|
|
||||||
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 {
|
|
||||||
programs.neovim = {
|
|
||||||
enable = true;
|
|
||||||
package = my_neovim;
|
|
||||||
viAlias = true;
|
|
||||||
vimAlias = true;
|
|
||||||
withPython3 = 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;
|
|
||||||
# only for here for archive-documentation
|
|
||||||
# extraPython3Packages = (pypkgs: [
|
|
||||||
# # pypkgs.python-lsp-server
|
|
||||||
# pypkgs.ujson
|
|
||||||
# ]);
|
|
||||||
# I use vim-plug, so I probably don't require packaging
|
|
||||||
# extraConfig actually writes to init-home-manager.vim (not lua)
|
|
||||||
# https://github.com/nix-community/home-manager/pull/3287
|
|
||||||
# extraConfig = builtins.readFile "${proj_root}/neovim/init.lua";
|
|
||||||
};
|
|
||||||
# home.packages = nvim_pkgs;
|
|
||||||
xdg.configFile."nvim/init.lua".source = "${proj_root.config.path}//neovim/init.lua";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
# TODO: maybe throw if base.graphics is not enabled?
|
|
||||||
# Though, headless chromium might be possible
|
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
let cfg = config.base.private_chromium;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.base.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
|
|
||||||
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";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
# A module that takes care of a GUI-ful, productive desktop environment
|
|
||||||
inputs@{ pkgs, ... }: {
|
|
||||||
imports = [
|
|
||||||
# slack
|
|
||||||
({ pkgs, ... }: {
|
|
||||||
home.packages = [
|
|
||||||
pkgs.slack
|
|
||||||
];
|
|
||||||
})
|
|
||||||
./private_chromium.nix
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
# Configurations for shell stuffs.
|
|
||||||
# Should probably be decoupled even more
|
|
||||||
{ config
|
|
||||||
, proj_root
|
|
||||||
, myLib
|
|
||||||
, pkgs
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let cfg = config.base.shells;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.base.shells = {
|
|
||||||
enable = myLib.mkOption {
|
|
||||||
type = myLib.types.bool;
|
|
||||||
description = "Enable umbrella shell configuration";
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
};
|
|
||||||
# TODO: Support shell-specific init
|
|
||||||
shellInitExtra = myLib.mkOption {
|
|
||||||
type = myLib.types.str;
|
|
||||||
description = "Extra shell init. The syntax should be sh-compliant";
|
|
||||||
default = "";
|
|
||||||
example = ''
|
|
||||||
# X11 support for WSL
|
|
||||||
export DISPLAY=$(ip route list default | awk '{print $3}'):0
|
|
||||||
export LIBGL_ALWAYS_INDIRECT=1
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
shellAliases = myLib.mkOption {
|
|
||||||
type = myLib.types.attrs;
|
|
||||||
description = "Shell command aliases";
|
|
||||||
default = { };
|
|
||||||
example = {
|
|
||||||
nixGL = "nixGLIntel";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
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)
|
|
||||||
# a directory with shell.nix-compatible and .envrc
|
|
||||||
programs.direnv = {
|
|
||||||
enable = true;
|
|
||||||
nix-direnv.enable = true;
|
|
||||||
# nix-direnv.enableFlakes = true; # must remove. this will always be supported.
|
|
||||||
};
|
|
||||||
# z <path> as smarter cd
|
|
||||||
programs.zoxide = {
|
|
||||||
enable = true;
|
|
||||||
enableZshIntegration = true;
|
|
||||||
};
|
|
||||||
programs.tmux = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
|
|
||||||
};
|
|
||||||
programs.exa = {
|
|
||||||
enable = true;
|
|
||||||
enableAliases = true;
|
|
||||||
};
|
|
||||||
programs.starship = {
|
|
||||||
enable = true;
|
|
||||||
enableZshIntegration = true;
|
|
||||||
};
|
|
||||||
programs.fzf.enable = true;
|
|
||||||
programs.bash = {
|
|
||||||
enable = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
initExtra = cfg.shellInitExtra or "";
|
|
||||||
};
|
|
||||||
programs.zsh = {
|
|
||||||
enable = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
enableAutosuggestions = true;
|
|
||||||
shellAliases = {
|
|
||||||
nix-rebuild = "sudo nixos-rebuild switch";
|
|
||||||
hm-switch = "home-manager switch --flake";
|
|
||||||
} // (cfg.shellAliases or { });
|
|
||||||
history = {
|
|
||||||
size = 10000;
|
|
||||||
path = "${config.xdg.dataHome}/zsh/history";
|
|
||||||
};
|
|
||||||
oh-my-zsh = {
|
|
||||||
enable = true;
|
|
||||||
plugins = [
|
|
||||||
"git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases
|
|
||||||
# "sudo" # double-escape to prepend sudo # UPDATE: just use vi-mode lol
|
|
||||||
"command-not-found" # suggests which package to install; does not support nixos (we have solution already)
|
|
||||||
"gitignore" # `gi list` -> `gi java >>.gitignore`
|
|
||||||
"ripgrep" # adds completion for `rg`
|
|
||||||
"rust" # compe for rustc/cargo
|
|
||||||
# "vi-mode" # edit promps with vi motions :)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
sessionVariables = {
|
|
||||||
# VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true;
|
|
||||||
# VI_MODE_SET_CURSOR = true;
|
|
||||||
# ZVM_VI_ESCAPE_BINDKEY = "";
|
|
||||||
ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX";
|
|
||||||
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 :)
|
|
||||||
};
|
|
||||||
initExtra = (cfg.shellInitExtra or "") + ''
|
|
||||||
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
|
||||||
'';
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
{ config
|
|
||||||
, proj_root
|
|
||||||
, myLib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let cfg = config.base.ssh;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.base.ssh.enable = myLib.mkOption {
|
|
||||||
type = myLib.types.bool;
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
description = ''
|
|
||||||
Enables SSH
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
config.programs.ssh = {
|
|
||||||
inherit (cfg) enable;
|
|
||||||
forwardAgent = true;
|
|
||||||
extraConfig = builtins.readFile "${proj_root.config.path}/ssh/config";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix
|
|
||||||
(import
|
|
||||||
(
|
|
||||||
let
|
|
||||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
|
||||||
c_ = import ./../../c_.nix {src = ./.;};
|
|
||||||
in
|
|
||||||
c_.fetchTree lock.nodes.flake-compat.locked
|
|
||||||
)
|
|
||||||
{ src = ./.; }
|
|
||||||
).defaultNix
|
|
|
@ -1,322 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1,
|
|
||||||
"narHash": "sha256-d6CilJXP+UPv3nF00zBBRhMgRklTCjSCMrjbYtYDuOI=",
|
|
||||||
"path": "../../out-of-tree/flake-compat",
|
|
||||||
"type": "path"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"path": "../../out-of-tree/flake-compat",
|
|
||||||
"type": "path"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-compat_2": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1668681692,
|
|
||||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1667395993,
|
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1667395993,
|
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_3": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1659877975,
|
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_4": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1659877975,
|
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"home-manager": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"utils": "utils"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673948101,
|
|
||||||
"narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "home-manager",
|
|
||||||
"rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "home-manager",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"kpcli-py": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1619087457,
|
|
||||||
"narHash": "sha256-iRNLq5s2WJJHwB4beP5xQDKrBPWS/42s/ozLoSa5gAE=",
|
|
||||||
"owner": "rebkwok",
|
|
||||||
"repo": "kpcli",
|
|
||||||
"rev": "e4d699e3b3d28887f74185f8fa69d0aade111d84",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "rebkwok",
|
|
||||||
"repo": "kpcli",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"neovim-flake": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils_2",
|
|
||||||
"nixpkgs": [
|
|
||||||
"neovim-nightly-overlay",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"dir": "contrib",
|
|
||||||
"lastModified": 1673937267,
|
|
||||||
"narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=",
|
|
||||||
"owner": "neovim",
|
|
||||||
"repo": "neovim",
|
|
||||||
"rev": "2093e574c6c934a718f96d0a173aa965d3958a8b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"dir": "contrib",
|
|
||||||
"owner": "neovim",
|
|
||||||
"repo": "neovim",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"neovim-nightly-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat_2",
|
|
||||||
"neovim-flake": "neovim-flake",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673943288,
|
|
||||||
"narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "neovim-nightly-overlay",
|
|
||||||
"rev": "3c0bb335936754a2683a84ddf081594ddb567a89",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "neovim-nightly-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix-index-database": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673752441,
|
|
||||||
"narHash": "sha256-/g4ImZWV05CrXRWTSJsda6ztIp7LAPxs2L6RCrbQ66U=",
|
|
||||||
"owner": "mic92",
|
|
||||||
"repo": "nix-index-database",
|
|
||||||
"rev": "391180f77505c1c8cdd45fe1a59dc89d3e40300a",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "mic92",
|
|
||||||
"repo": "nix-index-database",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixgl": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils_3",
|
|
||||||
"nixpkgs": "nixpkgs_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1,
|
|
||||||
"narHash": "sha256-RkO+8E7MahERHw1C5DNObDjq4xeI+FqaWH9+M7Fv2UE=",
|
|
||||||
"path": "./../../out-of-tree/nixGL",
|
|
||||||
"type": "path"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"path": "./../../out-of-tree/nixGL",
|
|
||||||
"type": "path"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1671983799,
|
|
||||||
"narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1660551188,
|
|
||||||
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_3": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673796341,
|
|
||||||
"narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "6dccdc458512abce8d19f74195bb20fdb067df50",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_4": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1665296151,
|
|
||||||
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"home-manager": "home-manager",
|
|
||||||
"kpcli-py": "kpcli-py",
|
|
||||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
|
||||||
"nix-index-database": "nix-index-database",
|
|
||||||
"nixgl": "nixgl",
|
|
||||||
"nixpkgs": "nixpkgs_3",
|
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils_4",
|
|
||||||
"nixpkgs": "nixpkgs_4"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673922364,
|
|
||||||
"narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=",
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"utils": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1667395993,
|
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
|
@ -1,260 +0,0 @@
|
||||||
{
|
|
||||||
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="
|
|
||||||
];
|
|
||||||
};
|
|
||||||
description = "simple home-manager config";
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
home-manager = {
|
|
||||||
url = "github:nix-community/home-manager";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
nixgl.url = "path:./../../out-of-tree/nixGL";
|
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
||||||
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
|
|
||||||
flake-compat = {
|
|
||||||
url = "path:../../out-of-tree/flake-compat";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
kpcli-py = {
|
|
||||||
url = "github:rebkwok/kpcli";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
neovim-nightly-overlay = {
|
|
||||||
url = "github:nix-community/neovim-nightly-overlay";
|
|
||||||
# Pin to a nixpkgs revision that doesn't have NixOS/nixpkgs#208103 yet
|
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
|
|
||||||
};
|
|
||||||
nix-index-database = {
|
|
||||||
url = "github:mic92/nix-index-database";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs =
|
|
||||||
flake_inputs@{ nixpkgs
|
|
||||||
, home-manager
|
|
||||||
, nixgl
|
|
||||||
, rust-overlay
|
|
||||||
, flake-utils
|
|
||||||
, kpcli-py
|
|
||||||
, neovim-nightly-overlay
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
# 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 = import nixpkgs {
|
|
||||||
inherit system overlays;
|
|
||||||
config = { allowUnfree = true; };
|
|
||||||
};
|
|
||||||
# lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
|
|
||||||
base = import ./base flake_inputs;
|
|
||||||
inherit (base) mkModuleArgs;
|
|
||||||
|
|
||||||
nerd_font_module = { config, pkgs, ... }: {
|
|
||||||
fonts.fontconfig.enable = true;
|
|
||||||
home.packages = [
|
|
||||||
(pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; })
|
|
||||||
];
|
|
||||||
# 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
|
|
||||||
{
|
|
||||||
debug = {
|
|
||||||
inherit overlays pkgs base;
|
|
||||||
};
|
|
||||||
homeConfigurations =
|
|
||||||
let
|
|
||||||
x11_wsl = ''
|
|
||||||
# x11 output for WSL
|
|
||||||
export DISPLAY=$(ip route list default | awk '{print $3}'):0
|
|
||||||
export LIBGL_ALWAYS_INDIRECT=1
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
"hungtr" = home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = base.modules ++ [
|
|
||||||
./home.nix
|
|
||||||
];
|
|
||||||
# optionally pass inarguments to module
|
|
||||||
# we migrate this from in-place modules to allow flexibility
|
|
||||||
# in this case, we can add "home" to input arglist of home.nix
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
|
||||||
inherit pkgs;
|
|
||||||
myHome = {
|
|
||||||
username = "hungtr";
|
|
||||||
homeDirectory = "/home/hungtr";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"hungtr@bao" = home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = base.modules ++ [
|
|
||||||
./home.nix
|
|
||||||
nerd_font_module
|
|
||||||
./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
|
|
||||||
# we migrate this from in-place modules to allow flexibility
|
|
||||||
# in this case, we can add "home" to input arglist of home.nix
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
|
||||||
inherit pkgs;
|
|
||||||
myHome = {
|
|
||||||
username = "hungtr";
|
|
||||||
homeDirectory = "/home/hungtr";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# 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;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
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.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/htran/keepass.kdbx";
|
|
||||||
base.alacritty.font.size = 11.0;
|
|
||||||
base.git.name = "Hung";
|
|
||||||
base.git.email = "htran@egihosting.com";
|
|
||||||
}
|
|
||||||
nerd_font_module
|
|
||||||
];
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
|
||||||
inherit pkgs;
|
|
||||||
myHome = {
|
|
||||||
username = "htran";
|
|
||||||
homeDirectory = "/Users/htran";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"nixos@Felia" = home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = [
|
|
||||||
./home.nix
|
|
||||||
{
|
|
||||||
base.shells = {
|
|
||||||
shellInitExtra = ''
|
|
||||||
'' + x11_wsl;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
# optionally pass inarguments to module
|
|
||||||
# we migrate this from in-place modules to allow flexibility
|
|
||||||
# in this case, we can add "home" to input arglist of home.nix
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
|
||||||
inherit pkgs;
|
|
||||||
myHome = {
|
|
||||||
username = "nixos";
|
|
||||||
homeDirectory = "/home/nixos";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# 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
|
|
||||||
hwtr = home-manager.lib.homeManagerConfiguration {
|
|
||||||
inherit pkgs;
|
|
||||||
modules = base.modules ++ [
|
|
||||||
./home.nix
|
|
||||||
./base/graphics.nix
|
|
||||||
{
|
|
||||||
base.graphics.enable = true;
|
|
||||||
base.alacritty.font.family = "BitstreamVeraSansMono Nerd Font";
|
|
||||||
base.keepass.path = "/media/homelab/f/PersistentHotStorage/keepass.kdbx";
|
|
||||||
}
|
|
||||||
./base/productive_desktop.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
extraSpecialArgs = mkModuleArgs {
|
|
||||||
inherit pkgs;
|
|
||||||
myHome = {
|
|
||||||
username = "hwtr";
|
|
||||||
homeDirectory = "/home/hwtr";
|
|
||||||
packages = [
|
|
||||||
pkgs.postman
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
{
|
|
||||||
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 }
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
# This is a nix module, with an additional wrapper from home-manager
|
|
||||||
# myHome, myLib is injected from extraSpecialArgs in flake.nix
|
|
||||||
# This file represents the base settings for each machine
|
|
||||||
# Additional configurations goes to profiles/<user>
|
|
||||||
# or inlined in flake.nix
|
|
||||||
{ config # Represents the realized final configuration
|
|
||||||
, pkgs # This is by default just ``= import <nixpkgs>{}`
|
|
||||||
, myHome
|
|
||||||
, myLib
|
|
||||||
, option # The options we're given, this might be useful for typesafety?
|
|
||||||
, proj_root
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (myLib) fromYaml;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./base/neovim.nix
|
|
||||||
./base/keepass.nix
|
|
||||||
];
|
|
||||||
home = {
|
|
||||||
username = myHome.username;
|
|
||||||
homeDirectory = myHome.homeDirectory;
|
|
||||||
stateVersion = myHome.stateVersion or "22.05";
|
|
||||||
};
|
|
||||||
home.packages = pkgs.lib.unique ([
|
|
||||||
# pkgs.ncdu
|
|
||||||
pkgs.rclone # cloud file operations
|
|
||||||
pkgs.htop # system diagnostics in CLI
|
|
||||||
pkgs.ripgrep # content fuzzy search
|
|
||||||
pkgs.unzip # compression
|
|
||||||
pkgs.zip # compression
|
|
||||||
|
|
||||||
# cool utilities
|
|
||||||
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.logseq # TODO: only include if have GL # Obsidian alt
|
|
||||||
pkgs.mosh # Parsec for SSH
|
|
||||||
pkgs.nixops_unstable # nixops v2 # insecure for now
|
|
||||||
pkgs.lynx # Web browser at your local terminal
|
|
||||||
pkgs.zk
|
|
||||||
|
|
||||||
# pkgs.tailscale # VPC;; This should be installed in system-nix
|
|
||||||
pkgs.python310 # dev packages should be in project
|
|
||||||
# pkgs.python310.numpy
|
|
||||||
# pkgs.python310Packages.tensorflow
|
|
||||||
# pkgs.python310Packages.scikit-learn
|
|
||||||
] ++ (myHome.packages or [ ]) ++ (if pkgs.system == "x86_64-linux" then [
|
|
||||||
pkgs.logseq
|
|
||||||
] else [ ])
|
|
||||||
);
|
|
||||||
|
|
||||||
## Configs ##
|
|
||||||
xdg.configFile."zk/config.toml".source = "${proj_root.config.path}//zk/config.toml";
|
|
||||||
|
|
||||||
## Programs ##
|
|
||||||
programs.jq = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
# not exist in home-manager
|
|
||||||
# have to do it at system level
|
|
||||||
# services.ntp.enable = true; # automatic time
|
|
||||||
programs.nix-index = {
|
|
||||||
enable = true;
|
|
||||||
enableBashIntegration = true;
|
|
||||||
enableZshIntegration = true;
|
|
||||||
};
|
|
||||||
base.keepass.enable = true;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
accept-flake-config = true
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# main module exporter for different configuration profiles
|
|
||||||
{ pkgs, libs, ... } @ inputs:
|
|
||||||
{
|
|
||||||
hwtr = import ./hwtr.nix;
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
{ pkgs
|
|
||||||
, lib ? pkgs.lib
|
|
||||||
, ...
|
|
||||||
}@flake_import:
|
|
||||||
let
|
|
||||||
serde = import ./serde { inherit pkgs lib; };
|
|
||||||
recursiveUpdate = lib.recursiveUpdate;
|
|
||||||
in
|
|
||||||
recursiveUpdate (recursiveUpdate pkgs.lib lib) {
|
|
||||||
fromYaml = serde.fromYaml;
|
|
||||||
fromYamlPath = serde.fromYamlPath;
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
# 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?
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
# This module aims to be merge (not inject/override) with top-level pkgs to provide
|
|
||||||
# personalized/custom packages
|
|
||||||
{ pkgs
|
|
||||||
, lib
|
|
||||||
, naersk # rust packages
|
|
||||||
, ...
|
|
||||||
}@pkgs_input: {
|
|
||||||
# dot-hwtr = import "./dot-hwtr" pkgs_input;
|
|
||||||
cargo-bacon = pkgs.rustPlatform.buildRustPackage rec {
|
|
||||||
pname = "bacon";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
||||||
naersk.url = "gihub:nix-community/naersk";
|
|
||||||
};
|
|
||||||
outputs = { nixpkgs, rust-overlay, naersk }:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs { overlays = [ rust-overlay.overlays.default ]; };
|
|
||||||
lib = pkgs.lib;
|
|
||||||
in
|
|
||||||
(import ./default.nix { inherit pkgs lib naersk; });
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
let
|
|
||||||
# user-specific (~/.ssh/id_ed25519.pub)
|
|
||||||
users = {
|
|
||||||
"hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z";
|
|
||||||
};
|
|
||||||
# System-specific settings (/etc/ssh/ssh_hsot_ed25519_key.pub)
|
|
||||||
systems = {
|
|
||||||
"bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs";
|
|
||||||
};
|
|
||||||
all = users // systems;
|
|
||||||
# stands for calculus
|
|
||||||
c_ = builtins;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
"system/secrets/s3fs.age".publicKeys = c_.attrValues (all);
|
|
||||||
"system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all);
|
|
||||||
"system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
{ lib, pkgs, config, modulesPath, specialArgs, ... }:
|
|
||||||
let
|
|
||||||
hostname = specialArgs.hostname;
|
|
||||||
enableSSH = specialArgs.enableSSH or true;
|
|
||||||
_networking = lib.recursiveUpdate { hostName = hostname; } (specialArgs._networking or { });
|
|
||||||
_boot = specialArgs._boot or { };
|
|
||||||
_services = specialArgs._services or { };
|
|
||||||
includeHardware = specialArgs.includeHardware or true;
|
|
||||||
proj_root = builtins.toString ./../..;
|
|
||||||
in
|
|
||||||
with lib;
|
|
||||||
{
|
|
||||||
imports = (if includeHardware then [
|
|
||||||
"${proj_root}/hosts/${hostname}/hardware-configuration.nix"
|
|
||||||
] else [ ]) ++ [
|
|
||||||
"${modulesPath}/profiles/minimal.nix"
|
|
||||||
"${proj_root}/modules/tailscale.sys.nix"
|
|
||||||
"${proj_root}/modules/mosh.sys.nix"
|
|
||||||
];
|
|
||||||
boot = _boot;
|
|
||||||
|
|
||||||
# prune old builds
|
|
||||||
nix.settings.auto-optimise-store = true;
|
|
||||||
|
|
||||||
# Enable nix flakes
|
|
||||||
nix.package = pkgs.nixFlakes;
|
|
||||||
nix.extraOptions = ''
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
'';
|
|
||||||
users.users.hungtr = {
|
|
||||||
isNormalUser = true;
|
|
||||||
home = "/home/hungtr";
|
|
||||||
description = "pegasust/hungtr";
|
|
||||||
extraGroups = [ "wheel" "networkmanager" "audio" ];
|
|
||||||
};
|
|
||||||
users.users.root = {
|
|
||||||
# openssh runs in root, no? This is because port < 1024 requires root.
|
|
||||||
openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile "${proj_root}/native_configs/ssh/authorized_keys");
|
|
||||||
};
|
|
||||||
|
|
||||||
# Some basic programs
|
|
||||||
programs.neovim = {
|
|
||||||
enable = true;
|
|
||||||
defaultEditor = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.git = {
|
|
||||||
enable = true;
|
|
||||||
# more information should be configured under user level
|
|
||||||
# See other config at @/home-nix
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = [
|
|
||||||
pkgs.gnumake
|
|
||||||
pkgs.wget
|
|
||||||
pkgs.inetutils # network diag
|
|
||||||
pkgs.mtr # network diag
|
|
||||||
pkgs.sysstat # sys diag
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"agenix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1665870395,
|
|
||||||
"narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=",
|
|
||||||
"owner": "ryantm",
|
|
||||||
"repo": "agenix",
|
|
||||||
"rev": "a630400067c6d03c9b3e0455347dc8559db14288",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "ryantm",
|
|
||||||
"repo": "agenix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1672525397,
|
|
||||||
"narHash": "sha256-WASDnyxHKWVrEe0dIzkpH+jzKlCKAk0husv0f/9pyxg=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "8ba56d7c0d7490680f2d51ba46a141eca7c46afa",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"agenix": "agenix",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
|
@ -1,406 +0,0 @@
|
||||||
{
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
|
||||||
agenix = {
|
|
||||||
url = "github:ryantm/agenix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, agenix, ... }:
|
|
||||||
let
|
|
||||||
lib = nixpkgs.lib;
|
|
||||||
proj_root = ./../..;
|
|
||||||
# TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- `
|
|
||||||
base_modules = [
|
|
||||||
agenix.nixosModule
|
|
||||||
{
|
|
||||||
age.secrets.s3fs = {
|
|
||||||
file = ../../secrets/s3fs.age;
|
|
||||||
# mode = "600"; # owner + group only
|
|
||||||
# owner = "hungtr";
|
|
||||||
# group = "users";
|
|
||||||
};
|
|
||||||
age.secrets."s3fs.digital-garden" = {
|
|
||||||
file = ../../secrets/s3fs.digital-garden.age;
|
|
||||||
};
|
|
||||||
age.secrets._nhitrl_cred = {
|
|
||||||
file = ../../secrets/_nhitrl.age;
|
|
||||||
};
|
|
||||||
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# Windows with NixOS WSL
|
|
||||||
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = base_modules ++ [
|
|
||||||
./wsl-configuration.nix
|
|
||||||
{
|
|
||||||
system.stateVersion = "22.05";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
specialArgs = {
|
|
||||||
# includeHardware = false;
|
|
||||||
hostname = "Felia";
|
|
||||||
_services.openssh = {
|
|
||||||
permitRootLogin = "no";
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = base_modules ++ [
|
|
||||||
./configuration.nix
|
|
||||||
{
|
|
||||||
system.stateVersion = "22.05";
|
|
||||||
mod.tailscale.enable = true;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
specialArgs = {
|
|
||||||
hostname = "lizzi";
|
|
||||||
_networking = {
|
|
||||||
interfaces.eth1.ipv4.addresses = [{
|
|
||||||
address = "71.0.0.1";
|
|
||||||
prefixLength = 24;
|
|
||||||
}];
|
|
||||||
firewall = {
|
|
||||||
enable = true;
|
|
||||||
allowedTCPPorts = [ 80 443 22 ];
|
|
||||||
};
|
|
||||||
useDHCP = false;
|
|
||||||
# required so that we get IP address from linode
|
|
||||||
interfaces.eth0.useDHCP = true;
|
|
||||||
};
|
|
||||||
_boot.loader.grub.enable = true;
|
|
||||||
_boot.loader.grub.version = 2;
|
|
||||||
_services.openssh = {
|
|
||||||
permitRootLogin = "no";
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
_services.gitea = {
|
|
||||||
enable = true;
|
|
||||||
stateDir = "/gitea";
|
|
||||||
rootUrl = "https://git.pegasust.com";
|
|
||||||
settings = {
|
|
||||||
repository = {
|
|
||||||
"ENABLE_PUSH_CREATE_USER" = true;
|
|
||||||
"ENABLE_PUSH_CREATE_ORG" = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# Highly suspect that thanks to nginx, ipv6 is disabled?
|
|
||||||
_services.nginx = {
|
|
||||||
enable = true;
|
|
||||||
clientMaxBodySize = "100m"; # Allow big file transfers over git :^)
|
|
||||||
recommendedGzipSettings = true;
|
|
||||||
recommendedOptimisation = true;
|
|
||||||
recommendedProxySettings = true;
|
|
||||||
recommendedTlsSettings = true;
|
|
||||||
virtualHosts."git.pegasust.com" = {
|
|
||||||
# Gitea hostname
|
|
||||||
sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem";
|
|
||||||
sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem";
|
|
||||||
forceSSL = true; # Runs on port 80 and 443
|
|
||||||
locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# Generic machine
|
|
||||||
nixosConfigurations.pixi = nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = base_modules ++ [
|
|
||||||
./configuration.nix
|
|
||||||
{
|
|
||||||
system.stateVersion = "22.05";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
specialArgs = {
|
|
||||||
hostname = "pixi";
|
|
||||||
_networking = {
|
|
||||||
# interfaces.eth1.ipv4.addresses = [{
|
|
||||||
# address = "71.0.0.1";
|
|
||||||
# prefixLength = 24;
|
|
||||||
# }];
|
|
||||||
firewall = {
|
|
||||||
enable = false;
|
|
||||||
allowedTCPPorts = [ 80 443 22 ];
|
|
||||||
};
|
|
||||||
useDHCP = false;
|
|
||||||
# interfaces.eth0.useDHCP = true;
|
|
||||||
};
|
|
||||||
_boot.loader.grub.enable = true;
|
|
||||||
_boot.loader.grub.version = 2;
|
|
||||||
_services.openssh = {
|
|
||||||
permitRootLogin = "no";
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
_services.gitea = {
|
|
||||||
enable = true;
|
|
||||||
stateDir = "/gitea";
|
|
||||||
rootUrl = "https://git.pegasust.com";
|
|
||||||
settings = {
|
|
||||||
repository = {
|
|
||||||
"ENABLE_PUSH_CREATE_USER" = true;
|
|
||||||
"ENABLE_PUSH_CREATE_ORG" = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
_services.nginx = {
|
|
||||||
enable = true;
|
|
||||||
clientMaxBodySize = "100m"; # Allow big file transfers over git :^)
|
|
||||||
recommendedGzipSettings = true;
|
|
||||||
recommendedOptimisation = true;
|
|
||||||
recommendedProxySettings = true;
|
|
||||||
recommendedTlsSettings = true;
|
|
||||||
virtualHosts."git.pegasust.com" = {
|
|
||||||
# Gitea hostname
|
|
||||||
sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem";
|
|
||||||
sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem";
|
|
||||||
forceSSL = true; # Runs on port 80 and 443
|
|
||||||
locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
nixosConfigurations.nyx = nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = base_modules ++ [
|
|
||||||
./configuration.nix
|
|
||||||
{
|
|
||||||
system.stateVersion = "22.05";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
specialArgs = {
|
|
||||||
hostname = "nyx";
|
|
||||||
_networking = {
|
|
||||||
enableIPv6 = false;
|
|
||||||
interfaces.eth1.ipv4.addresses = [{
|
|
||||||
address = "71.0.0.2";
|
|
||||||
prefixLength = 24;
|
|
||||||
}];
|
|
||||||
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.nixos = nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = base_modules ++ [
|
|
||||||
./configuration.nix
|
|
||||||
{
|
|
||||||
system.stateVersion = "22.05";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
specialArgs = {
|
|
||||||
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 {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
specialArgs.hostname = "bao";
|
|
||||||
modules = base_modules ++ [
|
|
||||||
./configuration.nix
|
|
||||||
./../../modules/storage.perso.sys.nix
|
|
||||||
# GPU, sound, networking stuffs
|
|
||||||
({ 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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
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
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
|
|
||||||
networking.hostName = "bao"; # Define your hostname.
|
|
||||||
# Pick only one of the below networking options.
|
|
||||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
|
||||||
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";
|
|
||||||
# Configure keymap in X11
|
|
||||||
services.xserver.layout = "us";
|
|
||||||
# services.xserver.xkbOptions = {
|
|
||||||
# "eurosign:e";
|
|
||||||
# "caps:escape" # map caps to escape.
|
|
||||||
# };
|
|
||||||
|
|
||||||
# Enable CUPS to print documents.
|
|
||||||
# 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";
|
|
||||||
mod.tailscale.enable = true;
|
|
||||||
|
|
||||||
# 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).
|
|
||||||
# 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
|
|
||||||
users.users.user = {
|
|
||||||
initialPassword = "pw123";
|
|
||||||
extraGroups = [ "wheel" "networkmanager" "audio" ];
|
|
||||||
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
|
|
||||||
# started in user sessions.
|
|
||||||
# programs.mtr.enable = true;
|
|
||||||
# programs.gnupg.agent = {
|
|
||||||
# enable = true;
|
|
||||||
# enableSSHSupport = true;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# List services that you want to enable:
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
|
||||||
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
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "22.11"; # Did you read the comment?
|
|
||||||
}))
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
|
||||||
boot.loader.grub.extraConfig = ''
|
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
|
||||||
terminal_input serial;
|
|
||||||
terminal_output serial
|
|
||||||
'';
|
|
||||||
boot.loader.grub.forceInstall = true;
|
|
||||||
boot.loader.grub.device = "nodev";
|
|
||||||
boot.loader.timeout = 10;
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{
|
|
||||||
device = "/dev/sda";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[{ device = "/dev/sdb"; }];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
use_flake() {
|
|
||||||
watch_file flake.nix
|
|
||||||
watch_file flake.lock
|
|
||||||
eval "$(nix print-dev-env)"
|
|
||||||
}
|
|
||||||
|
|
||||||
use flake
|
|
|
@ -1,26 +0,0 @@
|
||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ''
|
|
||||||
labels: bug
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!-- Please only open an issue, if you are experiencing a problem with NixOS-WSL, that looks like it has to be fixed in the code. If you aren't sure how to use the project or want help with using it, consider opening a discussion in the "Q&A"-Category instead -->
|
|
||||||
|
|
||||||
## Bug description
|
|
||||||
<!-- A clear and concise description of what the bug is. -->
|
|
||||||
|
|
||||||
## To Reproduce
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
<!-- A clear and concise description of what you expected to happen. -->
|
|
||||||
|
|
||||||
## Logs
|
|
||||||
```
|
|
||||||
Include relevant console logs
|
|
||||||
```
|
|
||||||
|
|
||||||
<!-- If your issue is related to the installation process, please include the SHA256 checksum of the tarball you used to install NixOS-WSL -->
|
|
|
@ -1,16 +0,0 @@
|
||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: enhancement
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!-- Please only open an issue, if you want to suggest a concrete feature, including a way that it could be implemented. If you have more broad suggestions, consider opening a discussion in the "ideas" category instead. -->
|
|
||||||
|
|
||||||
## Problem
|
|
||||||
<!-- Describe the problem you are trying to solve -->
|
|
||||||
|
|
||||||
## Solution
|
|
||||||
<!-- Describe the solution you want to see integrated in the project -->
|
|
|
@ -1,17 +0,0 @@
|
||||||
change-template: "* $TITLE (#$NUMBER) @$AUTHOR"
|
|
||||||
categories:
|
|
||||||
- title: '🚀 Features'
|
|
||||||
labels:
|
|
||||||
- enhancement
|
|
||||||
- title: "🪲 Bugfixes"
|
|
||||||
labels:
|
|
||||||
- bug
|
|
||||||
- title: "📖 Documentation"
|
|
||||||
labels:
|
|
||||||
- documentation
|
|
||||||
template: |
|
|
||||||
# Changelog
|
|
||||||
|
|
||||||
## 🛠️ General Changes
|
|
||||||
|
|
||||||
$CHANGES
|
|
|
@ -1,78 +0,0 @@
|
||||||
name: 'Build NixOS WSL tarball'
|
|
||||||
|
|
||||||
on: [push, pull_request, release]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
# Nix Flakes doesn't work on shallow clones
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install nix
|
|
||||||
uses: cachix/install-nix-action@v12
|
|
||||||
with:
|
|
||||||
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install
|
|
||||||
# Configure Nix to enable flakes
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- name: Run checks
|
|
||||||
run: |
|
|
||||||
nix flake check
|
|
||||||
|
|
||||||
- name: Build tarball
|
|
||||||
run: |
|
|
||||||
nix build '.#nixosConfigurations.mysystem.config.system.build.tarball'
|
|
||||||
|
|
||||||
- name: Upload tarball
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: rootfs
|
|
||||||
path: result/tarball/nixos-wsl-x86_64-linux.tar.gz
|
|
||||||
|
|
||||||
- name: Build installer
|
|
||||||
run: |
|
|
||||||
nix build '.#nixosConfigurations.mysystem.config.system.build.installer'
|
|
||||||
|
|
||||||
- name: Upload installer
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: installer
|
|
||||||
path: result/tarball/nixos-wsl-installer.tar.gz
|
|
||||||
|
|
||||||
release:
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: rootfs
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: installer
|
|
||||||
|
|
||||||
- name: Generate checksums
|
|
||||||
run: |
|
|
||||||
for x in *.tar.gz; do
|
|
||||||
sha256sum $x > ${x}.sha256
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Attach to release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
nixos-wsl-x86_64-linux.tar.gz
|
|
||||||
nixos-wsl-x86_64-linux.tar.gz.sha256
|
|
||||||
nixos-wsl-installer.tar.gz
|
|
||||||
nixos-wsl-installer.tar.gz.sha256
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
@ -1,19 +0,0 @@
|
||||||
name: Release Drafter
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- reopened
|
|
||||||
- synchronize
|
|
||||||
-
|
|
||||||
jobs:
|
|
||||||
update_release_draft:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: release-drafter/release-drafter@v5
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
@ -1,50 +0,0 @@
|
||||||
name: 'Update flakes'
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 2 * * 0'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-flakes:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
# Nix Flakes doesn't work on shallow clones
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install nix
|
|
||||||
uses: cachix/install-nix-action@v12
|
|
||||||
with:
|
|
||||||
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install
|
|
||||||
# Configure Nix to enable flakes
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- name: Update flakes
|
|
||||||
run: nix flake update --recreate-lock-file
|
|
||||||
|
|
||||||
- name: Create Pull Request
|
|
||||||
id: cpr
|
|
||||||
uses: peter-evans/create-pull-request@v3
|
|
||||||
with:
|
|
||||||
commit-message: Update flakes
|
|
||||||
committer: GitHub <noreply@github.com>
|
|
||||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
|
||||||
signoff: false
|
|
||||||
branch: flake-updates
|
|
||||||
delete-branch: true
|
|
||||||
title: 'Update flakes'
|
|
||||||
body: |
|
|
||||||
Update report
|
|
||||||
- Updated with *today's* date
|
|
||||||
- Auto-generated by [create-pull-request][1]
|
|
||||||
|
|
||||||
[1]: https://github.com/peter-evans/create-pull-request
|
|
||||||
|
|
||||||
- name: Check outputs
|
|
||||||
run: |
|
|
||||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
|
||||||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
|
|
@ -1,2 +0,0 @@
|
||||||
result
|
|
||||||
result-*
|
|
|
@ -1,202 +0,0 @@
|
||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
|
@ -1,112 +0,0 @@
|
||||||
<h1 align=center>
|
|
||||||
NixOS on WSL<br />
|
|
||||||
<a href="https://matrix.to/#/#wsl:nixos.org"><img src="https://img.shields.io/matrix/wsl:nixos.org?server_fqdn=nixos.ems.host&logo=matrix" alt="Matrix Chat" /></a>
|
|
||||||
<a href="https://github.com/NixOS/nixpkgs/tree/nixos-22.05"><img src="https://img.shields.io/badge/nixpkgs-22.05-brightgreen" alt="nixpkgs 22.05" /></a>
|
|
||||||
<a href="https://github.com/nix-community/NixOS-WSL/releases"><img alt="Downloads" src="https://img.shields.io/github/downloads/nix-community/NixOS-WSL/total"></a>
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
A minimal root filesystem for running NixOS on WSL. It can be used with
|
|
||||||
[DistroLauncher](https://github.com/microsoft/WSL-DistroLauncher) as
|
|
||||||
`install.tar.gz` or as input to `wsl --import --version 2`.
|
|
||||||
|
|
||||||
## Quick start
|
|
||||||
|
|
||||||
First, [download the latest release\'s installer](https://github.com/nix-community/NixOS-WSL/releases/latest).
|
|
||||||
|
|
||||||
Then open up a Terminal, PowerShell or Command Prompt and run:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
wsl --import NixOS .\NixOS\ nixos-wsl-installer.tar.gz --version 2
|
|
||||||
```
|
|
||||||
|
|
||||||
This sets up a new WSL distribution `NixOS` that is installed under
|
|
||||||
`.\NixOS`. `nixos-wsl-installer.tar.gz` is the path to the file you
|
|
||||||
downloaded earlier. You might need to change this path or change to the download directory first.
|
|
||||||
|
|
||||||
You can now run NixOS:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
wsl -d NixOS
|
|
||||||
```
|
|
||||||
|
|
||||||
The installer will unpack the file system and subsequently start NixOS.
|
|
||||||
A few warnings about file systems and locales will pop up. You can
|
|
||||||
safely ignore them. After systemd has started, you should be greeted
|
|
||||||
with a bash prompt inside your fresh NixOS installation.
|
|
||||||
|
|
||||||
If you want to make NixOS your default distribution, you can do so with
|
|
||||||
|
|
||||||
```sh
|
|
||||||
wsl -s NixOS
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building your own system tarball
|
|
||||||
|
|
||||||
This requires access to a system that already has Nix installed. Please refer to the [Nix installation guide](https://nixos.org/guides/install-nix.html) if that\'s not the case.
|
|
||||||
|
|
||||||
If you have a flakes-enabled Nix, you can use the following command to
|
|
||||||
build your own tarball instead of relying on a prebuilt one:
|
|
||||||
|
|
||||||
```cmd
|
|
||||||
nix build github:nix-community/NixOS-WSL#nixosConfigurations.mysystem.config.system.build.installer
|
|
||||||
```
|
|
||||||
|
|
||||||
Or, if you want to build with local changes, run inside your checkout:
|
|
||||||
|
|
||||||
```cmd
|
|
||||||
nix build .#nixosConfigurations.mysystem.config.system.build.installer
|
|
||||||
```
|
|
||||||
|
|
||||||
Without a flakes-enabled Nix, you can build a tarball using:
|
|
||||||
|
|
||||||
```cmd
|
|
||||||
nix-build -A nixosConfigurations.mysystem.config.system.build.installer
|
|
||||||
```
|
|
||||||
|
|
||||||
The resulting installer tarball can then be found under
|
|
||||||
`./result/tarball/nixos-wsl-installer.tar.gz`.
|
|
||||||
|
|
||||||
You can also build a rootfs tarball without wrapping it in the installer
|
|
||||||
by replacing `installer` with `tarball` in the above commands. The
|
|
||||||
rootfs tarball can then be found under
|
|
||||||
`./result/tarball/nixos-wsl-x86_64-linux.tar.gz`.
|
|
||||||
|
|
||||||
## Design
|
|
||||||
|
|
||||||
Getting NixOS to run under WSL requires some workarounds:
|
|
||||||
|
|
||||||
### systemd support
|
|
||||||
|
|
||||||
WSL comes with its own (non-substitutable) init system while NixOS uses
|
|
||||||
systemd. Simply starting systemd later on does not work out of the box,
|
|
||||||
because systemd as system instance refuses to start if it is not PID 1.
|
|
||||||
This unfortunate combination is resolved in two ways:
|
|
||||||
|
|
||||||
- the user\'s default shell is replaced by a wrapper script that acts
|
|
||||||
is init system and then drops to the actual shell
|
|
||||||
- systemd is started in its own PID namespace; therefore, it is PID 1.
|
|
||||||
The shell wrapper (see above) enters the systemd namespace before
|
|
||||||
dropping to the shell.
|
|
||||||
|
|
||||||
### Installer
|
|
||||||
|
|
||||||
Usually WSL distributions ship as a tarball of their root file system.
|
|
||||||
These tarballs however, can not contain any hard-links due to the way
|
|
||||||
they are unpacked by WSL, resulting in an \"Unspecified Error\". By
|
|
||||||
default some Nix-derivations will contain hard-links when they are
|
|
||||||
built. This results in system tarballs that can not be imported into
|
|
||||||
WSL. To circumvent this problem, the rootfs tarball is wrapped in that
|
|
||||||
of a minimal distribution (the installer), that is packaged without any
|
|
||||||
hard-links. When the installer system is started for the first time, it
|
|
||||||
overwrites itself with the contents of the rootfs tarball.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
Apache License, Version 2.0. See `LICENSE` or <http://www.apache.org/licenses/LICENSE-2.0.html> for details.
|
|
||||||
|
|
||||||
## Further links
|
|
||||||
|
|
||||||
- [DistroLauncher](https://github.com/microsoft/WSL-DistroLauncher)
|
|
||||||
- [A quick way into a systemd \"bottle\" for WSL](https://github.com/arkane-systems/genie)
|
|
||||||
- [NixOS in Windows Store for Windows Subsystem for Linux](https://github.com/NixOS/nixpkgs/issues/30391)
|
|
||||||
- [wsl2-hacks](https://github.com/shayne/wsl2-hacks)
|
|
|
@ -1,13 +0,0 @@
|
||||||
(import
|
|
||||||
(
|
|
||||||
let
|
|
||||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
|
||||||
in
|
|
||||||
fetchTarball {
|
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
{
|
|
||||||
src = ./.;
|
|
||||||
}).defaultNix
|
|
|
@ -1,59 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1650374568,
|
|
||||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1659877975,
|
|
||||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1660318005,
|
|
||||||
"narHash": "sha256-g9WCa9lVUmOV6dYRbEPjv/TLOR5hamjeCcKExVGS3OQ=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "5c211b47aeadcc178c5320afd4e74c7eed5c389f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"ref": "nixos-22.05",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
{
|
|
||||||
description = "NixOS WSL";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "nixpkgs/nixos-22.05";
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
|
|
||||||
flake-compat = {
|
|
||||||
url = "github:edolstra/flake-compat";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
|
||||||
{
|
|
||||||
|
|
||||||
nixosModules.wsl = {
|
|
||||||
imports = [
|
|
||||||
./modules/build-tarball.nix
|
|
||||||
./modules/docker-desktop.nix
|
|
||||||
./modules/docker-native.nix
|
|
||||||
./modules/installer.nix
|
|
||||||
./modules/interop.nix
|
|
||||||
./modules/wsl-distro.nix
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = [
|
|
||||||
./configuration.nix
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
} //
|
|
||||||
flake-utils.lib.eachSystem
|
|
||||||
(with flake-utils.lib.system; [ "x86_64-linux" "aarch64-linux" ])
|
|
||||||
(system:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
checks.check-format = pkgs.runCommand "check-format"
|
|
||||||
{
|
|
||||||
buildInputs = with pkgs; [ nixpkgs-fmt ];
|
|
||||||
} ''
|
|
||||||
nixpkgs-fmt --check ${./.}
|
|
||||||
mkdir $out # success
|
|
||||||
'';
|
|
||||||
|
|
||||||
devShell = pkgs.mkShell {
|
|
||||||
nativeBuildInputs = with pkgs; [ nixpkgs-fmt ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,97 +0,0 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
with builtins; with lib;
|
|
||||||
let
|
|
||||||
pkgs2storeContents = l: map (x: { object = x; symlink = "none"; }) l;
|
|
||||||
|
|
||||||
nixpkgs = lib.cleanSource pkgs.path;
|
|
||||||
|
|
||||||
channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}"
|
|
||||||
{ preferLocalBuild = true; }
|
|
||||||
''
|
|
||||||
mkdir -p $out
|
|
||||||
cp -prd ${nixpkgs.outPath} $out/nixos
|
|
||||||
chmod -R u+w $out/nixos
|
|
||||||
if [ ! -e $out/nixos/nixpkgs ]; then
|
|
||||||
ln -s . $out/nixos/nixpkgs
|
|
||||||
fi
|
|
||||||
echo -n ${toString config.system.nixos.revision} > $out/nixos/.git-revision
|
|
||||||
echo -n ${toString config.system.nixos.versionSuffix} > $out/nixos/.version-suffix
|
|
||||||
echo ${toString config.system.nixos.versionSuffix} | sed -e s/pre// > $out/nixos/svn-revision
|
|
||||||
'';
|
|
||||||
|
|
||||||
preparer = pkgs.writeShellScriptBin "wsl-prepare" ''
|
|
||||||
set -e
|
|
||||||
|
|
||||||
mkdir -m 0755 ./bin ./etc
|
|
||||||
mkdir -m 1777 ./tmp
|
|
||||||
|
|
||||||
# WSL requires a /bin/sh - only temporary, NixOS's activate will overwrite
|
|
||||||
ln -s ${config.users.users.root.shell} ./bin/sh
|
|
||||||
|
|
||||||
# WSL also requires a /bin/mount, otherwise the host fs isn't accessible
|
|
||||||
ln -s /nix/var/nix/profiles/system/sw/bin/mount ./bin/mount
|
|
||||||
|
|
||||||
# Set system profile
|
|
||||||
system=${config.system.build.toplevel}
|
|
||||||
./$system/sw/bin/nix-store --store `pwd` --load-db < ./nix-path-registration
|
|
||||||
rm ./nix-path-registration
|
|
||||||
./$system/sw/bin/nix-env --store `pwd` -p ./nix/var/nix/profiles/system --set $system
|
|
||||||
|
|
||||||
# Set channel
|
|
||||||
mkdir -p ./nix/var/nix/profiles/per-user/root
|
|
||||||
./$system/sw/bin/nix-env --store `pwd` -p ./nix/var/nix/profiles/per-user/root/channels --set ${channelSources}
|
|
||||||
mkdir -m 0700 -p ./root/.nix-defexpr
|
|
||||||
ln -s /nix/var/nix/profiles/per-user/root/channels ./root/.nix-defexpr/channels
|
|
||||||
|
|
||||||
# It's now a NixOS!
|
|
||||||
touch ./etc/NIXOS
|
|
||||||
|
|
||||||
# Write wsl.conf so that it is present when NixOS is started for the first time
|
|
||||||
cp ${config.environment.etc."wsl.conf".source} ./etc/wsl.conf
|
|
||||||
|
|
||||||
${lib.optionalString config.wsl.tarball.includeConfig ''
|
|
||||||
# Copy the system configuration
|
|
||||||
mkdir -p ./etc/nixos/nixos-wsl
|
|
||||||
cp -R ${lib.cleanSource ../.}/. ./etc/nixos/nixos-wsl
|
|
||||||
mv ./etc/nixos/nixos-wsl/configuration.nix ./etc/nixos/configuration.nix
|
|
||||||
# Patch the import path to avoid having a flake.nix in /etc/nixos
|
|
||||||
sed -i 's|import \./default\.nix|import \./nixos-wsl|' ./etc/nixos/configuration.nix
|
|
||||||
''}
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
options.wsl.tarball = {
|
|
||||||
includeConfig = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = "Whether or not to copy the system configuration into the tarball";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
config = mkIf config.wsl.enable {
|
|
||||||
# These options make no sense without the wsl-distro module anyway
|
|
||||||
|
|
||||||
system.build.tarball = pkgs.callPackage "${nixpkgs}/nixos/lib/make-system-tarball.nix" {
|
|
||||||
# No contents, structure will be added by prepare script
|
|
||||||
contents = [ ];
|
|
||||||
|
|
||||||
fileName = "nixos-wsl-${pkgs.hostPlatform.system}";
|
|
||||||
|
|
||||||
storeContents = pkgs2storeContents [
|
|
||||||
config.system.build.toplevel
|
|
||||||
channelSources
|
|
||||||
preparer
|
|
||||||
];
|
|
||||||
|
|
||||||
extraCommands = "${preparer}/bin/wsl-prepare";
|
|
||||||
|
|
||||||
# Use gzip
|
|
||||||
compressCommand = "gzip";
|
|
||||||
compressionExtension = ".gz";
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
with builtins; with lib; {
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
(mkRenamedOptionModule [ "wsl" "docker" ] [ "wsl" "docker-desktop" ])
|
|
||||||
];
|
|
||||||
|
|
||||||
options.wsl.docker-desktop = with types; {
|
|
||||||
enable = mkEnableOption "Docker Desktop integration";
|
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
cfg = config.wsl.docker-desktop;
|
|
||||||
in
|
|
||||||
mkIf (config.wsl.enable && cfg.enable) {
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
docker
|
|
||||||
docker-compose
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.services.docker-desktop-proxy = {
|
|
||||||
description = "Docker Desktop proxy";
|
|
||||||
script = ''
|
|
||||||
${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop
|
|
||||||
'';
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Restart = "on-failure";
|
|
||||||
RestartSec = "30s";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
users.groups.docker.members = [
|
|
||||||
config.wsl.defaultUser
|
|
||||||
];
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
with builtins; with lib; {
|
|
||||||
|
|
||||||
options.wsl.docker-native = with types; {
|
|
||||||
enable = mkEnableOption "Native Docker integration in NixOS.";
|
|
||||||
|
|
||||||
addToDockerGroup = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = config.security.sudo.wheelNeedsPassword;
|
|
||||||
description = ''
|
|
||||||
Wether to add the default user to the docker group.
|
|
||||||
|
|
||||||
This is not recommended, if you have a password, because it essentially permits unauthenticated root access.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
cfg = config.wsl.docker-native;
|
|
||||||
in
|
|
||||||
mkIf (config.wsl.enable && cfg.enable) {
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(self: super: {
|
|
||||||
docker = super.docker.override { iptables = pkgs.iptables-legacy; };
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
docker
|
|
||||||
docker-compose
|
|
||||||
];
|
|
||||||
|
|
||||||
virtualisation.docker.enable = true;
|
|
||||||
|
|
||||||
users.groups.docker.members = lib.mkIf cfg.addToDockerGroup [
|
|
||||||
config.wsl.defaultUser
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
with builtins; with lib; {
|
|
||||||
|
|
||||||
config = mkIf config.wsl.enable (
|
|
||||||
let
|
|
||||||
mkTarball = pkgs.callPackage "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix";
|
|
||||||
|
|
||||||
pkgs2storeContents = map (x: { object = x; symlink = "none"; });
|
|
||||||
|
|
||||||
rootfs = let tarball = config.system.build.tarball; in "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}";
|
|
||||||
|
|
||||||
installer = pkgs.writeScript "installer.sh" ''
|
|
||||||
#!${pkgs.busybox}/bin/sh
|
|
||||||
BASEPATH=$PATH
|
|
||||||
export PATH=$BASEPATH:${pkgs.busybox}/bin # Add busybox to path
|
|
||||||
|
|
||||||
set -e
|
|
||||||
cd /
|
|
||||||
|
|
||||||
echo "Unpacking root file system..."
|
|
||||||
${pkgs.pv}/bin/pv ${rootfs} | tar xz
|
|
||||||
|
|
||||||
echo "Activating nix configuration..."
|
|
||||||
/nix/var/nix/profiles/system/activate
|
|
||||||
PATH=$BASEPATH:/run/current-system/sw/bin # Use packages from target system
|
|
||||||
|
|
||||||
echo "Cleaning up installer files..."
|
|
||||||
nix-collect-garbage
|
|
||||||
rm /nix-path-registration
|
|
||||||
|
|
||||||
echo "Optimizing store..."
|
|
||||||
nix-store --optimize
|
|
||||||
|
|
||||||
# Don't package the shell here, it's contained in the rootfs
|
|
||||||
exec ${builtins.unsafeDiscardStringContext config.users.users.root.shell} "$@"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Set installer.sh as the root shell
|
|
||||||
passwd = pkgs.writeText "passwd" ''
|
|
||||||
root:x:0:0:System administrator:/root:${installer}
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
system.build.installer = mkTarball {
|
|
||||||
fileName = "nixos-wsl-installer";
|
|
||||||
compressCommand = "gzip";
|
|
||||||
compressionExtension = ".gz";
|
|
||||||
extraArgs = "--hard-dereference";
|
|
||||||
|
|
||||||
storeContents = with pkgs; pkgs2storeContents [
|
|
||||||
installer
|
|
||||||
];
|
|
||||||
|
|
||||||
contents = [
|
|
||||||
{ source = config.environment.etc."wsl.conf".source; target = "/etc/wsl.conf"; }
|
|
||||||
{ 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" ''
|
|
||||||
export PATH=$PATH:${pkgs.coreutils}/bin
|
|
||||||
mkdir -p bin
|
|
||||||
ln -s /init bin/wslpath
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,88 +0,0 @@
|
||||||
{ lib, pkgs, config, ... }:
|
|
||||||
|
|
||||||
with builtins; with lib;
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
(mkRenamedOptionModule [ "wsl" "compatibility" "interopPreserveArgvZero" ] [ "wsl" "interop" "preserveArgvZero" ])
|
|
||||||
];
|
|
||||||
|
|
||||||
options.wsl.interop = with types; {
|
|
||||||
register = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = false; # Use the existing registration by default
|
|
||||||
description = "Explicitly register the binfmt_misc handler for Windows executables";
|
|
||||||
};
|
|
||||||
|
|
||||||
includePath = mkOption {
|
|
||||||
type = bool;
|
|
||||||
default = true;
|
|
||||||
description = "Include Windows PATH in WSL PATH";
|
|
||||||
};
|
|
||||||
|
|
||||||
preserveArgvZero = mkOption {
|
|
||||||
type = nullOr bool;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Register binfmt interpreter for Windows executables with 'preserves argv[0]' flag.
|
|
||||||
|
|
||||||
Default (null): autodetect, at some performance cost.
|
|
||||||
To avoid the performance cost, set this to true for WSL Preview 0.58 and up,
|
|
||||||
or to false for any older versions, including pre-Microsoft Store and Windows 10.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
cfg = config.wsl.interop;
|
|
||||||
in
|
|
||||||
mkIf config.wsl.enable {
|
|
||||||
|
|
||||||
boot.binfmt.registrations = mkIf cfg.register {
|
|
||||||
WSLInterop =
|
|
||||||
let
|
|
||||||
compat = cfg.preserveArgvZero;
|
|
||||||
|
|
||||||
# WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable
|
|
||||||
# with the "preserve argv[0]" flag, so if you run `./foo.exe`, the interp gets invoked
|
|
||||||
# as `/init foo.exe ./foo.exe`.
|
|
||||||
# argv[0] --^ ^-- actual path
|
|
||||||
#
|
|
||||||
# Older versions expect to be called without the argv[0] bit, simply as `/init ./foo.exe`.
|
|
||||||
#
|
|
||||||
# We detect that by running `/init /known-not-existing-path.exe` and checking the exit code:
|
|
||||||
# the new style interp expects at least two arguments, so exits with exit code 1,
|
|
||||||
# presumably meaning "parsing error"; the old style interp attempts to actually run
|
|
||||||
# the executable, fails to find it, and exits with 255.
|
|
||||||
compatWrapper = pkgs.writeShellScript "nixos-wsl-binfmt-hack" ''
|
|
||||||
/init /nixos-wsl-does-not-exist.exe
|
|
||||||
[ $? -eq 255 ] && shift
|
|
||||||
exec /init "$@"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# use the autodetect hack if unset, otherwise call /init directly
|
|
||||||
interpreter = if compat == null then compatWrapper else "/init";
|
|
||||||
|
|
||||||
# enable for the wrapper and autodetect hack
|
|
||||||
preserveArgvZero = if compat == false then false else true;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
magicOrExtension = "MZ";
|
|
||||||
fixBinary = true;
|
|
||||||
wrapInterpreterInShell = false;
|
|
||||||
inherit interpreter preserveArgvZero;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Include Windows %PATH% in Linux $PATH.
|
|
||||||
environment.extraInit = mkIf cfg.includePath ''PATH="$PATH:$WSLPATH"'';
|
|
||||||
|
|
||||||
warnings =
|
|
||||||
let
|
|
||||||
registrations = config.boot.binfmt.registrations;
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,139 +0,0 @@
|
||||||
{ lib, pkgs, config, ... }:
|
|
||||||
|
|
||||||
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";
|
|
||||||
automountPath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "/mnt";
|
|
||||||
description = "The path where windows drives are mounted (e.g. /mnt/c)";
|
|
||||||
};
|
|
||||||
automountOptions = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "metadata,uid=1000,gid=100";
|
|
||||||
description = "Options to use when mounting windows drives";
|
|
||||||
};
|
|
||||||
defaultUser = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "nixos";
|
|
||||||
description = "The name of the default user";
|
|
||||||
};
|
|
||||||
startMenuLaunchers = mkEnableOption "shortcuts for GUI applications in the windows start menu";
|
|
||||||
wslConf = mkOption {
|
|
||||||
type = attrsOf (attrsOf (oneOf [ string int bool ]));
|
|
||||||
description = "Entries that are added to /etc/wsl.conf";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
cfg = config.wsl;
|
|
||||||
syschdemd = import ../syschdemd.nix { inherit lib pkgs config; inherit (cfg) automountPath defaultUser; defaultUserHome = config.users.users.${cfg.defaultUser}.home; };
|
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
|
||||||
|
|
||||||
wsl.wslConf = {
|
|
||||||
automount = {
|
|
||||||
enabled = true;
|
|
||||||
mountFsTab = true;
|
|
||||||
root = "${cfg.automountPath}/";
|
|
||||||
options = cfg.automountOptions;
|
|
||||||
};
|
|
||||||
network = {
|
|
||||||
generateResolvConf = mkDefault true;
|
|
||||||
generateHosts = mkDefault true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# WSL is closer to a container than anything else
|
|
||||||
boot.isContainer = true;
|
|
||||||
|
|
||||||
environment.noXlibs = lib.mkForce false; # override xlibs not being installed (due to isContainer) to enable the use of GUI apps
|
|
||||||
hardware.opengl.enable = true; # Enable GPU acceleration
|
|
||||||
|
|
||||||
environment = {
|
|
||||||
|
|
||||||
etc = {
|
|
||||||
"wsl.conf".text = generators.toINI { } cfg.wslConf;
|
|
||||||
|
|
||||||
# DNS settings are managed by WSL
|
|
||||||
hosts.enable = !config.wsl.wslConf.network.generateHosts;
|
|
||||||
"resolv.conf".enable = !config.wsl.wslConf.network.generateResolvConf;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemPackages = [
|
|
||||||
(pkgs.runCommand "wslpath" { } ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
ln -s /init $out/bin/wslpath
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.dhcpcd.enable = false;
|
|
||||||
|
|
||||||
users.users.${cfg.defaultUser} = {
|
|
||||||
isNormalUser = true;
|
|
||||||
uid = 1000;
|
|
||||||
extraGroups = [ "wheel" ]; # Allow the default user to use sudo
|
|
||||||
};
|
|
||||||
|
|
||||||
users.users.root = {
|
|
||||||
shell = "${syschdemd}/bin/syschdemd";
|
|
||||||
# Otherwise WSL fails to login as root with "initgroups failed 5"
|
|
||||||
extraGroups = [ "root" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
security.sudo = {
|
|
||||||
extraConfig = ''
|
|
||||||
Defaults env_keep+=INSIDE_NAMESPACE
|
|
||||||
'';
|
|
||||||
wheelNeedsPassword = mkDefault false; # The default user will not have a password by default
|
|
||||||
};
|
|
||||||
|
|
||||||
system.activationScripts = {
|
|
||||||
copy-launchers = mkIf cfg.startMenuLaunchers (
|
|
||||||
stringAfter [ ] ''
|
|
||||||
for x in applications icons; do
|
|
||||||
echo "Copying /usr/share/$x"
|
|
||||||
mkdir -p /usr/share/$x
|
|
||||||
${pkgs.rsync}/bin/rsync -ar --delete $systemConfig/sw/share/$x/. /usr/share/$x
|
|
||||||
done
|
|
||||||
''
|
|
||||||
);
|
|
||||||
populateBin = stringAfter [ ] ''
|
|
||||||
echo "setting up /bin..."
|
|
||||||
ln -sf /init /bin/wslpath
|
|
||||||
ln -sf ${pkgs.bashInteractive}/bin/bash /bin/sh
|
|
||||||
ln -sf ${pkgs.util-linux}/bin/mount /bin/mount
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd = {
|
|
||||||
# Disable systemd units that don't make sense on WSL
|
|
||||||
services = {
|
|
||||||
"serial-getty@ttyS0".enable = false;
|
|
||||||
"serial-getty@hvc0".enable = false;
|
|
||||||
"getty@tty1".enable = false;
|
|
||||||
"autovt@".enable = false;
|
|
||||||
firewall.enable = false;
|
|
||||||
systemd-resolved.enable = false;
|
|
||||||
systemd-udevd.enable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
tmpfiles.rules = [
|
|
||||||
# Don't remove the X11 socket
|
|
||||||
"d /tmp/.X11-unix 1777 root root"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Don't allow emergency mode, because we don't have a console.
|
|
||||||
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");
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
{ lib
|
|
||||||
, pkgs
|
|
||||||
, config
|
|
||||||
, automountPath
|
|
||||||
, defaultUser
|
|
||||||
, defaultUserHome ? "/home/${defaultUser}"
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
|
|
||||||
pkgs.substituteAll {
|
|
||||||
name = "syschdemd";
|
|
||||||
src = ./syschdemd.sh;
|
|
||||||
dir = "bin";
|
|
||||||
isExecutable = true;
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [ daemonize ];
|
|
||||||
|
|
||||||
inherit defaultUser defaultUserHome;
|
|
||||||
inherit (pkgs) daemonize;
|
|
||||||
inherit (config.security) wrapperDir;
|
|
||||||
fsPackagesPath = lib.makeBinPath config.system.fsPackages;
|
|
||||||
|
|
||||||
systemdWrapper = pkgs.writeShellScript "systemd-wrapper.sh" ''
|
|
||||||
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc || true
|
|
||||||
mount --make-rshared ${automountPath}
|
|
||||||
exec systemd
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,78 +0,0 @@
|
||||||
#! @shell@
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
sw="/nix/var/nix/profiles/system/sw/bin"
|
|
||||||
systemPath=$(${sw}/readlink -f /nix/var/nix/profiles/system)
|
|
||||||
|
|
||||||
function start_systemd {
|
|
||||||
echo "Starting systemd..." >&2
|
|
||||||
|
|
||||||
PATH=/run/current-system/systemd/lib/systemd:@fsPackagesPath@ \
|
|
||||||
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive \
|
|
||||||
@daemonize@/bin/daemonize /run/current-system/sw/bin/unshare -fp --mount-proc @systemdWrapper@
|
|
||||||
|
|
||||||
# Wait until systemd has been started to prevent a race condition from occuring
|
|
||||||
while ! $sw/pgrep -xf systemd | $sw/tail -n1 >/run/systemd.pid; do
|
|
||||||
$sw/sleep 1s
|
|
||||||
done
|
|
||||||
|
|
||||||
# Wait for systemd to start services
|
|
||||||
status=1
|
|
||||||
while [[ $status -gt 0 ]]; do
|
|
||||||
$sw/sleep 1
|
|
||||||
status=0
|
|
||||||
$sw/nsenter -t $(</run/systemd.pid) -p -m -- \
|
|
||||||
$sw/systemctl is-system-running -q --wait 2>/dev/null ||
|
|
||||||
status=$?
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Needs root to work
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
|
||||||
echo "[ERROR] Requires root! :( Make sure the WSL default user is set to root" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "/run/current-system" ]; then
|
|
||||||
LANG="C.UTF-8" /nix/var/nix/profiles/system/activate
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "/run/systemd.pid" ]; then
|
|
||||||
start_systemd
|
|
||||||
fi
|
|
||||||
|
|
||||||
userShell=$($sw/getent passwd @defaultUser@ | $sw/cut -d: -f7)
|
|
||||||
if [[ $# -gt 0 ]]; then
|
|
||||||
# wsl seems to prefix with "-c"
|
|
||||||
shift
|
|
||||||
cmd="$@"
|
|
||||||
else
|
|
||||||
cmd="$userShell"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pass external environment but filter variables specific to root user.
|
|
||||||
exportCmd="$(export -p | $sw/grep -vE ' (HOME|LOGNAME|SHELL|USER)='); export WSLPATH=\"$PATH\"; export INSIDE_NAMESPACE=true"
|
|
||||||
|
|
||||||
if [[ -z "${INSIDE_NAMESPACE:-}" ]]; then
|
|
||||||
|
|
||||||
# Test whether systemd is still alive if it was started previously
|
|
||||||
if ! [ -d "/proc/$(</run/systemd.pid)" ]; then
|
|
||||||
# Clear systemd pid if the process is not alive anymore
|
|
||||||
$sw/rm /run/systemd.pid
|
|
||||||
start_systemd
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we are currently in /root, this is probably because the directory that WSL was started is inaccessible
|
|
||||||
# cd to the user's home to prevent a warning about permission being denied on /root
|
|
||||||
if [[ $PWD == "/root" ]]; then
|
|
||||||
cd @defaultUserHome@
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec $sw/nsenter -t $(</run/systemd.pid) -p -m -- $sw/machinectl -q \
|
|
||||||
--uid=@defaultUser@ shell .host /bin/sh -c \
|
|
||||||
"cd \"$PWD\"; $exportCmd; source /etc/set-environment; exec $cmd"
|
|
||||||
|
|
||||||
else
|
|
||||||
exec $cmd
|
|
||||||
fi
|
|
|
@ -1,80 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [ ];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
## NOTE: These filesystems are mounted by a wrapper script from nix-wsl
|
|
||||||
|
|
||||||
# fileSystems."/" =
|
|
||||||
# {
|
|
||||||
# device = "/dev/sdc";
|
|
||||||
# fsType = "ext4";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/mnt/wsl" =
|
|
||||||
# {
|
|
||||||
# device = "tmpfs";
|
|
||||||
# fsType = "tmpfs";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/mnt/wsl/docker-desktop/shared-sockets/guest-services" =
|
|
||||||
# {
|
|
||||||
# device = "none";
|
|
||||||
# fsType = "tmpfs";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/usr/lib/wsl/drivers" =
|
|
||||||
# {
|
|
||||||
# device = "drivers";
|
|
||||||
# fsType = "drvfs";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/usr/lib/wsl/lib" =
|
|
||||||
# {
|
|
||||||
# device = "lib";
|
|
||||||
# fsType = "drvfs";
|
|
||||||
# };
|
|
||||||
|
|
||||||
fileSystems."/mnt/c" =
|
|
||||||
{
|
|
||||||
device = "C:";
|
|
||||||
fsType = "drvfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/mnt/d" =
|
|
||||||
{
|
|
||||||
device = "D:";
|
|
||||||
fsType = "drvfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/mnt/f" =
|
|
||||||
{
|
|
||||||
device = "F:";
|
|
||||||
fsType = "drvfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.bond0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.bonding_masters.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.dummy0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eth0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.sit0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.tunl0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Machine-specific profile
|
|
||||||
|
|
||||||
- Currently only contains machine-specific details such as the `hardware-configuration.nix`
|
|
|
@ -1,44 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
|
||||||
# boot.initrd.kernelModules = [ "amdgpu" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-amd" "coretemp" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
# Might be wise to use /dev/nvme0p1 instead
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-uuid/27fc09b3-e3b7-4883-94a0-c313a0e0abe2";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
# Might be wise to use /dev/nvme0p2 instead
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-uuid/EBA6-394D";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
|
||||||
boot.loader.grub.extraConfig = ''
|
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
|
||||||
terminal_input serial;
|
|
||||||
terminal_output serial
|
|
||||||
'';
|
|
||||||
boot.loader.grub.forceInstall = true;
|
|
||||||
boot.loader.grub.device = "nodev";
|
|
||||||
boot.loader.timeout = 10;
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{
|
|
||||||
device = "/dev/sda";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[{ device = "/dev/sdb"; }];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
|
||||||
boot.loader.grub.extraConfig = ''
|
|
||||||
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1
|
|
||||||
terminal_input serial;
|
|
||||||
terminal_output serial
|
|
||||||
'';
|
|
||||||
boot.loader.grub.forceInstall = true;
|
|
||||||
boot.loader.grub.device = "nodev";
|
|
||||||
boot.loader.timeout = 10;
|
|
||||||
boot.kernelModules = [ ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{
|
|
||||||
device = "/dev/sda";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[{ device = "/dev/sdb"; }];
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp0s5.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue