diff --git a/.rgignore b/.rgignore new file mode 100644 index 00000000..1d741e81 --- /dev/null +++ b/.rgignore @@ -0,0 +1 @@ +/config/trusted/tf/ diff --git a/README.md b/README.md index d8cbf64d..551d0a89 100644 --- a/README.md +++ b/README.md @@ -59,18 +59,23 @@ These are the NixOS configurations for my systems. I run nothing other than NixO - [x] aarch64 specific implementation - [ ] ARMv6 specific implementation - [ ] Generalised emulated compiles. +- [ ] Imports structure refactor. + - [ ] Work on the readTree-like modList replacement. + - [ ] Create a “lite” base profile for devices like shinmyoumaru. + - [ ] Add a shared profile that adds user imports. ## Nodes -| Node | Purpose | -|---------------|----------------------------------------------------------| -| [athame][] | Currently the main server. Ad-hoc hetzner cloud box. | -| [daiyousei][] | Intended athame replacement. Provisioned OCI Ampere box. | -| [rinnosuke][] | My primary nameserver. Provisioned OCI EPYC box. | -| [beltane][] | Home server. NAS + HTPC, does DVB stuff. | -| [samhain][] | Beloved workstation. Does VFIO. | -| [yule][] | Main laptop. | -| [ostara][] | CCTV netbook. | +| Node | Purpose | +|------------------|----------------------------------------------------------| +| [athame][] | Currently the main server. Ad-hoc hetzner cloud box. | +| [daiyousei][] | Intended athame replacement. Provisioned OCI Ampere box. | +| [rinnosuke][] | My primary nameserver. Provisioned OCI EPYC box. | +| [shinmyoumaru][] | My Raspberry Pi 1 Model B+. DHT22 sensors box. | +| [beltane][] | Home server. NAS + HTPC, does DVB stuff. | +| [samhain][] | Beloved workstation. Does VFIO. | +| [yule][] | Main laptop. | +| [ostara][] | CCTV netbook. | ## Profiles @@ -215,6 +220,7 @@ Please use `nix-shell` or [direnv/direnv][]. The shell is not compatible with [n [athame]: config/hosts/athame [daiyousei]: config/hosts/daiyousei [rinnosuke]: config/hosts/rinnosuke + [shinmyoumaru]: config/hosts/shinmyoumaru [beltane]: config/hosts/beltane [samhain]: config/hosts/samhain [yule]: config/hosts/yule diff --git a/config/hosts/shinmyoumaru/nixos.nix b/config/hosts/shinmyoumaru/nixos.nix index 3b7e97ec..4a2db1dd 100644 --- a/config/hosts/shinmyoumaru/nixos.nix +++ b/config/hosts/shinmyoumaru/nixos.nix @@ -8,7 +8,27 @@ ./image.nix ]; + nixpkgs.crossOverlays = [ + (import ../../../overlays/pi) + ]; + + boot = { + kernelModules = mkForce ["loop" "atkbd"]; + initrd = { + includeDefaultModules = false; + availableKernelModules = mkForce [ + "mmc_block" + "usbhid" + "ext4" + "hid_generic" "hid_lenovo" "hid_apple" "hid_roccat" + "hid_logitech_hidpp" "hid_logitech_dj" "hid_microsoft" + ]; + }; + }; + home-manager.users.kat.programs.neovim.enable = mkForce false; + home-manager.users.hexchen.programs.vim.enable = mkForce false; + programs.mosh.enable = mkForce false; # Weird Shit diff --git a/config/modules/home/disables.nix b/config/modules/home/disables.nix new file mode 100644 index 00000000..6a9312a1 --- /dev/null +++ b/config/modules/home/disables.nix @@ -0,0 +1,5 @@ +{ ... }: { + disabledModules = [ + "programs/vim.nix" + ]; +} diff --git a/config/modules/home/vim.nix b/config/modules/home/vim.nix new file mode 100644 index 00000000..c7ea2c72 --- /dev/null +++ b/config/modules/home/vim.nix @@ -0,0 +1,157 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.vim; + defaultPlugins = [ "vim-sensible" ]; + + knownSettings = { + background = types.enum [ "dark" "light" ]; + backupdir = types.listOf types.str; + copyindent = types.bool; + directory = types.listOf types.str; + expandtab = types.bool; + hidden = types.bool; + history = types.int; + ignorecase = types.bool; + modeline = types.bool; + mouse = types.enum [ "n" "v" "i" "c" "h" "a" "r" ]; + mousefocus = types.bool; + mousehide = types.bool; + mousemodel = types.enum [ "extend" "popup" "popup_setpos" ]; + number = types.bool; + relativenumber = types.bool; + shiftwidth = types.int; + smartcase = types.bool; + tabstop = types.int; + undodir = types.listOf types.str; + undofile = types.bool; + }; + + vimSettingsType = types.submodule { + options = + let + opt = name: type: mkOption { + type = types.nullOr type; + default = null; + visible = false; + }; + in + mapAttrs opt knownSettings; + }; + + setExpr = name: value: + let + v = + if isBool value then (if value then "" else "no") + name + else + "${name}=${ + if isList value + then concatStringsSep "," value + else toString value + }"; + in + optionalString (value != null) ("set " + v); + +in + +{ + options = { + programs.vim = { + enable = mkEnableOption "Vim"; + + plugins = mkOption { + type = types.listOf types.str; + default = defaultPlugins; + example = [ "YankRing" ]; + description = '' + List of vim plugins to install. To get a list of supported plugins run: + nix-env -f '<nixpkgs>' -qaP -A vimPlugins. + ''; + }; + + settings = mkOption { + type = vimSettingsType; + default = {}; + example = literalExample '' + { + expandtab = true; + history = 1000; + background = "dark"; + } + ''; + description = '' + At attribute set of Vim settings. The attribute names and + corresponding values must be among the following supported + options. + + + ${concatStringsSep "\n" ( + mapAttrsToList (n: v: '' + + ${n} + ${v.description} + + '') knownSettings + )} + + + See the Vim documentation for detailed descriptions of these + options. Note, use extraConfig to + manually set any options not listed above. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = '' + set nocompatible + set nobackup + ''; + description = "Custom .vimrc lines"; + }; + + package = mkOption { + type = types.package; + description = "Resulting customized vim package"; + readOnly = true; + }; + + packageConfigurable = mkOption { + type = types.package; + description = "Configurable vim package"; + default = pkgs.vim_configurable; + defaultText = "pkgs.vim_configurable"; + }; + }; + }; + + config = ( + let + customRC = '' + ${concatStringsSep "\n" ( + filter (v: v != "") ( + mapAttrsToList setExpr ( + builtins.intersectAttrs knownSettings cfg.settings)))} + + ${cfg.extraConfig} + ''; + + vim = cfg.packageConfigurable.customize { + name = "vim"; + vimrcConfig.customRC = customRC; + vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; + vimrcConfig.vam.pluginDictionaries = [ + { names = defaultPlugins ++ cfg.plugins; } + ]; + }; + + in mkIf cfg.enable { + programs.vim.package = vim; + home.packages = [ cfg.package ]; + } + ); +} diff --git a/config/modules/meta/network.nix b/config/modules/meta/network.nix index 5ec092e2..fa55d68c 100644 --- a/config/modules/meta/network.nix +++ b/config/modules/meta/network.nix @@ -28,13 +28,19 @@ with lib; nodes = let nixosModule = { name, config, meta, modulesPath, lib, ... }: with lib; { + options = { + nixpkgs.crossOverlays = mkOption { + type = types.listOf types.unspecified; + default = []; + }; + }; config = { nixpkgs = { system = mkDefault pkgs.system; pkgs = let pkgsReval = import pkgs.path { - inherit (config.nixpkgs) localSystem crossSystem; + inherit (config.nixpkgs) localSystem crossSystem crossOverlays; inherit (pkgs) overlays config; }; in diff --git a/config/profiles/base/system.nix b/config/profiles/base/system.nix index 7a3651b0..a08e921d 100644 --- a/config/profiles/base/system.nix +++ b/config/profiles/base/system.nix @@ -1,10 +1,10 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: with lib; { boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; hardware.enableRedistributableFirmware = lib.mkDefault true; boot.tmpOnTmpfs = true; - boot.zfs.enableUnstable = true; + boot.zfs.enableUnstable = mkIf (elem "zfs" config.boot.supportedFilesystems) true; boot.kernel.sysctl = { "fs.inotify.max_user_watches" = "524288"; "net.core.rmem_max" = "16777216"; diff --git a/config/users/hexchen/default.nix b/config/users/hexchen/default.nix index ddc0c887..016bfeab 100644 --- a/config/users/hexchen/default.nix +++ b/config/users/hexchen/default.nix @@ -9,7 +9,6 @@ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDI3T1eFS77URHZ/HVWkMOqx7W1U54zJtn9C7QWsHOtyH72i/4EVj8SxYqLllElh1kuKUXSUipPeEzVsipFVvfH0wEuTDgFffiSQ3a8lfUgdEBuoySwceEoPgc5deapkOmiDIDeeWlrRe3nqspLRrSWU1DirMxoFPbwqJXRvpl6qJPxRg+2IolDcXlZ6yxB4Vv48vzRfVzZNUz7Pjmy2ebU8PbDoFWL/S3m7yOzQpv3L7KYBz7+rkjuF3AU2vy6CAfIySkVpspZZLtkTGCIJF228ev0e8NvhuN6ZnjzXxVTQOy32HCdPdbBbicu0uHfZ5O7JX9DjGd8kk1r2dnZwwy/ hexchen@yubi5" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4CLJ+mFfq5XiBXROKewmN9WYmj+79bj/AoaR6Iud2pirulot3tkrrLe2cMjiNWFX8CGVqrsAELKUA8EyUTJfStlcTE0/QNESTRmdDaC+lZL41pWUO9KOiD6/0axAhHXrSJ0ScvbqtD0CtpnCKKxtuOflVPoUGZsH9cLKJNRKfEka0H0GgeKb5Tp618R/WNAQOwaCcXzg/nG4Bgv3gJW4Nm9IKy/MwRZqtILi8Mtd+2diTqpMwyNRmbenmRHCQ1vRw46joYkledVqrmSlfSMFgIHI1zRSBXb/JkG2IvIyB5TGbTkC4N2fqJNpH8wnCKuOvs46xmgdiRA26P48C2em3 hexchen@yubi5c" ]; - shell = pkgs.fish; }; home-manager.users.hexchen = { diff --git a/config/users/kat/base/base16.nix b/config/users/kat/base/base16.nix index 7b548a4b..b5bdc2fb 100644 --- a/config/users/kat/base/base16.nix +++ b/config/users/kat/base/base16.nix @@ -7,6 +7,4 @@ alias.light = "atelier.atelier-cave-light"; alias.dark = "atelier.atelier-cave"; }; - - kw.theme.enable = true; } diff --git a/config/users/kat/base/packages.nix b/config/users/kat/base/packages.nix index 307bbde9..993ba8c4 100644 --- a/config/users/kat/base/packages.nix +++ b/config/users/kat/base/packages.nix @@ -6,7 +6,7 @@ htop fd sd - duc + duc-cli bat exa-noman socat @@ -20,7 +20,6 @@ file whois dnsutils - borgbackup neofetch ]; } diff --git a/config/users/kat/base/vim/base16-vim.patch b/config/users/kat/base/vim/base16-vim.patch new file mode 100644 index 00000000..d34bb751 --- /dev/null +++ b/config/users/kat/base/vim/base16-vim.patch @@ -0,0 +1,65 @@ +diff --git a/templates/default.mustache b/templates/default.mustache +index f95466f..8da6909 100644 +--- a/templates/default.mustache ++++ b/templates/default.mustache +@@ -194,12 +194,12 @@ fun hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) + endfun + + " Vim editor colors +-call hi("Normal", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") ++call hi("Normal", s:gui05, "NONE", s:cterm05, "NONE", "", "") + call hi("Bold", "", "", "", "", "bold", "") + call hi("Debug", s:gui08, "", s:cterm08, "", "", "") + call hi("Directory", s:gui0D, "", s:cterm0D, "", "", "") + call hi("Error", s:gui00, s:gui08, s:cterm00, s:cterm08, "", "") +-call hi("ErrorMsg", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") ++call hi("ErrorMsg", s:gui08, "NONE", s:cterm08, "NONE", "", "") + call hi("Exception", s:gui08, "", s:cterm08, "", "", "") + call hi("FoldColumn", s:gui0C, s:gui01, s:cterm0C, s:cterm01, "", "") + call hi("Folded", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "") +@@ -220,15 +220,15 @@ call hi("VisualNOS", s:gui08, "", s:cterm08, "", "", "") + call hi("WarningMsg", s:gui08, "", s:cterm08, "", "", "") + call hi("WildMenu", s:gui00, s:gui05, s:cterm00, s:cterm05, "", "") + call hi("Title", s:gui0D, "", s:cterm0D, "", "none", "") +-call hi("Conceal", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") ++call hi("Conceal", s:gui0D, "NONE", s:cterm0D, "NONE", "", "") + call hi("Cursor", s:gui00, s:gui05, s:cterm00, s:cterm05, "inverse", "") + call hi("NonText", s:gui03, "", s:cterm03, "", "", "") + call hi("Whitespace", s:gui03, "", s:cterm03, "", "", "") +-call hi("LineNr", s:gui03, s:gui00, s:cterm03, s:cterm00, "", "") +-call hi("SignColumn", s:gui03, s:gui00, s:cterm03, s:cterm00, "", "") ++call hi("LineNr", s:gui03, "NONE", s:cterm03, "NONE", "", "") ++call hi("SignColumn", s:gui03, "NONE", s:cterm03, "NONE", "", "") + call hi("StatusLine", s:gui04, s:gui01, s:cterm04, s:cterm01, "none", "") + call hi("StatusLineNC", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "") +-call hi("VertSplit", s:gui01, s:gui00, s:cterm01, s:cterm00, "none", "") ++call hi("VertSplit", s:gui01, "NONE", s:cterm01, "NONE", "none", "") + call hi("ColorColumn", "", s:gui01, "", s:cterm01, "none", "") + call hi("CursorColumn", "", s:gui01, "", s:cterm01, "none", "") + call hi("CursorLine", "", s:gui01, "", s:cterm01, "none", "") +@@ -403,11 +403,11 @@ call hi("DiffAdd", s:gui0B, s:gui02, s:cterm0B, s:cterm02, "", "") + call hi("DiffChange", s:gui05, s:gui02, s:cterm05, s:cterm02, "", "") + call hi("DiffDelete", s:gui08, s:gui02, s:cterm08, s:cterm02, "", "") + call hi("DiffText", s:gui0D, s:gui02, s:cterm0D, s:cterm02, "", "") +-call hi("DiffAdded", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") +-call hi("DiffFile", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") +-call hi("DiffNewFile", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "") +-call hi("DiffLine", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "") +-call hi("DiffRemoved", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "") ++call hi("DiffAdded", s:gui0B, "NONE", s:cterm0B, "NONE", "", "") ++call hi("DiffFile", s:gui08, "NONE", s:cterm08, "NONE", "", "") ++call hi("DiffNewFile", s:gui0B, "NONE", s:cterm0B, "NONE", "", "") ++call hi("DiffLine", s:gui0D, "NONE", s:cterm0D, "NONE", "", "") ++call hi("DiffRemoved", s:gui08, "NONE", s:cterm08, "NONE", "", "") + + " Git highlighting + call hi("gitcommitOverflow", s:gui08, "", s:cterm08, "", "", "") +@@ -471,7 +471,7 @@ call hi("mailEmail", s:gui0D, "", s:cterm0D, "", "", "") + + " Markdown highlighting + call hi("markdownCode", s:gui0B, "", s:cterm0B, "", "", "") +-call hi("markdownError", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "") ++call hi("markdownError", s:gui05, "NONE", s:cterm05, "NONE", "", "") + call hi("markdownCodeBlock", s:gui0B, "", s:cterm0B, "", "", "") + call hi("markdownHeadingDelimiter", s:gui0D, "", s:cterm0D, "", "", "") + diff --git a/config/users/kat/base/vim/default.nix b/config/users/kat/base/vim/default.nix index 4b09eb38..37451303 100644 --- a/config/users/kat/base/vim/default.nix +++ b/config/users/kat/base/vim/default.nix @@ -1,44 +1,6 @@ -{ config, lib, pkgs, ... }: - -let initvim = pkgs.callPackage - ({ stdenv, elinks, nodejs }: stdenv.mkDerivation { - name = "init.vim"; - src = ./init.vim; - inherit nodejs elinks; - buildInputs = [ - elinks - nodejs - ]; - phases = [ "buildPhase" ]; - buildPhase = '' - substituteAll $src $out - ''; - }) - { }; -in -{ - home.sessionVariables.EDITOR = "nvim"; - - programs.neovim = { - enable = true; - extraConfig = '' - source ${initvim} - ''; - vimAlias = true; - viAlias = true; - plugins = with pkgs.vimPlugins; [ - vim-cool - vim-lastplace - vim-hexokinase - vim-easymotion - vim-nix - fzf-vim - vim-fugitive - vim-startify - vim-airline - vim-airline-themes - vim-lastplace - base16-vim - ]; - }; +{ ... }: { + imports = [ + ./vim.nix + ./nvim.nix + ]; } diff --git a/config/users/kat/base/vim/nvim.nix b/config/users/kat/base/vim/nvim.nix new file mode 100644 index 00000000..23a3c6bc --- /dev/null +++ b/config/users/kat/base/vim/nvim.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: with lib; + +let initvim = pkgs.callPackage + ({ stdenv, elinks, nodejs }: stdenv.mkDerivation { + name = "init.vim"; + src = ./init.vim; + inherit nodejs elinks; + buildInputs = [ + elinks + nodejs + ]; + phases = [ "buildPhase" ]; + buildPhase = '' + substituteAll $src $out + ''; + }) + { }; +in +{ + home.sessionVariables = mkIf config.programs.neovim.enable { EDITOR = "nvim"; }; + + programs.neovim = { + enable = true; + extraConfig = '' + source ${initvim} + ''; + vimAlias = true; + viAlias = true; + plugins = with pkgs.vimPlugins; [ + vim-cool + vim-lastplace + vim-hexokinase + vim-easymotion + vim-nix + fzf-vim + vim-fugitive + vim-startify + vim-airline + vim-airline-themes + vim-lastplace + base16-vim + ]; + }; +} diff --git a/config/users/kat/base/vim/vim.nix b/config/users/kat/base/vim/vim.nix new file mode 100644 index 00000000..61c18638 --- /dev/null +++ b/config/users/kat/base/vim/vim.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: with lib; + +let initvim = pkgs.callPackage + ({ stdenv }: stdenv.mkDerivation { + name = "init.vim"; + src = ./init.vim; + phases = [ "buildPhase" ]; + buildPhase = '' + substituteAll $src $out + ''; + }) + { }; +in +{ + home.sessionVariables = mkIf config.programs.vim.enable { EDITOR = "vim"; }; + + programs.vim = { + enable = false; + packageConfigurable = pkgs.vim_configurable-pynvim; + extraConfig = '' + source ${initvim} + ''; + plugins = with pkgs.vimPlugins; [ + "vim-cool" + "vim-lastplace" + "vim-hexokinase" + "vim-easymotion" + "vim-nix" + "fzf-vim" + "vim-fugitive" + "vim-startify" + "vim-airline" + "vim-airline-themes" + "vim-lastplace" + "base16-vim" + ]; + }; +} diff --git a/config/users/kat/default.nix b/config/users/kat/default.nix index eb06e13f..4866d5f8 100644 --- a/config/users/kat/default.nix +++ b/config/users/kat/default.nix @@ -20,7 +20,7 @@ let katUser = { lib }: lib.genAttrs profileNames userImport // { services = lib.genAttrs serviceNames serviceImport; base = { imports = [ ./nixos.nix (userImport "base") ]; }; - server = { }; + server = {}; guiFull = { imports = [ gui sway dev media personal ]; }; }; in diff --git a/config/users/kat/dev/rustfmt.nix b/config/users/kat/dev/rustfmt.nix index 61202ac3..23feaccf 100644 --- a/config/users/kat/dev/rustfmt.nix +++ b/config/users/kat/dev/rustfmt.nix @@ -1,15 +1,11 @@ { config, pkgs, ... }: { - xdg.configFile."rustfmt/rustfmt.toml".text = '' - # SPDX-FileCopyrightText: V - # SPDX-License-Identifier: OSL-3.0 - - hard_tabs = true - imports_granularity = "One" - ''; - - home.packages = with pkgs; [ - rustfmt - ]; + programs.rustfmt = { + enable = true; + config = { + hard_tabs = true; + imports_granularity = "One"; + }; + }; } diff --git a/config/users/kat/gui/base16.nix b/config/users/kat/gui/base16.nix new file mode 100644 index 00000000..12e64ab8 --- /dev/null +++ b/config/users/kat/gui/base16.nix @@ -0,0 +1,3 @@ +{ config, ... }: { + kw.theme.enable = true; +} diff --git a/config/users/kat/gui/default.nix b/config/users/kat/gui/default.nix index 45674f2a..d56e63db 100644 --- a/config/users/kat/gui/default.nix +++ b/config/users/kat/gui/default.nix @@ -5,6 +5,7 @@ ./firefox ./packages.nix ./gtk.nix + ./base16.nix ./foot.nix ./kitty.nix ./xdg.nix diff --git a/config/users/kat/base/nano.png b/config/users/kat/personal/nano.png similarity index 100% rename from config/users/kat/base/nano.png rename to config/users/kat/personal/nano.png diff --git a/config/users/kat/personal/packages.nix b/config/users/kat/personal/packages.nix index 3571aaee..a2266e70 100644 --- a/config/users/kat/personal/packages.nix +++ b/config/users/kat/personal/packages.nix @@ -4,5 +4,6 @@ home.packages = with pkgs; [ pinentry.gtk2 niv + borgbackup ]; } diff --git a/overlays/pi/default.nix b/overlays/pi/default.nix new file mode 100644 index 00000000..a75944ed --- /dev/null +++ b/overlays/pi/default.nix @@ -0,0 +1,3 @@ +final: prev: { + cairo = prev.cairo.override { glSupport = false; }; +} diff --git a/shell.nix b/shell.nix index b147a7e7..b7218cfc 100644 --- a/shell.nix +++ b/shell.nix @@ -3,6 +3,7 @@ let meta = import ./default.nix; config = meta; inherit (meta) pkgs; + inherit (pkgs) lib; fixedSources = removeAttrs config.sources [ "__functor" ]; nf-update = pkgs.writeShellScriptBin "nf-update" '' TEMP=$(mktemp -d) @@ -60,13 +61,16 @@ let cd $START_DIR ''; in -pkgs.mkShell { +with lib; pkgs.mkShell { nativeBuildInputs = with pkgs; [ inetutils nf-update nf-actions nf-actions-test - ] ++ config.runners.lazy.nativeBuildInputs; + ] ++ config.runners.lazy.nativeBuildInputs + ++ (map (node: writeShellScriptBin "${node.networking.hostName}-img" '' + nix build -f . network.nodes.${node.networking.hostName}.system.build.sdImage --show-trace + '') (filter (node: node.system.build ? sdImage) (attrValues meta.network.nodes))); shellHook = '' export HOME_HOSTNAME=$(hostname -s) export HOME_UID=$(id -u)