1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00

Make NvChad work with lots of hacks

This commit is contained in:
RGBCube 2023-05-08 23:43:54 +03:00
parent 1aabfa2475
commit 6155df6199
6 changed files with 32 additions and 13 deletions

1
.gitignore vendored
View file

@ -6,6 +6,7 @@
!machines/asus/git/
!machines/asus/neovim/
!machines/asus/neovim/config/
!machines/asus/neovim/nvchad/
!machines/asus/networkmanager/
!machines/asus/nixpkgs/
!machines/asus/nushell/

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "./machines/asus/neovim/nvchad"]
path = ./machines/asus/neovim/nvchad
url = https://github.com/RGBCube/NvChad

View file

@ -46,10 +46,26 @@
overlays = [fenix.overlays.default];
};
# Helper function for DRY.
# Helper functiona for DRY.
homeManagerConfiguration = userName: attrs: {
home-manager.users.${userName} = attrs;
};
homeManagerConfigurationWithArgs = userName: attrsFunc: {
home-manager.users.${userName} = args: attrsFunc args;
};
# Q: Can't we just do "./foo" ?
# A: When configuring our system with flakes, Nix copies them to the
# Nix store to run them. So we can't use relative paths as they will refer
# to a file which is in the Nix store, and is immutable because it is in
# the Nix store, which beats the point of abusing Home Managers
# mkOutOfStoreSymlink to create symlinks to mutable files.
# To avoid this, we must give an absolute path to a file,
# so we do this. The $PWD is replaced by the rebuild script
# with the working directory, then changed back after the build.
# And yes, this is a major hack.
projectPath = "@pwd@";
};
modules = [

View file

@ -1,4 +1,4 @@
{ pkgs, lib, homeManagerConfiguration, ... }:
{ pkgs, lib, homeManagerConfigurationWithArgs, projectPath, ... }:
{
# Nuking nano out of orbit.
@ -8,7 +8,7 @@
//
(homeManagerConfiguration "nixos" {
(homeManagerConfigurationWithArgs "nixos" ({ config, ... }: {
programs.neovim.enable = true;
programs.neovim = {
defaultEditor = true;
@ -19,13 +19,6 @@
# NvChad
home.file.".config/nvim" = {
source = pkgs.callPackage ../../../packages/nvchad {};
recursive = true;
source = config.lib.file.mkOutOfStoreSymlink projectPath + "/machines/asus/neovim/nvchad";
};
home.file.".config/nvim/lua/custom" = {
source = ./config;
recursive = true;
force = true;
};
})
}))

@ -0,0 +1 @@
Subproject commit 3dd0fa6c5b0933d9a395e2492de69c151831c66e

View file

@ -19,12 +19,17 @@ else
read -p "What machine would you want to build? [$(ls --format=commas machines)]: " machine
fi
sudo nixos-rebuild switch --flake .#$machine
sed -ie "s|@pwd@|$PWD|g" flake.nix
sudo nixos-rebuild switch --impure --flake .#$machine
if [[ $? != 0 ]]; then
exit 1
fi
sed -ie "s|$PWD|@pwd@|g" flake.nix
# No clue how to prevent sed from outputting this.
rm flake.nixe
if [[ $1 != "-c" && $1 != "--clean-garbage" ]]; then
read -p "Clean garbage? [Y/N]: " clean_garbage