diff --git a/.envrc b/.envrc
index 3550a30f..0b56b103 100644
--- a/.envrc
+++ b/.envrc
@@ -1 +1,2 @@
+export REPO_ROOT="$(pwd)"
use flake
diff --git a/.gitignore b/.gitignore
index b2be92b7..4812d58f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
result
+.direnv/
diff --git a/darwin/base/docs.nix b/darwin/base/docs.nix
new file mode 100644
index 00000000..1b272a8e
--- /dev/null
+++ b/darwin/base/docs.nix
@@ -0,0 +1,8 @@
+_: {
+ documentation = {
+ enable = false;
+ man.enable = false;
+ info.enable = false;
+ doc.enable = false;
+ };
+}
diff --git a/darwin/base/fonts.nix b/darwin/base/fonts.nix
new file mode 100644
index 00000000..a638e739
--- /dev/null
+++ b/darwin/base/fonts.nix
@@ -0,0 +1,5 @@
+_: {
+ fonts = {
+ fontDir.enable = true;
+ };
+}
diff --git a/darwin/base/gpg.nix b/darwin/base/gpg.nix
new file mode 100644
index 00000000..fa9b49e7
--- /dev/null
+++ b/darwin/base/gpg.nix
@@ -0,0 +1,6 @@
+_: {
+ programs.gnupg.agent = {
+ enable = true;
+ enableSSHSupport = true;
+ };
+}
diff --git a/darwin/base/homebrew.nix b/darwin/base/homebrew.nix
new file mode 100644
index 00000000..55c4c231
--- /dev/null
+++ b/darwin/base/homebrew.nix
@@ -0,0 +1,12 @@
+_: {
+ homebrew = {
+ enable = true;
+ onActivation = {
+ upgrade = true;
+ cleanup = "zap";
+ };
+ brews = [
+ "mas"
+ ];
+ };
+}
diff --git a/darwin/base/nix.nix b/darwin/base/nix.nix
new file mode 100644
index 00000000..faa4d0a3
--- /dev/null
+++ b/darwin/base/nix.nix
@@ -0,0 +1,8 @@
+_: {
+ services.nix-daemon.enable = true;
+ nix = {
+ extraOptions = ''
+ extra-platforms = x86_64-darwin aarch64-darwin
+ '';
+ };
+}
diff --git a/darwin/base/shell.nix b/darwin/base/shell.nix
new file mode 100644
index 00000000..69f3fa7b
--- /dev/null
+++ b/darwin/base/shell.nix
@@ -0,0 +1,5 @@
+_: {
+ programs.zsh = {
+ enable = true;
+ };
+}
diff --git a/darwin/base/system.nix b/darwin/base/system.nix
new file mode 100644
index 00000000..9269ea7a
--- /dev/null
+++ b/darwin/base/system.nix
@@ -0,0 +1,42 @@
+_: {
+ services.activate-system.enable = true;
+ system = {
+ defaults = {
+ SoftwareUpdate.AutomaticallyInstallMacOSUpdates = true;
+ NSGlobalDomain = {
+ AppleInterfaceStyleSwitchesAutomatically = true;
+ AppleShowAllFiles = true;
+ AppleShowAllExtensions = true;
+ };
+ dock = {
+ autohide = true;
+ orientation = "left";
+ tilesize = 32;
+ wvous-tl-corner = 1;
+ wvous-tr-corner = 10;
+ wvous-bl-corner = 4;
+ wvous-br-corner = 14;
+ };
+ finder = {
+ CreateDesktop = false;
+ ShowPathbar = true;
+ ShowStatusBar = true;
+ AppleShowAllFiles = true;
+ AppleShowAllExtensions = true;
+ };
+ loginwindow = {
+ GuestEnabled = false;
+ };
+ };
+ keyboard = {
+ enableKeyMapping = true;
+ remapCapsLockToControl = true;
+ userKeyMapping = [
+ {
+ HIDKeyboardModifierMappingSrc = 30064771129;
+ HIDKeyboardModifierMappingDst = 30064771299;
+ }
+ ];
+ };
+ };
+}
diff --git a/darwin/home.nix b/darwin/home.nix
new file mode 100644
index 00000000..eccbafee
--- /dev/null
+++ b/darwin/home.nix
@@ -0,0 +1,7 @@
+{config, ...}: {
+ services.gpg-agent.pinentryFlavor = null;
+
+ home.file."${config.programs.gpg.homedir}/gpg-agent.conf".text = ''
+ pinentry-program /opt/homebrew/bin/pinentry-mac
+ '';
+}
diff --git a/darwin/kat.nix b/darwin/kat.nix
new file mode 100644
index 00000000..42f231da
--- /dev/null
+++ b/darwin/kat.nix
@@ -0,0 +1,14 @@
+{pkgs, ...}: {
+ users.users.kat = {
+ name = "kat";
+ home = "/Users/kat";
+ shell = pkgs.zsh;
+ uid = 501;
+ };
+ users.knownUsers = [
+ "kat"
+ ];
+ home-manager.users.kat.programs.zsh.initExtraFirst = ''
+ source /etc/static/zshrc
+ '';
+}
diff --git a/home/base16.nix b/home/base16.nix
index 290b8361..b9c061d2 100644
--- a/home/base16.nix
+++ b/home/base16.nix
@@ -1,40 +1,46 @@
-{ pkgs, lib, ... }:
-
{
+ pkgs,
+ lib,
+ ...
+}: {
base16 = {
vim.enable = false;
vim.template = data: let
drv = pkgs.base16-templates.vim.withTemplateData data;
- in drv.overrideAttrs (old: {
+ in
+ drv.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
- repo = "base16-vim";
- owner = "fnune";
- rev = "52e4ce93a6234d112bc88e1ad25458904ffafe61";
- sha256 = "10y8z0ycmdjk47dpxf6r2pc85k0y19a29aww99vgnxp31wrkc17h";
+ repo = "base16-vim";
+ owner = "fnune";
+ rev = "52e4ce93a6234d112bc88e1ad25458904ffafe61";
+ sha256 = "10y8z0ycmdjk47dpxf6r2pc85k0y19a29aww99vgnxp31wrkc17h";
};
- patches = old.patches or [ ] ++ [
- (pkgs.fetchurl {
- # base16background=none
- url = "https://github.com/arcnmx/base16-vim/commit/fe16eaaa1de83b649e6867c61494276c1f35c3c3.patch";
- sha256 = "1c0n7mf6161mvxn5xlabhyxzha0m1c41csa6i43ng8zybbspipld";
- })
- (pkgs.fetchurl {
- # fix unreadable error highlights under cursor
- url = "https://github.com/arcnmx/base16-vim/commit/807e442d95c57740dd3610c9f9c07c9aae8e0995.patch";
- sha256 = "1l3qmk15v8d389363adkmfg8cpxppyhlk215yq3rdcasvw7r8bla";
- })
- ];
- });
+ patches =
+ old.patches
+ or []
+ ++ [
+ (pkgs.fetchurl {
+ # base16background=none
+ url = "https://github.com/arcnmx/base16-vim/commit/fe16eaaa1de83b649e6867c61494276c1f35c3c3.patch";
+ sha256 = "1c0n7mf6161mvxn5xlabhyxzha0m1c41csa6i43ng8zybbspipld";
+ })
+ (pkgs.fetchurl {
+ # fix unreadable error highlights under cursor
+ url = "https://github.com/arcnmx/base16-vim/commit/807e442d95c57740dd3610c9f9c07c9aae8e0995.patch";
+ sha256 = "1l3qmk15v8d389363adkmfg8cpxppyhlk215yq3rdcasvw7r8bla";
+ })
+ ];
+ });
shell.enable = true;
schemes = lib.mkMerge [
- {
- light = "atelier.atelier-cave-light";
- dark = "atelier.atelier-cave";
- }
- {
- dark.ansi.palette.background.alpha = "ee00";
- light.ansi.palette.background.alpha = "d000";
- }
+ {
+ light = "atelier.atelier-cave-light";
+ dark = "atelier.atelier-cave";
+ }
+ {
+ dark.ansi.palette.background.alpha = "ee00";
+ light.ansi.palette.background.alpha = "d000";
+ }
];
defaultSchemeName = "dark";
};
diff --git a/home/common.nix b/home/common.nix
deleted file mode 100644
index ce4bd9fe..00000000
--- a/home/common.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-_: {
- home = {
- username = "kat";
- stateVersion = "22.11";
- homeDirectory = "/home/kat";
- };
-}
diff --git a/home/default.nix b/home/default.nix
new file mode 100644
index 00000000..6c7b7d05
--- /dev/null
+++ b/home/default.nix
@@ -0,0 +1,17 @@
+{tree, ...}:
+tree.prev
+// {
+ base = {
+ imports = with tree.prev; [
+ base16
+ shell
+ neovim
+ ];
+ };
+ work = {
+ imports = with tree.prev; [
+ work
+ wezterm
+ ];
+ };
+}
diff --git a/home/gpg.nix b/home/gpg.nix
new file mode 100644
index 00000000..ff4bf30b
--- /dev/null
+++ b/home/gpg.nix
@@ -0,0 +1,16 @@
+{lib, ...}: let
+ inherit (lib.modules) mkMerge;
+in {
+ services.gpg-agent = {
+ enable = true;
+ enableExtraSocket = true;
+ enableSshSupport = false;
+ extraConfig = mkMerge [
+ "auto-expand-secmem 0x30000" # otherwise "gpg: public key decryption failed: Cannot allocate memory"
+ "pinentry-timeout 30"
+ "allow-loopback-pinentry"
+ "enable-ssh-support"
+ "no-allow-external-cache"
+ ];
+ };
+}
diff --git a/home/modules/blank.nix b/home/modules/blank.nix
new file mode 100644
index 00000000..eed71245
--- /dev/null
+++ b/home/modules/blank.nix
@@ -0,0 +1 @@
+_: {}
diff --git a/home/modules/disable.nix b/home/modules/disable.nix
new file mode 100644
index 00000000..ba2b4e9a
--- /dev/null
+++ b/home/modules/disable.nix
@@ -0,0 +1,3 @@
+{modulesPath, ...}: {
+ disabledModules = map (x: /. + "${toString modulesPath}/${x}") ["programs/neovim.nix"];
+}
diff --git a/home/modules/neovim.nix b/home/modules/neovim.nix
new file mode 100644
index 00000000..870c1d46
--- /dev/null
+++ b/home/modules/neovim.nix
@@ -0,0 +1,437 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib; let
+ cfg = config.programs.neovim;
+
+ jsonFormat = pkgs.formats.json {};
+
+ extraPython3PackageType = mkOptionType {
+ name = "extra-python3-packages";
+ description = "python3 packages in python.withPackages format";
+ check = with types; (x:
+ if isFunction x
+ then isList (x pkgs.python3Packages)
+ else false);
+ merge = mergeOneOption;
+ };
+
+ # Currently, upstream Neovim is pinned on Lua 5.1 for LuaJIT support.
+ # This will need to be updated if Neovim ever migrates to a newer
+ # version of Lua.
+ extraLua51PackageType = mkOptionType {
+ name = "extra-lua51-packages";
+ description = "lua5.1 packages in lua5_1.withPackages format";
+ check = with types; (x:
+ if isFunction x
+ then isList (x pkgs.lua51Packages)
+ else false);
+ merge = mergeOneOption;
+ };
+
+ pluginWithConfigType = types.submodule {
+ options = {
+ config = mkOption {
+ type = types.lines;
+ description = "Script to configure this plugin. The scripting language should match type.";
+ default = "";
+ };
+
+ type = mkOption {
+ type =
+ types.either (types.enum ["lua" "viml" "teal" "fennel"]) types.str;
+ description = "Language used in config. Configurations are aggregated per-language.";
+ default = "viml";
+ };
+
+ optional =
+ mkEnableOption "optional"
+ // {
+ description = "Don't load by default (load with :packadd)";
+ };
+
+ plugin = mkOption {
+ type = types.package;
+ description = "vim plugin";
+ };
+ };
+ };
+
+ # A function to get the configuration string (if any) from an element of 'plugins'
+ pluginConfig = p:
+ if p ? plugin && (p.config or "") != ""
+ then ''
+ " ${p.plugin.pname or p.plugin.name} {{{
+ ${p.config}
+ " }}}
+ ''
+ else "";
+
+ allPlugins =
+ cfg.plugins
+ ++ optional cfg.coc.enable {
+ type = "viml";
+ plugin = cfg.coc.package;
+ config = cfg.coc.pluginConfig;
+ optional = false;
+ };
+
+ moduleConfigure = {
+ packages.home-manager = {
+ start = remove null (map
+ (x:
+ if x ? plugin && x.optional
+ then null
+ else (x.plugin or x))
+ allPlugins);
+ opt =
+ remove null
+ (map (x:
+ if x ? plugin && x.optional
+ then x.plugin
+ else null)
+ allPlugins);
+ };
+ beforePlugins = "";
+ };
+
+ extraMakeWrapperArgs =
+ lib.optionalString (cfg.extraPackages != [])
+ ''--suffix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
+ extraMakeWrapperLuaCArgs = lib.optionalString (cfg.extraLuaPackages != []) ''
+ --suffix LUA_CPATH ";" "${
+ lib.concatMapStringsSep ";" pkgs.lua51Packages.getLuaCPath
+ cfg.extraLuaPackages
+ }"'';
+ extraMakeWrapperLuaArgs = lib.optionalString (cfg.extraLuaPackages != []) ''
+ --suffix LUA_PATH ";" "${
+ lib.concatMapStringsSep ";" pkgs.lua51Packages.getLuaPath
+ cfg.extraLuaPackages
+ }"'';
+in {
+ imports = [
+ (mkRemovedOptionModule ["programs" "neovim" "withPython"]
+ "Python2 support has been removed from neovim.")
+ (mkRemovedOptionModule ["programs" "neovim" "extraPythonPackages"]
+ "Python2 support has been removed from neovim.")
+ ];
+
+ options = {
+ programs.neovim = {
+ enable = mkEnableOption "Neovim";
+
+ viAlias = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Symlink vi to nvim binary.
+ '';
+ };
+
+ vimAlias = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Symlink vim to nvim binary.
+ '';
+ };
+
+ vimdiffAlias = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Alias vimdiff to nvim -d.
+ '';
+ };
+
+ withNodeJs = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable node provider. Set to true to
+ use Node plugins.
+ '';
+ };
+
+ withRuby = mkOption {
+ type = types.nullOr types.bool;
+ default = true;
+ description = ''
+ Enable ruby provider.
+ '';
+ };
+
+ withPython3 = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Enable Python 3 provider. Set to true to
+ use Python 3 plugins.
+ '';
+ };
+ generatedConfigViml = mkOption {
+ type = types.unspecified;
+ visible = true;
+ readOnly = true;
+ description = ''
+ Generated vimscript config.
+ '';
+ };
+ extraPython3Packages = mkOption {
+ type = with types; either extraPython3PackageType (listOf package);
+ default = _: [];
+ defaultText = literalExpression "ps: [ ]";
+ example = literalExpression "(ps: with ps; [ python-language-server ])";
+ description = ''
+ A function in python.withPackages format, which returns a
+ list of Python 3 packages required for your plugins to work.
+ '';
+ };
+
+ extraLuaPackages = mkOption {
+ type = with types; either extraLua51PackageType (listOf package);
+ default = [];
+ defaultText = literalExpression "[ ]";
+ example = literalExpression "(ps: with ps; [ luautf8 ])";
+ description = ''
+ A function in lua5_1.withPackages format, which returns a
+ list of Lua packages required for your plugins to work.
+ '';
+ };
+
+ generatedConfigs = mkOption {
+ type = types.attrsOf types.lines;
+ visible = true;
+ readOnly = true;
+ example = literalExpression ''
+ {
+ viml = '''
+ " Generated by home-manager
+ set packpath^=/nix/store/cn8vvv4ymxjf8cfzg7db15b2838nqqib-vim-pack-dir
+ set runtimepath^=/nix/store/cn8vvv4ymxjf8cfzg7db15b2838nqqib-vim-pack-dir
+ ''';
+
+ lua = '''
+ -- Generated by home-manager
+ vim.opt.background = "dark"
+ ''';
+ }'';
+ description = ''
+ Generated configurations with as key their language (set via type).
+ '';
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.neovim-unwrapped;
+ defaultText = literalExpression "pkgs.neovim-unwrapped";
+ description = "The package to use for the neovim binary.";
+ };
+
+ finalPackage = mkOption {
+ type = types.package;
+ visible = false;
+ readOnly = true;
+ description = "Resulting customized neovim package.";
+ };
+
+ configure = mkOption {
+ type = types.attrsOf types.anything;
+ default = {};
+ example = literalExpression ''
+ configure = {
+ customRC = $''''
+ " here your custom configuration goes!
+ $'''';
+ packages.myVimPackage = with pkgs.vimPlugins; {
+ # loaded on launch
+ start = [ fugitive ];
+ # manually loadable by calling `:packadd $plugin-name`
+ opt = [ ];
+ };
+ };
+ '';
+ description = ''
+ Deprecated. Please use the other options.
+
+ Generate your init file from your list of plugins and custom commands,
+ and loads it from the store via nvim -u /nix/store/hash-vimrc
+
+
+
+ This option is mutually exclusive with extraConfig
+ and plugins.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ example = ''
+ set nocompatible
+ set nobackup
+ '';
+ description = ''
+ Custom vimrc lines.
+
+
+
+ This option is mutually exclusive with configure.
+ '';
+ };
+
+ extraPackages = mkOption {
+ type = with types; listOf package;
+ default = [];
+ example = literalExpression "[ pkgs.shfmt ]";
+ description = "Extra packages available to nvim.";
+ };
+
+ plugins = mkOption {
+ type = with types; listOf (either package pluginWithConfigType);
+ default = [];
+ example = literalExpression ''
+ with pkgs.vimPlugins; [
+ yankring
+ vim-nix
+ { plugin = vim-startify;
+ config = "let g:startify_change_to_vcs_root = 0";
+ }
+ ]
+ '';
+ description = ''
+ List of vim plugins to install optionally associated with
+ configuration to be placed in init.vim.
+
+
+
+ This option is mutually exclusive with configure.
+ '';
+ };
+
+ coc = {
+ enable = mkEnableOption "Coc";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.vimPlugins.coc-nvim;
+ defaultText = literalExpression "pkgs.vimPlugins.coc-nvim";
+ description = "The package to use for the CoC plugin.";
+ };
+
+ settings = mkOption {
+ inherit (jsonFormat) type;
+ default = {};
+ example = literalExpression ''
+ {
+ "suggest.noselect" = true;
+ "suggest.enablePreview" = true;
+ "suggest.enablePreselect" = false;
+ "suggest.disableKind" = true;
+ languageserver = {
+ haskell = {
+ command = "haskell-language-server-wrapper";
+ args = [ "--lsp" ];
+ rootPatterns = [
+ "*.cabal"
+ "stack.yaml"
+ "cabal.project"
+ "package.yaml"
+ "hie.yaml"
+ ];
+ filetypes = [ "haskell" "lhaskell" ];
+ };
+ };
+ };
+ '';
+ description = ''
+ Extra configuration lines to add to
+ $XDG_CONFIG_HOME/nvim/coc-settings.json
+ See
+
+ for options.
+ '';
+ };
+
+ pluginConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Script to configure CoC. Must be viml.";
+ };
+ };
+ };
+ };
+
+ config = let
+ # transform all plugins into an attrset
+ pluginsNormalized = map (x:
+ if (x ? plugin)
+ then x
+ else {
+ type = x.type or "viml";
+ plugin = x;
+ config = "";
+ optional = false;
+ })
+ allPlugins;
+ suppressNotVimlConfig = p:
+ if p.type != "viml"
+ then p // {config = "";}
+ else p;
+
+ neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
+ inherit (cfg) extraPython3Packages withPython3 withRuby viAlias vimAlias;
+ withNodeJs = cfg.withNodeJs || cfg.coc.enable;
+ configure = cfg.configure // moduleConfigure;
+ plugins = map suppressNotVimlConfig pluginsNormalized;
+ customRC = cfg.extraConfig;
+ };
+ in
+ mkIf cfg.enable {
+ warnings = optional (cfg.configure != {}) ''
+ programs.neovim.configure is deprecated.
+ Other programs.neovim options can override its settings or ignore them.
+ Please use the other options at your disposal:
+ configure.packages.*.opt -> programs.neovim.plugins = [ { plugin = ...; optional = true; }]
+ configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }]
+ configure.customRC -> programs.neovim.extraConfig
+ '';
+ programs.neovim.generatedConfigViml = neovimConfig;
+ programs.neovim.generatedConfigs = let
+ grouped = builtins.groupBy (x: x.type) pluginsNormalized;
+ concatConfigs = lib.concatMapStrings (p: p.config);
+ in
+ mapAttrs (_: concatConfigs) grouped;
+
+ home.packages = [cfg.finalPackage];
+
+ xdg.configFile."nvim/lua/init-home-manager.lua" = mkIf (hasAttr "lua" config.programs.neovim.generatedConfigs) {
+ text = config.programs.neovim.generatedConfigs.lua;
+ };
+ xdg.configFile."nvim/coc-settings.json" = mkIf cfg.coc.enable {
+ source = jsonFormat.generate "coc-settings.json" cfg.coc.settings;
+ };
+
+ programs.neovim.finalPackage =
+ pkgs.wrapNeovimUnstable cfg.package
+ (neovimConfig
+ // {
+ wrapperArgs =
+ (lib.escapeShellArgs neovimConfig.wrapperArgs)
+ + " "
+ + extraMakeWrapperArgs
+ + " "
+ + extraMakeWrapperLuaCArgs
+ + " "
+ + extraMakeWrapperLuaArgs;
+ wrapRc = false;
+ });
+
+ programs.bash.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
+ programs.fish.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
+ programs.zsh.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
+ };
+}
diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix
deleted file mode 100644
index fc09bf6b..00000000
--- a/home/modules/neovim/default.nix
+++ /dev/null
@@ -1,93 +0,0 @@
-{
- config,
- lib,
- pkgs,
- ...
-}: let
- inherit (lib.modules) mkIf;
- inherit (lib.strings) fixedWidthNumber hasInfix;
- inherit (lib.attrsets) mapAttrs filterAttrs;
- packDir = builtins.toString (pkgs.vimUtils.packDir config.programs.neovim.generatedConfigViml.configure.packages);
- initLua = pkgs.substituteAll ({
- name = "init.lua";
- src = ./init.lua;
- inherit packDir;
- base16ShellPath = config.base16.shell.package;
- inherit (config.base16) defaultSchemeName;
- defaultSchemeSlug = config.base16.defaultScheme.slug;
- }
- // mapAttrs (_: col: fixedWidthNumber 2 col.ansiIndex)
- (filterAttrs (var: _: hasInfix "base" var) config.base16.defaultScheme));
-in
- mkIf config.programs.neovim.enable {
- home.sessionVariables.EDITOR = "nvim";
-
- programs.neovim = {
- vimAlias = true;
- viAlias = true;
- plugins = with pkgs.vimPlugins; [
- # Libraries
- plenary-nvim
- # Disables and re-enables highlighting when searching
- vim-cool
- # Colour highlighting
- vim-hexokinase
- # Git porcelain
- vim-fugitive
- # Start screen
- vim-startify
- # Re-open with cursor at the same place
- vim-lastplace
- # Status Bar
- lualine-nvim
- # EasyMotion Equivalent
- hop-nvim
- # base16
- config.base16.vim.plugin
- # Fonts
- nvim-web-devicons
- # Completion
- nvim-cmp
- # Fuzzy Finder
- telescope-nvim
- # Buffers
- bufferline-nvim
- # Language Server
- nvim-lspconfig
- (pkgs.vimPlugins.nvim-treesitter.withPlugins (_:
- with pkgs.tree-sitter-grammars; [
- tree-sitter-c
- tree-sitter-lua
- tree-sitter-rust
- #tree-sitter-bash
- tree-sitter-css
- tree-sitter-dockerfile
- tree-sitter-go
- tree-sitter-hcl
- tree-sitter-html
- tree-sitter-javascript
- tree-sitter-markdown
- tree-sitter-nix
- tree-sitter-norg
- tree-sitter-python
- tree-sitter-regex
- tree-sitter-scss
- ]))
- # Treesitter Plugins
- nvim-ts-rainbow
- nvim-treesitter-context
- twilight-nvim
- ];
- extraPackages = with pkgs; [
- # For nvim-lspconfig, Terraform Language Server
- terraform-ls
- # For tree-sitter
- tree-sitter
- nodejs
- clang
- clangStdenv.cc
- ];
- };
-
- xdg.configFile."nvim/init.lua".source = initLua;
- }
diff --git a/home/modules/wezterm.nix b/home/modules/wezterm.nix
deleted file mode 100644
index 62434169..00000000
--- a/home/modules/wezterm.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- config,
- lib,
- pkgs,
- ...
-}: let
- inherit (lib.modules) mkIf;
- inherit (lib.options) mkEnableOption;
-in {
- options.programs.wezterm = {
- enable = mkEnableOption "the wezterm terminal emulator";
- };
- config = mkIf config.programs.wezterm.enable {
- home.packages = [
- pkgs.wezterm
- ];
- };
-}
diff --git a/home/neovim/default.nix b/home/neovim/default.nix
new file mode 100644
index 00000000..a43b3296
--- /dev/null
+++ b/home/neovim/default.nix
@@ -0,0 +1,94 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ inherit (lib.modules) mkIf;
+ inherit (lib.strings) fixedWidthNumber hasInfix;
+ inherit (lib.attrsets) mapAttrs filterAttrs;
+ packDir = builtins.toString (pkgs.vimUtils.packDir config.programs.neovim.generatedConfigViml.configure.packages);
+ initLua = pkgs.substituteAll ({
+ name = "init.lua";
+ src = ./init.lua;
+ inherit packDir;
+ base16ShellPath = config.base16.shell.package;
+ inherit (config.base16) defaultSchemeName;
+ defaultSchemeSlug = config.base16.defaultScheme.slug;
+ }
+ // mapAttrs (_: col: fixedWidthNumber 2 col.ansiIndex)
+ (filterAttrs (var: _: hasInfix "base" var) config.base16.defaultScheme));
+in {
+ home.sessionVariables = mkIf config.programs.neovim.enable {EDITOR = "nvim";};
+
+ programs.neovim = {
+ enable = true;
+ vimAlias = true;
+ viAlias = true;
+ plugins = with pkgs.vimPlugins; [
+ # Libraries
+ plenary-nvim
+ # Disables and re-enables highlighting when searching
+ vim-cool
+ # Colour highlighting
+ vim-hexokinase
+ # Git porcelain
+ vim-fugitive
+ # Start screen
+ vim-startify
+ # Re-open with cursor at the same place
+ vim-lastplace
+ # Status Bar
+ lualine-nvim
+ # EasyMotion Equivalent
+ hop-nvim
+ # org-mode for vim
+ # neorg
+ # base16
+ config.base16.vim.plugin
+ # Fonts
+ nvim-web-devicons
+ # Completion
+ nvim-cmp
+ # Fuzzy Finder
+ telescope-nvim
+ # Buffers
+ bufferline-nvim
+ # Language Server
+ nvim-lspconfig
+ (pkgs.vimPlugins.nvim-treesitter.withPlugins (_:
+ with pkgs.tree-sitter-grammars; [
+ tree-sitter-c
+ tree-sitter-lua
+ tree-sitter-rust
+ #tree-sitter-bash
+ tree-sitter-css
+ tree-sitter-dockerfile
+ tree-sitter-go
+ tree-sitter-hcl
+ tree-sitter-html
+ tree-sitter-javascript
+ tree-sitter-markdown
+ tree-sitter-nix
+ tree-sitter-norg
+ tree-sitter-python
+ tree-sitter-regex
+ tree-sitter-scss
+ ]))
+ # Treesitter Plugins
+ nvim-ts-rainbow
+ nvim-treesitter-context
+ twilight-nvim
+ ];
+ extraPackages = with pkgs; [
+ # For nvim-lspconfig, Terraform Language Server
+ terraform-ls
+ # For tree-sitter
+ tree-sitter
+ nodejs
+ clang
+ clangStdenv.cc
+ ];
+ };
+ xdg.configFile."nvim/init.lua".source = initLua;
+}
diff --git a/home/modules/neovim/init.lua b/home/neovim/init.lua
similarity index 100%
rename from home/modules/neovim/init.lua
rename to home/neovim/init.lua
diff --git a/home/shell/bitw.nix b/home/shell/bitw.nix
index 61cdfccd..377b2229 100644
--- a/home/shell/bitw.nix
+++ b/home/shell/bitw.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, meta, lib, ... }: {
+{pkgs, ...}: {
programs.rbw = {
enable = true;
- package = lib.mkIf (meta.trusted ? secrets) (pkgs.writeShellScriptBin "bitw" ''${pkgs.rbw-bitw}/bin/bitw -p gpg://${config.secrets.repo.bitw.source} "$@"'');
+ package = pkgs.rbw-bitw;
settings = {
email = "kat@kittywit.ch";
base_url = "https://vault.kittywit.ch";
diff --git a/home/shell/direnv.nix b/home/shell/direnv.nix
index 6c116fa0..35a819a7 100644
--- a/home/shell/direnv.nix
+++ b/home/shell/direnv.nix
@@ -1,4 +1,4 @@
-{ config, ... }: {
+_: {
programs.direnv = {
enable = true;
enableZshIntegration = true;
diff --git a/home/shell/exa.nix b/home/shell/exa.nix
index cc9eded0..b7a71db5 100644
--- a/home/shell/exa.nix
+++ b/home/shell/exa.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }: {
- home.packages = [ pkgs.exa ];
+{pkgs, ...}: {
+ home.packages = [pkgs.exa];
programs.zsh.shellAliases = {
exa = "exa --time-style long-iso";
diff --git a/home/shell/fzf.nix b/home/shell/fzf.nix
index e49642d9..6b8f73dd 100644
--- a/home/shell/fzf.nix
+++ b/home/shell/fzf.nix
@@ -1,9 +1,15 @@
-{ config, pkgs, lib, ... }: {
+{
+ pkgs,
+ lib,
+ ...
+}: let
+ inherit (lib.lists) optional;
+in {
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
- programs.zsh.plugins = lib.optional (pkgs.hostPlatform == pkgs.buildPlatform) {
+ programs.zsh.plugins = optional (pkgs.hostPlatform == pkgs.buildPlatform) {
name = "fzf-tab";
src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
};
diff --git a/home/shell/git.nix b/home/shell/git.nix
index ada08d47..57ea5fa9 100644
--- a/home/shell/git.nix
+++ b/home/shell/git.nix
@@ -1,6 +1,4 @@
-{ config, pkgs, lib, ... }:
-
-{
+{pkgs, ...}: {
home.packages = with pkgs; [
gitAndTools.git-remote-gcrypt
git-crypt
@@ -13,7 +11,7 @@
userName = "Kat Inskip";
userEmail = "kat@inskip.me";
extraConfig = {
- init = { defaultBranch = "main"; };
+ init = {defaultBranch = "main";};
protocol.gcrypt.allow = "always";
annex = {
autocommit = false;
diff --git a/home/shell/inputrc.nix b/home/shell/inputrc.nix
index 8950b4b1..e3efbb57 100644
--- a/home/shell/inputrc.nix
+++ b/home/shell/inputrc.nix
@@ -1,6 +1,4 @@
-{ config, ... }:
-
-{
+{config, ...}: {
xdg.configFile."inputrc".text = ''
set editing-mode vi
set keyseq-timeout 1
diff --git a/home/shell/lc.nix b/home/shell/lc.nix
index e5c39fc8..cee823e4 100644
--- a/home/shell/lc.nix
+++ b/home/shell/lc.nix
@@ -1,7 +1,6 @@
-{ config, ... }: {
+_: {
home.language = let
ca = "en_CA.UTF-8";
- dk = "en_DK.UTF-8";
in {
base = ca;
ctype = ca;
diff --git a/home/shell/packages.nix b/home/shell/packages.nix
index 877da53f..bb02f57b 100644
--- a/home/shell/packages.nix
+++ b/home/shell/packages.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ... }: {
+{pkgs, ...}: {
home.packages = with pkgs; [
# task managers
htop
btop
- # disk usage
+ # disk usage
duc-cli
# nix formatting
nixpkgs-fmt
diff --git a/home/shell/rink.nix b/home/shell/rink.nix
index 6f343158..66b63aae 100644
--- a/home/shell/rink.nix
+++ b/home/shell/rink.nix
@@ -1,12 +1,16 @@
-{ config, lib, pkgs, ... }:
-
{
+ pkgs,
+ lib,
+ ...
+}: let
+ inherit (lib) toTOML;
+in {
home.packages = with pkgs; [
#rink-readline TODO: wait for fix
rink
];
- xdg.configFile."rink/config.toml".text = lib.toTOML {
+ xdg.configFile."rink/config.toml".text = toTOML {
colors = {
enabled = true;
theme = "my_theme";
diff --git a/home/shell/ssh.nix b/home/shell/ssh.nix
index e1255062..9cba5804 100644
--- a/home/shell/ssh.nix
+++ b/home/shell/ssh.nix
@@ -1,6 +1,4 @@
-{ meta, config, pkgs, lib, ... }:
-
-{
+_: {
programs.ssh = {
enable = true;
controlMaster = "auto";
diff --git a/home/shell/starship.nix b/home/shell/starship.nix
index c0dde97e..bc08f023 100644
--- a/home/shell/starship.nix
+++ b/home/shell/starship.nix
@@ -1,4 +1,4 @@
-{ config, ... }: {
+_: {
programs.starship = {
enable = true;
enableZshIntegration = true;
diff --git a/home/shell/tmux.nix b/home/shell/tmux.nix
index ff94dd0c..6eb55db0 100644
--- a/home/shell/tmux.nix
+++ b/home/shell/tmux.nix
@@ -1,6 +1,10 @@
-{ config, lib, pkgs, ... }:
-
{
+ lib,
+ pkgs,
+ ...
+}: let
+ inherit (lib.attrsets) mapAttrs;
+in {
programs.zsh.shellAliases = {
tt = "tmux new -AD -s";
};
@@ -9,7 +13,7 @@
terminal = "tmux-256color";
keyMode = "vi";
baseIndex = 1;
- extraConfig = with lib.mapAttrs (_: v: "colour${toString v}") pkgs.base16.shell.shell256; ''
+ extraConfig = with mapAttrs (_: v: "colour${toString v}") pkgs.base16.shell.shell256; ''
# proper title handling
set -g set-titles on
set -g set-titles-string "#T"
diff --git a/home/shell/z.nix b/home/shell/z.nix
index 22655f63..c65b7235 100644
--- a/home/shell/z.nix
+++ b/home/shell/z.nix
@@ -1,4 +1,8 @@
-{ config, pkgs, ... }: {
+{
+ config,
+ pkgs,
+ ...
+}: {
# ensure .local/share/z is created
xdg.dataFile."z/.keep".text = "";
@@ -6,11 +10,12 @@
localVariables = {
_Z_DATA = "${config.xdg.dataHome}/z/data";
};
- plugins = map (plugin: (with pkgs.${plugin}; {
- name = pname;
- inherit src;
- })) [
- "zsh-z"
- ];
+ plugins =
+ map (plugin: (with pkgs.${plugin}; {
+ name = pname;
+ inherit src;
+ })) [
+ "zsh-z"
+ ];
};
}
diff --git a/home/shell/zsh.nix b/home/shell/zsh.nix
index 39b6a45f..d7979631 100644
--- a/home/shell/zsh.nix
+++ b/home/shell/zsh.nix
@@ -1,107 +1,114 @@
-{ config, lib, pkgs, ... }:
-
{
+ config,
+ lib,
+ pkgs,
+ ...
+}: {
+ home.packages = with pkgs; [
+ # programs.zsh.enableAutosuggestions only includes nix-zsh-autocompletions
+ zsh-completions
+ ];
- home.packages = with pkgs; [
-# programs.zsh.enableAutosuggestions only includes nix-zsh-autocompletions
- zsh-completions
- ];
+ xdg.configFile."kattheme_immutable.json".text = builtins.toJSON rec {
+ default = config.base16.defaultSchemeName;
+ current = default;
+ };
-xdg.configFile."kattheme_immutable.json".text = builtins.toJSON rec {
- default = config.base16.defaultSchemeName;
- current = default;
-};
+ programs.zsh = {
+ enable = true;
+ enableSyntaxHighlighting = true;
+ enableAutosuggestions = true;
+ initExtra = let
+ zshOpts = [
+ "auto_pushd"
+ "pushd_ignore_dups"
+ "pushdminus"
+ "rmstarsilent"
+ "nonomatch"
+ "long_list_jobs"
+ "interactivecomments"
+ "append_history"
+ "hist_ignore_space"
+ "hist_verify"
+ "inc_append_history"
+ "nosharehistory"
+ "nomenu_complete"
+ "auto_menu"
+ "no_auto_remove_slash"
+ "complete_in_word"
+ "always_to_end"
+ "nolistbeep"
+ "autolist"
+ "listrowsfirst"
+ ];
+ in ''
+ ${
+ if pkgs.hostPlatform.isLinux
+ then ''
+ eval $(dircolors -b | sd "\*#=00;90" "*\#=00;90")
+ ''
+ else ''
+ ''
+ }
+ PROMPT_EOL_MARK='''
+ ZSH_TAB_TITLE_ADDITIONAL_TERMS='wezterm'
+ ZSH_TAB_TITLE_ENABLE_FULL_COMMAND=true
+ zmodload -i zsh/complist
+ h=()
+ if [[ -r ~/.ssh/config ]]; then
+ h=($h ''${''${''${(@M)''${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
+ fi
+ if [[ $#h -gt 0 ]]; then
+ zstyle ':completion:*:ssh:*' hosts $h
+ zstyle ':completion:*:slogin:*' hosts $h
+ fi
+ unset h
+ u=(root ${config.home.username})
+ zstyle ':completion:*:ssh:*' users $u
+ unset u
+ zstyle ':completion:*:*:*:*:*' menu select
+ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
+ zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
+ zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
+ zstyle ':completion:*:complete:pass:*:*' matcher 'r:|[./_-]=** r:|=*' 'l:|=* r:|=*'
+ zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
+ zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1lb --color=always $realpath'
+ ${lib.concatStringsSep "\n" (map (opt: "setopt ${opt}") zshOpts)}
+ bindkey '^ ' autosuggest-accept
+ ${
+ if pkgs.hostPlatform.isDarwin
+ then ''
+ export PATH="''${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
+ ''
+ else ""
+ }
+ '';
+ shellAliases = lib.mkMerge [
+ {
+ nixdirfmt = "nixpkgs-fmt $(fd -e nix)";
+ dmesg = "dmesg -HP";
+ hg = "history 0 | rg";
+ }
+ (lib.mkIf pkgs.hostPlatform.isLinux {
+ sys = "systemctl";
+ sysu = "systemctl --user";
+ logu = "journalctl --user";
+ log = "journalctl";
+ lg = "log --no-pager | rg";
+ })
+ ];
+ localVariables = {
+ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold";
+ ZSH_AUTOSUGGEST_USE_ASYNC = 1;
+ };
+ plugins = with pkgs.zsh-plugins; (map (plugin: plugin.zshPlugin) [
+ tab-title
+ vim-mode
+ evil-registers
+ ]);
+ };
-
- programs.zsh = {
- enable = true;
- enableSyntaxHighlighting = true;
- enableAutosuggestions = true;
- initExtra =
- let
- zshOpts = [
- "auto_pushd"
- "pushd_ignore_dups"
- "pushdminus"
- "rmstarsilent"
- "nonomatch"
- "long_list_jobs"
- "interactivecomments"
- "append_history"
- "hist_ignore_space"
- "hist_verify"
- "inc_append_history"
- "nosharehistory"
- "nomenu_complete"
- "auto_menu"
- "no_auto_remove_slash"
- "complete_in_word"
- "always_to_end"
- "nolistbeep"
- "autolist"
- "listrowsfirst"
- ]; in
- ''
- ${if pkgs.hostPlatform.isLinux then ''
- eval $(dircolors -b | sd "\*#=00;90" "*\#=00;90")
- '' else ''
- ''}
- PROMPT_EOL_MARK='''
- ZSH_TAB_TITLE_ADDITIONAL_TERMS='wezterm'
- ZSH_TAB_TITLE_ENABLE_FULL_COMMAND=true
- zmodload -i zsh/complist
- h=()
- if [[ -r ~/.ssh/config ]]; then
- h=($h ''${''${''${(@M)''${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
- fi
- if [[ $#h -gt 0 ]]; then
- zstyle ':completion:*:ssh:*' hosts $h
- zstyle ':completion:*:slogin:*' hosts $h
- fi
- unset h
- u=(root ${config.home.username})
- zstyle ':completion:*:ssh:*' users $u
- unset u
- zstyle ':completion:*:*:*:*:*' menu select
- zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
- zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
- zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
- zstyle ':completion:*:complete:pass:*:*' matcher 'r:|[./_-]=** r:|=*' 'l:|=* r:|=*'
- zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS}
- zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1lb --color=always $realpath'
- ${lib.concatStringsSep "\n" (map (opt: "setopt ${opt}") zshOpts)}
- bindkey '^ ' autosuggest-accept
- ${if pkgs.hostPlatform.isDarwin then ''
- export PATH="''${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
-'' else ""
- }
- '';
- shellAliases = lib.mkMerge [
- {
- nixdirfmt = "nixpkgs-fmt $(fd -e nix)";
- dmesg = "dmesg -HP";
- hg = "history 0 | rg";
- }
- (lib.mkIf pkgs.hostPlatform.isLinux {
- sys = "systemctl";
- sysu = "systemctl --user";
- logu = "journalctl --user";
- log = "journalctl";
- lg = "log --no-pager | rg";
- })
- ];
- localVariables = {
- ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold";
- ZSH_AUTOSUGGEST_USE_ASYNC = 1;
- };
- plugins = with pkgs.zsh-plugins; (map (plugin: plugin.zshPlugin) [
- tab-title
- vim-mode
- evil-registers
- ]);
- };
-
- home.sessionVariables = {
- XDG_DATA_HOME = "${config.xdg.dataHome}";
- };
+ home.sessionVariables = {
+ XDG_DATA_HOME = "${config.xdg.dataHome}";
+ };
}
diff --git a/home/state.nix b/home/state.nix
new file mode 100644
index 00000000..86a6143f
--- /dev/null
+++ b/home/state.nix
@@ -0,0 +1,3 @@
+_: {
+ home.stateVersion = "22.11";
+}
diff --git a/home/system.nix b/home/system.nix
deleted file mode 100644
index 13f2f90b..00000000
--- a/home/system.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- config,
- tree,
- machine,
- ...
-}: {
- home-manager = {
- useGlobalPkgs = true;
- useUserPackages = true;
- sharedModules = with tree; [
- home.modules
- home.common
- ];
- extraSpecialArgs = {
- inherit tree machine;
- nixos = config;
- };
- };
-}
diff --git a/home/vim/default.nix b/home/vim/default.nix
deleted file mode 100644
index 205e9692..00000000
--- a/home/vim/default.nix
+++ /dev/null
@@ -1,89 +0,0 @@
-{ config, lib, pkgs, nixos, ... }:
-
-let
-inherit (lib.modules) mkIf;
-inherit (lib.strings) concatStringsSep fixedWidthNumber hasInfix;
-inherit (lib.attrsets) mapAttrs filterAttrs;
-packDir = builtins.toString(pkgs.vimUtils.packDir config.programs.neovim.generatedConfigViml.configure.packages);
-initLua = pkgs.substituteAll ({
- name = "init.lua";
- src = ./init.lua;
- inherit packDir;
- base16ShellPath = config.base16.shell.package;
- inherit (config.base16) defaultSchemeName;
- defaultSchemeSlug = config.base16.defaultScheme.slug;
-} // mapAttrs (_: col: fixedWidthNumber 2 col.ansiIndex)
- (filterAttrs (var: _: hasInfix "base" var) config.base16.defaultScheme));
-in {
- home.sessionVariables = mkIf config.programs.neovim.enable { EDITOR = "nvim"; };
-
- programs.neovim = {
- enable = true;
- vimAlias = true;
- viAlias = true;
- plugins = with pkgs.vimPlugins; [
-# Libraries
- plenary-nvim
-# Disables and re-enables highlighting when searching
- vim-cool
-# Colour highlighting
- vim-hexokinase
-# Git porcelain
- vim-fugitive
-# Start screen
- vim-startify
-# Re-open with cursor at the same place
- vim-lastplace
-# Status Bar
- lualine-nvim
-# EasyMotion Equivalent
- hop-nvim
-# org-mode for vim
-# neorg
-# base16
- config.base16.vim.plugin
-# Fonts
- nvim-web-devicons
-# Completion
- nvim-cmp
-# Fuzzy Finder
- telescope-nvim
-# Buffers
- bufferline-nvim
-# Language Server
- nvim-lspconfig
- (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with pkgs.tree-sitter-grammars; [
- tree-sitter-c
- tree-sitter-lua
- tree-sitter-rust
- #tree-sitter-bash
- tree-sitter-css
- tree-sitter-dockerfile
- tree-sitter-go
- tree-sitter-hcl
- tree-sitter-html
- tree-sitter-javascript
- tree-sitter-markdown
- tree-sitter-nix
- tree-sitter-norg
- tree-sitter-python
- tree-sitter-regex
- tree-sitter-scss
- ]))
-# Treesitter Plugins
- nvim-ts-rainbow
- nvim-treesitter-context
- twilight-nvim
- ];
- extraPackages = with pkgs; [
-# For nvim-lspconfig, Terraform Language Server
- terraform-ls
-# For tree-sitter
- tree-sitter
- nodejs
- clang
- clangStdenv.cc
- ];
- };
- xdg.configFile."nvim/init.lua".source = initLua;
-}
diff --git a/home/vim/init.lua b/home/vim/init.lua
deleted file mode 100644
index 76223bde..00000000
--- a/home/vim/init.lua
+++ /dev/null
@@ -1,345 +0,0 @@
------------------------------------------------------------
--- Variables
------------------------------------------------------------
-local g = vim.g -- Global variables
-local opt = vim.opt -- Set options (global/buffer/windows-scoped)
-local wo = vim.wo -- Window local variables
-local api = vim.api -- Lua API
-
------------------------------------------------------------
--- Nix Fuckery
------------------------------------------------------------
-opt.packpath:prepend{"@packDir@"}
-opt.runtimepath:prepend{"@packDir@"}
-
------------------------------------------------------------
--- Base16
------------------------------------------------------------
-vim.g.base16colorspace = 256
-vim.g.base16background = "@defaultSchemeName@"
-g.base16_shell_path = "@base16ShellPath@"
-vim.cmd("colorscheme base16-@defaultSchemeSlug@")
-g.colors_name = "@defaultSchemeSlug@"
-
-local base16 = {
- base00 = "@base00@",
- base01 = "@base01@",
- base02 = "@base02@",
- base03 = "@base03@",
- base04 = "@base04@",
- base05 = "@base05@",
- base06 = "@base06@",
- base07 = "@base07@",
- base08 = "@base08@",
- base09 = "@base09@",
- base0A = "@base0A@",
- base0B = "@base0B@",
- base0C = "@base0C@",
- base0D = "@base0D@",
- base0E = "@base0E@",
- base0F = "@base0F@"
-}
-
-api.nvim_create_autocmd("vimenter", {
- command = "highlight Normal guibg=NONE ctermbg=NONE"
-})
-api.nvim_create_autocmd("SourcePost", {
- command = "highlight Normal ctermbg=NONE guibg=NONE | " ..
- "highlight LineNr ctermbg=NONE guibg=NONE | " ..
- "highlight SignColumn ctermbg=NONE guibg=NONE"
-})
-
-
------------------------------------------------------------
--- General
------------------------------------------------------------
-opt.mouse = 'a' -- Enable mouse support
-opt.clipboard = 'unnamedplus' -- Copy/paste to system clipboard
-opt.completeopt = 'longest,menuone' -- Autocomplete options
-opt.backup = false -- Disable backup
-opt.writebackup = false -- Disable backup
-opt.ttimeoutlen = 100 -- Mapping timeout
-
------------------------------------------------------------
--- Neovim UI
------------------------------------------------------------
-opt.number = true -- Show line number
-opt.relativenumber = true -- Relative line numbers
-opt.showmatch = true -- Highlight matching parenthesis
-opt.foldmethod = 'marker' -- Enable folding (default 'foldmarker')
-opt.colorcolumn = '80' -- Line length marker at 80 columns
-opt.splitright = true -- Vertical split to the right
-opt.splitbelow = true -- Horizontal split to the bottom
-opt.ignorecase = true -- Ignore case letters when search
-opt.smartcase = true -- Ignore lowercase for the whole pattern
-opt.wrap = true -- Wrap on word boundary
-opt.linebreak = true -- Wrap on word boundary
-opt.showbreak = " ↳" -- Character to use to display word boundary
-opt.termguicolors = false -- Enable 24-bit RGB colors
-opt.laststatus = 3 -- Set global statusline
-opt.cursorline = true -- Highlight cursor screenline
-opt.cmdheight = 1 -- Command entry line height
-opt.hlsearch = true -- Highlight matches with last search pattern
-
------------------------------------------------------------
--- Tabs, indent
------------------------------------------------------------
-opt.expandtab = true -- Use spaces instead of tabs
-opt.shiftwidth = 2 -- Shift 2 spaces when tab
-opt.tabstop = 2 -- 1 tab == 2 spaces
-opt.smartindent = true -- Autoindent new lines
-opt.list = true -- List chars
-opt.listchars = {
- tab = '» ',
- extends = '›',
- precedes= '‹',
- nbsp = '·',
- trail = '✖'
-}
-
------------------------------------------------------------
--- Memory, CPU
------------------------------------------------------------
-opt.hidden = true -- Enable background buffers
-opt.history = 100 -- Remember N lines in history
-opt.lazyredraw = true -- Faster scrolling
-opt.synmaxcol = 240 -- Max column for syntax highlight
-opt.updatetime = 700 -- ms to wait for trigger an event
-
------------------------------------------------------------
--- Plugins
------------------------------------------------------------
-
--- Remove perl
-g.loaded_perl_provider = 0
-
--- Hexokinaise
-g.Hexokinase_highlighters = {'virtual'}
-g.Hexokinase_optInPatterns = {
- 'full_hex',
- 'rgb',
- 'rgba',
- 'hsl',
- 'hsla',
- 'colour_names'
-}
-
--- Lastplace
-g.lastplace_ignore = 'gitcommit,gitrebase,svn,hgcommit'
-
------------------------------------------------------------
--- Startup
------------------------------------------------------------
-
--- Disable builtins plugins
-local disabled_built_ins = {
- "netrw",
- "netrwPlugin",
- "netrwSettings",
- "netrwFileHandlers",
- "gzip",
- "zip",
- "zipPlugin",
- "tar",
- "tarPlugin",
- "getscript",
- "getscriptPlugin",
- "vimball",
- "vimballPlugin",
- "2html_plugin",
- "logipat",
- "rrhelper",
- "spellfile_plugin",
- "matchit"
-}
-
-for _, plugin in pairs(disabled_built_ins) do
- g["loaded_" .. plugin] = 1
-end
-
------------------------------------------------------------
--- Plugins
------------------------------------------------------------
-
--- lualine
-require('lualine').setup{}
-
--- nvim-cmp
-local cmp = require('cmp')
-
-cmp.setup({
- snippet = {
- expand = function(args)
- vim.fn["vsnip#anonymous"](args.body)
- end,
- },
- mapping = {
- [''] = cmp.mapping.confirm({ select = true }),
- },
- sources = {
--- { name = 'neorg' },
- }
-})
-
--- lspconfig
-require('lspconfig').terraformls.setup{}
-
-api.nvim_create_autocmd('BufWritePre', {
- pattern = '*.tf',
- command = 'lua vim.lsp.buf.formatting_sync()'
-})
-
---[[
--- neorg
-require('neorg').setup {
- -- Tell Neorg what modules to load
- load = {
- ['core.defaults'] = {}, -- Load all the default modules
- ['core.norg.concealer'] = {}, -- Allows for use of icons
- ['core.norg.dirman'] = { -- Manage your directories with Neorg
- config = {
- engine = 'nvim-cmp',
- workspaces = {
- home = '~/neorg'
- }
- }
- }
- },
-}]]--
-
--- telescope
-local telescope = require('telescope.builtin')
-
-vim.keymap.set("n", "ff", function()
- telescope.find_files()
-end, { silent = true })
-
-vim.keymap.set("n", "fg", function()
- telescope.live_grep()
-end, { silent = true })
-
-vim.keymap.set("n", "fb", function()
- telescope.buffers()
-end, { silent = true })
-
-vim.keymap.set("n", "fh", function()
- telescope.help_tags()
-end, { silent = true })
-
--- treesitter
-require('nvim-treesitter.configs').setup {
- -- A list of parser names, or "all"
- ensure_installed = {
- },
-
- sync_install = false,
- auto_install = false,
- ignore_install = {},
-
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = false,
- },
- indent = {
- enable = true,
- },
- rainbow = {
- enable = true,
- extended_mode = true
- },
-}
-
--- twilight
-require("twilight").setup {
- dimming = {
- alpha = 0.5,
- },
- context = 10,
- expand = {
- "function",
- "method",
- "table",
- "if_statement",
- },
-}
-
--- bufferline
-require('bufferline').setup {
- options = {
- mode = "buffers", -- set to "tabs" to only show tabpages instead
- numbers = "ordinal",
- close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
- right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
- left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
- middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
- indicator = {
- icon = '▎',
- style = 'icon',
- },
- buffer_close_icon = '',
- modified_icon = '●',
- close_icon = '',
- left_trunc_marker = '',
- right_trunc_marker = '',
- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
- -- remove extension from markdown files for example
- if buf.name:match('%.md') then
- return vim.fn.fnamemodify(buf.name, ':t:r')
- end
- end,
- max_name_length = 18,
- max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
- tab_size = 18,
- diagnostics = "nvim_lsp",
- diagnostics_update_in_insert = false,
- color_icons = true,
- show_buffer_icons = true, -- disable filetype icons for buffers
- show_buffer_close_icons = true,
- show_close_icon = false,
- show_tab_indicators = true,
- persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
- separator_style = "slant",
- always_show_bufferline = true,
- }
-}
-
-local barColor = base16.base00;
-
-local highlightItems = {
- BufferLineFill = "bg",
- BufferLineBackground = "bg",
- BufferLineSeparator = "fg",
- BufferLineSeparatorSelected = "fg",
- BufferLineSeparatorVisible = "fg",
-}
-
-local commandString = ""
-
-for item, ground in pairs(highlightItems) do
- commandString = "highlight " .. item .. " cterm" .. ground .. "=" .. barColor .. " | " .. commandString
-end
-
-api.nvim_create_autocmd("ColorScheme", {
- command = commandString;
-})
-
--- hop
-local hop = require('hop')
-local directions = require("hop.hint").HintDirection
-hop.setup()
-
-vim.keymap.set("", "t", function()
- hop.hint_words()
-end, {})
-
-vim.keymap.set("", "T", function()
- hop.hint_lines_skip_whitespace()
-end, {remap=true})
-
-vim.keymap.set("", "f", function()
- hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
-end, {remap=true})
-
-vim.keymap.set("", "F", function()
- hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
-end, {remap=true})
diff --git a/home/wezterm.nix b/home/wezterm.nix
index 41f34e32..0f3320c3 100644
--- a/home/wezterm.nix
+++ b/home/wezterm.nix
@@ -1,10 +1,12 @@
_: {
- programs.wezterm.enable = true;
- xdg.configFile."wezterm/wezterm.lua".text = ''
- local = wezterm = require 'wezterm'
- return {
- check_for_updates = false,
- enable_tab_bar = true
- }
- '';
+ programs.wezterm = {
+ enable = true;
+ extraConfig = ''
+ local = wezterm = require 'wezterm'
+ return {
+ check_for_updates = false,
+ enable_tab_bar = true
+ }
+ '';
+ };
}
diff --git a/nixos/base.nix b/nixos/base.nix
new file mode 100644
index 00000000..6ac884e4
--- /dev/null
+++ b/nixos/base.nix
@@ -0,0 +1,6 @@
+_: {
+ boot.loader = {
+ grub.configurationLimit = 8;
+ systemd-boot.configurationLimit = 8;
+ };
+}
diff --git a/nixos/gnome.nix b/nixos/gnome.nix
index 6b3004b1..1ad8ebad 100644
--- a/nixos/gnome.nix
+++ b/nixos/gnome.nix
@@ -1,7 +1,4 @@
-{
- pkgs,
- ...
-}: {
+{pkgs, ...}: {
services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
diff --git a/nixos/laptop.nix b/nixos/laptop.nix
index 11b2926f..86b56922 100644
--- a/nixos/laptop.nix
+++ b/nixos/laptop.nix
@@ -1,7 +1,4 @@
-{
- lib,
- ...
-}: let
+{lib, ...}: let
inherit (lib.modules) mkDefault;
in {
powerManagement.cpuFreqGovernor = mkDefault "powersave";
diff --git a/nixos/nix.nix b/nixos/nix.nix
new file mode 100644
index 00000000..b6ba949f
--- /dev/null
+++ b/nixos/nix.nix
@@ -0,0 +1,9 @@
+{lib, ...}: let
+ inherit (lib.modules) mkDefault;
+in {
+ nix.gc = {
+ automatic = mkDefault true;
+ dates = mkDefault "weekly";
+ options = mkDefault "--delete-older-than 7d";
+ };
+}
diff --git a/nixos/server.nix b/nixos/server.nix
index 188a8126..d631a7fe 100644
--- a/nixos/server.nix
+++ b/nixos/server.nix
@@ -1,7 +1,4 @@
-{
- lib,
- ...
-}: let
+{lib, ...}: let
inherit (lib.attrsets) mapAttrsToList;
in {
systemd.tmpfiles.rules = mapAttrsToList (username: _: "f /var/lib/systemd/linger/${username}") config.users.users;
diff --git a/outputs.nix b/outputs.nix
index aeed0d17..14f69811 100644
--- a/outputs.nix
+++ b/outputs.nix
@@ -1,194 +1,7 @@
-{
- utils,
- nixpkgs,
- darwin,
- home-manager,
- ragenix,
- scalpel,
- nix-index-database,
- arcexprs,
- ...
-} @ inputs: let
- tree =
- (inputs.tree.tree {
- inherit inputs;
- folder = ./.;
- config = {
- "/" = {
- excludes = [
- "flake"
- "default"
- ];
- };
- "darwin/modules" = {
- functor = {
- enable = true;
- external = [
- home-manager.darwinModules.home-manager
- ragenix.nixosModules.age
- ];
- };
- };
- "system/modules" = {
- functor = {
- enable = true;
- };
- };
- "nixos/modules" = {
- functor = {
- enable = true;
- external =
- [
- nix-index-database.nixosModules.nix-index
- home-manager.nixosModules.home-manager
- ragenix.nixosModules.age
- ]
- ++ (with (import (arcexprs + "/modules")).nixos; [
- base16
- base16-shared
- ]);
- };
- };
- "home/modules" = {
- functor = {
- enable = true;
- external =
- [
- nix-index-database.hmModules.nix-index
- ]
- ++ (with (import (arcexprs + "/modules")).home-manager; [
- base16
- base16-shared
- ]);
- };
- };
- };
- })
- .impure;
+inputs: let
inherit (inputs.nixpkgs) lib;
- inherit (lib.lists) fold;
- inherit (lib.attrsets) mapAttrs mapAttrsToList recursiveUpdate;
- inherit (lib.strings) toLower;
- inherit (lib.options) mkOption;
- inherit (lib.types) str listOf attrs unspecified;
- inherit (lib.modules) evalModules;
- recursiveMergeAttrs = fold recursiveUpdate {};
- defaultSpecialArgs = {
- inherit inputs tree;
- };
- hostModule = {
- config,
- machine,
- ...
- }: {
- options = {
- arch = mkOption {
- description = "Processor architecture of the host";
- type = str;
- default = "x86_64";
- };
- type = mkOption {
- description = "Operating system type of the host";
- type = str;
- default = "NixOS";
- };
- folder = mkOption {
- type = str;
- internal = true;
- };
- system = mkOption {
- type = str;
- internal = true;
- };
- modules = mkOption {
- type = listOf unspecified;
- };
- specialArgs = mkOption {
- type = attrs;
- internal = true;
- };
- builder = mkOption {
- type = unspecified;
- internal = true;
- };
- };
- config = {
- system = let
- kernel =
- {
- nixos = "linux";
- macos = "darwin";
- darwin = "darwin";
- linux = "linux";
- }
- .${toLower config.type};
- in "${config.arch}-${kernel}";
- folder =
- {
- nixos = "nixos";
- macos = "darwin";
- darwin = "darwin";
- linux = "linux";
- }
- .${toLower config.type};
- modules = with tree; [
- tree.${config.folder}.modules
- home.system
- ];
- builder =
- {
- nixos = nixpkgs.lib.nixosSystem;
- darwin = darwin.lib.darwinSystem;
- macos = darwin.lib.darwinSystem;
- }
- .${toLower config.type};
- specialArgs = {inherit machine;} // defaultSpecialArgs;
- };
- };
- hostConfigs = mapAttrs (name: path:
- evalModules {
- modules = [
- hostModule
- path
- ];
- specialArgs =
- {
- machine = name;
- }
- // defaultSpecialArgs;
- })
- tree.systems;
- processHost = name: cfg: let
- host = cfg.config;
- in {
- "${host.folder}Configurations".${name} = let
- hostConfig = host.builder {
- inherit (host) system modules specialArgs;
- };
- in
- if host.folder == "nixos"
- then
- hostConfig.extendModules {
- modules = [scalpel.nixosModule];
- specialArgs = {
- prev = hostConfig;
- };
- }
- else hostConfig;
- };
+ tree = import ./tree.nix {inherit inputs;};
+ systems = import ./systems {inherit inputs tree lib;};
+ shells = import ./shells {inherit inputs tree lib;};
in
- recursiveMergeAttrs (mapAttrsToList processHost hostConfigs)
- // {
- inherit inputs tree hostConfigs;
- }
- // (utils.lib.eachDefaultSystem (system: {
- devShells = let
- shells = mapAttrs (_: path:
- import path rec {
- inherit tree inputs system;
- pkgs = nixpkgs.legacyPackages.${system};
- inherit (nixpkgs) lib;
- })
- tree.shells;
- in shells // { default = shells.repo; };
- }))
+ {inherit inputs tree lib;} // systems // shells
diff --git a/shells/default.nix b/shells/default.nix
new file mode 100644
index 00000000..86185307
--- /dev/null
+++ b/shells/default.nix
@@ -0,0 +1,20 @@
+{
+ lib,
+ tree,
+ inputs,
+ ...
+}: let
+ inherit (lib.attrsets) mapAttrs;
+in
+ inputs.utils.lib.eachDefaultSystem (system: {
+ devShells = let
+ shells = mapAttrs (_: path:
+ import path rec {
+ inherit tree inputs system;
+ pkgs = inputs.nixpkgs.legacyPackages.${system};
+ inherit (inputs.nixpkgs) lib;
+ })
+ tree.shells;
+ in
+ shells // {default = shells.repo;};
+ })
diff --git a/shells/repo.nix b/shells/repo.nix
index 67173fb5..a2bc3c9c 100644
--- a/shells/repo.nix
+++ b/shells/repo.nix
@@ -1,15 +1,22 @@
-{pkgs, inputs, system, ...}: with pkgs; let
- repo = import ../outputs.nix (inputs // { inherit inputs system; });
+{
+ pkgs,
+ inputs,
+ system,
+ ...
+}:
+with pkgs; let
+ repo = import ../outputs.nix (inputs // {inherit inputs system;});
inherit (lib.attrsets) mapAttrsToList;
in
mkShell {
- nativeBuildInputs = [
- deadnix # dead-code scanner
- alejandra # code formatter
- statix # anti-pattern finder
- ] ++ mapAttrsToList (name: _:
- (pkgs.writeShellScriptBin "${name}-rebuild" ''
- darwin-rebuild switch --flake ${toString ../.}#${name}
+ nativeBuildInputs =
+ [
+ deadnix # dead-code scanner
+ alejandra # code formatter
+ statix # anti-pattern finder
+ ]
+ ++ mapAttrsToList (name: _: (pkgs.writeShellScriptBin "${name}-rebuild" ''
+ darwin-rebuild switch --flake $REPO_ROOT#${name}
''))
- repo.darwinConfigurations;
+ repo.darwinConfigurations;
}
diff --git a/shells/work.nix b/shells/work.nix
new file mode 100644
index 00000000..769d5eb6
--- /dev/null
+++ b/shells/work.nix
@@ -0,0 +1,10 @@
+{pkgs, ...}:
+with pkgs;
+ mkShell {
+ nativeBuildInputs = [
+ jq
+ k9s
+ terraform
+ awscli
+ ];
+ }
diff --git a/system/home.nix b/system/home.nix
new file mode 100644
index 00000000..82f6dfca
--- /dev/null
+++ b/system/home.nix
@@ -0,0 +1,29 @@
+{
+ config,
+ tree,
+ machine,
+ systemType,
+ lib,
+ ...
+}: let
+ inherit (lib.lists) optional;
+in {
+ home-manager = {
+ useGlobalPkgs = true;
+ useUserPackages = true;
+ sharedModules = with tree;
+ [
+ home.modules
+ home.state
+ ]
+ ++ optional (tree.${systemType} ? home) tree.${systemType}.home;
+
+ users.kat.imports = with tree; [
+ home.base
+ ];
+ extraSpecialArgs = {
+ inherit tree machine;
+ parent = config;
+ };
+ };
+}
diff --git a/system/nix.nix b/system/nix.nix
new file mode 100644
index 00000000..61a05a94
--- /dev/null
+++ b/system/nix.nix
@@ -0,0 +1,23 @@
+{
+ config,
+ lib,
+ inputs,
+ ...
+}: let
+ inherit (lib.attrsets) mapAttrs mapAttrsToList;
+ inherit (lib.lists) optional;
+ inherit (lib.strings) versionAtLeast;
+in {
+ nix = {
+ nixPath = mapAttrsToList (name: flake: "${name}=${flake}") inputs;
+ registry = mapAttrs (_: flake: {inherit flake;}) inputs;
+
+ settings = {
+ experimental-features = optional (versionAtLeast config.nix.package.version "2.4") "nix-command flakes";
+ substituters = ["https://arc.cachix.org" "https://kittywitch.cachix.org" "https://nix-community.cachix.org"];
+ trusted-public-keys = ["arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" "kittywitch.cachix.org-1:KIzX/G5cuPw5WgrXad6UnrRZ8UDr7jhXzRTK/lmqyK0=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="];
+ auto-optimise-store = true;
+ trusted-users = ["root" "@wheel"];
+ };
+ };
+}
diff --git a/system/overlay.nix b/system/overlay.nix
new file mode 100644
index 00000000..501a8555
--- /dev/null
+++ b/system/overlay.nix
@@ -0,0 +1,7 @@
+{inputs, ...}: {
+ nixpkgs = {
+ overlays = map (path: import "${path}/overlay.nix") [
+ inputs.arcexprs
+ ];
+ };
+}
diff --git a/systems/default.nix b/systems/default.nix
new file mode 100644
index 00000000..4bb9d83e
--- /dev/null
+++ b/systems/default.nix
@@ -0,0 +1,124 @@
+{
+ inputs,
+ tree,
+ lib,
+ ...
+}: let
+ # The purpose of this file is to set up the host module which allows assigning of the system, e.g. aarch64-linux and the builder used with less pain.
+ inherit (lib.lists) fold;
+ inherit (lib.attrsets) mapAttrs mapAttrsToList recursiveUpdate;
+ inherit (lib.strings) toLower;
+ inherit (lib.options) mkOption;
+ inherit (lib.types) str listOf attrs unspecified;
+ inherit (lib.modules) evalModules;
+ recursiveMergeAttrs = fold recursiveUpdate {};
+ defaultSpecialArgs = {
+ inherit inputs tree;
+ };
+ hostModule = {
+ config,
+ machine,
+ ...
+ }: {
+ options = {
+ arch = mkOption {
+ description = "Processor architecture of the host";
+ type = str;
+ default = "x86_64";
+ };
+ type = mkOption {
+ description = "Operating system type of the host";
+ type = str;
+ default = "NixOS";
+ };
+ folder = mkOption {
+ type = str;
+ internal = true;
+ };
+ system = mkOption {
+ type = str;
+ internal = true;
+ };
+ modules = mkOption {
+ type = listOf unspecified;
+ };
+ specialArgs = mkOption {
+ type = attrs;
+ internal = true;
+ };
+ builder = mkOption {
+ type = unspecified;
+ internal = true;
+ };
+ };
+ config = {
+ system = let
+ kernel =
+ {
+ nixos = "linux";
+ macos = "darwin";
+ darwin = "darwin";
+ linux = "linux";
+ }
+ .${toLower config.type};
+ in "${config.arch}-${kernel}";
+ folder =
+ {
+ nixos = "nixos";
+ macos = "darwin";
+ darwin = "darwin";
+ linux = "linux";
+ }
+ .${toLower config.type};
+ modules = with tree; [
+ tree.${config.folder}.modules
+ system
+ ];
+ builder =
+ {
+ nixos = inputs.nixpkgs.lib.nixosSystem;
+ darwin = inputs.darwin.lib.darwinSystem;
+ macos = inputs.darwin.lib.darwinSystem;
+ }
+ .${toLower config.type};
+ specialArgs =
+ {
+ inherit machine;
+ systemType = config.folder;
+ }
+ // defaultSpecialArgs;
+ };
+ };
+ hostConfigs = mapAttrs (name: path:
+ evalModules {
+ modules = [
+ hostModule
+ path
+ ];
+ specialArgs =
+ defaultSpecialArgs
+ // {
+ machine = name;
+ };
+ })
+ tree.systems;
+ processHost = name: cfg: let
+ host = cfg.config;
+ in {
+ "${host.folder}Configurations".${name} = let
+ hostConfig = host.builder {
+ inherit (host) system modules specialArgs;
+ };
+ in
+ if host.folder == "nixos"
+ then
+ hostConfig.extendModules {
+ modules = [inputs.scalpel.nixosModule];
+ specialArgs = {
+ prev = hostConfig;
+ };
+ }
+ else hostConfig;
+ };
+in
+ recursiveMergeAttrs (mapAttrsToList processHost hostConfigs)
diff --git a/systems/koishi.nix b/systems/koishi.nix
index aec49cc4..d67664b9 100644
--- a/systems/koishi.nix
+++ b/systems/koishi.nix
@@ -1,8 +1,5 @@
_: let
- hostConfig = {
- tree,
- ...
- }: {
+ hostConfig = {tree, ...}: {
imports = with tree; [
nixos.gnome
];
diff --git a/systems/sumireko.nix b/systems/sumireko.nix
index fb890f17..b5c1568a 100644
--- a/systems/sumireko.nix
+++ b/systems/sumireko.nix
@@ -1,5 +1,92 @@
_: let
- hostConfig = _: {
+ hostConfig = {tree, ...}: {
+ imports = with tree; [
+ darwin.base
+ darwin.kat
+ ];
+
+ security.pam.enableSudoTouchIdAuth = true;
+
+ home-manager.users.root.programs.ssh = {
+ enable = true;
+ matchBlocks = {
+ "daiyousei-build" = {
+ hostname = "daiyousei.kittywit.ch";
+ port = 62954;
+ user = "root";
+ };
+ "renko-build" = {
+ hostname = "192.168.64.3";
+ port = 62954;
+ user = "root";
+ };
+ };
+ };
+
+ nix = {
+ envVars = {
+ "SSH_AUTH_SOCK" = "/Users/kat/.gnupg/S.gpg-agent.ssh";
+ };
+ buildMachines = [
+ {
+ hostName = "renko-build";
+ sshUser = "root";
+ system = "x86_64-linux";
+ maxJobs = 100;
+ speedFactor = 1;
+ supportedFeatures = ["benchmark" "big-parallel" "kvm"];
+ mandatoryFeatures = [];
+ }
+ {
+ hostName = "daiyousei-build";
+ sshUser = "root";
+ system = "aarch64-linux";
+ maxJobs = 100;
+ speedFactor = 1;
+ supportedFeatures = ["benchmark" "big-parallel" "kvm"];
+ mandatoryFeatures = [];
+ }
+ ];
+ distributedBuilds = true;
+ };
+
+ homebrew = {
+ brewPrefix = "/opt/homebrew/bin";
+ brews = [
+ "gnupg"
+ "pinentry-mac"
+ ];
+ casks = [
+ "utm"
+ "discord"
+ "mullvadvpn"
+ "bitwarden"
+ "deluge"
+ "telegram-desktop"
+ "spotify"
+ "element"
+ "signal"
+ "brave-browser"
+ "disk-inventory-x"
+ "dozer"
+ "firefox"
+ "devtoys"
+ "cyberduck"
+ "docker"
+ "pycharm-ce"
+ "slack"
+ "boop"
+ "obsidian"
+ "contexts"
+ ];
+ masApps = {
+ Tailscale = 1475387142;
+ Dato = 1470584107;
+ Lungo = 1263070803;
+ "Battery Indicator" = 1206020918;
+ };
+ };
+
system.stateVersion = 4;
};
in {
diff --git a/tree.nix b/tree.nix
new file mode 100644
index 00000000..4352515b
--- /dev/null
+++ b/tree.nix
@@ -0,0 +1,74 @@
+{inputs, ...}:
+(inputs.tree.tree {
+ inherit inputs;
+ folder = ./.;
+ config = {
+ # Exclude things that would overlap with namespace things, potentially
+ "/" = {
+ excludes = [
+ "flake"
+ "default"
+ "tree"
+ "inputs"
+ "outputs"
+ ];
+ };
+ # Ignore the default.nix we actually use
+ shells = {
+ excludes = [
+ "default"
+ ];
+ };
+ systems = {
+ excludes = [
+ "default"
+ ];
+ };
+ # Required for all-system common imports
+ system.functor.enable = true;
+ # Re-map home directory profiles
+ home.evaluateDefault = true;
+ # Allow profile importing
+ "nixos/*".functor.enable = true;
+ "darwin/*".functor.enable = true;
+ "home/*".functor.enable = true;
+ # Various modules
+ "nixos/modules" = {
+ functor = {
+ enable = true;
+ external = with inputs;
+ [
+ nix-index-database.nixosModules.nix-index
+ home-manager.nixosModules.home-manager
+ ragenix.nixosModules.age
+ ]
+ ++ (with (import (inputs.arcexprs + "/modules")).nixos; [
+ base16
+ base16-shared
+ ]);
+ };
+ };
+ "darwin/modules" = {
+ functor = {
+ enable = true;
+ external = with inputs; [
+ home-manager.darwinModules.home-manager
+ ragenix.nixosModules.age
+ ];
+ };
+ };
+ "home/modules" = {
+ functor = {
+ enable = true;
+ external = with inputs;
+ [
+ nix-index-database.hmModules.nix-index
+ ]
+ ++ (with (import (inputs.arcexprs + "/modules")).home-manager; [
+ base16
+ ]);
+ };
+ };
+ };
+})
+.impure