Compare commits

...

2 Commits

14 changed files with 1462 additions and 167 deletions

1386
flake.lock

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,33 @@
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";
rust-overlay = "github:oxalica/rust-overlay.git";
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";
};
};
outputs = {std, ...} @ inputs:
outputs = {self, std, ...} @ inputs:
std.growOn
{
# boilerplate
@ -23,22 +44,27 @@
# modules = ./nix/modules;
cellBlocks = let
inherit (std.blockTypes) devshells functions;
inherit (std.blockTypes) devshells functions anything installables;
in [
(devshells "devshells")
(devshells "userShells")
(functions "home-profiles")
(functions "home-modules")
(anything "home-configs")
(installables "packages")
(anything "lib")
];
}
{
devShells = std.harvest [["dotfiles" "devshells"]];
devShells = std.harvest self [["dotfiles" "devshells"]];
# nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ];
# homeConfigurations = std.pick [ [ "dotfiles" "home" ] ];
homeModules = std.pick [["repo" "home-modules"]];
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"]];
# TODO: Debug only
homeProfiles = std.pick [["repo" "home-profiles"]];
packages = std.harvest [["repo" "home-configs"]];
homeProfiles = std.pick self [["repo" "home-profiles"]];
};
}

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',
'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels",
'nil_ls', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels",
"jsonls", "denols", "gopls", "nickel_ls", 'pylsp',
}
require("mason").setup({

View File

@ -67,9 +67,6 @@ 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

@ -0,0 +1,24 @@
{
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

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

View File

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

View File

@ -0,0 +1,46 @@
# 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,13 +133,12 @@ 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 (font.family != null) font.family;
font.size = lib.mkIf (font.size != null) font.size;
font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family;
font.size = lib.mkIf (cfg.font.size != null) cfg.font.size;
};
};
};

View File

@ -15,10 +15,6 @@ in {
pkgs,
...
}: {
imports = [
import
inputs.cells."${namespace}"
];
fonts.fontconfig.enable = true;
home.packages = [
(pkgs.nerdfonts.override {fonts = ["Hack"];})
@ -74,12 +70,11 @@ in {
cfg = config."${namespace}".alacritty;
in {
imports = [
import
"${inputs.cells.repo.home-modules.alacritty}"
inputs.cells.repo.home-modules.alacritty
];
configs."${namespace}".alacritty = {
config."${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";
};
@ -141,4 +136,53 @@ 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,14 +18,7 @@
# see: :/--suffix.*PATH
# there should be mentions of additional packages
my_neovim = pkgs.neovim-unwrapped;
rust_pkgs =
pkgs.rust-bin.selectLatestNightlyWith
(
toolchain:
toolchain.default.override {
extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"];
}
);
inherit (inputs.nixpkgs) system;
nvim_pkgs =
[
# pkgs.gccStdenv
@ -35,8 +28,8 @@
pkgs.zk # Zettelkasten (limited support)
pkgs.fd # Required by a Telescope plugin (?)
pkgs.stdenv.cc.cc.lib
pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo
pkgs.rust4cargo
pkgs.nil # oxalica's better nix language server
inputs.nix-boost.packages."${system}".rust4cargo
pkgs.nickel
pkgs.nls
@ -90,7 +83,7 @@ in {
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
plugins = let
inherit
(pkgs.vimPlugins)
(inputs.nixpkgs-latest.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 "${innputs.self}/native_configs/tmux/tmux.conf";
extraConfig = builtins.readFile "${inputs.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,7 +1,6 @@
{ inputs, cell }:
let
namespace = "repo";
namespace = "repo"; # ignore: unused
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath
@ -10,30 +9,8 @@ let
# note that $out is passed onto the bash/sh script for execution
''
echo "$yamlContent" | yq >$out
'')
{ });
'');
in
{
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;
fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
}

View File

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