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)";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-latest.url = "github:nixos/nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
std.url = "github:divnix/std";
home-manager = {
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";
};
rust-overlay = "github:oxalica/rust-overlay.git";
};
outputs = {self, std, ...} @ inputs:
outputs = {std, ...} @ inputs:
std.growOn
{
# boilerplate
@ -44,27 +23,22 @@
# modules = ./nix/modules;
cellBlocks = let
inherit (std.blockTypes) devshells functions anything installables;
inherit (std.blockTypes) devshells functions;
in [
(devshells "devshells")
(devshells "userShells")
(functions "home-profiles")
(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" ] ];
# homeConfigurations = std.pick [ [ "dotfiles" "home" ] ];
homeModules = std.pick self [["repo" "home-modules"]];
packages = std.harvest self [["repo" "packages"]];
legacyPackages = std.harvest self [["repo" "home-configs"]];
lib = std.pick self [["repo" "lib"]];
homeModules = std.pick [["repo" "home-modules"]];
# 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
local servers = {
'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',
}
require("mason").setup({

View File

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

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

View File

@ -15,6 +15,10 @@ in {
pkgs,
...
}: {
imports = [
import
inputs.cells."${namespace}"
];
fonts.fontconfig.enable = true;
home.packages = [
(pkgs.nerdfonts.override {fonts = ["Hack"];})
@ -70,11 +74,12 @@ in {
cfg = config."${namespace}".alacritty;
in {
imports = [
inputs.cells.repo.home-modules.alacritty
import
"${inputs.cells.repo.home-modules.alacritty}"
];
config."${namespace}".alacritty = {
configs."${namespace}".alacritty = {
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.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
# there should be mentions of additional packages
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 =
[
# pkgs.gccStdenv
@ -28,8 +35,8 @@
pkgs.zk # Zettelkasten (limited support)
pkgs.fd # Required by a Telescope plugin (?)
pkgs.stdenv.cc.cc.lib
pkgs.nil # oxalica's better nix language server
inputs.nix-boost.packages."${system}".rust4cargo
pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo
pkgs.rust4cargo
pkgs.nickel
pkgs.nls
@ -83,7 +90,7 @@ in {
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
plugins = let
inherit
(inputs.nixpkgs-latest.vimPlugins)
(pkgs.vimPlugins)
plenary-nvim
nvim-treesitter
nvim-treesitter-textobjects

View File

@ -52,7 +52,7 @@ in {
programs.tmux = {
enable = true;
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 ''
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 }:
let
namespace = "repo"; # ignore: unused
namespace = "repo";
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath
@ -9,8 +10,30 @@ let
# note that $out is passed onto the bash/sh script for execution
''
echo "$yamlContent" | yq >$out
'');
'')
{ });
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;
}