hosts/shinmyoumaru: Init (buildable)

This commit is contained in:
kat witch 2021-09-03 00:27:40 +01:00
parent 78ea6db567
commit 5e9b427292
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
22 changed files with 382 additions and 74 deletions

1
.rgignore Normal file
View file

@ -0,0 +1 @@
/config/trusted/tf/

View file

@ -59,14 +59,19 @@ 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. |
| [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. |
@ -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

View file

@ -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

View file

@ -0,0 +1,5 @@
{ ... }: {
disabledModules = [
"programs/vim.nix"
];
}

157
config/modules/home/vim.nix Normal file
View file

@ -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:
<command>nix-env -f '&lt;nixpkgs&gt;' -qaP -A vimPlugins</command>.
'';
};
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.
<informaltable frame="none"><tgroup cols="1"><tbody>
${concatStringsSep "\n" (
mapAttrsToList (n: v: ''
<row>
<entry><varname>${n}</varname></entry>
<entry>${v.description}</entry>
</row>
'') knownSettings
)}
</tbody></tgroup></informaltable>
See the Vim documentation for detailed descriptions of these
options. Note, use <varname>extraConfig</varname> 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 ];
}
);
}

View file

@ -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

View file

@ -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";

View file

@ -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 = {

View file

@ -7,6 +7,4 @@
alias.light = "atelier.atelier-cave-light";
alias.dark = "atelier.atelier-cave";
};
kw.theme.enable = true;
}

View file

@ -6,7 +6,7 @@
htop
fd
sd
duc
duc-cli
bat
exa-noman
socat
@ -20,7 +20,6 @@
file
whois
dnsutils
borgbackup
neofetch
];
}

View file

