Compare commits

..

No commits in common. "3f1f1c8f6f289e9fcae49909004fbe13e1e01890" and "d5d4415d5cacd87fd52f6dfbedd8c7b0a8444f0e" have entirely different histories.

14 changed files with 153 additions and 1448 deletions

1358
flake.lock

File diff suppressed because it is too large Load Diff

View File

@ -7,33 +7,12 @@
description = "My personal configuration in Nix (and some native configurations)"; description = "My personal configuration in Nix (and some native configurations)";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-latest.url = "github:nixos/nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.url = "github:serokell/deploy-rs";
std.url = "github:divnix/std"; std.url = "github:divnix/std";
home-manager = { rust-overlay = "github:oxalica/rust-overlay.git";
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay = {
# need to pin this until darwin build is successful again.
url = "github:nix-community/neovim-nightly-overlay?rev=88a6c749a7d126c49f3374f9f28ca452ea9419b8";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-boost = {
url = "git+https://git.pegasust.com/pegasust/nix-boost?ref=bleed";
};
kpcli-py = {
url = "github:rebkwok/kpcli";
flake = false;
};
nix-index-database = {
url = "github:mic92/nix-index-database";
# Should show the latest nixpkgs whenever possible
inputs.nixpkgs.follows = "nixpkgs-latest";
};
}; };
outputs = {self, std, ...} @ inputs: outputs = {std, ...} @ inputs:
std.growOn std.growOn
{ {
# boilerplate # boilerplate
@ -44,27 +23,22 @@
# modules = ./nix/modules; # modules = ./nix/modules;
cellBlocks = let cellBlocks = let
inherit (std.blockTypes) devshells functions anything installables; inherit (std.blockTypes) devshells functions;
in [ in [
(devshells "devshells") (devshells "devshells")
(devshells "userShells") (devshells "userShells")
(functions "home-profiles") (functions "home-profiles")
(functions "home-modules") (functions "home-modules")
(anything "home-configs")
(installables "packages")
(anything "lib")
]; ];
} }
{ {
devShells = std.harvest self [["dotfiles" "devshells"]]; devShells = std.harvest [["dotfiles" "devshells"]];
# nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; # nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ];
# homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; # homeConfigurations = std.pick [ [ "dotfiles" "home" ] ];
homeModules = std.pick self [["repo" "home-modules"]]; homeModules = std.pick [["repo" "home-modules"]];
packages = std.harvest self [["repo" "packages"]];
legacyPackages = std.harvest self [["repo" "home-configs"]];
lib = std.pick self [["repo" "lib"]];
# TODO: Debug only # TODO: Debug only
homeProfiles = std.pick self [["repo" "home-profiles"]]; homeProfiles = std.pick [["repo" "home-profiles"]];
packages = std.harvest [["repo" "home-configs"]];
}; };
} }

View File

