wip: more migrations, mostly adding nix-index, kpcli-py, and nix-boost integration

std
Hung 2023-06-17 23:31:47 -07:00
parent d5d4415d5c
commit 820736fc8c
12 changed files with 1502 additions and 153 deletions

1441
flake.lock

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,37 @@
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";
rust-overlay = "github:oxalica/rust-overlay.git"; poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
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 std.growOn
{ {
# boilerplate # boilerplate
@ -32,13 +57,13 @@
]; ];
} }
{ {
devShells = std.harvest [["dotfiles" "devshells"]]; devShells = std.harvest self [["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 [["repo" "home-modules"]]; homeModules = std.pick self [["repo" "home-modules"]];
# TODO: Debug only # TODO: Debug only
homeProfiles = std.pick [["repo" "home-profiles"]]; homeProfiles = std.pick self [["repo" "home-profiles"]];
packages = std.harvest [["repo" "home-configs"]]; packages = std.harvest self [["repo" "home-configs"] ["repo" "packages"]];
}; };
} }

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',
'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', "jsonls", "denols", "gopls", "nickel_ls", 'pylsp',
} }
require("mason").setup({ require("mason").setup({

View File

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

@ -0,0 +1,22 @@
{
inputs,
cell,
}: let
inherit (inputs.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,44 @@
# 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 {
htran = home-config {
supported_systems = ["aarch64-darwin" "x86_64-darwin"];
tested_systems = ["aarch64-darwin"];
hm = home-manager.lib.homeConfigurations {
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
];
# TODO: might need config prefix. remove this todo after QA
home.username = "htran";
home.homeDirectory = "/Users/htran";
home.stateVersion = "23.11";
};
};
}

View File

@ -141,4 +141,51 @@ in {
}; };
}; };
}; };
git-htran = {
imports = [inputs.cells.repo.home-profiles.git];
config.git."${namespace}".name = "htran";
config.git."${namespace}".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 # 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;
rust_pkgs = inherit (inputs) system;
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
@ -35,8 +28,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.rnix-lsp # doesn't work, Mason just installs it using cargo pkgs.nil # oxalica's better nix language server
pkgs.rust4cargo inputs.nix-boost.packages."${system}".rust4cargo
pkgs.nickel pkgs.nickel
pkgs.nls pkgs.nls
@ -90,7 +83,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
(pkgs.vimPlugins) (inputs.nixpkgs-latest.vimPlugins)
plenary-nvim plenary-nvim
nvim-treesitter nvim-treesitter
nvim-treesitter-textobjects nvim-treesitter-textobjects

View File

@ -1,7 +1,6 @@
{ inputs, cell }: { inputs, cell }:
let let
namespace = "repo"; namespace = "repo"; # ignore: unused
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath outputPath
@ -10,30 +9,8 @@ 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: bulitins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json")); fromYAML = yamlContent: builtins.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

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