@ -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 <sid>hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp)
endfun
" Vim editor colors
-call <sid>hi("Normal", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "")
+call <sid>hi("Normal", s:gui05, "NONE", s:cterm05, "NONE", "", "")
call <sid>hi("Bold", "", "", "", "", "bold", "")
call <sid>hi("Debug", s:gui08, "", s:cterm08, "", "", "")
call <sid>hi("Directory", s:gui0D, "", s:cterm0D, "", "", "")
call <sid>hi("Error", s:gui00, s:gui08, s:cterm00, s:cterm08, "", "")
-call <sid>hi("ErrorMsg", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "")
+call <sid>hi("ErrorMsg", s:gui08, "NONE", s:cterm08, "NONE", "", "")
call <sid>hi("Exception", s:gui08, "", s:cterm08, "", "", "")
call <sid>hi("FoldColumn", s:gui0C, s:gui01, s:cterm0C, s:cterm01, "", "")
call <sid>hi("Folded", s:gui03, s:gui01, s:cterm03, s:cterm01, "", "")
@@ -220,15 +220,15 @@ call <sid>hi("VisualNOS", s:gui08, "", s:cterm08, "", "", "")
call <sid>hi("WarningMsg", s:gui08, "", s:cterm08, "", "", "")
call <sid>hi("WildMenu", s:gui00, s:gui05, s:cterm00, s:cterm05, "", "")
call <sid>hi("Title", s:gui0D, "", s:cterm0D, "", "none", "")
-call <sid>hi("Conceal", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "")
+call <sid>hi("Conceal", s:gui0D, "NONE", s:cterm0D, "NONE", "", "")
call <sid>hi("Cursor", s:gui00, s:gui05, s:cterm00, s:cterm05, "inverse", "")
call <sid>hi("NonText", s:gui03, "", s:cterm03, "", "", "")
call <sid>hi("Whitespace", s:gui03, "", s:cterm03, "", "", "")
-call <sid>hi("LineNr", s:gui03, s:gui00, s:cterm03, s:cterm00, "", "")
-call <sid>hi("SignColumn", s:gui03, s:gui00, s:cterm03, s:cterm00, "", "")
+call <sid>hi("LineNr", s:gui03, "NONE", s:cterm03, "NONE", "", "")
+call <sid>hi("SignColumn", s:gui03, "NONE", s:cterm03, "NONE", "", "")
call <sid>hi("StatusLine", s:gui04, s:gui01, s:cterm04, s:cterm01, "none", "")
call <sid>hi("StatusLineNC", s:gui03, s:gui01, s:cterm03, s:cterm01, "none", "")
-call <sid>hi("VertSplit", s:gui01, s:gui00, s:cterm01, s:cterm00, "none", "")
+call <sid>hi("VertSplit", s:gui01, "NONE", s:cterm01, "NONE", "none", "")
call <sid>hi("ColorColumn", "", s:gui01, "", s:cterm01, "none", "")
call <sid>hi("CursorColumn", "", s:gui01, "", s:cterm01, "none", "")
call <sid>hi("CursorLine", "", s:gui01, "", s:cterm01, "none", "")
@@ -403,11 +403,11 @@ call <sid>hi("DiffAdd", s:gui0B, s:gui02, s:cterm0B, s:cterm02, "", "")
call <sid>hi("DiffChange", s:gui05, s:gui02, s:cterm05, s:cterm02, "", "")
call <sid>hi("DiffDelete", s:gui08, s:gui02, s:cterm08, s:cterm02, "", "")
call <sid>hi("DiffText", s:gui0D, s:gui02, s:cterm0D, s:cterm02, "", "")
-call <sid>hi("DiffAdded", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "")
-call <sid>hi("DiffFile", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "")
-call <sid>hi("DiffNewFile", s:gui0B, s:gui00, s:cterm0B, s:cterm00, "", "")
-call <sid>hi("DiffLine", s:gui0D, s:gui00, s:cterm0D, s:cterm00, "", "")
-call <sid>hi("DiffRemoved", s:gui08, s:gui00, s:cterm08, s:cterm00, "", "")
+call <sid>hi("DiffAdded", s:gui0B, "NONE", s:cterm0B, "NONE", "", "")
+call <sid>hi("DiffFile", s:gui08, "NONE", s:cterm08, "NONE", "", "")
+call <sid>hi("DiffNewFile", s:gui0B, "NONE", s:cterm0B, "NONE", "", "")
+call <sid>hi("DiffLine", s:gui0D, "NONE", s:cterm0D, "NONE", "", "")
+call <sid>hi("DiffRemoved", s:gui08, "NONE", s:cterm08, "NONE", "", "")
" Git highlighting
call <sid>hi("gitcommitOverflow", s:gui08, "", s:cterm08, "", "", "")
@@ -471,7 +471,7 @@ call <sid>hi("mailEmail", s:gui0D, "", s:cterm0D, "", "", "")
" Markdown highlighting
call <sid>hi("markdownCode", s:gui0B, "", s:cterm0B, "", "", "")
-call <sid>hi("markdownError", s:gui05, s:gui00, s:cterm05, s:cterm00, "", "")
+call <sid>hi("markdownError", s:gui05, "NONE", s:cterm05, "NONE", "", "")
call <sid>hi("markdownCodeBlock", s:gui0B, "", s:cterm0B, "", "", "")
call <sid>hi("markdownHeadingDelimiter", s:gui0D, "", s:cterm0D, "", "", "")

View file

@ -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
{ ... }: {
imports = [
./vim.nix
./nvim.nix
];
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
];
};
}

View file

@ -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
];
};
}

View file

@ -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"
];
};
}

View file

@ -1,15 +1,11 @@
{ config, pkgs, ... }:
{
xdg.configFile."rustfmt/rustfmt.toml".text = ''
# SPDX-FileCopyrightText: V <v@anomalous.eu>
# 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";
};
};
}

View file

@ -0,0 +1,3 @@
{ config, ... }: {
kw.theme.enable = true;
}

View file

@ -5,6 +5,7 @@
./firefox
./packages.nix
./gtk.nix
./base16.nix
./foot.nix
./kitty.nix
./xdg.nix

View file

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Before After
Before After

View file

@ -4,5 +4,6 @@
home.packages = with pkgs; [
pinentry.gtk2
niv
borgbackup
];
}

3
overlays/pi/default.nix Normal file
View file

@ -0,0 +1,3 @@
final: prev: {
cairo = prev.cairo.override { glSupport = false; };
}

View file

@ -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)