@ -900,7 +900,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- default language servers -- default language servers
local servers = { local servers = {
'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals', 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals',
'nil_ls', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels",
"jsonls", "denols", "gopls", "nickel_ls", 'pylsp', "jsonls", "denols", "gopls", "nickel_ls", 'pylsp',
} }
require("mason").setup({ require("mason").setup({

View File

@ -67,6 +67,9 @@ in {
programs.jq = { programs.jq = {
enable = true; enable = true;
}; };
# not exist in home-manager
# have to do it at system level
# services.ntp.enable = true; # automatic time
programs.nix-index = { programs.nix-index = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = true;

View File

@ -1,24 +0,0 @@
{
inputs,
cell,
}: let
inherit (inputs.nixpkgs) system;
inherit (inputs.nix-boost.pkgs."${system}".mypkgs) poetry2nix;
inherit (poetry2nix) mkPoetryApplication defaultPoetryOverrides;
in {
kpcli-py = mkPoetryApplication {
projectDir = inputs.kpcli-py;
overrides = defaultPoetryOverrides.extend (self: super: {
# TODO: add this to upstream poetry2nix
tableformatter = super.tableformatter.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [self.setuptools self.cython_3];
src = old.src;
});
kpcli = super.kpcli.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [self.setuptools];
});
});
};
}

View File

@ -0,0 +1,5 @@
{
inputs,
cell,
}: let
in {}

View File

@ -0,0 +1,4 @@
{
inputs,
cell,
}: {}

View File

@ -1,46 +0,0 @@
# TODO: this should use winnow with a fair matching of supported systems
{
inputs,
cell,
}: let
inherit (cell) home-profiles home-modules;
inherit (inputs) home-manager;
pkgs = inputs.nixpkgs;
# hm is derivation that is compatible with homeConfigurations
home-config = {supported_systems, hm, tested_systems ? []}:
hm // {
_supported_systems = supported_systems;
_tested_systems = tested_systems;
};
base-modules = [
home-profiles.alacritty
home-profiles.git
home-profiles.ssh
home-profiles.shells
({config.programs.home-manager.enable = true;})
home-profiles.nix-index
];
in {
homeConfigurations.htran = home-config {
supported_systems = ["aarch64-darwin" "x86_64-darwin"];
tested_systems = ["aarch64-darwin"];
hm = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base-modules ++ [
home-profiles.nerd_font_module
home-profiles.git-htran
home-profiles.dev-packages
home-profiles.zk
home-modules.darwin-spotlight
({
home.username = "htran";
home.homeDirectory = "/Users/htran";
home.stateVersion = "23.11";
})
];
};
};
}

View File

@ -91,7 +91,7 @@ in
}; };
}; };
alacritty = { config, lib, ... }: alacritty = { config, lib }:
let let
inherit (inputs.cells.repo.lib) fromYAML; inherit (inputs.cells.repo.lib) fromYAML;
cfg = config."${namespace}".alacritty; cfg = config."${namespace}".alacritty;
@ -133,12 +133,13 @@ in
enable = cfg.enable; enable = cfg.enable;
settings = settings =
let let
;
actualConfig = actualConfig =
if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { }; if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { };
in in
lib.recursiveUpdate actualConfig { lib.recursiveUpdate actualConfig {
font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family; font.normal.family = lib.mkIf (font.family != null) font.family;
font.size = lib.mkIf (cfg.font.size != null) cfg.font.size; font.size = lib.mkIf (font.size != null) font.size;
}; };
}; };
}; };

View File

@ -15,6 +15,10 @@ in {
pkgs, pkgs,
... ...
}: { }: {
imports = [
import
inputs.cells."${namespace}"
];
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
home.packages = [ home.packages = [
(pkgs.nerdfonts.override {fonts = ["Hack"];}) (pkgs.nerdfonts.override {fonts = ["Hack"];})
@ -70,11 +74,12 @@ in {
cfg = config."${namespace}".alacritty; cfg = config."${namespace}".alacritty;
in { in {
imports = [ imports = [
inputs.cells.repo.home-modules.alacritty import
"${inputs.cells.repo.home-modules.alacritty}"
]; ];
config."${namespace}".alacritty = { configs."${namespace}".alacritty = {
enable = true; enable = true;
config-path = "${inputs.self}//native_configs/alacritty/alacritty.yml"; config-path = "${inputs.self}//native-configs/alacritty/alacritty.yml";
font.size = 11.0; font.size = 11.0;
font.family = "Hack Nerd Font Mono"; font.family = "Hack Nerd Font Mono";
}; };
@ -136,53 +141,4 @@ in {
}; };
}; };
}; };
git-htran = {
imports = [inputs.cells.repo.home-profiles.git];
config."${namespace}".git = {
name = "htran";
email = "htran@egihosting.com";
};
};
git-pegasust = {
imports = [inputs.cells.repo.home-profiles.git];
config.git."${namespace}".name = "pegasust";
config.git."${namespace}".email = "pegasucksgg@gmail.com";
};
dev-packages = let pkgs = inputs.nixpkgs; in {
programs.jq.enable = true;
home.packages = [
pkgs.htop
pkgs.ripgrep
pkgs.unzip
pkgs.zip
pkgs.yq-go
pkgs.mosh
pkgs.python310
];
};
# Local nixpkgs search and fallback if command not found to search from nixpkgs
nix-index = {
imports = [
inputs.nix-index-database.hmModules.nix-index
];
programs.nix-index = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
};
# digital garden stack
zk = {
xdg.configFile."zk/config.toml".source = "${inputs.self}/native_configs/zk/config.toml";
# NB: lib.mkMerge
home.packages = [
inputs.nixpkgs.zk
];
};
} }

