diff --git a/README.md b/README.md deleted file mode 100644 index 8b8dc70..0000000 --- a/README.md +++ /dev/null @@ -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` - - diff --git a/c_.nix b/c_.nix deleted file mode 100644 index 04f23fa..0000000 --- a/c_.nix +++ /dev/null @@ -1,111 +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; - } -) - diff --git a/default.nix b/default.nix deleted file mode 100644 index 9004ce7..0000000 --- a/default.nix +++ /dev/null @@ -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 diff --git a/dev-shell.nix b/dev-shell.nix deleted file mode 100644 index 69b54a4..0000000 --- a/dev-shell.nix +++ /dev/null @@ -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 { } -, 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"; -} - diff --git a/docs/DEV.md b/docs/DEV.md deleted file mode 100644 index f5f7c68..0000000 --- a/docs/DEV.md +++ /dev/null @@ -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` - diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 4a4f39e..0000000 --- a/flake.lock +++ /dev/null @@ -1,358 +0,0 @@ -{ - "nodes": { - "agenix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1673301561, - "narHash": "sha256-gRUWHbBAtMuPDJQXotoI8u6+3DGBIUZHkyQWpIv7WpM=", - "owner": "ryantm", - "repo": "agenix", - "rev": "42d371d861a227149dc9a7e03350c9ab8b8ddd68", - "type": "github" - }, - "original": { - "owner": "ryantm", - "repo": "agenix", - "type": "github" - } - }, - "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" - } - }, - "nixlib": { - "locked": { - "lastModified": 1673743903, - "narHash": "sha256-sloY6KYyVOozJ1CkbgJPpZ99TKIjIvM+04V48C04sMQ=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "7555e2dfcbac1533f047021f1744ac8871150f9f", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "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": 1673631141, - "narHash": "sha256-AprpYQ5JvLS4wQG/ghm2UriZ9QZXvAwh1HlgA/6ZEVQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "befc83905c965adfd33e5cae49acb0351f6e0404", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "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": { - "agenix": "agenix", - "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": { - "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 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 90daf2f..0000000 --- a/flake.nix +++ /dev/null @@ -1,178 +0,0 @@ -{ - nixConfig = { - accept-flake-config = true; - experimental-features = "nix-command flakes"; - # for darwin's browser - allowUnsupportedSystem = true; - }; - description = "My personal configuration in Nix (and some native configurations)"; - inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; - # 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 = - { nixpkgs - , agenix - , home-manager - , flake-utils - , nixgl - , 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; - }); -} diff --git a/hosts/Felia/hardware-configuration.nix b/hosts/Felia/hardware-configuration.nix deleted file mode 100644 index 97c93fb..0000000 --- a/hosts/Felia/hardware-configuration.nix +++ /dev/null @@ -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..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; -} diff --git a/hosts/bao/default.nix b/hosts/bao/default.nix deleted file mode 100644 index 6559c04..0000000 --- a/hosts/bao/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ nixpkgs -, agenix -, home-manager -, flake-utils -, nixgl -, rust-overlay -, flake-compat -, pkgs -, lib -, proj_root -}: { } - diff --git a/hosts/bao/hardware-configuration.nix b/hosts/bao/hardware-configuration.nix deleted file mode 100644 index fb30806..0000000 --- a/hosts/bao/hardware-configuration.nix +++ /dev/null @@ -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..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; -} diff --git a/hosts/default.nix b/hosts/default.nix deleted file mode 100644 index b1e6771..0000000 --- a/hosts/default.nix +++ /dev/null @@ -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; -} diff --git a/hosts/homeless/hardware-configuration.nix b/hosts/homeless/hardware-configuration.nix deleted file mode 100644 index e45b92a..0000000 --- a/hosts/homeless/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/lester/hardware-configuration.nix b/hosts/lester/hardware-configuration.nix deleted file mode 100644 index e45b92a..0000000 --- a/hosts/lester/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/lizzi/default.nix b/hosts/lizzi/default.nix deleted file mode 100644 index 9596da8..0000000 --- a/hosts/lizzi/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ nixpkgs -, agenix -, home-manager -, flake-utils -, nixgl -, rust-overlay -, flake-compat -, pkgs -, lib -, proj_root -}: { } diff --git a/hosts/lizzi/hardware-configuration.nix b/hosts/lizzi/hardware-configuration.nix deleted file mode 100644 index 5fa1db1..0000000 --- a/hosts/lizzi/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/nyx/hardware-configuration.nix b/hosts/nyx/hardware-configuration.nix deleted file mode 100644 index 88ffe66..0000000 --- a/hosts/nyx/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/prince/hardware-configuration.nix b/hosts/prince/hardware-configuration.nix deleted file mode 100644 index 8b13789..0000000 --- a/hosts/prince/hardware-configuration.nix +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index 6568f0c..0000000 --- a/lib/default.nix +++ /dev/null @@ -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; -} diff --git a/lib/serde.nix b/lib/serde.nix deleted file mode 100644 index d0d5732..0000000 --- a/lib/serde.nix +++ /dev/null @@ -1,31 +0,0 @@ -# Takes care of serializing and deserializing to some formats -# Blame: Pegasust -# 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? -} diff --git a/lib/test.nix b/lib/test.nix deleted file mode 100644 index da4b506..0000000 --- a/lib/test.nix +++ /dev/null @@ -1 +0,0 @@ -{ lib, ... }: { } diff --git a/modules/amdgpu.sys.nix b/modules/amdgpu.sys.nix deleted file mode 100644 index d07dc1f..0000000 --- a/modules/amdgpu.sys.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ ./gpu.sys.nix ]; - boot.initrd.kernelModules = [ "amdgpu" ]; - services.xserver.enable = true; - services.xserver.videoDrivers = [ "amdgpu" ]; -} diff --git a/modules/base.sys.nix b/modules/base.sys.nix deleted file mode 100644 index 8bc5c8a..0000000 --- a/modules/base.sys.nix +++ /dev/null @@ -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"; - -} diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index be9a414..0000000 --- a/modules/default.nix +++ /dev/null @@ -1 +0,0 @@ -inputs: { } diff --git a/modules/gpu.sys.nix b/modules/gpu.sys.nix deleted file mode 100644 index 40a94e5..0000000 --- a/modules/gpu.sys.nix +++ /dev/null @@ -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; - }; -} diff --git a/modules/kde.sys.nix b/modules/kde.sys.nix deleted file mode 100644 index e5b427f..0000000 --- a/modules/kde.sys.nix +++ /dev/null @@ -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; -} diff --git a/modules/minimal.sys.nix b/modules/minimal.sys.nix deleted file mode 100644 index da0b92c..0000000 --- a/modules/minimal.sys.nix +++ /dev/null @@ -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"); - }; -} diff --git a/modules/mosh.sys.nix b/modules/mosh.sys.nix deleted file mode 100644 index 33571cd..0000000 --- a/modules/mosh.sys.nix +++ /dev/null @@ -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 - ]; - }; - }; -} - diff --git a/modules/nvgpu.sys.nix b/modules/nvgpu.sys.nix deleted file mode 100644 index 4b6d3e7..0000000 --- a/modules/nvgpu.sys.nix +++ /dev/null @@ -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; -} diff --git a/modules/opengl.sys.nix b/modules/opengl.sys.nix deleted file mode 100644 index 42788f0..0000000 --- a/modules/opengl.sys.nix +++ /dev/null @@ -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; - }; - environment.systemPackages = gpu_pkgs; - }; -in gpu_conf diff --git a/modules/pipewire.audio.sys.nix b/modules/pipewire.audio.sys.nix deleted file mode 100644 index 8c36bee..0000000 --- a/modules/pipewire.audio.sys.nix +++ /dev/null @@ -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; -} diff --git a/modules/pulseaudio.sys.nix b/modules/pulseaudio.sys.nix deleted file mode 100644 index 3b804f3..0000000 --- a/modules/pulseaudio.sys.nix +++ /dev/null @@ -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"; -} diff --git a/modules/secrets.nix b/modules/secrets.nix deleted file mode 100644 index d491da3..0000000 --- a/modules/secrets.nix +++ /dev/null @@ -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]; -} diff --git a/modules/ssh.sys.nix b/modules/ssh.sys.nix deleted file mode 100644 index 7133f33..0000000 --- a/modules/ssh.sys.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - services.openssh = { - enable = true; - permitRootLogin = "no"; - }; -} diff --git a/modules/storage.perso.sys.nix b/modules/storage.perso.sys.nix deleted file mode 100644 index ab8ac44..0000000 --- a/modules/storage.perso.sys.nix +++ /dev/null @@ -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 - }; -} diff --git a/modules/tailscale.sys.nix b/modules/tailscale.sys.nix deleted file mode 100644 index 6e3e1bb..0000000 --- a/modules/tailscale.sys.nix +++ /dev/null @@ -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"; - }; - }; -} diff --git a/modules/wifi.sys.nix b/modules/wifi.sys.nix deleted file mode 100644 index 1d615ee..0000000 --- a/modules/wifi.sys.nix +++ /dev/null @@ -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@"; - }; -} diff --git a/native_configs/README.md b/native_configs/README.md deleted file mode 100644 index 63955ee..0000000 --- a/native_configs/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Native configs - -Contains all configurations that are written in their native language diff --git a/native_configs/alacritty/alacritty.yml b/native_configs/alacritty/alacritty.yml deleted file mode 100755 index 773f376..0000000 --- a/native_configs/alacritty/alacritty.yml +++ /dev/null @@ -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 diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua deleted file mode 100644 index b4b3979..0000000 --- a/native_configs/neovim/init.lua +++ /dev/null @@ -1,1007 +0,0 @@ --- What: Mono-file nvim configuration file --- Why: Easy to see through everything without needing to navigate thru files --- Features: --- - LSP --- - Auto-complete (in insert mode: ctrl-space, navigate w/ Tab+S-Tab, confirm: Enter) --- - df to format document --- - Harpoon marks: Navigate through main files within each project --- --- REQUIREMENTS: --- - zk @ https://github.com/mickael-menu/zk --- - prettierd @ npm install -g @fsouza/prettierd - -vim.cmd([[ -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' -let plug_path = data_dir . '/autoload/plug.vim' -if empty(glob(plug_path)) - execute '!curl -fLo '.plug_path.' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - execute 'so '.plug_path -endif -]]) - -local function truthy(v) return v ~= nil end - -local function cfg(cfg_var, do_fn) if truthy(cfg_var) then do_fn() end end - --- vim-plug -local Plug = vim.fn['plug#'] - -vim.call('plug#begin') - --- libs and dependencies -Plug('nvim-lua/plenary.nvim') -- The base of all plugins - --- plugins -Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua -Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting -Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects -Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser --- TODO: this might need to be taken extra care in our Nix config --- What this Plug declaration means is this repo needs to be built on our running environment --- ----- --- What to do: --- - Run `make` at anytime before Nix is done on this repository --- - Might mean that we fetch this repository, run make, and copy to destination folder --- - Make sure that if we run `make` at first Plug run, that `make` is idempotent --- OR --- Make sure that Plug does not run `make` and use the output it needs -Plug('nvim-telescope/telescope-fzf-native.nvim', - { ['do'] = 'make >> /tmp/log 2>&1' }) -Plug('nvim-telescope/telescope-file-browser.nvim') - --- cmp: auto-complete/suggestions -Plug('neovim/nvim-lspconfig') -- built-in LSP configurations -Plug('hrsh7th/cmp-nvim-lsp') -Plug('hrsh7th/cmp-path') -Plug('hrsh7th/cmp-buffer') -Plug('hrsh7th/cmp-cmdline') -Plug('hrsh7th/nvim-cmp') -Plug('onsails/lspkind-nvim') -Plug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent --- Plug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) - --- DevExp -Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... -Plug('windwp/nvim-ts-autotag') -- matches tags hello -Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer -Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines -Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns -Plug('tpope/vim-fugitive') -- git commands in nvim -Plug('williamboman/mason.nvim') -- LSP, debuggers,... package manager -Plug('williamboman/mason-lspconfig.nvim') -- lsp config for mason -Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project -Plug('TimUntersberger/neogit') -- Easy-to-see git status -Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics -Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands -Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" -Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator -Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) -Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) -Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis -Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration - --- UI & colorscheme -Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts -Plug('gruvbox-community/gruvbox') -- theme provider -Plug('nvim-lualine/lualine.nvim') -- fancy status line -Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines -Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes -Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog -Plug('folke/todo-comments.nvim') -- Highlights TODO - --- other utilities -Plug('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) -Plug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope -Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs -Plug('saadparwaiz1/cmp_luasnip') -- snippet engine -Plug('L3MON4D3/LuaSnip') -- snippet engine -Plug('mickael-menu/zk-nvim') -- Zettelkasten --- Switch cases: --- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust) --- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case --- `gs.` -> dot.case (R) -Plug('arthurxavierx/vim-caser') -- switch cases - ---------- -vim.call('plug#end') - -vim.cmd([[ -if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - PlugInstall --sync | autocmd VimEnter * so $MYVIMRC -endif -]]) - --- special terminals, place them at 4..=7 for ergonomics -vim.api.nvim_create_autocmd({ "VimEnter" }, { - callback = function() - local function named_term(term_idx, term_name) - require('harpoon.term').gotoTerminal(term_idx) - vim.cmd([[:exe ":file ]] .. term_name .. [[" | :bfirst]]) - end - - -- term:ctl at 4 - named_term(4, "term:ctl") - -- term:dev at 5 - named_term(5, "term:dev") - -- term:repl at 7 - named_term(7, "term:repl") - -- term:repl at 6 - named_term(6, "term:repl2") - end -}) - - -vim.g.gruvbox_contrast_dark="soft"; -vim.g.gruvbox_contrast_light="soft"; -vim.opt.ignorecase = true; -vim.opt.smartcase = true; -vim.opt.incsearch = true; -vim.opt.number = true; -vim.opt.relativenumber = true; -vim.opt.autoindent = true; -vim.opt.smartindent = true; -vim.opt.expandtab = true; -vim.opt.exrc = true; - -vim.opt.tabstop = 4; -vim.opt.softtabstop = 4; -vim.opt.shiftwidth = 4; -vim.opt.scrolloff = 30; -vim.opt.signcolumn = "yes"; -vim.opt.colorcolumn = "80"; - -vim.opt.background = "light"; - -vim.api.nvim_create_user_command('Dark', function(opts) - -- opts: {name, args: str, fargs: Splited, range, ...} - ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; - vim.g.gruvbox_contrast_dark = contrast; - vim.opt.background = "dark"; -end, - {nargs = "?";}) - -vim.api.nvim_create_user_command('Light', function(opts) - -- opts: {name, args: str, fargs: Splited, range, ...} - ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; - vim.g.gruvbox_contrast_light = contrast; - vim.opt.background = "light"; -end, - {nargs = "?";}) - -vim.opt.lazyredraw = true -vim.opt.termguicolors = true -vim.opt.cursorline = true --- some plugins misbehave when we do swap files -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undodir = vim.fn.stdpath('state')..'/.vim/undodir' -vim.opt.undofile = true -vim.opt.completeopt = 'menuone,noselect' --- vim.opt.clipboard = "unnamedplus" --- more aggressive swap file writing. ThePrimeagen believes higher number --- leads to low DX -vim.opt.updatetime = 50 - -vim.g.mapleader = ' ' -vim.g.maplocalleader = ',' - --- basic keymaps --- Since we use space for leader, we're asserting that this does nothing by itself -vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) --- make :terminal escape out. For zsh-vi-mode, just use Alt-Z or any keybind --- that does not collide with vi-motion keybind. This is because --- -> ^[x; while on the terminal is ^[ -vim.keymap.set('t', '', ')') -vim.keymap.set({ 'n', 'i', 'v' }, '', 'mode', { desc = "" }) -- redraw on every mode - --- diagnostics (errors/warnings to be shown) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next) -vim.keymap.set('n', 'e', vim.diagnostic.open_float) -- opens diag in box (floating) --- vim.keymap.set('n', 'q', vim.diagnostic.setloclist) -- opens list of diags --- vim.keymap.set('n', 'wq', vim.diagnostic.setqflist) -- workspace diags -vim.keymap.set('n', 'q', 'TroubleToggle loclist') -vim.keymap.set('n', 'wq', 'TroubleToggle workspace_diagnostics') - --- color, highlighting, UI stuffs -vim.cmd([[ -colorscheme gruvbox -]]) -require('hlargs').setup() -require('nvim-web-devicons').setup() -require('trouble').setup() - --- TODO: Any way to collect all the TODOs and its variants? -require('todo-comments').setup() - --- plugin keymaps - -local function remap(mode, key_cmd, binded_fn, opts) - opts = opts or { remap = true } - return vim.keymap.set(mode, key_cmd, binded_fn, opts) -end - --- Comment.nvim -require('Comment').setup() --- lukas-reineke/indent-blankline.nvim -vim.opt.list = true -vim.opt.listchars:append "space:⋅" -vim.opt.listchars:append "eol:↴" - -require("indent_blankline").setup { - show_end_of_line = true, - space_char_blankline = " ", -} --- User command that transform into 2-spaces by translating to tabstop -vim.api.nvim_create_user_command( - 'HalfSpaces', - function(opts) - vim.api.nvim_command("set ts=2 sts=2 noet") - vim.api.nvim_command("retab!") - vim.api.nvim_command("set ts=1 sts=1 et") - vim.api.nvim_command("retab") - vim.api.nvim_command("GuessIndent") - end, - { nargs = 0 } -) -vim.api.nvim_create_user_command( - 'DoubleSpaces', - function(opts) - -- cannot really do 1-space tab. The minimum is 2-space to begin - -- doubling - vim.api.nvim_command("set ts=2 sts=2 noet") - vim.api.nvim_command("retab!") - vim.api.nvim_command("set ts=4 sts=4 et") - vim.api.nvim_command("retab") - vim.api.nvim_command("GuessIndent") - end, - { nargs = 0 } -) - --- telescope -local fb_actions = require "telescope".extensions.file_browser.actions -require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, - }, - extensions = { - fzf = { - fuzzy = true, -- allow fuzzy matches - override_generic_sorter = true, - override_file_sorter = true, - case_mode = 'smart_case' - }, - file_browser = { - theme = require('telescope.themes').get_ivy().theme, - hiject_netrw = true, -- disables netrw and use file-browser instead - mappings = { - ["i"] = {}, -- disable any shortcut in insert mode for now - ["n"] = { - ["c"] = fb_actions.create, - ["r"] = fb_actions.rename, - ["m"] = fb_actions.move, - ["y"] = fb_actions.copy, - ["d"] = fb_actions.remove, - ["o"] = fb_actions.open, - ["g"] = fb_actions.goto_parent_dir, - ["e"] = fb_actions.goto_home_dir, - ["w"] = fb_actions.goto_cwd, - ["t"] = fb_actions.change_cwd, - ["f"] = fb_actions.toggle_browser, - ["h"] = fb_actions.toggle_hidden, - ["s"] = fb_actions.toggle_all, - } - } - } - } -} - --- Telescope key remap stuffs -pcall(require('telescope').load_extension, 'fzf') -pcall(require('telescope').load_extension, 'file_browser') -remap('n', '', 'Telescope', { desc = 'Open Telescope general search' }) - -remap('n', 'fm', function() - require("telescope").extensions.file_browser.file_browser({}) -end, { desc = '[F]ile [M]utation' }) - -remap('n', 'ff', function() - require('telescope.builtin').find_files({ - hidden = false, - no_ignore = false, - follow = false, - }) -end, { desc = '[F]ind [F]ile' }) - -remap('n', 'fa', function() - require('telescope.builtin').find_files({ - hidden = true, - no_ignore = true, - follow = true, - }) -end, { desc = '[F]ind [A]ll files' }) - -remap('n', 'fg', function() - require('telescope.builtin').live_grep() -end, { desc = '[F]ind by [G]rep' }) - -remap('n', 'fb', function() - require('telescope.builtin').buffers() -end, { desc = '[F]ind existing [B]uffers' }) - -remap('n', 'fh', function() - require('telescope.builtin').help_tags() -end, { desc = '[F]ind [H]elp' }) - -remap('n', 'fd', function() - require('telescope.builtin').diagnostics() -end, { desc = '[F]ind [D]iagnostics' }) - --- ZK remap stuffs -remap('n', 'zf', function() - -- vim.cmd([[:ZkNotes]]) - require('zk').edit({}, { multi_select = false }) -end, { desc = '[Z]ettelkasten [F]iles' }) - -remap('n', 'zg', function() - vim.cmd([[:ZkGrep]]) -end, { desc = '[Z]ettelkasten [G]rep' }) - --- treesitter -require 'treesitter-context' -require('nvim-treesitter.configs').setup { - yati = { - enable = true, default_lazy = true, default_fallback = "auto", - disable = { "nix" } - }, - indent = { enable = false }, - ensure_installed = { - 'tsx', 'toml', 'lua', 'typescript', 'rust', 'go', 'yaml', 'json', 'php', 'css', - 'python', 'prisma', 'html', "dockerfile", "c", "cpp", "hcl", "svelte", "astro", - "clojure", "fennel", "bash", "nix", "query", - }, - sync_install = false, - highlight = { - enable = true, - enable_vim_regex_highlighting = true, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - node_decremental = '', - pscope_incremental = '' - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - }, - playground = { - enable = true, - disable = {} - }, - -- automatically close and modify HTML and TSX tags - autotag = { - enable = true, - }, -} - -require('nvim-autopairs').setup { - check_ts = true, -} - -local parser_config = require('nvim-treesitter.parsers').get_parser_configs() -parser_config.tsx.filetype_to_parsername = { "javascript", "typescript.tsx" } -parser_config.astro.filetype_to_parsername = { "javascript", "typescript.tsx", "astro" } - - -require('guess-indent').setup { - auto_cmd = true, -- Set to false to disable automatic execution - filetype_exclude = { -- A list of filetypes for which the auto command gets disabled - "netrw", - "tutor", - }, - - buftype_exclude = { -- A list of buffer types for which the auto command gets disabled - "help", - "nofile", - "terminal", - -- "prompt", - }, -} - --- harpoon: O(1) buffer/terminal switching -remap('n', 'm', function() require('harpoon.mark').add_file() end, { desc = "[H]arpoon [M]ark" }) -local function harpoon_nav(key, nav_file_index, lead_keybind) - lead_keybind = lead_keybind or 'h' - assert(type(key) == "string", "expect key to be string(keybind)") - assert(type(nav_file_index) == "number" and nav_file_index >= 1, "expect 1-indexed number for file index") - return remap('n', lead_keybind .. key, - function() require('harpoon.ui').nav_file(nav_file_index) end, - { desc = "[H]arpoon navigate " .. tostring(nav_file_index) }) -end - --- remap letters to index. Inspired by alternating number of Dvorak programmer --- best practices: try to keep marked files to be around 4 -harpoon_nav('f', 1) -harpoon_nav('j', 2) -harpoon_nav('d', 3) -harpoon_nav('k', 4) -remap('n', 'hh', function() require('harpoon.ui').toggle_quick_menu() end) -for i = 1, 10 do - -- harpoon: navigate files by numbers - harpoon_nav(tostring(i % 10), i) - -- harpoon: navigate terms by numbers - remap('n', 't' .. tostring(i % 10), function() - require('harpoon.term').gotoTerminal(i) - end) -end - --- neogit: easy-to-see git status. Provides only productivity on staging/unstage -require('neogit').setup {} -remap('n', 'gs', function() require('neogit').open({}) end, { desc = "[G]it [S]tatus" }); - --- LSP settings --- This function gets run when an LSP connects to a particular buffer. -require("inlay-hints").setup { - only_current_line = false, - eol = { - right_align = false, - } -} -local on_attach = function(client, bufnr) - -- NOTE: Remember that lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself - -- many times. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) - end - - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - nmap('df', function() vim.lsp.buf.format({ async = true }) end, '[D]ocument [F]ormat') - - -- symbols and gotos - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') - nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') - nmap('gr', require('telescope.builtin').lsp_references) - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- documentations. See `:help K` for why this keymap - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - - -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('gtd', vim.lsp.buf.type_definition, '[G]oto [T]ype [D]efinition') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - - end, '[W]orkspace [L]ist Folders') - - -- enable inlay hints if available - require('inlay-hints').on_attach(client, bufnr) - -end --- nvim-cmp -local cmp = require 'cmp' -local luasnip = require 'luasnip' -local lspkind = require('lspkind') -local source_mapping = { - buffer = '[Buffer]', - nvim_lsp = '[LSP]', - nvim_lua = '[Lua]', - -- cmp_tabnine = '[T9]', - path = '[Path]', -} - -cmp.event:on( - "confirm_done", - require('nvim-autopairs.completion.cmp').on_confirm_done() -) - - -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }, - formatting = { - format = function(entry, vim_item) - vim_item.kind = lspkind.symbolic(vim_item.kind, { mode = 'symbol' }) - vim_item.menu = source_mapping[entry.source_name] - -- if entry.source.name == "cmp_tabnine" then - -- local detail = (entry.completion_item.data or {}).detail - -- vim_item.kind = "" - -- if detail and detail:find('.*%%.*') then - -- vim_item.kind = vim_item.kind .. ' ' .. detail - -- end - -- - -- if (entry.completion_item.data or {}).multiline then - -- vim_item.kind = vim_item.kind .. ' ' .. '[ML]' - -- end - -- end - local maxwidth = 80 - vim_item.abbr = string.sub(vim_item.abbr, 1, maxwidth) - return vim_item - end, - }, - sources = cmp.config.sources { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'buffer' }, - { name = 'path' }, - { name = "conjure" }, - -- { name = 'cmp_tabnine' }, - }, -} --- nvim-cmp supports additional completion capabilities -local capabilities = require('cmp_nvim_lsp').default_capabilities() --- local tabnine = require('cmp_tabnine.config') --- tabnine.setup({ --- max_lines = 1000, --- max_num_results = 20, --- sort = true, --- run_on_every_keystroke = true, --- snippet_placeholder = '..', --- ignored_file_types = {}, --- show_prediction_strength = true, --- }) --- default language servers -local servers = { - 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals', - 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", - "jsonls", "denols" -} -require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - }, - check_outdated_packages_on_open = true, - }, - -- The default settings is "prepend" https://github.com/williamboman/mason.nvim#default-configuration - -- Which means Mason's installed path is prioritized against our local install - -- see: https://git.pegasust.com/pegasust/aoc/commit/b45dc32c74d84c9f787ebce7a174c9aa1d411fc2 - -- This introduces some pitfalls, so we'll take the approach of trusting user's local installation - PATH = "append"; -}) -require('mason-lspconfig').setup({ - ensure_installed = servers, - automatic_installation = true -}) - -local inlay_hint_tsjs = { - includeInlayEnumMemberValueHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayFunctionParameterTypeHints = true, - includeInlayParameterNameHints = 'all', -- "none" | "literals" | "all" - inlcudeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayVariableTypeHints = true, -}; - -require('mason-lspconfig').setup_handlers({ - -- default handler - function(server_name) - require('lspconfig')[server_name].setup { - on_attach = on_attach, - capabilities = capabilities, - } - end, - ["sumneko_lua"] = function() - require('lspconfig').sumneko_lua.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { - Lua = { - runtime = { - version = "LuaJIT", - path = vim.split(package.path, ";"), - }, - diagnostics = { - globals = { "vim" } - }, - workspace = { - library = vim.api.nvim_get_runtime_file('', true) - }, - telemetry = { enable = false }, - hint = { enable = true, }, - format = { - enable = true, - defaultConfig = { - indent_style = "space", - indent_size = 4, - } - } - } - } - } - end, - ["tsserver"] = function() - require('lspconfig').tsserver.setup { - on_attach = on_attach, - capabilities = capabilities, - -- TODO: Have to figure out an alternative config for monorepo to prevent - -- Deno from injecting TS projects. - -- Monorepo support: spawn one instance of lsp within the git - -- repos. - -- root_dir = require('lspconfig.util').root_pattern('.git'), - root_dir = require('lspconfig.util').root_pattern('package.json'), - settings = { - javascript = inlay_hint_tsjs, - typescript = inlay_hint_tsjs, - } - } - end, - ["denols"] = function() - require('lspconfig').denols.setup { - on_attach = on_attach, - capabilities = capabilities, - root_dir = require('lspconfig.util').root_pattern("deno.json", "deno.jsonc"), - } - end, - -- ["rust_analyzer"] = function() - -- require('lspconfig').rust_analyzer.setup { - -- on_attach = on_attach, - -- capabilities = capabilities, - -- settings = { - -- checkOnSave = { - -- command = "clippy", - -- } - -- } - -- } - -- end, - -- ["astro"] = function() - -- print('configuring astro') - -- require('lspconfig').astro.setup { - -- on_attach = on_attach, - -- capabilities = capabilities, - -- init_options = { - -- configuration = {}, - -- typescript = { - -- serverPath = data_dir - -- } - -- } - -- } - -- end -}) -require("rust-tools").setup { - tools = { -- rust-tools options - - -- how to execute terminal commands - -- options right now: termopen / quickfix - executor = require("rust-tools/executors").termopen, - - -- callback to execute once rust-analyzer is done initializing the workspace - -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" - on_initialized = function() - require('inlay-hints').set_all() - end, - - -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. - reload_workspace_from_cargo_toml = true, - - -- These apply to the default RustSetInlayHints command - inlay_hints = { - -- automatically set inlay hints (type hints) - -- default: true - auto = false, - - -- Only show inlay hints for the current line - only_current_line = false, - - -- whether to show parameter hints with the inlay hints or not - -- default: true - show_parameter_hints = true, - - -- prefix for parameter hints - -- default: "<-" - parameter_hints_prefix = "<- ", - - -- prefix for all the other hints (type, chaining) - -- default: "=>" - other_hints_prefix = "=> ", - - -- whether to align to the length of the longest line in the file - max_len_align = false, - - -- padding from the left if max_len_align is true - max_len_align_padding = 1, - - -- whether to align to the extreme right or not - right_align = false, - - -- padding from the right if right_align is true - right_align_padding = 7, - - -- The color of the hints - highlight = "Comment", - }, - - -- options same as lsp hover / vim.lsp.util.open_floating_preview() - hover_actions = { - - -- the border that is used for the hover window - -- see vim.api.nvim_open_win() - border = { - { "╭", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, - { "│", "FloatBorder" }, - }, - - -- whether the hover action window gets automatically focused - -- default: false - auto_focus = false, - }, - - -- settings for showing the crate graph based on graphviz and the dot - -- command - crate_graph = { - -- Backend used for displaying the graph - -- see: https://graphviz.org/docs/outputs/ - -- default: x11 - backend = "x11", - -- where to store the output, nil for no output stored (relative - -- path from pwd) - -- default: nil - output = nil, - -- true for all crates.io and external crates, false only the local - -- crates - -- default: true - full = true, - - -- List of backends found on: https://graphviz.org/docs/outputs/ - -- Is used for input validation and autocompletion - -- Last updated: 2021-08-26 - enabled_graphviz_backends = { - "bmp", - "cgimage", - "canon", - "dot", - "gv", - "xdot", - "xdot1.2", - "xdot1.4", - "eps", - "exr", - "fig", - "gd", - "gd2", - "gif", - "gtk", - "ico", - "cmap", - "ismap", - "imap", - "cmapx", - "imap_np", - "cmapx_np", - "jpg", - "jpeg", - "jpe", - "jp2", - "json", - "json0", - "dot_json", - "xdot_json", - "pdf", - "pic", - "pct", - "pict", - "plain", - "plain-ext", - "png", - "pov", - "ps", - "ps2", - "psd", - "sgi", - "svg", - "svgz", - "tga", - "tiff", - "tif", - "tk", - "vml", - "vmlz", - "wbmp", - "webp", - "xlib", - "x11", - }, - }, - }, - - -- all the opts to send to nvim-lspconfig - -- these override the defaults set by rust-tools.nvim - -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer - server = { - -- standalone file support - -- setting it to false may improve startup time - standalone = true, - on_attach = function(client, bufnr) - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) - end - on_attach(client, bufnr) - require('inlay-hints').on_attach(client, bufnr) - nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation') - - end, - capabilities = capabilities, - settings = { - checkOnSave = { - command = "clippy", - } - } - - }, -- rust-analyzer options - - -- debugging stuff - dap = { - adapter = { - type = "executable", - command = "lldb-vscode", - name = "rt_lldb", - }, - }, -} - -require('zk').setup({ - picker = "telescope", - lsp = { - config = { - cmd = { "zk", "lsp" }, - name = "zk", - on_attach = on_attach, - }, - auto_attach = { - enable = true, - filetypes = { "markdown" } - }, - }, -}) - --- Custom ZkOrphans that determines unlinked notes --- `:ZkOrphans {tags = {"work"}}` -require('zk.commands').add("ZkOrphans", function(options) - options = vim.tbl_extend("force", { orphan = true }, options or {}) - -- zk.edit opens notes picker - require('zk').edit(options, { title = "Zk Orphans (unlinked notes)" }) -end) --- --- ZkGrep: opens file picker --- In the case where `match_ctor` is falsy, create a prompt. --- This is so that we distinguish between ZkGrep and ZkNotes --- Params: --- match_ctor: string | {match= :string,...} | "" | nil -require('zk.commands').add("ZkGrep", function(match_ctor) - -- handle polymorphic `match_ctor` - local grep_str = match_ctor - local match - if match_ctor == nil or match_ctor == '' then - vim.fn.inputsave() - grep_str = vim.fn.input('Grep string: >') - vim.fn.inputrestore() - match = { match = grep_str } - elseif type(match_ctor) == 'string' then - match = { match = grep_str } - end - require('zk').edit(match, { title = "Grep: '" .. grep_str .. "'", mutli_select = false }) -end) - - --- Gitsigns -require('gitsigns').setup { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - } -} -require('lualine').setup { - options = { - icons_enabled = true, - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff', 'diagnostics' }, - lualine_c = { - { 'filename', - file_status = true, - newfile_status = false, - path = 1, - symbols = { - modified = '[+]', - readonly = '[-]', - unnamed = '[Unnamed]', - newfile = '[New]', - }, - }, - }, - lualine_x = { 'encoding', 'fileformat', 'filetype', }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { { 'filename', path = 1, file_status = true, }, }, - lualine_x = { 'location' }, - lualine_y = {}, - lualine_z = {}, - } -} - -require('nvim-surround').setup {} diff --git a/native_configs/neovim/scripts/deps.sh b/native_configs/neovim/scripts/deps.sh deleted file mode 100644 index 7a39f30..0000000 --- a/native_configs/neovim/scripts/deps.sh +++ /dev/null @@ -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' - - diff --git a/native_configs/ssh/authorized_keys b/native_configs/ssh/authorized_keys deleted file mode 100644 index ea36815..0000000 --- a/native_configs/ssh/authorized_keys +++ /dev/null @@ -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 diff --git a/native_configs/ssh/config b/native_configs/ssh/config deleted file mode 100644 index a1b2f67..0000000 --- a/native_configs/ssh/config +++ /dev/null @@ -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 - diff --git a/native_configs/starship/starship.toml b/native_configs/starship/starship.toml deleted file mode 100644 index 14eaf5c..0000000 --- a/native_configs/starship/starship.toml +++ /dev/null @@ -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 diff --git a/native_configs/tmux/tmux.conf b/native_configs/tmux/tmux.conf deleted file mode 100644 index f5e7187..0000000 --- a/native_configs/tmux/tmux.conf +++ /dev/null @@ -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 diff --git a/native_configs/zk/config.toml b/native_configs/zk/config.toml deleted file mode 100644 index 56eff48..0000000 --- a/native_configs/zk/config.toml +++ /dev/null @@ -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" - diff --git a/nix-conf/home-manager/base/alacritty.nix b/nix-conf/home-manager/base/alacritty.nix deleted file mode 100644 index 5f08776..0000000 --- a/nix-conf/home-manager/base/alacritty.nix +++ /dev/null @@ -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; - }; - }; -} diff --git a/nix-conf/home-manager/base/default.nix b/nix-conf/home-manager/base/default.nix deleted file mode 100644 index d3a0d50..0000000 --- a/nix-conf/home-manager/base/default.nix +++ /dev/null @@ -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 - ]; -} diff --git a/nix-conf/home-manager/base/git.nix b/nix-conf/home-manager/base/git.nix deleted file mode 100644 index cd57aa7..0000000 --- a/nix-conf/home-manager/base/git.nix +++ /dev/null @@ -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; - }; -} diff --git a/nix-conf/home-manager/base/graphics.nix b/nix-conf/home-manager/base/graphics.nix deleted file mode 100644 index 646b720..0000000 --- a/nix-conf/home-manager/base/graphics.nix +++ /dev/null @@ -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 ]; - }; -} diff --git a/nix-conf/home-manager/base/keepass.nix b/nix-conf/home-manager/base/keepass.nix deleted file mode 100644 index e985131..0000000 --- a/nix-conf/home-manager/base/keepass.nix +++ /dev/null @@ -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; - }; - }); - }; -} diff --git a/nix-conf/home-manager/base/mkModuleArgs.nix b/nix-conf/home-manager/base/mkModuleArgs.nix deleted file mode 100644 index 844e7c9..0000000 --- a/nix-conf/home-manager/base/mkModuleArgs.nix +++ /dev/null @@ -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; -} diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix deleted file mode 100644 index f9677cd..0000000 --- a/nix-conf/home-manager/base/neovim.nix +++ /dev/null @@ -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"; - }; -} diff --git a/nix-conf/home-manager/base/private_chromium.nix b/nix-conf/home-manager/base/private_chromium.nix deleted file mode 100644 index 5cb7204..0000000 --- a/nix-conf/home-manager/base/private_chromium.nix +++ /dev/null @@ -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"; - }) - ]; - }; - }; -} diff --git a/nix-conf/home-manager/base/productive_desktop.nix b/nix-conf/home-manager/base/productive_desktop.nix deleted file mode 100644 index 944fbff..0000000 --- a/nix-conf/home-manager/base/productive_desktop.nix +++ /dev/null @@ -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 - ]; -} diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix deleted file mode 100644 index 6c278ee..0000000 --- a/nix-conf/home-manager/base/shells.nix +++ /dev/null @@ -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 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 - ''; - - }; - }; -} diff --git a/nix-conf/home-manager/base/ssh.nix b/nix-conf/home-manager/base/ssh.nix deleted file mode 100644 index dd02bdf..0000000 --- a/nix-conf/home-manager/base/ssh.nix +++ /dev/null @@ -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"; - }; -} - diff --git a/nix-conf/home-manager/default.nix b/nix-conf/home-manager/default.nix deleted file mode 100644 index 0a33c79..0000000 --- a/nix-conf/home-manager/default.nix +++ /dev/null @@ -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 diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock deleted file mode 100644 index 42737ea..0000000 --- a/nix-conf/home-manager/flake.lock +++ /dev/null @@ -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 -} diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix deleted file mode 100644 index 3b3abda..0000000 --- a/nix-conf/home-manager/flake.nix +++ /dev/null @@ -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 - ]; - }; - }; - }; - }; - }); -} diff --git a/nix-conf/home-manager/fromYamlSandbox/flake.lock b/nix-conf/home-manager/fromYamlSandbox/flake.lock deleted file mode 100644 index 65e798e..0000000 --- a/nix-conf/home-manager/fromYamlSandbox/flake.lock +++ /dev/null @@ -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 -} diff --git a/nix-conf/home-manager/fromYamlSandbox/flake.nix b/nix-conf/home-manager/fromYamlSandbox/flake.nix deleted file mode 100644 index 1bfc84a..0000000 --- a/nix-conf/home-manager/fromYamlSandbox/flake.nix +++ /dev/null @@ -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 } - ''; - }; -} - diff --git a/nix-conf/home-manager/home.nix b/nix-conf/home-manager/home.nix deleted file mode 100644 index b338fcc..0000000 --- a/nix-conf/home-manager/home.nix +++ /dev/null @@ -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/ -# or inlined in flake.nix -{ config # Represents the realized final configuration -, pkgs # This is by default just ``= import {}` -, 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; -} diff --git a/nix-conf/home-manager/hwtr/nix.conf b/nix-conf/home-manager/hwtr/nix.conf deleted file mode 100644 index 899ea7a..0000000 --- a/nix-conf/home-manager/hwtr/nix.conf +++ /dev/null @@ -1,3 +0,0 @@ -accept-flake-config = true -experimental-features = nix-command flakes - diff --git a/nix-conf/home-manager/profiles/default.nix b/nix-conf/home-manager/profiles/default.nix deleted file mode 100644 index 1734c70..0000000 --- a/nix-conf/home-manager/profiles/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -# main module exporter for different configuration profiles -{ pkgs, libs, ... } @ inputs: -{ - hwtr = import ./hwtr.nix; -} diff --git a/nix-conf/home-manager/profiles/hwtr.nix b/nix-conf/home-manager/profiles/hwtr.nix deleted file mode 100644 index 8b13789..0000000 --- a/nix-conf/home-manager/profiles/hwtr.nix +++ /dev/null @@ -1 +0,0 @@ - diff --git a/nix-conf/lib/default.nix b/nix-conf/lib/default.nix deleted file mode 100644 index c7ec7d9..0000000 --- a/nix-conf/lib/default.nix +++ /dev/null @@ -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; -} diff --git a/nix-conf/lib/serde/default.nix b/nix-conf/lib/serde/default.nix deleted file mode 100644 index b4c9299..0000000 --- a/nix-conf/lib/serde/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -# Takes care of serializing and deserializing to some formats -# Blame: Pegasust -# 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? -} diff --git a/nix-conf/pkgs/default.nix b/nix-conf/pkgs/default.nix deleted file mode 100644 index 7f47280..0000000 --- a/nix-conf/pkgs/default.nix +++ /dev/null @@ -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"; - }; -} diff --git a/nix-conf/pkgs/flake.nix b/nix-conf/pkgs/flake.nix deleted file mode 100644 index 2e17df4..0000000 --- a/nix-conf/pkgs/flake.nix +++ /dev/null @@ -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; }); -} diff --git a/nix-conf/secrets.nix b/nix-conf/secrets.nix deleted file mode 100644 index 0c5bf16..0000000 --- a/nix-conf/secrets.nix +++ /dev/null @@ -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); - -} diff --git a/nix-conf/system/configuration.nix b/nix-conf/system/configuration.nix deleted file mode 100755 index e4318dd..0000000 --- a/nix-conf/system/configuration.nix +++ /dev/null @@ -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 - ]; -} - diff --git a/nix-conf/system/flake.lock b/nix-conf/system/flake.lock deleted file mode 100644 index 2761459..0000000 --- a/nix-conf/system/flake.lock +++ /dev/null @@ -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 -} diff --git a/nix-conf/system/flake.nix b/nix-conf/system/flake.nix deleted file mode 100644 index 970abbb..0000000 --- a/nix-conf/system/flake.nix +++ /dev/null @@ -1,306 +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 - ./../../modules/kde.sys.nix - # GPU, sound, networking stuffs - ./../../modules/pulseaudio.sys.nix - ./../../modules/opengl.sys.nix - ./../../modules/nvgpu.sys.nix - ({ config, pkgs, lib, ... }: - { - mod.tailscale.enable = true; - # 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. - - 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 touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - # Just an initial user to get this started lol - users.users.user = { - initialPassword = "pw123"; - extraGroups = [ "wheel" "networkmanager" "audio" ]; - isNormalUser = true; - }; - - # 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; - - # 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? - }) - ]; - }; - }; -} diff --git a/nix-conf/system/hardware-configuration.nix b/nix-conf/system/hardware-configuration.nix deleted file mode 100644 index e45b92a..0000000 --- a/nix-conf/system/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/nix-conf/system/nixos-wsl/.envrc b/nix-conf/system/nixos-wsl/.envrc deleted file mode 100644 index c4f5ea4..0000000 --- a/nix-conf/system/nixos-wsl/.envrc +++ /dev/null @@ -1,7 +0,0 @@ -use_flake() { - watch_file flake.nix - watch_file flake.lock - eval "$(nix print-dev-env)" -} - -use flake diff --git a/nix-conf/system/nixos-wsl/.github/ISSUE_TEMPLATE/bug_report.md b/nix-conf/system/nixos-wsl/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 44e58a0..0000000 --- a/nix-conf/system/nixos-wsl/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - - - -## Bug description - - -## To Reproduce -Steps to reproduce the behavior: - -**Expected behavior** - - -## Logs -``` -Include relevant console logs -``` - - diff --git a/nix-conf/system/nixos-wsl/.github/ISSUE_TEMPLATE/feature_request.md b/nix-conf/system/nixos-wsl/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index a5173eb..0000000 --- a/nix-conf/system/nixos-wsl/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' - ---- - - - -## Problem - - -## Solution - diff --git a/nix-conf/system/nixos-wsl/.github/release-drafter.yml b/nix-conf/system/nixos-wsl/.github/release-drafter.yml deleted file mode 100644 index b798c14..0000000 --- a/nix-conf/system/nixos-wsl/.github/release-drafter.yml +++ /dev/null @@ -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 diff --git a/nix-conf/system/nixos-wsl/.github/workflows/main.yml b/nix-conf/system/nixos-wsl/.github/workflows/main.yml deleted file mode 100644 index c61332e..0000000 --- a/nix-conf/system/nixos-wsl/.github/workflows/main.yml +++ /dev/null @@ -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 }} diff --git a/nix-conf/system/nixos-wsl/.github/workflows/release-drafter.yml b/nix-conf/system/nixos-wsl/.github/workflows/release-drafter.yml deleted file mode 100644 index cade7c0..0000000 --- a/nix-conf/system/nixos-wsl/.github/workflows/release-drafter.yml +++ /dev/null @@ -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 }} diff --git a/nix-conf/system/nixos-wsl/.github/workflows/update-flakes.yml b/nix-conf/system/nixos-wsl/.github/workflows/update-flakes.yml deleted file mode 100644 index 6d1b68f..0000000 --- a/nix-conf/system/nixos-wsl/.github/workflows/update-flakes.yml +++ /dev/null @@ -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 - 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 }}" diff --git a/nix-conf/system/nixos-wsl/.gitignore b/nix-conf/system/nixos-wsl/.gitignore deleted file mode 100644 index 750baeb..0000000 --- a/nix-conf/system/nixos-wsl/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -result -result-* diff --git a/nix-conf/system/nixos-wsl/LICENSE b/nix-conf/system/nixos-wsl/LICENSE deleted file mode 100644 index ef51da2..0000000 --- a/nix-conf/system/nixos-wsl/LICENSE +++ /dev/null @@ -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. diff --git a/nix-conf/system/nixos-wsl/README.md b/nix-conf/system/nixos-wsl/README.md deleted file mode 100644 index b3a4ff9..0000000 --- a/nix-conf/system/nixos-wsl/README.md +++ /dev/null @@ -1,112 +0,0 @@ -

- NixOS on WSL
- Matrix Chat - nixpkgs 22.05 - Downloads -

- -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 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) diff --git a/nix-conf/system/nixos-wsl/default.nix b/nix-conf/system/nixos-wsl/default.nix deleted file mode 100644 index 873ece4..0000000 --- a/nix-conf/system/nixos-wsl/default.nix +++ /dev/null @@ -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 diff --git a/nix-conf/system/nixos-wsl/flake.lock b/nix-conf/system/nixos-wsl/flake.lock deleted file mode 100644 index ba649f6..0000000 --- a/nix-conf/system/nixos-wsl/flake.lock +++ /dev/null @@ -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 -} diff --git a/nix-conf/system/nixos-wsl/flake.nix b/nix-conf/system/nixos-wsl/flake.nix deleted file mode 100644 index 8a62b47..0000000 --- a/nix-conf/system/nixos-wsl/flake.nix +++ /dev/null @@ -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 ]; - }; - } - ); -} diff --git a/nix-conf/system/nixos-wsl/modules/build-tarball.nix b/nix-conf/system/nixos-wsl/modules/build-tarball.nix deleted file mode 100644 index feba78d..0000000 --- a/nix-conf/system/nixos-wsl/modules/build-tarball.nix +++ /dev/null @@ -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"; - }; - - }; -} diff --git a/nix-conf/system/nixos-wsl/modules/docker-desktop.nix b/nix-conf/system/nixos-wsl/modules/docker-desktop.nix deleted file mode 100644 index ade86e9..0000000 --- a/nix-conf/system/nixos-wsl/modules/docker-desktop.nix +++ /dev/null @@ -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 - ]; - - }; - -} diff --git a/nix-conf/system/nixos-wsl/modules/docker-native.nix b/nix-conf/system/nixos-wsl/modules/docker-native.nix deleted file mode 100644 index 35d10ef..0000000 --- a/nix-conf/system/nixos-wsl/modules/docker-native.nix +++ /dev/null @@ -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 - ]; - }; -} diff --git a/nix-conf/system/nixos-wsl/modules/installer.nix b/nix-conf/system/nixos-wsl/modules/installer.nix deleted file mode 100644 index 45d191a..0000000 --- a/nix-conf/system/nixos-wsl/modules/installer.nix +++ /dev/null @@ -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 - ''; - }; - - } - ); - -} diff --git a/nix-conf/system/nixos-wsl/modules/interop.nix b/nix-conf/system/nixos-wsl/modules/interop.nix deleted file mode 100644 index b7babfb..0000000 --- a/nix-conf/system/nixos-wsl/modules/interop.nix +++ /dev/null @@ -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"; - }; - - -} diff --git a/nix-conf/system/nixos-wsl/modules/wsl-distro.nix b/nix-conf/system/nixos-wsl/modules/wsl-distro.nix deleted file mode 100644 index 4c6eda5..0000000 --- a/nix-conf/system/nixos-wsl/modules/wsl-distro.nix +++ /dev/null @@ -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"); - }; -} diff --git a/nix-conf/system/nixos-wsl/syschdemd.nix b/nix-conf/system/nixos-wsl/syschdemd.nix deleted file mode 100644 index 406dd86..0000000 --- a/nix-conf/system/nixos-wsl/syschdemd.nix +++ /dev/null @@ -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 - ''; -} diff --git a/nix-conf/system/nixos-wsl/syschdemd.sh b/nix-conf/system/nixos-wsl/syschdemd.sh deleted file mode 100644 index 6223cda..0000000 --- a/nix-conf/system/nixos-wsl/syschdemd.sh +++ /dev/null @@ -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 $(/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/$(.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; -} diff --git a/nix-conf/system/profiles/README.md b/nix-conf/system/profiles/README.md deleted file mode 100644 index 4af7c99..0000000 --- a/nix-conf/system/profiles/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Machine-specific profile - -- Currently only contains machine-specific details such as the `hardware-configuration.nix` diff --git a/nix-conf/system/profiles/bao/hardware-configuration.nix b/nix-conf/system/profiles/bao/hardware-configuration.nix deleted file mode 100644 index 3d4935d..0000000 --- a/nix-conf/system/profiles/bao/hardware-configuration.nix +++ /dev/null @@ -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..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; -} diff --git a/nix-conf/system/profiles/homeless/hardware-configuration.nix b/nix-conf/system/profiles/homeless/hardware-configuration.nix deleted file mode 100644 index e45b92a..0000000 --- a/nix-conf/system/profiles/homeless/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/nix-conf/system/profiles/lester/hardware-configuration.nix b/nix-conf/system/profiles/lester/hardware-configuration.nix deleted file mode 100644 index e45b92a..0000000 --- a/nix-conf/system/profiles/lester/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/nix-conf/system/profiles/lizzi/hardware-configuration.nix b/nix-conf/system/profiles/lizzi/hardware-configuration.nix deleted file mode 100644 index 5fa1db1..0000000 --- a/nix-conf/system/profiles/lizzi/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/nix-conf/system/profiles/nyx/hardware-configuration.nix b/nix-conf/system/profiles/nyx/hardware-configuration.nix deleted file mode 100644 index 88ffe66..0000000 --- a/nix-conf/system/profiles/nyx/hardware-configuration.nix +++ /dev/null @@ -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..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s5.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/nix-conf/system/profiles/prince/hardware-configuration.nix b/nix-conf/system/profiles/prince/hardware-configuration.nix deleted file mode 100644 index 8b13789..0000000 --- a/nix-conf/system/profiles/prince/hardware-configuration.nix +++ /dev/null @@ -1 +0,0 @@ - diff --git a/nix-conf/system/scripts/felia-hwconf.sh b/nix-conf/system/scripts/felia-hwconf.sh deleted file mode 100755 index 4e108dd..0000000 --- a/nix-conf/system/scripts/felia-hwconf.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env sh -# This is used when we need to refresh hardware-configuration.nix -# Basically what this does is to mount the drives, then ask nixos-generate-config -# to regenerate hardware-configuration.nix for us. -# Manual on nixos-generate-config [here](https://www.mankier.com/8/nixos-generate-config) -SCRIPT_DIR=$(realpath $(dirname $0)) -${SCRIPT_DIR}/felia-mount.sh -sudo nixos-generate-config diff --git a/nix-conf/system/scripts/felia-mount.sh b/nix-conf/system/scripts/felia-mount.sh deleted file mode 100755 index 1900fe8..0000000 --- a/nix-conf/system/scripts/felia-mount.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env sh -SCRIPT_DIR=$(realpath $(dirname $0)) - -function mntDrive() { - WSL_DRIVE=$(echo $1 | tr '[:upper:]' '[:lower:]') - ${SCRIPT_DIR}/mount-windrive.sh $1 $WSL_DRIVE - echo "ls /mnt/${WSL_DRIVE}" - ls /mnt/${WSL_DRIVE} -} - -mntDrive C -mntDrive D -mntDrive F - diff --git a/nix-conf/system/scripts/mount-windrive.sh b/nix-conf/system/scripts/mount-windrive.sh deleted file mode 100755 index fdde18c..0000000 --- a/nix-conf/system/scripts/mount-windrive.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env sh - -# https://linuxnightly.com/mount-and-access-hard-drives-in-windows-subsystem-for-linux-wsl/ -# Usage: scripts/mount-windrive.sh C # /mnt/c -> C:\ - -WIN_DRIVE_CHAR=${1:-"C"} -WSL_DRIVE_CHAR=${2:-$(echo $WIN_DRIVE_CHAR | tr '[:upper:]' '[:lower:]')} - -sudo umount "/mnt/${WSL_DRIVE_CHAR}" -sudo mount -t drvfs "${WIN_DRIVE_CHAR}:" "/mnt/${WSL_DRIVE_CHAR}" - diff --git a/nix-conf/system/secrets/_nhitrl.age b/nix-conf/system/secrets/_nhitrl.age deleted file mode 100644 index 7b3f4d2..0000000 --- a/nix-conf/system/secrets/_nhitrl.age +++ /dev/null @@ -1,10 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 ahbzMg QEQ0gfV00KEZFXSUMAnITVG2vAhS0IrnbbEXVsQRjXA -/iXv++nOsRRmWAu4dFTmxxC7qlCjMuTYuTa6GsYgsX0 --> ssh-ed25519 glsjZQ Lob1uedpMxsDygT/i6Pnuwi6BzdgZPAeemISakcncVM -UddBD1YezLMeCUn4UuHGIrK68AwCIwuHAobpkJdi/3U --> Tx+>#u-grease ;A%8 W -m11Fw6roG6feroJ/o5Ro8Dv1C3Piq3bGbdV78TH9Z0URPru+srdINovMvoVqjkuZ -eHiRwb1fN0ymLRD6/WxT4ZLKbT6J5yNPCrc+ ---- 88hy3b76RX3PAc0Lfms//lhuqsi2tsqmL9gFQqUMBKM ->%frP+JY`',~ʼf݂_Q2A59N/V [Sg3 4Y(c}N[ ҕJ6Upvf/i+tT^) \ No newline at end of file diff --git a/nix-conf/system/secrets/s3fs.age b/nix-conf/system/secrets/s3fs.age deleted file mode 100644 index 89113d0..0000000 --- a/nix-conf/system/secrets/s3fs.age +++ /dev/null @@ -1,10 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 ahbzMg 6pTVLAgOY/JZVWiCFHLo8xQ4/CL6620IMaBRpqI8Wws -CtJeQuy5VzKZhJnIH+/cjlKsAcg0RY2bhHTWVm+hUOY --> ssh-ed25519 glsjZQ we7RCgsnODTJ8rKYhU+9tu0DmLH+98mcQKQ3I2slikM -G81lsFLQR9polxme1K/MU2d8Y01PrTqtzJnVq0EMJF0 --> |-grease B\W,I9z ^Gx;$ Kk7!4,P -0Jl5Lhx7R8YOs9S+hUtQDDpNIqBhC/MM0N7w1MCtwYtkIIIWKfY9jkJ7+Cew2Ee5 -Qb04jnE ---- b7AXWRgK45a/91iwmwt5g+CWOlU/2f4nUDfXlg/bs9A -%;3RmQWhp̖V;׮V[z9al=cLvau7,tUܶh^&ֿWJP6-ң n-=] \ No newline at end of file diff --git a/nix-conf/system/secrets/s3fs.digital-garden.age b/nix-conf/system/secrets/s3fs.digital-garden.age deleted file mode 100644 index bb46bdd..0000000 --- a/nix-conf/system/secrets/s3fs.digital-garden.age +++ /dev/null @@ -1,10 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 ahbzMg GUriNV3lYlrA4xfIUj9PedI8p87avdQKOXhFqVnyzG4 -TvLDyCGbmU0N26SLWDIhj8tAgwrx1kFyhe6knPvJbLg --> ssh-ed25519 glsjZQ uZUN8LJ5tnBlkrQ23JutAMzOODVF/96m+5qwgE0mJgM -srPQPu/fcCSDsbyZF8HLytPts7LGib6AHKBxaVXbK+c --> R{n]I@-grease -EdbrkSaDEZBhArX2fk83dPE8DAtFuCdzm9TlIfXWhv8+jFLNmSshkKYc2Rlj/FE1 -7w ---- GYDU/uV9eu8AKstyufFIueBnuvXwlKO3Oz9LLxkkhKQ -f/MXbvV}^}|~ꞹ.qU"*yIifjEJWa\ ysUQ$ \ No newline at end of file diff --git a/nix-conf/system/wsl-configuration.nix b/nix-conf/system/wsl-configuration.nix deleted file mode 100755 index 48fd9d3..0000000 --- a/nix-conf/system/wsl-configuration.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ lib, ... }: - -with lib; -let - nixos-wsl = import ./nixos-wsl; -in -{ - imports = [ - ./configuration.nix - nixos-wsl.nixosModules.wsl - ]; - - wsl = { - enable = true; - automountPath = "/mnt"; - defaultUser = "nixos"; # if change defaultUser, make sure uid to be 1000 (first user) - startMenuLaunchers = true; - # automountOptions = "drvfs,metadata,uid=1000,gid=100"; - # Enable native Docker support - # docker-native.enable = true; - - # Enable integration with Docker Desktop (needs to be installed) - docker-desktop.enable = true; - - }; - # users.users..uid = 1000; - # networking.hostName = "nixos"; - -} diff --git a/out-of-tree/flake-compat/COPYING b/out-of-tree/flake-compat/COPYING deleted file mode 100644 index 694ce95..0000000 --- a/out-of-tree/flake-compat/COPYING +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2020-2021 Eelco Dolstra and the flake-compat contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/out-of-tree/flake-compat/README.md b/out-of-tree/flake-compat/README.md deleted file mode 100644 index 8added0..0000000 --- a/out-of-tree/flake-compat/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# flake-compat - -## Usage - -To use, add the following to your `flake.nix`: - -```nix -inputs.flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; -}; -``` - -Afterwards, create a `default.nix` file containing the following: - -```nix -(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 -``` - -If you would like a `shell.nix` file, create one containing the above, replacing `defaultNix` with `shellNix`. diff --git a/out-of-tree/flake-compat/default.nix b/out-of-tree/flake-compat/default.nix deleted file mode 100644 index c966c6d..0000000 --- a/out-of-tree/flake-compat/default.nix +++ /dev/null @@ -1,204 +0,0 @@ -# Compatibility function to allow flakes to be used by -# non-flake-enabled Nix versions. Given a source tree containing a -# 'flake.nix' and 'flake.lock' file, it fetches the flake inputs and -# calls the flake's 'outputs' function. It then returns an attrset -# containing 'defaultNix' (to be used in 'default.nix'), 'shellNix' -# (to be used in 'shell.nix'). - -{ src, system ? builtins.currentSystem or "unknown-system" }: - -let - - lockFilePath = src + "/flake.lock"; - - lockFile = builtins.fromJSON (builtins.readFile lockFilePath); - - fetchTree = - 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}'"; - - callFlake4 = flakeSrc: locks: - let - flake = import (flakeSrc + "/flake.nix"); - - inputs = builtins.mapAttrs (n: v: - if v.flake or true - then callFlake4 (fetchTree (v.locked // v.info)) v.inputs - else fetchTree (v.locked // v.info)) locks; - - outputs = flakeSrc // (flake.outputs (inputs // {self = outputs;})); - in - assert flake.edition == 201909; - outputs; - - callLocklessFlake = flakeSrc: - let - flake = import (flakeSrc + "/flake.nix"); - outputs = flakeSrc // (flake.outputs ({ self = outputs; })); - in outputs; - - rootSrc = let - # Try to clean the source tree by using fetchGit, if this source - # tree is a valid git repository. - tryFetchGit = src: - if isGit && !isShallow - then - let res = builtins.fetchGit src; - in if res.rev == "0000000000000000000000000000000000000000" then removeAttrs res ["rev" "shortRev"] else res - else { outPath = src; }; - # NB git worktrees have a file for .git, so we don't check the type of .git - isGit = builtins.pathExists (src + "/.git"); - isShallow = builtins.pathExists (src + "/.git/shallow"); - - in - { lastModified = 0; lastModifiedDate = formatSecondsSinceEpoch 0; } - // (if src ? outPath then src else tryFetchGit src); - - # Format number of seconds in the Unix epoch as %Y%m%d%H%M%S. - 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)}"; - - allNodes = - builtins.mapAttrs - (key: node: - let - sourceInfo = - if key == lockFile.root - then rootSrc - else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]); - - subdir = if key == lockFile.root then "" else node.locked.dir or ""; - - flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix"); - - inputs = builtins.mapAttrs - (inputName: inputSpec: allNodes.${resolveInput inputSpec}) - (node.inputs or {}); - - # Resolve a input spec into a node name. An input spec is - # either a node name, or a 'follows' path from the root - # node. - resolveInput = inputSpec: - if builtins.isList inputSpec - then getInputByPath lockFile.root inputSpec - else inputSpec; - - # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the - # root node, returning the final node. - getInputByPath = nodeName: path: - if path == [] - then nodeName - else - getInputByPath - # Since this could be a 'follows' input, call resolveInput. - (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path}) - (builtins.tail path); - - outputs = flake.outputs (inputs // { self = result; }); - - result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; }; - in - if node.flake or true then - assert builtins.isFunction flake.outputs; - result - else - sourceInfo - ) - lockFile.nodes; - - result = - if !(builtins.pathExists lockFilePath) - then callLocklessFlake rootSrc - else if lockFile.version == 4 - then callFlake4 rootSrc (lockFile.inputs) - else if lockFile.version >= 5 && lockFile.version <= 7 - then allNodes.${lockFile.root} - else throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}"; - -in - rec { - defaultNix = - (builtins.removeAttrs result ["__functor"]) - // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {}) - // (if result ? packages.${system}.default then { default = result.packages.${system}.default; } else {}); - - shellNix = - defaultNix - // (if result ? devShell.${system} then { default = result.devShell.${system}; } else {}) - // (if result ? devShells.${system}.default then { default = result.devShells.${system}.default; } else {}); - } diff --git a/out-of-tree/nixGL/.github/workflows/test.yml b/out-of-tree/nixGL/.github/workflows/test.yml deleted file mode 100644 index dd5f213..0000000 --- a/out-of-tree/nixGL/.github/workflows/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Test - -on: [ push, pull_request ] - -jobs: - test: - name: 'Test' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2.4.2 - - uses: cachix/install-nix-action@v17 - - uses: cachix/cachix-action@v10 - with: - name: guibou - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - name: Build all - run: nix-build all.nix - diff --git a/out-of-tree/nixGL/README.md b/out-of-tree/nixGL/README.md deleted file mode 100644 index c12064e..0000000 --- a/out-of-tree/nixGL/README.md +++ /dev/null @@ -1,248 +0,0 @@ -# NixGL - -NixGL solve the "OpenGL" problem with [nix](https://nixos.org/nix/). It works with all mesa drivers (Intel cards and "free" version for Nvidia or AMD cards), Nvidia proprietary drivers, and even with hybrid configuration via bumblebee. It works for Vulkan programs too. - -# Motivation - -Using Nix on non-NixOS distros, it's common to see GL application errors: - -```bash -$ program -libGL error: unable to load driver: i965_dri.so -libGL error: driver pointer missing -libGL error: failed to load driver: i965 -libGL error: unable to load driver: i965_dri.so -libGL error: driver pointer missing -libGL error: failed to load driver: i965 -libGL error: unable to load driver: swrast_dri.so -libGL error: failed to load driver: swrast -``` - -NixGL provides a set of wrappers able to launch GL or Vulkan applications: - -```bash -$ nixGL program -$ nixVulkan program -``` - -# Installation - -## nix-channel (Recommended) - -To get started, - -```bash -$ nix-channel --add https://github.com/guibou/nixGL/archive/main.tar.gz nixgl && nix-channel --update -$ nix-env -iA nixgl.auto.nixGLDefault # or replace `nixGLDefault` with your desired wrapper -``` - -Many wrappers are available, depending on your hardware and the graphical API you want to use (i.e. Vulkan or OpenGL). You may want to install a few of them, for example if you want to support OpenGL and Vulkan on a laptop with an hybrid configuration. - -OpenGL wrappers: - -- `auto.nixGLDefault`: Tries to auto-detect and install Nvidia, if not, fallback to mesa. Recommended. Invoke with `nixGL program`. -- `auto.nixGLNvidia`: Proprietary Nvidia driver (auto detection of version) -- `auto.nixGLNvidiaBumblebee`: Proprietary Nvidia driver on hybrid hardware (auto detection). -- `nixGLIntel`: Mesa OpenGL implementation (intel, amd, nouveau, ...). - -Vulkan wrappers: - -- `auto.nixVulkanNvidia`: Proprietary Nvidia driver (auto detection). -- `nixVulkanIntel`: Mesa Vulkan implementation. - -The Vulkan wrapper also sets `VK_LAYER_PATH` the validation layers in the nix store. - -## Flakes - -### Directly run nixGL - -You need to specify the same version of `nixpkgs` that your `program` is using. For example, replace `nixos-21.11` with `nixos-21.05`. - -```sh -nix run --override-input nixpkgs nixpkgs/nixos-21.11 --impure github:guibou/nixGL -- program -``` - -If you use the default `nixpkgs` channel (i.e. `nixpkgs-unstable`), you can ommit those arguments like so: - -```sh -nix run --impure github:guibou/nixGL -- program -``` - -You can also specify which wrapper to use instead of using the default auto detection: - -```sh -nix run github:guibou/nixGL#nixGLIntel -- program -``` - -This will result in a lighter download and execution time. Also, this evaluation is pure. - - -#### Error about experimental features - -You can directly use: - -```sh -nix --extra-experimental-features "nix-command flakes" run --impure github:guibou/nixGL -- program -``` - -Or set the appropriate conf in `~/.config/nix/nix.conf` / `/etc/nix/nix.conf` / `nix.extraOptions`. - -#### Error with GLIBC version - -if you get errors with messages similar to -``` -/nix/store/g02b1lpbddhymmcjb923kf0l7s9nww58-glibc-2.33-123/lib/libc.so.6: version `GLIBC_2.34' not found (required by /nix/store/hrl51nkr7dszlwcs29wmyxq0jsqlaszn-libglvnd-1.4.0/lib/libGLX.so.0) -``` - -It means that there's a mismatch between the versions of `nixpkgs` used by `nixGL` and `program`. - -### Use an overlay - -Add nixGL as a flake input: - - -```Nix -{ - inputs = { - nixgl.url = "github:guibou/nixGL"; - }; - outputs = { nixgl, ... }: { }; -} -``` - -Then, use the flake's `overlay` attr: - -```Nix -{ - outputs = { nixgl, nixpkgs, ... }: - let - pkgs = import nixpkgs { - system = "x86_64-linux"; - overlays = [ nixgl.overlay ]; - }; - in - # You can now reference pkgs.nixgl.nixGLIntel, etc. - { } -} -``` - -## Installation from source - -```bash -$ git clone https://github.com/guibou/nixGL -$ cd nixGL -$ nix-env -f ./ -iA -``` - -# Usage - -Just launch the program you want prefixed by the right wrapper. - -For example, for OpenGL programs: - -```bash -$ nixGL program args # For the `nixGLDefault` wrapper, recommended. -$ nixGLNvidia program args -$ nixGLIntel program args -$ nixGLNvidiaBumblebee program args -``` - -For Vulkan programs: - -```bash -$ nixVulkanNvidia program args -$ nixVulkanIntel program args -``` - -# OpenGL - Hybrid Intel + Nvidia laptop - -After installing `nixGLIntel` and `nixGLNvidiaBumblebee`. - -```bash -$ nixGLIntel $(nix run nixpkgs.glxinfo -c glxinfo) | grep -i 'OpenGL version string' -OpenGL version string: 3.0 Mesa 17.3.3 -$ nixGLNvidiaBumblebee $(nix run nixpkgs.glxinfo -c glxinfo) | grep -i 'OpenGL version string' -OpenGL version string: 4.6.0 NVIDIA 390.25 -``` - -If the program you'd like to run is already installed by nix in your current environment, you can simply run it with the wrapper, for example: - -```bash -$ nixGLIntel blender -``` - -# Vulkan - Intel GPU - -After installing `nixVulkanIntel`. - -```bash -$ sudo apt install mesa-vulkan-drivers -... -$ nixVulkanIntel $(nix-build '' --no-out-link -A vulkan-tools)/bin/vulkaninfo | grep VkPhysicalDeviceProperties -A 7 -VkPhysicalDeviceProperties: -=========================== - apiVersion = 0x400036 (1.0.54) - driverVersion = 71311368 (0x4402008) - vendorID = 0x8086 - deviceID = 0x591b - deviceType = INTEGRATED_GPU - deviceName = Intel(R) HD Graphics 630 (Kaby Lake GT2) -``` - -# Troubleshooting - -## Nvidia auto detection does not work - -```bash -building '/nix/store/ijs5h6h07faai0k74diiy5b2xlxh891g-auto-detect-nvidia.drv'... -pcregrep: Failed to open /proc/driver/nvidia/version: No such file or directory -builder for '/nix/store/ijs5h6h07faai0k74diiy5b2xlxh891g-auto-detect-nvidia.drv' failed with exit code 2 -error: build of '/nix/store/ijs5h6h07faai0k74diiy5b2xlxh891g-auto-detect-nvidia.drv' faile -``` - -You can run the Nvidia installer using an explicit version string instead of the automatic detection method: - -```bash -nix-build -A auto.nixGLNvidia --argstr nvidiaVersion 440.82 -``` - -(or `nixGLNvidiaBumblebee`, `nixVulkanNividia`) - - -The version of your driver can be found using `glxinfo` from your system default package manager, or `nvidia-settings`. - -## On nixOS - -`nixGL` can also be used on nixOS if the system is installed with a different -nixpkgs clone than the one your application are installed with. Override the -`pkgs` argument of the script with the correct nixpkgs clone: - -```bash -nix-build ./default.nix -A nixGLIntel --arg pkgs "import path_to_your_nixpkgs {}". -``` - -## Old nvidia drivers - -Users of Nvidia legacy driver should use the `backport/noGLVND` branch. This branch is not tested and may not work well, please open a bug report, it will be taken care of as soon as possible. - -# `nixGLCommon` - -`nixGLCommon nixGLXXX` can be used to get `nixGL` executable which fallback to `nixGLXXX`. It is a shorter name for people with only one OpenGL configuration. - -For example: - -``` -nix-build -E "with import ./default.nix {}; nixGLCommon nixGLIntel" -``` - -# Limitations - -`nixGL` is badly tested, mostly because it is difficult to test automatically in a continuous integration context because you need access to different type of hardware. - -Some OpenGL configurations may not work, for example AMD proprietary drivers. There is no fundamental limitation, so if you want support for theses configurations, open an issue. - -# Hacking - -One great way to contribute to nixGL is to run the test suite. Just run -`./Test.hs` in the main directory and check that all the test relevant to your -hardware are green. diff --git a/out-of-tree/nixGL/Test.hs b/out-of-tree/nixGL/Test.hs deleted file mode 100755 index 64581c5..0000000 --- a/out-of-tree/nixGL/Test.hs +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages(p: with p; [hspec process])" -p nix -{-# LANGUAGE OverloadedStrings #-} -import Test.Hspec -import System.Process -import qualified Data.Text as Text -import Data.Text (Text) -import Control.Monad.IO.Class (liftIO) -import Data.List (find) - --- nixos-19-09 is used so hopefully it will have a different libc than --- the current `` used in a current nixOS system, so it will trigger the --- driver failure. --- Run `./Test.hs --match "/Sanity/"` to ensure that non wrapped --- binaries fails on NixOS. - -currentChannel = "channel:nixos-19.09-small" - --- | Utils function: run a command and returns its output. -processOutput p args = Text.strip . Text.pack <$> readCreateProcess ((proc (Text.unpack p) (Text.unpack <$> args)) { std_err = Inherit }) "" - --- * OpenGL - --- | Returns the path to the nixGLXXX binary. -getNixGLBin version = (<>("/bin/"<>version)) <$> processOutput "nix-build" ["./", "-A", version, "-I", "nixpkgs=" <> currentChannel] - --- | Returns the vendor string associated with a glxinfo wrapped by a nixGL. -getVendorString io = do - output <- Text.lines <$> io - pure $ Text.unpack <$> find ("OpenGL version string"`Text.isPrefixOf`) output - --- | Checks that a nixGL wrapper works with glxinfo 32 & 64 bits. -checkOpenGL_32_64 glxinfo32 glxinfo64 vendorName nixGLName = do - beforeAll (getNixGLBin nixGLName) $ do - it "32 bits" $ \nixGLBin -> do - Just vendorString <- getVendorString (processOutput nixGLBin [glxinfo32, "-B"]) - vendorString `shouldContain` vendorName - - it "64 bits" $ \nixGLBin -> do - Just vendorString <- getVendorString (processOutput nixGLBin [glxinfo64, "-B"]) - vendorString `shouldContain` vendorName - --- * Vulkan - --- | Heuristic to detect if vulkan work. `driverName` must appears in the output -checkVulkanIsWorking io = do - res <- io - res `shouldSatisfy` ("driverName"`Text.isInfixOf`) - --- | Checks that a nixGL wrapper works with glxinfo 32 & 64 bits. -checkVulkan_32_64 vulkaninfo32 vulkaninfo64 vendorName nixGLName = do - beforeAll (getNixGLBin nixGLName) $ do - it "32 bits" $ \nixGLBin -> do - checkVulkanIsWorking (processOutput nixGLBin [vulkaninfo32]) - - it "64 bits" $ \nixGLBin -> do - checkVulkanIsWorking (processOutput nixGLBin [vulkaninfo64]) - - -main = do - putStrLn "Running tests for nixGL" - putStrLn "It can take a while, this will build and test all drivers in the background" - glxinfo64 <- (<>"/bin/glxinfo") <$> processOutput "nix-build" [currentChannel, "-A", "glxinfo"] - glxinfo32 <- (<>"/bin/glxinfo") <$> processOutput "nix-build" [currentChannel, "-A", "pkgsi686Linux.glxinfo"] - - vulkaninfo64 <- (<>"/bin/vulkaninfo") <$> processOutput "nix-build" [currentChannel, "-A", "vulkan-tools"] - vulkaninfo32 <- (<>"/bin/vulkaninfo") <$> processOutput "nix-build" [currentChannel, "-A", "pkgsi686Linux.vulkan-tools"] - - let checkOpenGL = checkOpenGL_32_64 glxinfo32 glxinfo64 - checkVulkan = checkVulkan_32_64 vulkaninfo32 vulkaninfo64 - - hspec $ do - -- This category ensure that tests are failing if not run with nixGL - -- This allows testing on nixOS - describe "Sanity" $ do - describe "OpenGL" $ do - it "fails with unwrapped glxinfo64" $ do - vendorString <- getVendorString (processOutput glxinfo64 ["-B"]) - vendorString `shouldBe` Nothing - - it "fails with unwrapped glxinfo32" $ do - vendorString <- getVendorString (processOutput glxinfo32 ["-B"]) - vendorString `shouldBe` Nothing - describe "Vulkan" $ do - it "fails with unwrapped vulkaninfo64" $ do - processOutput vulkaninfo64 [] `shouldThrow` anyIOException - - it "fails with unwrapped vulkaninfo32" $ do - processOutput vulkaninfo32 [] `shouldThrow` anyIOException - - describe "NixGL" $ do - describe "Mesa" $ do - describe "OpenGL" $ do - checkOpenGL "Mesa" "nixGLIntel" - describe "Vulkan" $ do - checkVulkan "Mesa" "nixVulkanIntel" - - describe "Nvidia - Bumblebee" $ do - describe "OpenGL" $ do - checkOpenGL "NVIDIA" "nixGLNvidiaBumblebee" - xdescribe "Vulkan" $ do - -- Not tested: I don't have the hardware (@guibou) - checkVulkan "NVIDIA" "nixVulkanNvidiaBumblebee" - - -- TODO: check Nvidia (I don't have this hardware) - describe "Nvidia" $ do - describe "OpenGL" $ do - checkOpenGL "NVIDIA" "nixGLNvidia" - describe "Vulkan" $ do - checkVulkan "NVIDIA" "nixVulkanNvidia" diff --git a/out-of-tree/nixGL/all.nix b/out-of-tree/nixGL/all.nix deleted file mode 100644 index 20d1862..0000000 --- a/out-of-tree/nixGL/all.nix +++ /dev/null @@ -1,25 +0,0 @@ -let - pkgs = import ./nixpkgs.nix { config = { allowUnfree = true; }; }; - - pure = pkgs.recurseIntoAttrs (pkgs.callPackage ./nixGL.nix { - nvidiaVersion = "440.82"; - nvidiaHash = "edd415acf2f75a659e0f3b4f27c1fab770cf21614e84a18152d94f0d004a758e"; - }); - - versionFile440 = (pkgs.callPackage ./nixGL.nix { - nvidiaVersionFile = pkgs.writeText "nvidia-version-440.82" '' - NVRM version: NVIDIA UNIX x86_64 Kernel Module 440.82 Wed Apr 1 20:04:33 UTC 2020 - GCC version: gcc version 9.3.0 (Arch Linux 9.3.0-1) - ''; - }); - - versionFile510 = (pkgs.callPackage ./nixGL.nix { - nvidiaVersionFile = pkgs.writeText "nvidia-version-510.54" '' - NVRM version: NVIDIA UNIX x86_64 Kernel Module 510.54 Wed Apr 1 20:04:33 UTC 2020 - GCC version: gcc version 9.3.0 (Arch Linux 9.3.0-1) - ''; - }); -in -(with pure; [ nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel ]) -++ (with versionFile440.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) -++ (with versionFile510.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) diff --git a/out-of-tree/nixGL/default.nix b/out-of-tree/nixGL/default.nix deleted file mode 100644 index 3419421..0000000 --- a/out-of-tree/nixGL/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - ## Nvidia informations. - # Version of the system kernel module. Let it to null to enable auto-detection. - nvidiaVersion ? null -, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here - # will be more reproducible and more efficient. - nvidiaHash ? null -, # Alternatively, you can pass a path that points to a nvidia version file - # and let nixGL extract the version from it. That file must be a copy of - # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see - # https://github.com/NixOS/nix/issues/3539 ). - nvidiaVersionFile ? null -, # Enable 32 bits driver - # This is on by default, you can switch it to off if you want to reduce a - # bit the size of nixGL closure. - enable32bits ? true -, # Make sure to enable config.allowUnfree to the instance of nixpkgs to be - # able to access the nvidia drivers. - pkgs ? import { - config = { allowUnfree = true; }; - } -, # Enable all Intel specific extensions which only works on x86_64 - enableIntelX86Extensions ? true -}: -pkgs.callPackage ./nixGL.nix ({ - inherit - nvidiaVersion - nvidiaVersionFile - nvidiaHash - enable32bits - ; -} // (if enableIntelX86Extensions then { } -else { - intel-media-driver = null; - vaapiIntel = null; -})) diff --git a/out-of-tree/nixGL/fetch.py b/out-of-tree/nixGL/fetch.py deleted file mode 100755 index 11d0e3e..0000000 --- a/out-of-tree/nixGL/fetch.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python3 -import urllib3 -import json - -http = urllib3.PoolManager() -dl_dir = http.request("GET", "https://download.nvidia.com/XFree86/Linux-x86_64/") - -# print(f"{dl_dir.status=}\n{dl_dir.data=}") - -assert (dl_dir.status < 400), "Error probably occurred" - -def find_versions(dir_html: bytes) -> list[str]: - # this algorithm obviously need recursion because we need to discover the items - def _rec(dir_html: bytes, start: int = 0, so_far: list[str] = []) -> list[str]: - MATCH_START = b"= 400: - return err_fn(res.status) - return then_fn(res.data) - -identity = lambda e: e -none_id = lambda _: None - -def get_sha256(version: str) -> str | None: - for url in sha256_urls(version): - res = http.request("GET", url) - # print(f"attempting: {url}") - if res.status < 400: - return res.data.decode().split()[0] - return None -fetch_data = [(v, download_urls(v)[0], get_sha256(v)) for v in versions] -fetch_data.append(("latest", *fetch_data[-1][1:])) - -# print(fetch_data) - -# now print the JSON object -print(json.dumps({ - version: { - "url": dl_url, - "sha256": sha256 - } for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4)) -# execution: fetch.py >nvidia_versions.json - diff --git a/out-of-tree/nixGL/flake.lock b/out-of-tree/nixGL/flake.lock deleted file mode 100644 index 97737ae..0000000 --- a/out-of-tree/nixGL/flake.lock +++ /dev/null @@ -1,42 +0,0 @@ -{ - "nodes": { - "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": 1660551188, - "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/out-of-tree/nixGL/flake.nix b/out-of-tree/nixGL/flake.nix deleted file mode 100644 index bbb7c43..0000000 --- a/out-of-tree/nixGL/flake.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - description = "A wrapper tool for nix OpenGL applications"; - - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.nixpkgs.url = "github:nixos/nixpkgs"; - - outputs = { self, nixpkgs, flake-utils }: - (flake-utils.lib.eachDefaultSystem (system: - let - isIntelX86Platform = system == "x86_64-linux"; - nix_pkgs = import nixpkgs { inherit system; }; - pkgs = import ./default.nix { - pkgs = nix_pkgs; - enable32bits = isIntelX86Platform; - enableIntelX86Extensions = isIntelX86Platform; - }; - in - rec { - - packages = { - # makes it easy to use "nix run nixGL --impure -- program" - default = pkgs.auto.nixGLDefault; - - nixGLDefault = pkgs.auto.nixGLDefault; - nixGLNvidia = pkgs.auto.nixGLNvidia; - nixGLNvidiaBumblebee = pkgs.auto.nixGLNvidiaBumblebee; - nixGLIntel = pkgs.nixGLIntel; - nixVulkanNvidia = pkgs.auto.nixVulkanNvidia; - nixVulkanIntel = pkgs.nixVulkanIntel; - }; - - # deprecated attributes for retro compatibility - defaultPackage = packages; - })) // rec { - # deprecated attributes for retro compatibility - overlay = overlays.default; - overlays.default = final: _: - let isIntelX86Platform = final.system == "x86_64-linux"; - in { - nixgl = import ./default.nix { - pkgs = final; - enable32bits = isIntelX86Platform; - enableIntelX86Extensions = isIntelX86Platform; - }; - }; - }; -} diff --git a/out-of-tree/nixGL/nixGL.nix b/out-of-tree/nixGL/nixGL.nix deleted file mode 100644 index fa74b0c..0000000 --- a/out-of-tree/nixGL/nixGL.nix +++ /dev/null @@ -1,288 +0,0 @@ -{ - # # Nvidia informations. - # Version of the system kernel module. Let it to null to enable auto-detection. - nvidiaVersion ? null -, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here - # will be more reproducible and more efficient. - nvidiaHash ? null -, # Alternatively, you can pass a path that points to a nvidia version file - # and let nixGL extract the version from it. That file must be a copy of - # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see - # https://github.com/NixOS/nix/issues/3539 ). - nvidiaVersionFile ? null -, # Enable 32 bits driver - # This is one by default, you can switch it to off if you want to reduce a - # bit the size of nixGL closure. - enable32bits ? true -, writeTextFile -, shellcheck -, pcre -, runCommand -, linuxPackages -, fetchurl -, lib -, runtimeShell -, bumblebee -, libglvnd -, vulkan-validation-layers -, mesa -, libvdpau-va-gl -, intel-media-driver -, vaapiIntel -, pkgsi686Linux -, driversi686Linux -, zlib -, libdrm -, xorg -, wayland -, gcc -}: - -let - writeExecutable = { name, text }: - writeTextFile { - inherit name text; - - executable = true; - destination = "/bin/${name}"; - - checkPhase = '' - ${shellcheck}/bin/shellcheck "$out/bin/${name}" - - # Check that all the files listed in the output binary exists - for i in $(${pcre}/bin/pcregrep -o0 '/nix/store/.*?/[^ ":]+' $out/bin/${name}) - do - ls $i > /dev/null || (echo "File $i, referenced in $out/bin/${name} does not exists."; exit -1) - done - ''; - }; - fetch_db = builtins.fromJSON (builtins.readFile ./nvidia_versions.json); - top = rec { - /* - It contains the builder for different nvidia configuration, parametrized by - the version of the driver and sha256 sum of the driver installer file. - */ - nvidiaPackages = { version, sha256 ? fetch_db."${version}".sha256 }: - let - nvidiaDrivers = (linuxPackages.nvidia_x11.override { }).overrideAttrs - (oldAttrs: { - pname = "nvidia"; - name = "nvidia-x11-${version}-nixGL"; - inherit version; - src = - let - url = - "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run"; - in - fetchurl { inherit url sha256; }; - useGLVND = true; - }); - nvidiaLibsOnly = nvidiaDrivers.override { - libsOnly = true; - kernel = null; - }; - nixNvidiaWrapper = api: - writeExecutable { - name = "nix${api}Nvidia-${version}"; - text = '' - #!${runtimeShell} - ${lib.optionalString (api == "Vulkan") - "export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d"} - NVIDIA_JSON=(${nvidiaLibsOnly}/share/glvnd/egl_vendor.d/*nvidia.json) - ${lib.optionalString enable32bits "NVIDIA_JSON32=(${nvidiaLibsOnly.lib32}/share/glvnd/egl_vendor.d/*nvidia.json)"} - - ${''export __EGL_VENDOR_LIBRARY_FILENAMES=''${NVIDIA_JSON[*]}${ - lib.optionalString enable32bits - '':''${NVIDIA_JSON32[*]}'' - }"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"'' - } - - ${ - lib.optionalString (api == "Vulkan") - ''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json${ - lib.optionalString enable32bits - ":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json" - }"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"'' - } - export LD_LIBRARY_PATH=${ - lib.makeLibraryPath ([ libglvnd nvidiaLibsOnly ] - ++ lib.optional (api == "Vulkan") vulkan-validation-layers - ++ lib.optionals enable32bits [ - nvidiaLibsOnly.lib32 - pkgsi686Linux.libglvnd - ]) - }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - exec "$@" - ''; - }; - in - { - inherit nvidiaDrivers nvidiaLibsOnly; - - nixGLNvidiaBumblebee = writeExecutable { - name = "nixGLNvidiaBumblebee-${version}"; - text = '' - #!${runtimeShell} - export LD_LIBRARY_PATH=${ - lib.makeLibraryPath [ nvidiaDrivers ] - }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - ${ - bumblebee.override { - nvidia_x11 = nvidiaDrivers; - nvidia_x11_i686 = nvidiaDrivers.lib32; - } - }/bin/optirun --ldpath ${ - lib.makeLibraryPath ([ libglvnd nvidiaDrivers ] - ++ lib.optionals enable32bits [ - nvidiaDrivers.lib32 - pkgsi686Linux.libglvnd - ]) - } "$@" - ''; - }; - - # TODO: 32bit version? Not tested. - inherit nixNvidiaWrapper; - - # TODO: 32bit version? Not tested. - nixGLNvidia = nixNvidiaWrapper "GL"; - - # TODO: 32bit version? Not tested. - nixVulkanNvidia = nixNvidiaWrapper "Vulkan"; - }; - - nixGLIntel = writeExecutable { - name = "nixGLIntel"; - # add the 32 bits drivers if needed - text = - let - mesa-drivers = [ mesa.drivers ] - ++ lib.optional enable32bits pkgsi686Linux.mesa.drivers; - intel-driver = [ intel-media-driver vaapiIntel ] - # Note: intel-media-driver is disabled for i686 until https://github.com/NixOS/nixpkgs/issues/140471 is fixed - ++ lib.optionals enable32bits [ /* pkgsi686Linux.intel-media-driver */ driversi686Linux.vaapiIntel ]; - libvdpau = [ libvdpau-va-gl ] - ++ lib.optional enable32bits pkgsi686Linux.libvdpau-va-gl; - glxindirect = runCommand "mesa_glxindirect" { } ( - '' - mkdir -p $out/lib - ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0 - '' - ); - in - '' - #!${runtimeShell} - export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers} - export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver} - ${''export __EGL_VENDOR_LIBRARY_FILENAMES=${mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json${ - lib.optionalString enable32bits - ":${pkgsi686Linux.mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json" - }"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"'' - } - export LD_LIBRARY_PATH=${lib.makeLibraryPath mesa-drivers}:${lib.makeSearchPathOutput "lib" "lib/vdpau" libvdpau}:${glxindirect}/lib:${lib.makeLibraryPath [libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - exec "$@" - ''; - }; - - nixVulkanIntel = writeExecutable { - name = "nixVulkanIntel"; - text = - let - # generate a file with the listing of all the icd files - icd = runCommand "mesa_icd" { } ( - # 64 bits icd - '' - ls ${mesa.drivers}/share/vulkan/icd.d/*.json > f - '' - # 32 bits ones - + lib.optionalString enable32bits '' - ls ${pkgsi686Linux.mesa.drivers}/share/vulkan/icd.d/*.json >> f - '' - # concat everything as a one line string with ":" as seperator - + ''cat f | xargs | sed "s/ /:/g" > $out'' - ); - in - '' - #!${runtimeShell} - if [ -n "$LD_LIBRARY_PATH" ]; then - echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2 - fi - export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d - ICDS=$(cat ${icd}) - export VK_ICD_FILENAMES=$ICDS"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}" - export LD_LIBRARY_PATH=${ - lib.makeLibraryPath [ - zlib - libdrm - xorg.libX11 - xorg.libxcb - xorg.libxshmfence - wayland - gcc.cc - ] - }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - exec "$@" - ''; - }; - - nixGLCommon = nixGL: - runCommand "nixGL" { } '' - mkdir -p "$out/bin" - # star because nixGLNvidia... have version prefixed name - cp ${nixGL}/bin/* "$out/bin/nixGL"; - ''; - - auto = - let - _nvidiaVersionFile = - if nvidiaVersionFile != null then - nvidiaVersionFile - else - # HACK: Get the version from /proc. It turns out that /proc is mounted - # inside of the build sandbox and varies from machine to machine. - # - # builtins.readFile is not able to read /proc files. See - # https://github.com/NixOS/nix/issues/3539. - runCommand "impure-nvidia-version-file" - { - # To avoid sharing the build result over time or between machine, - # Add an impure parameter to force the rebuild on each access. - # time = builtins.currentTime; - preferLocalBuild = true; - allowSubstitutes = false; - } "cp /proc/driver/nvidia/version $out 2> /dev/null || touch $out"; - - # The nvidia version. Either fixed by the `nvidiaVersion` argument, or - # auto-detected. Auto-detection is impure. - nvidiaVersionAuto = - if nvidiaVersion != null then - nvidiaVersion - else - # Get if from the nvidiaVersionFile - let - data = builtins.readFile _nvidiaVersionFile; - versionMatch = builtins.match ".*Module ([0-9.]+) .*" data; - in - if versionMatch != null then builtins.head versionMatch else null; - - autoNvidia = nvidiaPackages { version = nvidiaVersionAuto; }; - in - rec { - # The output derivation contains nixGL which point either to - # nixGLNvidia or nixGLIntel using an heuristic. - nixGLDefault = - if nvidiaVersionAuto != null then - nixGLCommon autoNvidia.nixGLNvidia - else - nixGLCommon nixGLIntel; - } // autoNvidia; - }; -in -top // (if nvidiaVersion != null then - top.nvidiaPackages - { - version = nvidiaVersion; - sha256 = nvidiaHash; - } -else - { }) diff --git a/out-of-tree/nixGL/nixpkgs.nix b/out-of-tree/nixGL/nixpkgs.nix deleted file mode 100644 index a4e1b5b..0000000 --- a/out-of-tree/nixGL/nixpkgs.nix +++ /dev/null @@ -1,7 +0,0 @@ -let - rev = "4f6d8095fd51"; -in -import (fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz"; - sha256 = "14sm0bjjcmi9qmznwy3nkd2vbhj5xcshgm54a5wiprl9ssvxqw53"; -}) diff --git a/out-of-tree/nixGL/nvidia_versions.json b/out-of-tree/nixGL/nvidia_versions.json deleted file mode 100644 index 0241076..0000000 --- a/out-of-tree/nixGL/nvidia_versions.json +++ /dev/null @@ -1,570 +0,0 @@ -{ - "256.25": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.25/NVIDIA-Linux-x86_64-256.25.run", - "sha256": "a93e4de6df8336741ace5a4bd2bc80b3b0b0ebde8c31003671af91bc44db61d3" - }, - "256.29": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.29/NVIDIA-Linux-x86_64-256.29.run", - "sha256": "e387780b265e9eec2f68295f7f08dab0238c87426e9968d8dd9d02d6ff023da3" - }, - "256.35": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.35/NVIDIA-Linux-x86_64-256.35.run", - "sha256": "ef10ecddd8db11f0fa3c6e4727dc275eb0ca9d23a7b7d37a038d17d2a42acb2a" - }, - "256.38.02": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.38.02/NVIDIA-Linux-x86_64-256.38.02.run", - "sha256": "c3c9c60932830a648034b98f38910058df339a84ad5998adc8df19c697fd6663" - }, - "256.38.03": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.38.03/NVIDIA-Linux-x86_64-256.38.03.run", - "sha256": "0dcb0098e294d5b89f57b8100f6af660225310ba48b4298a2ac79bb19cc8ca7c" - }, - "256.44": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.44/NVIDIA-Linux-x86_64-256.44.run", - "sha256": "528aaed18b6b4ba79dbf4ae5c5ecda8350007d610d2c7c608eb646739cfeb500" - }, - "256.52": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.52/NVIDIA-Linux-x86_64-256.52.run", - "sha256": "3ab713f969fe7cf0d7ccfdfee2863c92ea96d1eb5bf3f734b3a1e5b37c2611c8" - }, - "256.53": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.53/NVIDIA-Linux-x86_64-256.53.run", - "sha256": "febee3eb128e1d62565fccb3ad1577f741c4bf067072e45e7766ab999aa590c9" - }, - "260.19.04": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.04/NVIDIA-Linux-x86_64-260.19.04.run", - "sha256": "09391b63daa6bc08ea520c28295a8535b83710f8ba48d01778bf7fe22d095485" - }, - "260.19.06": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.06/NVIDIA-Linux-x86_64-260.19.06.run", - "sha256": "ecd3e2113fbf9dd7e167c737d3b4490dd653b49b70ead62c194635ffc3fd4d00" - }, - "260.19.12": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.12/NVIDIA-Linux-x86_64-260.19.12.run", - "sha256": "7cc90b5bd402742167a1647d0d92aa997af4184da614c2ca882afb2f2e48eb7e" - }, - "260.19.21": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.21/NVIDIA-Linux-x86_64-260.19.21.run", - "sha256": "bf80147e94ab4c86dffe4529635e5f5b0caff5f6758a068d0e2d95ee466d2214" - }, - "260.19.26": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.26/NVIDIA-Linux-x86_64-260.19.26.run", - "sha256": "78ce4e3344ee15330708054b5c3ceabb96aabaa1194a9bc92cee9559c7cd3c9f" - }, - "260.19.29": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.29/NVIDIA-Linux-x86_64-260.19.29.run", - "sha256": "09461a1eb6f46b394e9a2cfef20448311a395c3969521881b334c413715174eb" - }, - "260.19.36": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.36/NVIDIA-Linux-x86_64-260.19.36.run", - "sha256": "35a8769585e1f9b426c9c21b5f5898c06251a642ed73e9fb9eea9ab87ef91067" - }, - "260.19.44": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.44/NVIDIA-Linux-x86_64-260.19.44.run", - "sha256": "8526267407d71b1257e43abc2b98e588c8d271e30584a754b8b8ef426cc69c64" - }, - "270.18": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.18/NVIDIA-Linux-x86_64-270.18.run", - "sha256": "b10af40db402f9f8e6a3a5a55b2385a06e2b8b14c8fc539624b07c63d70bef32" - }, - "270.26": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.26/NVIDIA-Linux-x86_64-270.26.run", - "sha256": "120ead8941ad6c9ea5bc263e12b004e6c4639151469cfe46a99781ab1cc1f33a" - }, - "270.29": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.29/NVIDIA-Linux-x86_64-270.29.run", - "sha256": "c45209b72b2a0128fa4721c616dd51ad799e2698d46f672b006c4b2cc0c44f9c" - }, - "270.30": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.30/NVIDIA-Linux-x86_64-270.30.run", - "sha256": "5f49d1497c60ea3d82e6640ebc233e05c855adf5f6702dfc0a5c73773f26207e" - }, - "270.41.03": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.03/NVIDIA-Linux-x86_64-270.41.03.run", - "sha256": "35dd4a1d89228a8ffc26dd9513aaf806e67826c42ff34954e2bd576068abd0b5" - }, - "270.41.06": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.06/NVIDIA-Linux-x86_64-270.41.06.run", - "sha256": "825c593e77d33df599b2cfe2a3b4cde0c61b837a843a3caa6469298de721f2fa" - }, - "270.41.19": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.19/NVIDIA-Linux-x86_64-270.41.19.run", - "sha256": "4d7131f07e739abc787d69696ca4ac52df2fc0b338405ffd474288c2a4a1e7a6" - }, - "275.09": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09/NVIDIA-Linux-x86_64-275.09.run", - "sha256": "e4c94cbd85f619c2b83f6c53bddc8a7b7ce306f28b80c8cfacdfba884da45f4d" - }, - "275.09.04": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09.04/NVIDIA-Linux-x86_64-275.09.04.run", - "sha256": "dceb415aec70d7fa2bafea45268b1913100cc19e08e57dfda0f0920caad43b68" - }, - "275.09.07": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09.07/NVIDIA-Linux-x86_64-275.09.07.run", - "sha256": "747c09b0a0a8d60e1b5fee49fb1ea07ee5812f8e85a87b2403011af6de58164d" - }, - "275.19": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.19/NVIDIA-Linux-x86_64-275.19.run", - "sha256": "58bf5d90fbabd30c5980a8ce5fe831337ccfe0ab843e78e0b0b12eec8e327e40" - }, - "275.21": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.21/NVIDIA-Linux-x86_64-275.21.run", - "sha256": "9e071aef05545ece8f2836b57f49f73853adb998f9987669c4803549fb50f479" - }, - "275.28": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.28/NVIDIA-Linux-x86_64-275.28.run", - "sha256": "fc1dfded42d21b08f40fa7f50589c6c0c4922cc0d30af71bf721ab8682b00648" - }, - "275.36": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.36/NVIDIA-Linux-x86_64-275.36.run", - "sha256": "91a8c8865514fbeec20fa90c00690011426ad7b5d5c9a221f7ced253d94ddab7" - }, - "275.43": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.43/NVIDIA-Linux-x86_64-275.43.run", - "sha256": "468515a3b3fb2423dc47a6066e2f1b646ec78283b008a3702c111e5cfd3f5dc2" - }, - "280.04": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.04/NVIDIA-Linux-x86_64-280.04.run", - "sha256": "e230b25462ab4eeba71363f12360d4785223c023111f08d21ce1a7456665e712" - }, - "280.11": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.11/NVIDIA-Linux-x86_64-280.11.run", - "sha256": "9d56c08c45a0648c62f00745413f0828549928f0e4e7549bea3d9fce8e498e5f" - }, - "280.13": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.13/NVIDIA-Linux-x86_64-280.13.run", - "sha256": "98a08c7d943912a178a9bbe419db60634088e5262ae9053bf2fe730984e5a012" - }, - "285.03": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/285.03/NVIDIA-Linux-x86_64-285.03.run", - "sha256": "fc1e895635b9ea7171f4e7c549e6502f3853838cb4cc254a190b004579a1f919" - }, - "285.05.09": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/285.05.09/NVIDIA-Linux-x86_64-285.05.09.run", - "sha256": "7159a1f7e898b50dd49ea2273ac6facb870546ad5496bf70c6fbe1642d2c4970" - }, - "290.03": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.03/NVIDIA-Linux-x86_64-290.03.run", - "sha256": "14a412b6a01cd9ae98b1dba0f1a2805c9038fd731dd66747ca57ab6ec4f550b0" - }, - "290.06": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.06/NVIDIA-Linux-x86_64-290.06.run", - "sha256": "48df72cd225043ebecbe1a6a9a575d692e0a9fa0b0bb65c037800d83ba54f3ec" - }, - "290.10": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.10/NVIDIA-Linux-x86_64-290.10.run", - "sha256": "34a2ab07f4ae7afdeb2c8415f3f37c1099e6690eb25f3dbef92eca771f7ce4cd" - }, - "295.09": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.09/NVIDIA-Linux-x86_64-295.09.run", - "sha256": "4b2ff7f9fcc1db6f30f4b4a2eb5a22bc5fe1c566828e3d6a56ef088d187bf786" - }, - "295.17": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.17/NVIDIA-Linux-x86_64-295.17.run", - "sha256": "b1fede162dce9c3d31a991cf48a4743dacece05cfef86dafac8e8284369a86c2" - }, - "295.20": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.20/NVIDIA-Linux-x86_64-295.20.run", - "sha256": "3b84fdeae335c047193f68a1da26f2a736461c35cfe94566fc7ace1e5762d34c" - }, - "295.33": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.33/NVIDIA-Linux-x86_64-295.33.run", - "sha256": "4e939bac1ebc03c6439969d638540b99900b0fe4e4799b4186e5ff9521d37b73" - }, - "295.40": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.40/NVIDIA-Linux-x86_64-295.40.run", - "sha256": "f6d5ae338b3b8ac6c512d06b335010934a62728f181a1fa5253aa84b7bf45e7a" - }, - "295.49": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.49/NVIDIA-Linux-x86_64-295.49.run", - "sha256": "61dc9623ea1981f801d97de7c67c32b7e4f7ef4aaa6744910967cb634d9ace62" - }, - "295.53": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.53/NVIDIA-Linux-x86_64-295.53.run", - "sha256": "4525e994a0d0a8cd776415401423e7de3985923637642955c3fe50a3d047d4ca" - }, - "295.59": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.59/NVIDIA-Linux-x86_64-295.59.run", - "sha256": "4b1d96389abd2b804ad470c5189142a02ee4c82c1ac56cea37ecb45e8051313e" - }, - "295.71": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.71/NVIDIA-Linux-x86_64-295.71.run", - "sha256": "956c7660bff61c07a99cea2130e73baf1574907008d41d9462147aad6b83dcc6" - }, - "295.75": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.75/NVIDIA-Linux-x86_64-295.75.run", - "sha256": "b7ae04da001ade59b87abd15e7786b3f0fc75a312368fa466f6c0400e803debd" - }, - "302.07": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.07/NVIDIA-Linux-x86_64-302.07.run", - "sha256": "6a9e515c21afed122621a69a844a2891bb625773e481ebfe70699bf2d06be5e1" - }, - "302.11": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.11/NVIDIA-Linux-x86_64-302.11.run", - "sha256": "e44816814bce58a9f1cf0d10edec1a2f4b25104a212714c2bbd1bc9e70b53f61" - }, - "302.17": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.17/NVIDIA-Linux-x86_64-302.17.run", - "sha256": "5cf9059ebb70ade99e5621c0a605ed5bbb6c274f7c52a7ef40342ceb41b381fc" - }, - "304.22": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.22/NVIDIA-Linux-x86_64-304.22.run", - "sha256": "4c1b6f7dcda007622bb5e243b858abdb3881d5d5befdc617b23393545d9c96fd" - }, - "304.30": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.30/NVIDIA-Linux-x86_64-304.30.run", - "sha256": "ada4deee8a7a19093af7bb724dfd55e2594fb28932ff915723532ddf16b85e1f" - }, - "304.32": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.32/NVIDIA-Linux-x86_64-304.32.run", - "sha256": "a26d6c64108371027fbca1b35b182d0ff1609dd53ce6f9d06fea85f039393bc8" - }, - "304.37": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.37/NVIDIA-Linux-x86_64-304.37.run", - "sha256": "cae75158047d0b97ea48f269fd2903a6731f53b978a1065720343436c97ca9c2" - }, - "304.43": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.43/NVIDIA-Linux-x86_64-304.43.run", - "sha256": "76946e2fe4160cfd59e7a75fefd174a9c7e71c51cca6b88c40a16cf35947b777" - }, - "304.48": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.48/NVIDIA-Linux-x86_64-304.48.run", - "sha256": "c018541d30e4f276e1afc60077e5c75b54954daa8888c870fc80a19b28d4eae8" - }, - "304.51": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.51/NVIDIA-Linux-x86_64-304.51.run", - "sha256": "28654ff26923660de7296488054154bbbac0ef6e669377eeed84178fd0c17e64" - }, - "304.60": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.60/NVIDIA-Linux-x86_64-304.60.run", - "sha256": "12dbd2661e8b6114fa3f531cb0c7a6820c98198aa6044bddff0d2431141bc6d0" - }, - "304.64": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.64/NVIDIA-Linux-x86_64-304.64.run", - "sha256": "b3c3bb7f136ccd978c9c5a511a02199ec2498c4243baae19ac68e5d905ca5340" - }, - "304.84": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.84/NVIDIA-Linux-x86_64-304.84.run", - "sha256": "8d51e0a8e5bd20d0add5dbacdcdb95eba05bc01d17c3bb247b5a1880feb0e0fe" - }, - "304.88": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.88/NVIDIA-Linux-x86_64-304.88.run", - "sha256": "c1a73211566b085214b0ad1824733aa56d09c6139f729feebd0eff44f6113da3" - }, - "304.108": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.108/NVIDIA-Linux-x86_64-304.108.run", - "sha256": "56a61871f0488521f50c04607c568a177cad48a577c0f4ca625665d0015e2b39" - }, - "304.116": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.116/NVIDIA-Linux-x86_64-304.116.run", - "sha256": "3f267f2cd3f4ede4f954c5f36c8427ae4a2fa19ca8c275f892488f4dc3a4109a" - }, - "304.117": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.117/NVIDIA-Linux-x86_64-304.117.run", - "sha256": "0e5a751cf12b55057c00ccf53d05c8934d5eee49c5f8b3f33c5e11e2c6989e6e" - }, - "304.119": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.119/NVIDIA-Linux-x86_64-304.119.run", - "sha256": "1fd710a78d2bf711ede3bcbd20058de1e94c498db31973dfec1b8c25bf87e6cd" - }, - "304.121": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.121/NVIDIA-Linux-x86_64-304.121.run", - "sha256": "6532eef8b6f65dc44ed912b4ffa86494a954ae98f53c3ffd394fa511cdf75928" - }, - "304.123": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.123/NVIDIA-Linux-x86_64-304.123.run", - "sha256": "68ee60d2a96ff80adad7e62f79f55f137dd10b8c38ce6c60fb481e73fdf6b155" - }, - "304.125": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.125/NVIDIA-Linux-x86_64-304.125.run", - "sha256": "c654889b85a18326f2c610260a8fbc3b1bb6f9b8be1c052a46a213f60bd62262" - }, - "304.128": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.128/NVIDIA-Linux-x86_64-304.128.run", - "sha256": "e301342b93af24a6676519cb3a7fbe5d557b6a23a588ef121478b7fbab8a495f" - }, - "310.14": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.14/NVIDIA-Linux-x86_64-310.14.run", - "sha256": "a187cc9de4939b171b600544e8dbf78dbb1a05cb481b2b3b506c3699f8e6c4c7" - }, - "310.19": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.19/NVIDIA-Linux-x86_64-310.19.run", - "sha256": "3326cf9eb432a10fee5cb663132cd6c175813d0225750ef237dcc7feefd20fca" - }, - "310.32": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.32/NVIDIA-Linux-x86_64-310.32.run", - "sha256": "e5f179a62d1a0e6a877f3f89315d0a28cb7c3cbceff7df13e1a71ab189ac3616" - }, - "310.40": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.40/NVIDIA-Linux-x86_64-310.40.run", - "sha256": "48fc9ff847b57ce959b401ad37040dc1332f9c0b3bdef08c246dba91e091a65e" - }, - "310.44": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.44/NVIDIA-Linux-x86_64-310.44.run", - "sha256": "585365fc37939794ab7ed6907ab2fd9fbcc6f4f19c003d21139895dc97dd88f4" - }, - "310.51": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.51/NVIDIA-Linux-x86_64-310.51.run", - "sha256": "4d0f9829105a8f06121f8308fa5e67834f52b84add48eaf4101b02522db15f53" - }, - "313.09": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.09/NVIDIA-Linux-x86_64-313.09.run", - "sha256": "11cc2c4d32da321ad7ce63b9cdb41578400542d0b9d0ac6c5061a3253db96e13" - }, - "313.18": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.18/NVIDIA-Linux-x86_64-313.18.run", - "sha256": "9aaf6ce2fb08f72b2ab4f7a2d9fc5af8216ac263fa4883deec3844f34ea7ba3a" - }, - "313.26": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.26/NVIDIA-Linux-x86_64-313.26.run", - "sha256": "4cbf3ec4fe1ce0b24ebbdcc3badde369aeb98ab59b6689261fa39f2dde00d41e" - }, - "313.30": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.30/NVIDIA-Linux-x86_64-313.30.run", - "sha256": "72317f2e4c459c33c764e3283deb3e1615b1852ead1f9bfad82148e120506022" - }, - "319.12": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.12/NVIDIA-Linux-x86_64-319.12.run", - "sha256": "4b68617d75d0d1149d2d6e836783429c715204fad567aa621ae7982df676a8d4" - }, - "319.17": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.17/NVIDIA-Linux-x86_64-319.17.run", - "sha256": "5579a8c4f5a7927eb9756d276c4e3d60540877cd68f6c946890fddc5d176764a" - }, - "319.23": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.23/NVIDIA-Linux-x86_64-319.23.run", - "sha256": "d130dd0a9d889063d0dbad0a27789af756076af879a68a5dbc1175821542fa78" - }, - "319.32": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.32/NVIDIA-Linux-x86_64-319.32.run", - "sha256": "204a00728c3cfbe3dcb12a9dae5bf0371a1e5b2c48dedf86a2bb6c881e901e2a" - }, - "319.49": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.49/NVIDIA-Linux-x86_64-319.49.run", - "sha256": "f4bfee9f48725e20e05439ee099730fb1b42892b9ecfac000180426b044be585" - }, - "319.60": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.60/NVIDIA-Linux-x86_64-319.60.run", - "sha256": "2bd663d0d0a9ae8769b0335ff282acfddea3cd86a3992970e445eb2f82fa1b04" - }, - "319.72": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.72/NVIDIA-Linux-x86_64-319.72.run", - "sha256": "25a15200d6fd58782db860c7bc0807583b1d78c13810013c024700e63df4c643" - }, - "319.82": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.82/NVIDIA-Linux-x86_64-319.82.run", - "sha256": "9e00555488fd1c934a86ccf04f3a9eb8c5bcbc29ea38ce66d72788d0bd9dde7b" - }, - "325.08": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/325.08/NVIDIA-Linux-x86_64-325.08.run", - "sha256": "83a567dc6b1ddd0c74af1ebc54e966ae19f52baa17166981046af4d6288c6ce4" - }, - "325.15": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/325.15/NVIDIA-Linux-x86_64-325.15.run", - "sha256": "01446fbd94f6eb3b2e1b3d3f2b06970bf470c3ee2cb1838b3d0c2416e6c74500" - }, - "331.13": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.13/NVIDIA-Linux-x86_64-331.13.run", - "sha256": "571741b8ea153281916382d287849f99a9fa65b911aa54d678b48ef0091cc0cd" - }, - "331.17": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.17/NVIDIA-Linux-x86_64-331.17.run", - "sha256": "22968b7bd6460456e99edcad18ec237ebe66fd19e349c9ec9c3d5a16c074eab4" - }, - "331.20": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.20/NVIDIA-Linux-x86_64-331.20.run", - "sha256": "b8803906402354d201d3b9bc21938a0fe8a7d76e93e486fddaab340df18092ec" - }, - "331.38": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.38/NVIDIA-Linux-x86_64-331.38.run", - "sha256": "1015ac65a85ba39bdbe9e6bac54ae7ce3b2441fc7512909074e991242a46cf34" - }, - "331.49": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.49/NVIDIA-Linux-x86_64-331.49.run", - "sha256": "ee0e0c3e95439e3d55e76aa6477fdb62bc62c04805b3efaa1f028ea64d2422f8" - }, - "331.67": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.67/NVIDIA-Linux-x86_64-331.67.run", - "sha256": "9c7f2bb44bb26a5effb915d8aa22132a6c06483e0cfa6f47b7265b15da83bbd7" - }, - "331.79": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.79/NVIDIA-Linux-x86_64-331.79.run", - "sha256": "c3314bd7f1f722929a2b401e12301a750ee7a73640518932a5a9af39c390a604" - }, - "331.89": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.89/NVIDIA-Linux-x86_64-331.89.run", - "sha256": "e7f51a6c7abfe3ba8f03dbb284e2ade7430cc909b2241ff7703b17beff0dd237" - }, - "331.104": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.104/NVIDIA-Linux-x86_64-331.104.run", - "sha256": "e0a26dc4444e84dae876db773f717e33846e1ae8a23802795ba3d39f1631f79e" - }, - "331.113": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.113/NVIDIA-Linux-x86_64-331.113.run", - "sha256": "e9d5eb4394ef31825f7a86290b19b522851d1b599284095d81bac0f33a996219" - }, - "334.16": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/334.16/NVIDIA-Linux-x86_64-334.16.run", - "sha256": "59a930f7ed6391a1e57b9fc7683420facd1c4548757d4120b1c594479af759f7" - }, - "334.21": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/334.21/NVIDIA-Linux-x86_64-334.21.run", - "sha256": "dd35011967b815e096c267f80b36664e34d779bc33017f396dabbd1a1b86d057" - }, - "337.12": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.12/NVIDIA-Linux-x86_64-337.12.run", - "sha256": "8fa588e0491e652a1cfd45aa01be9336c9b5bb5dd54bf45801a40d53d957e4b4" - }, - "337.19": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.19/NVIDIA-Linux-x86_64-337.19.run", - "sha256": "bd6998c4aa5e491fb8fcb957b11dfb983ebfb755e938fce0382b006a7aba59d2" - }, - "337.25": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.25/NVIDIA-Linux-x86_64-337.25.run", - "sha256": "83280f7738f65bb2e790e7530a38978cf0bd0aa741eda51629c9e9b068128af0" - }, - "340.17": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.17/NVIDIA-Linux-x86_64-340.17.run", - "sha256": "b3311d4bc82dd1c58805f2ac29d20711f2b0c0978407bba138d603606e603662" - }, - "340.24": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.24/NVIDIA-Linux-x86_64-340.24.run", - "sha256": "db0f4f45ece587b95a8ceb0d1acf6f7f758a370ee0c4adfa2403ba4828d58ce6" - }, - "340.32": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.32/NVIDIA-Linux-x86_64-340.32.run", - "sha256": "ef96003110564953cad4ffaec073696dcf9652338dfe5eb0c58ae3ce45db42ac" - }, - "340.46": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.46/NVIDIA-Linux-x86_64-340.46.run", - "sha256": "57e7694b5a985ee95d2da37598ec37cdabf40f914490f4cdb0c5184f12a74270" - }, - "340.58": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.58/NVIDIA-Linux-x86_64-340.58.run", - "sha256": "70cc452161b969d659225a3a7d4cc17d5827f8f8ce6eb053757f30f6a666a643" - }, - "340.65": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.65/NVIDIA-Linux-x86_64-340.65.run", - "sha256": "cd3948db5c1e2468c50140efb4bb50f1a4c84c923db8ec756bd56ff35df9ff04" - }, - "340.76": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.76/NVIDIA-Linux-x86_64-340.76.run", - "sha256": "3bf670e9a2bdb184648dec54ce06fab65e798a9a4c9dd5155e2be4efee3e0994" - }, - "340.93": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.93/NVIDIA-Linux-x86_64-340.93.run", - "sha256": "ea2ac747fd473ea55ed5f6263bd314efa94c71384f3e03d527f8d550ba84c218" - }, - "343.13": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.13/NVIDIA-Linux-x86_64-343.13.run", - "sha256": "424a7d0fbf668c94454a140c880c298c71496ad7dee699a0bfc594c70e499e54" - }, - "343.22": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.22/NVIDIA-Linux-x86_64-343.22.run", - "sha256": "762e9d3c1253712a5a62f7052d58e4768eaea3f0492cab934dbf5349c8523315" - }, - "343.36": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.36/NVIDIA-Linux-x86_64-343.36.run", - "sha256": "2285efa2c0e6675d8724e47a09403630a674c32e514bdcfb54cec3c81810fc78" - }, - "346.16": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.16/NVIDIA-Linux-x86_64-346.16.run", - "sha256": "d44bc3f868ce9cbd6c5bbe88d8622f693ef44282f14ed018d150fcab21a0ce32" - }, - "346.22": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.22/NVIDIA-Linux-x86_64-346.22.run", - "sha256": "ecb3edab63ff053aa1d6e19eb0a69360075ab1b021e5181a6df738e29be9b71a" - }, - "346.35": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.35/NVIDIA-Linux-x86_64-346.35.run", - "sha256": "8625acbbc7a2abdda436a5cb9d06f2a7f5913b16e0a35ac4f9f106853a94d086" - }, - "346.47": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.47/NVIDIA-Linux-x86_64-346.47.run", - "sha256": "85ab28abe9defc2838839969b31aea647e0de34615fbfed3ba716205de365d0a" - }, - "346.59": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.59/NVIDIA-Linux-x86_64-346.59.run", - "sha256": "231020548431569c0172605815ba131a18f969966b4abf82129f974740bc64ca" - }, - "346.72": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.72/NVIDIA-Linux-x86_64-346.72.run", - "sha256": "2ae3777bcff6bf4883b6a903c82b82257bf8fc323fe174992df96a3208c50cef" - }, - "346.82": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.82/NVIDIA-Linux-x86_64-346.82.run", - "sha256": "f68b74479a2c329628fed061977e99f744980329c94b6e9c3f396714f2a10f0e" - }, - "346.87": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.87/NVIDIA-Linux-x86_64-346.87.run", - "sha256": "908446b20c9992cc6a7700866d36c13d9f53646837842d096d91b35644ee4e31" - }, - "346.96": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.96/NVIDIA-Linux-x86_64-346.96.run", - "sha256": "229b28a6b65965a248d07223d941de7d79b54cee7c6574f1037293e8a8026727" - }, - "349.12": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/349.12/NVIDIA-Linux-x86_64-349.12.run", - "sha256": "fe2e3be342859d2de947aed55c369f4944211ecde00435c76e50a4842fffd68a" - }, - "349.16": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/349.16/NVIDIA-Linux-x86_64-349.16.run", - "sha256": "f980b22729b20c9eb3a3a800af524da181afbc78e2409a3f83845894983f8322" - }, - "352.09": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.09/NVIDIA-Linux-x86_64-352.09.run", - "sha256": "a3ec271896b775c936e1a14e7af2e8ebf02b0bd59381217510185b313c5a5fd6" - }, - "352.21": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.21/NVIDIA-Linux-x86_64-352.21.run", - "sha256": "aadfbd991b5418cbf89d2368cc49485a4194196ef08362a18f92df049381f791" - }, - "352.30": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.30/NVIDIA-Linux-x86_64-352.30.run", - "sha256": "4c5fb75ba94c97b6d70ddb9ea2cb11b5ed01829b5f671d9e8abce7afba20aef5" - }, - "352.41": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.41/NVIDIA-Linux-x86_64-352.41.run", - "sha256": "0eb60d0543a0e7c5c3cfec13702005ffec6e2b8c7f22c631f324736ba2a1a832" - }, - "355.06": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/355.06/NVIDIA-Linux-x86_64-355.06.run", - "sha256": "898304e1455bbccad4a3da3520d7fe17db254413f3458d0a296b45fb9cf2bcd6" - }, - "355.11": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/355.11/NVIDIA-Linux-x86_64-355.11.run", - "sha256": "a59b425381add9d9058dc2d987bf3087ab59c43224b5eb04c3f273f5886451ed" - }, - "470.161.03": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.161.03/NVIDIA-Linux-x86_64-470.161.03.run", - "sha256": "5da82a7f8c76e781e7d7f0be7b798db4d344f26bd4facf9abcf3c71c71fe7640" - }, - "510.108.03": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/510.108.03/NVIDIA-Linux-x86_64-510.108.03.run", - "sha256": "410a515e78df29c2cba4ac0b497889ce0ff1b04cfc711ff889e2dfc80f0da0d8" - }, - "515.86.01": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.86.01/NVIDIA-Linux-x86_64-515.86.01.run", - "sha256": "141777e1ca2f11e97d8d33260213f1be327eb73922ae22f4ddab404bb2ef4664" - }, - "525.53": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.53/NVIDIA-Linux-x86_64-525.53.run", - "sha256": "74bb0971f04f1dddd3c4641c891706fb96e8de52e22f6079e50de76d3a51687f" - }, - "525.60.11": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.60.11/NVIDIA-Linux-x86_64-525.60.11.run", - "sha256": "816ee6c2e0813ccc3d4a7958f71fc49a37c60efe1d51d6146c1ce72403983d5d" - }, - "525.60.13": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.60.13/NVIDIA-Linux-x86_64-525.60.13.run", - "sha256": "dce1c184f9f038be72237ccd29c66bb151077f6037f1c158c83d582bd2dba8ca" - }, - "525.78.01": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run", - "sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93" - }, - "latest": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run", - "sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93" - } -} diff --git a/overlays.nix b/overlays.nix deleted file mode 100644 index 1c570ce..0000000 --- a/overlays.nix +++ /dev/null @@ -1,46 +0,0 @@ -flake_input@{ kpcli-py -, nixgl -, rust-overlay -, neovim-nightly-overlay -, system -, ... -}: let - kpcli-py = (final: prev: { - # use python3.9, which works because of cython somehow? - kpcli-py = final.poetry2nix.mkPoetryApplication { - projectDir = flake_input.kpcli-py; - python = final.python39; - overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: { - # tableformatter requires setuptools - tableformatter = super.tableformatter.overridePythonAttrs ( - old: { - buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools super.cython_3 ]; - } - ); - }); - }; - }); - - rust = (final: prev: - let - nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith ( - toolchain: (toolchain.minimal.override { - extensions = exts; - }) - ); - # https://rust-lang.github.io/rustup/concepts/profiles.html - rust-default-components = [ "rust-docs" "rustfmt" "clippy" ]; - rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ]; - in { - rust4devs = nightlyRustWithExts rust-dev-components; - rust4cargo = nightlyRustWithExts [ ]; - rust4normi = nightlyRustWithExts rust-default-components; - }); -in [ - nixgl.overlays.default - rust-overlay.overlays.default - neovim-nightly-overlay.overlay - rust - kpcli-py -] - diff --git a/scripts/config-sysnix-edge.sh b/scripts/config-sysnix-edge.sh deleted file mode 100755 index f7de08d..0000000 --- a/scripts/config-sysnix-edge.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env sh -## Configures a new nixos system to this repository -## Blame: Hung Tran (Pegasust) - -set -xv - -HOSTNAME=${1} - -if [ -z $HOSTNAME ]; then - current_hostname=$(hostname) - echo "Missing hostname as first param." - echo "Type the hostname you want to be here" - read -p "[${current_hostname}] > " HOSTNAME - HOSTNAME=${HOSTNAME:-${current_hostname}} - read -p "Using hostname: ${HOSTNAME}. Press ENTER to continue." _WHATEVER_ -fi - -# Where is this script located -SCRIPT_DIR=$(realpath $(dirname $0)) -echo "SCRIPT_DIR: ${SCRIPT_DIR}" - -SYSNIX_DIR="${SCRIPT_DIR}/.." - -# Copy hardware-configuration of existing machine onto our version control -SYSNIX_PROF="${SYSNIX_DIR}/hosts/${HOSTNAME}" -HARDWARE_CONF="${SYSNIX_PROF}/hardware-configuration.nix" -if [ ! -f "${HARDWARE_CONF}" ]; then - mkdir "$SYSNIX_PROF" - sudo cp /etc/nixos/hardware-configuration.nix ${HARDWARE_CONF} -fi -git add "${HARDWARE_CONF}" - -# Copy ssh/id-rsa details onto ssh/authorized_keys -SSH_PRIV="${HOME}/.ssh/id_rsa" -SSH_PUB="${SSH_PRIV}.pub" -SSH_DIR="${SCRIPT_DIR}/../native_configs/ssh" -if [ ! -f "${SSH_PRIV}" ]; then - ssh-keygen -b 2048 -t rsa -f "${SSH_PRIV}" -q -N "" -fi -# idempotently adds to authorized_keys -cat "${SSH_PUB}" >> "${SSH_DIR}/authorized_keys" -# sort "${SSH_DIR}/authorized_keys" | uniq >"${SSH_DIR}/authorized_keys" -# NOTE: if we do sort... file >file, the ">file" is performed first, which truncates -# the file before we open to read. Hence, `sort [...] file >file` yields empty file. -# Because of this, we have to use `-o` -sort -u "${SSH_DIR}/authorized_keys" -o "${SSH_DIR}/authorized_keys" - -echo "Apply nixos-rebuild" -sudo nixos-rebuild switch --flake "${SYSNIX_DIR}#${HOSTNAME}" - diff --git a/scripts/config-sysnix.sh b/scripts/config-sysnix.sh deleted file mode 100755 index d8586a5..0000000 --- a/scripts/config-sysnix.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env sh -## Configures a new nixos system to this repository -## Blame: Hung Tran (Pegasust) - -set -xv - -HOSTNAME=${1} - -if [ -z $HOSTNAME ]; then - current_hostname=$(hostname) - echo "Missing hostname as first param." - echo "Type the hostname you want to be here" - read -p "[${current_hostname}] > " HOSTNAME - HOSTNAME=${HOSTNAME:-${current_hostname}} - read -p "Using hostname: ${HOSTNAME}. Press ENTER to continue." _WHATEVER_ -fi - -# Where is this script located -SCRIPT_DIR=$(realpath $(dirname $0)) -echo "SCRIPT_DIR: ${SCRIPT_DIR}" - -SYSNIX_DIR="${SCRIPT_DIR}/.." - -# Copy hardware-configuration of existing machine onto our version control -SYSNIX_PROF="${SYSNIX_DIR}/hosts/${HOSTNAME}" -HARDWARE_CONF="${SYSNIX_PROF}/hardware-configuration.nix" -if [ ! -f "${HARDWARE_CONF}" ]; then - mkdir "$SYSNIX_PROF" - sudo cp /etc/nixos/hardware-configuration.nix ${HARDWARE_CONF} -fi -git add "${HARDWARE_CONF}" - -# Copy ssh/id-rsa details onto ssh/authorized_keys -SSH_PRIV="${HOME}/.ssh/id_rsa" -SSH_PUB="${SSH_PRIV}.pub" -SSH_DIR="${SCRIPT_DIR}/../native_configs/ssh" -if [ ! -f "${SSH_PRIV}" ]; then - ssh-keygen -b 2048 -t rsa -f "${SSH_PRIV}" -q -N "" -fi -# idempotently adds to authorized_keys -cat "${SSH_PUB}" >> "${SSH_DIR}/authorized_keys" -# sort "${SSH_DIR}/authorized_keys" | uniq >"${SSH_DIR}/authorized_keys" -# NOTE: if we do sort... file >file, the ">file" is performed first, which truncates -# the file before we open to read. Hence, `sort [...] file >file` yields empty file. -# Because of this, we have to use `-o` -sort -u "${SSH_DIR}/authorized_keys" -o "${SSH_DIR}/authorized_keys" - -echo "Apply nixos-rebuild" -sudo nixos-rebuild switch --flake "${SYSNIX_DIR}/nix-conf/system#${HOSTNAME}" - diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh deleted file mode 100755 index b99a7ac..0000000 --- a/scripts/hm-switch.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env sh -# NOTE: Untested on case of no home-manager -set -xv -# Where this script located -SCRIPT_DIR=$(readlink -f $(dirname $0)) -echo "SCRIPT_DIR: ${SCRIPT_DIR}" - -HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager" - -# Manage nix.conf. Ideally, this should be done with snapshot-based version -# and with preview on-the-spot, with some timeout -if [ -f /etc/nix/nix.conf ]; then - # managed nix.conf - BACKUP_FILE="/etc/nix/nix.conf.backup" - echo "overwriting /etc/nix/nix.conf. Please find latest backup in ${BACKUP_FILE}" - sudo cp /etc/nix/nix.conf ${BACKUP_FILE} - sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/ -fi - -# Mason is bad: it puts binaries onto xdg.data -# let's make mason starts fresh, just in case we introduce RPATH hacks -# that injects binary for Mason to use. -rm -rf ~/.local/share/nvim/mason - -# test if we have home-manager, if not, attempt to use nix to put home-manager to -# our environment -if ! command -v home-manager ; then - nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR $@" -else - home-manager switch -b backup --flake "$HOME_MANAGER_DIR" $@ -fi - - diff --git a/scripts/list-generations.sh b/scripts/list-generations.sh deleted file mode 100755 index f1b3db3..0000000 --- a/scripts/list-generations.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh -sudo nix-env --list-generations --profile /nix/var/nix/profiles/system - diff --git a/scripts/sys-switch.sh b/scripts/sys-switch.sh deleted file mode 100755 index e69de29..0000000 diff --git a/secrets.nix b/secrets.nix deleted file mode 100644 index 04e5d81..0000000 --- a/secrets.nix +++ /dev/null @@ -1,22 +0,0 @@ -let - inherit ((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) secrets; - inherit (secrets) pubKeys; - inherit (pubKeys) users hosts; - all = users // hosts; - c_ = builtins; -in -{ - "secrets/s3fs.age".publicKeys = c_.attrValues (all); - "secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); - "secrets/_nhitrl.age".publicKeys = c_.attrValues (all); - "secrets/wifi.env.age".publicKeys = c_.attrValues (all); -} diff --git a/secrets/_nhitrl.age b/secrets/_nhitrl.age deleted file mode 100644 index ba859ad..0000000 Binary files a/secrets/_nhitrl.age and /dev/null differ diff --git a/secrets/default.nix b/secrets/default.nix deleted file mode 100644 index 0624482..0000000 --- a/secrets/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -# TODO: put ssh keys as user/host config -inputs: -let - # user-specific (~/.ssh/id_ed25519.pub) - users = { - "hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; - }; - # System-specific settings (/etc/ssh/ssh_host_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); -} diff --git a/secrets/s3fs.age b/secrets/s3fs.age deleted file mode 100644 index 88ed5a8..0000000 --- a/secrets/s3fs.age +++ /dev/null @@ -1,10 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 ahbzMg Lx4TLKDZ2yk3DQsM6nOOI1o+FHu0lNtT2p3PBdao+C4 -RsTScUeLmFrO6v1OOxBbyBCMBMVhsGrtu5W9iMOw8B0 --> ssh-ed25519 glsjZQ CdLCkzb1dBoG9gYdMisaZBZT+nnzfOX326CWq6cvN1s -UKGCxej9lZnLzsuFJnFOMpyrz7YzJrHcrFuDz8l8RQk --> U /dev/null -then - use flake -fi - diff --git a/templates/py-poetry/README.md b/templates/py-poetry/README.md deleted file mode 100644 index 2b1e13a..0000000 --- a/templates/py-poetry/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# A Python project that uses Poetry for packaging and package management - -[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org) - -- Bootstrapped with [pegasust/dotfiles](https://git.pegasust.com/pegasust/dotfiles) - -`nix flake new --template git+https://git.pegasust.com/pegasust/dotfiles.git#py-poetry ./` - -- Provides [devShell (`nix develop`)](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html), -[shell.nix (`nix-shell -p ./`)](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html) - -- Install [nix-direnv](https://github.com/nix-community/nix-direnv) here for automatic -dev-shell integration - -## Bootstrapping the project - -- This repo uses [poetry](https://python-poetry.org/docs/cli/#init), a repo-manager -with an intuitive CLI - -```sh -poetry init -``` - -### Libraries worth integrating - -- [tophat/syrupy](https://github.com/tophat/syrupy) Snapshot testing plugin for (builtin) pytest - -```sh -poetry add --group dev syrupy -``` -- [HypothesisWorks/hypothesis](https://github.com/HypothesisWorks/hypothesis) -Hypothesis testing (generate testing data) framework - data driven testing. - -```sh -poetry add --group dev hypothesis -``` - -- [requests](https://github.com/psf/requests) An intuitive way to perform network requests in Python - -```sh -poetry add requests -``` - -- [plotly](https://github.com/plotly/plotly.py) Create plots. - -```sh -poetry add plotly -``` - -- [toolz](https://github.com/pytoolz/toolz) Functional programming in Python - - Beware, you might lose typesafety doing this, but this is what the - [REPL](https://github.com/Olical/conjure/wiki/Quick-start:-Python-(stdio)) - is invented to mitigate. - diff --git a/templates/py-poetry/default.nix b/templates/py-poetry/default.nix deleted file mode 100644 index 89308a3..0000000 --- a/templates/py-poetry/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -(import - ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; - } - ) - { - src = ./.; - }).defaultNix diff --git a/templates/py-poetry/flake.nix b/templates/py-poetry/flake.nix deleted file mode 100644 index d8a8e70..0000000 --- a/templates/py-poetry/flake.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - - outputs = { self, nixpkgs }: - let - supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); - in - { - packages = forAllSystems (system: { - default = pkgs.${system}.poetry2nix.mkPoetryApplication { projectDir = self; }; - }); - - devShells = forAllSystems (system: { - bootstrap = pkgs.${system}.mkShellNoCC { - packages = [ - pkgs.${system}.poetry - ]; - }; - default = pkgs.${system}.mkShellNoCC { - packages = [ - (pkgs.${system}.poetry2nix.mkPoetryEnv { projectDir = self; }) - pkgs.${system}.poetry - ]; - }; - }); - }; -} diff --git a/templates/py-poetry/shell.nix b/templates/py-poetry/shell.nix deleted file mode 100644 index 47458ad..0000000 --- a/templates/py-poetry/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -(import - ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; - } - ) - { - src = ./.; - }).shellNix diff --git a/templates/rust-monorepo/.envrc b/templates/rust-monorepo/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/templates/rust-monorepo/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/templates/rust-monorepo/.github/workflows/build_nix.yml b/templates/rust-monorepo/.github/workflows/build_nix.yml deleted file mode 100644 index 2f684e1..0000000 --- a/templates/rust-monorepo/.github/workflows/build_nix.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: "Build legacy Nix package on Ubuntu" - -on: - push: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: cachix/install-nix-action@v12 - - name: Building package - run: nix-build . -A defaultPackage.x86_64-linux diff --git a/templates/rust-monorepo/.gitignore b/templates/rust-monorepo/.gitignore deleted file mode 100644 index ca401be..0000000 --- a/templates/rust-monorepo/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ - -# These are backup files generated by rustfmt -**/*.rs.bk - -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb -.direnv diff --git a/templates/rust-monorepo/Cargo.toml b/templates/rust-monorepo/Cargo.toml deleted file mode 100644 index 230aee7..0000000 --- a/templates/rust-monorepo/Cargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -[workspace] -members = [ - "packages/*", - "exec/*" -] diff --git a/templates/rust-monorepo/README.md b/templates/rust-monorepo/README.md deleted file mode 100644 index 11b3606..0000000 --- a/templates/rust-monorepo/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Rust-monorepo. TODO: Change this to your monorepo name - -## About this template - -[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org) - -- Bootstrapped with [pegasust/dotfiles](https://git.pegasust.com/pegasust/dotfiles) - -- Uses [naersk](https://github.com/nix-community/naersk.git) to build package(s) - -- Provides [devShell (`nix develop`)](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html), -[shell.nix (`nix-shell -p ./`)](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html) -for development environment. It contains: - - The default `devShell` provides Nightly rustc via -[`gh:oxalica/rust-overlay`](https://github.com/oxalica/rust-overlay.git) - - [rustc components](https://rust-lang.github.io/rustup/concepts/components.html) includes - `rust-src`, [`rust-analyzer`](https://github.com/rust-lang/rust-analyzer.git), - `clippy`, `miri` - - [`evcxr`: Rust REPL]() and [`bacon`: Rust nodemon]() - -## Check out these [killer libraries](https://jondot.medium.com/12-killer-rust-libraries-you-should-know-c60bab07624f) -### Application development - -- [Serde](https://github.com/serde-rs/serde) for (de)serialization needs - - Data-driven programming in Rust starts with Serde - - Service system programming starts with defining your message protocols & data formats - -- [Clap](https://docs.rs/clap/latest/clap/) declarative CLI arguments - - Data-driven CLI development in Rust starts with Clap - -- [itertools](https://lib.rs/crates/itertools) for extra juice to iterators - -- [log](https://lib.rs/crates/log) or [env-logger](https://docs.rs/env_logger/latest/env_logger) -for logging needs - -### Library development - -- [proptest](https://lib.rs/crates/proptest) for hypothesis testing - - Data-driven testing starts with proptest - - diff --git a/templates/rust-monorepo/config.toml b/templates/rust-monorepo/config.toml deleted file mode 100644 index 93bcc86..0000000 --- a/templates/rust-monorepo/config.toml +++ /dev/null @@ -1,4 +0,0 @@ -[cargo-new] -# since we already have a root .git -vcs = "none" # enum["git", "hg", "pijul", "fossil", "none"] - diff --git a/templates/rust-monorepo/default.nix b/templates/rust-monorepo/default.nix deleted file mode 100644 index 89308a3..0000000 --- a/templates/rust-monorepo/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -(import - ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; - } - ) - { - src = ./.; - }).defaultNix diff --git a/templates/rust-monorepo/exec/cli/.gitignore b/templates/rust-monorepo/exec/cli/.gitignore deleted file mode 100644 index ea8c4bf..0000000 --- a/templates/rust-monorepo/exec/cli/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/templates/rust-monorepo/exec/cli/Cargo.toml b/templates/rust-monorepo/exec/cli/Cargo.toml deleted file mode 100644 index 6d7106a..0000000 --- a/templates/rust-monorepo/exec/cli/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "cli" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -corelib = { version = "0.1.0", path = "../../packages/corelib" } diff --git a/templates/rust-monorepo/exec/cli/src/main.rs b/templates/rust-monorepo/exec/cli/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/templates/rust-monorepo/exec/cli/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/templates/rust-monorepo/flake.nix b/templates/rust-monorepo/flake.nix deleted file mode 100644 index a75001f..0000000 --- a/templates/rust-monorepo/flake.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - inputs = { - naersk.url = "github:nix-community/naersk/master"; - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - utils.url = "github:numtide/flake-utils"; - rust-overlay.url = "github:oxalica/rust-overlay"; - }; - - outputs = { self, nixpkgs, utils, naersk, rust-overlay }: - utils.lib.eachDefaultSystem (system: - let - overlays = [ rust-overlay.overlays.default ]; - pkgs = import nixpkgs { inherit system overlays; }; - rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith - ( - toolchain: - toolchain.default.override { - extensions = [ "rust-src" "rust-analyzer" "rust-docs" "clippy" "miri" ]; - } - )); - naersk-lib = pkgs.callPackage naersk { }; - in - { - defaultPackage = naersk-lib.buildPackage ./.; - devShell = with pkgs; mkShell { - buildInputs = [ - rust_pkgs - # rust's compiler is quite powerful enough to the point where - # a REPL is not really necessary. - # Rely on the compiler and bacon 99% of the time - # only use REPL if you need to explore/prototype - # In that case, might as well put the code into sandbox - pkgs.evcxr - pkgs.bacon - ]; - shellHook = '' - # nix flake update # is this even needed? - ''; - }; - }); -} diff --git a/templates/rust-monorepo/packages/corelib/.gitignore b/templates/rust-monorepo/packages/corelib/.gitignore deleted file mode 100644 index 4fffb2f..0000000 --- a/templates/rust-monorepo/packages/corelib/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/Cargo.lock diff --git a/templates/rust-monorepo/packages/corelib/Cargo.toml b/templates/rust-monorepo/packages/corelib/Cargo.toml deleted file mode 100644 index f8d9a89..0000000 --- a/templates/rust-monorepo/packages/corelib/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "corelib" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] diff --git a/templates/rust-monorepo/packages/corelib/src/lib.rs b/templates/rust-monorepo/packages/corelib/src/lib.rs deleted file mode 100644 index 7d12d9a..0000000 --- a/templates/rust-monorepo/packages/corelib/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/templates/rust-monorepo/shell.nix b/templates/rust-monorepo/shell.nix deleted file mode 100644 index 47458ad..0000000 --- a/templates/rust-monorepo/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -(import - ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; - } - ) - { - src = ./.; - }).shellNix diff --git a/templates/rust/.envrc b/templates/rust/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/templates/rust/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/templates/rust/.github/workflows/build_nix.yml b/templates/rust/.github/workflows/build_nix.yml deleted file mode 100644 index 2f684e1..0000000 --- a/templates/rust/.github/workflows/build_nix.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: "Build legacy Nix package on Ubuntu" - -on: - push: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: cachix/install-nix-action@v12 - - name: Building package - run: nix-build . -A defaultPackage.x86_64-linux diff --git a/templates/rust/default.nix b/templates/rust/default.nix deleted file mode 100644 index 89308a3..0000000 --- a/templates/rust/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -(import - ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; - } - ) - { - src = ./.; - }).defaultNix diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix deleted file mode 100644 index a75001f..0000000 --- a/templates/rust/flake.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - inputs = { - naersk.url = "github:nix-community/naersk/master"; - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - utils.url = "github:numtide/flake-utils"; - rust-overlay.url = "github:oxalica/rust-overlay"; - }; - - outputs = { self, nixpkgs, utils, naersk, rust-overlay }: - utils.lib.eachDefaultSystem (system: - let - overlays = [ rust-overlay.overlays.default ]; - pkgs = import nixpkgs { inherit system overlays; }; - rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith - ( - toolchain: - toolchain.default.override { - extensions = [ "rust-src" "rust-analyzer" "rust-docs" "clippy" "miri" ]; - } - )); - naersk-lib = pkgs.callPackage naersk { }; - in - { - defaultPackage = naersk-lib.buildPackage ./.; - devShell = with pkgs; mkShell { - buildInputs = [ - rust_pkgs - # rust's compiler is quite powerful enough to the point where - # a REPL is not really necessary. - # Rely on the compiler and bacon 99% of the time - # only use REPL if you need to explore/prototype - # In that case, might as well put the code into sandbox - pkgs.evcxr - pkgs.bacon - ]; - shellHook = '' - # nix flake update # is this even needed? - ''; - }; - }); -} diff --git a/templates/rust/shell.nix b/templates/rust/shell.nix deleted file mode 100644 index 47458ad..0000000 --- a/templates/rust/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -(import - ( - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; - sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; - } - ) - { - src = ./.; - }).shellNix diff --git a/templates/ts/turborepo/flake.nix b/templates/ts/turborepo/flake.nix deleted file mode 100644 index 8446117..0000000 --- a/templates/ts/turborepo/flake.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - description = "Provides devShell for Nodejs + pnpm"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - # https://github.com/vercel/turbo/issues/2293#issuecomment-1296094236 - # work-around for turbo-repo on nix - turbo.url = "github:dlip/turbo"; - }; - - outputs = { self, turbo, flake-utils, nixpkgs }: - with flake-utils; lib.eachSystem lib.defaultSystems (sys: - let - overlays = [ turbo.overlay ]; - # pkgs is our tweaked nixpkgs - pkgs = import nixpkgs { system = sys; overlays = overlays; }; - shellMsg = '' - echo "Hello from nix ${sys}" - echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)" - echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)" - echo "See more on CONTRIBUTING.md" - ''; - in - { - devShell = pkgs.mkShell { - nativeBuildInputs = [ pkgs.bashInteractive ]; - buildInputs = [ - pkgs.nodejs-18_x - pkgs.nodePackages.pnpm - pkgs.nodePackages.prisma - pkgs.prisma-engines - pkgs.turbo - # pkgs.turbo-tooling - pkgs.jq - pkgs.pscale - pkgs.act # Github workflow - ]; - shellHook = - # https://github.com/prisma/prisma/issues/3026#issuecomment-927258138 - # nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv - '' - export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine" - export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine" - export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node" - export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine" - export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt" - export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo" - pnpm install - '' + shellMsg; - }; - }); -} diff --git a/users/default.nix b/users/default.nix deleted file mode 100644 index 030b376..0000000 --- a/users/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, ... }@inputs: -let - config = { - hungtr.metadata = { }; - "hungtr@bao".metadata = { - ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; - }; - }; -in -{ - homeConfigurations = { }; - pubKeys = lib.getPubkey config; -}