View File

@ -18,7 +18,14 @@
# see: :/--suffix.*PATH # see: :/--suffix.*PATH
# there should be mentions of additional packages # there should be mentions of additional packages
my_neovim = pkgs.neovim-unwrapped; my_neovim = pkgs.neovim-unwrapped;
inherit (inputs.nixpkgs) system; rust_pkgs =
pkgs.rust-bin.selectLatestNightlyWith
(
toolchain:
toolchain.default.override {
extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"];
}
);
nvim_pkgs = nvim_pkgs =
[ [
# pkgs.gccStdenv # pkgs.gccStdenv
@ -28,8 +35,8 @@
pkgs.zk # Zettelkasten (limited support) pkgs.zk # Zettelkasten (limited support)
pkgs.fd # Required by a Telescope plugin (?) pkgs.fd # Required by a Telescope plugin (?)
pkgs.stdenv.cc.cc.lib pkgs.stdenv.cc.cc.lib
pkgs.nil # oxalica's better nix language server pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo
inputs.nix-boost.packages."${system}".rust4cargo pkgs.rust4cargo
pkgs.nickel pkgs.nickel
pkgs.nls pkgs.nls
@ -83,7 +90,7 @@ in {
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua"; extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
plugins = let plugins = let
inherit inherit
(inputs.nixpkgs-latest.vimPlugins) (pkgs.vimPlugins)
plenary-nvim plenary-nvim
nvim-treesitter nvim-treesitter
nvim-treesitter-textobjects nvim-treesitter-textobjects

View File

@ -52,7 +52,7 @@ in {
programs.tmux = { programs.tmux = {
enable = true; enable = true;
plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [cpu net-speed]; plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [cpu net-speed];
extraConfig = builtins.readFile "${inputs.self}/native_configs/tmux/tmux.conf"; extraConfig = builtins.readFile "${innputs.self}/native_configs/tmux/tmux.conf";
}; };
xdg.configFile."tmux/tmux.conf".text = lib.mkOrder 600 '' xdg.configFile."tmux/tmux.conf".text = lib.mkOrder 600 ''
set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '

View File

@ -1,6 +1,7 @@
{ inputs, cell }: { inputs, cell }:
let let
namespace = "repo"; # ignore: unused namespace = "repo";
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath outputPath
@ -9,8 +10,30 @@ let
# note that $out is passed onto the bash/sh script for execution # note that $out is passed onto the bash/sh script for execution
'' ''
echo "$yamlContent" | yq >$out echo "$yamlContent" | yq >$out
''); '')
{ });
in in
{ {
fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json")); fromYAML = yamlContent: bulitins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
# NOTE: Deprecate
# ctor
opt-some = a: [ a ];
opt-none = [ ];
opt-none_thunk = _: [ ];
# from-to null
opt-fromNullable = nullable: if nullable == null then [ ] else [ nullable ];
opt-toNullable = opt-fork (a:a) (_: null);
opt-map = builtins.map;
opt-filter = builtins.filter;
opt-fork = on_some: on_none: opt: if opt == [ ] then (on_none null) else (on_some (builtins.elemAt opt 0));
opt-unwrap = opt-fork (a:a) (_: throw "opt-unwrap: expected some, got none");
opt-unwrapOrElse = opt-fork (a:a);
opt-unwrapOr = fallback_val: opt-fork (a:a) (_: fallback_val);
opt-orElse = opt: fallback_opt: opt-fork (opt-some) (opt-none_thunk) (opt ++ fallback_opt);
opt-leftmostSome = opts: builtins.foldl' (opt-orElse) [ ] opts;
} }

View File

@ -1,6 +0,0 @@
{
inputs,
cell,
}: {
inherit (inputs.cells.dotfiles.packages) kpcli-py;
}