Add support for non-nixos systems

I run Debian on my Thinkpad and wanted to take advantage of nix on there
without also installing NixOS there, so here is added support for it.
This commit is contained in:
caem 2024-06-06 12:41:31 +02:00
parent c2ba41fd36
commit 62a2c850ae
Signed by: caem
GPG key ID: 69A830D03203405F
11 changed files with 103 additions and 21 deletions

4
users/blank/README.md Normal file
View file

@ -0,0 +1,4 @@
This user is a standalone home-manager user which I use for
systems that are not NixOS but still make use of home-manager.
You should not import this user when running NixOS.

View file

@ -0,0 +1,30 @@
{ config, pkgs, ... }:
{
home.username = "blank";
home.homeDirectory = "/home/blank";
home.stateVersion = "24.05";
/*
home.packages = with pkgs; [
nvim
];
*/
home.file.".zshenv" = {
text = "source ~/.nix-profile/etc/profile.d/hm-session-vars.sh";
};
home.sessionVariables = {
EDITOR = "nvim";
ZDOTDIR = "${config.xdg.configHome}/zsh";
};
imports = [
./packages/nvim/neovim.nix
./packages/zsh/zsh-home.nix
];
programs.home-manager.enable = true;
}

View file

@ -0,0 +1 @@
../../../hu/packages/nvim

View file

@ -0,0 +1 @@
../../../hu/packages/zsh

View file

@ -0,0 +1,4 @@
{
allowUnfree = true;
}

View file

@ -1,9 +1,11 @@
#!/usr/bin/env zsh
if [ -z "$FZF_TAB_FILE" ] && [ ! -d "$HOME/.cache/fzf-tab" ]; then
echo "Installing fzf-tab"
git clone "https://github.com/Aloxaf/fzf-tab" "$HOME/.cache/fzf-tab"
FZF_TAB_FILE="$HOME/.cache/fzf-tab/fzf-tab.plugin.zsh"
if [ -z "$FZF_TAB_FILE" ]; then
if [ ! -d "$HOME/.cache/fzf-tab" ]; then
echo "Installing fzf-tab"
git clone "https://github.com/Aloxaf/fzf-tab" "$HOME/.cache/fzf-tab"
fi
FZF_TAB_FILE="$HOME/.cache/fzf-tab/fzf-tab.plugin.zsh"
fi
autoload -Uz compinit

View file

@ -8,6 +8,10 @@ add_to_path() {
add_to_path "$HOME/.local/bin"
if [ -f "/etc/profile.d/nix.sh" ]; then
source /etc/profile.d/nix.sh
fi
# Language package mangers
if [ -n "$(command -v go)" ]; then
export GOPATH="$HOME/.local/share/go"

View file

@ -1,15 +1,36 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
home.file."/home/hu/.config/zsh/conf.d" = {
home.packages = with pkgs; [
fzf
zsh-fzf-tab
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
nix-zsh-completions
thefuck
];
home.file."${config.xdg.configHome}/zsh/conf.d" = {
source = ./config/conf.d;
recursive = true;
};
home.file."/home/hu/.config/zsh/.zshrc" = {
home.file."${config.xdg.configHome}/zsh/.zshrc" = {
text = ''
#!/usr/bin/env zsh
SYNTAX_FILE="${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
FZF_TAB_FILE="${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh"
# On systems that are not on glibc 2.38, loading fzf-tab will fail. This prevents that.
if [ -f "/lib/x86_64-linux-gnu/libc.so.6" ]; then
GLIBC_VERSION="$(/lib/x86_64-linux-gnu/libc.so.6 | head -n1 | sed -e 's/.* //g' | rev | cut -c2- | rev)"
if [ "$GLIBC_VERSION" = "2.38" ]; then
FZF_TAB_FILE="${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh"
fi
else
FZF_TAB_FILE="${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh"
fi
AUTOSUGGEST_FILE="${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
'' + (builtins.readFile config/.zshrc);
};

View file

@ -2,18 +2,5 @@
{
programs.zsh.enable = true;
environment.variables = {
ZDOTDIR = "${config.users.users.hu.home}/.config/zsh";
};
environment.systemPackages = with pkgs; [
fzf
zsh-fzf-tab
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
nix-zsh-completions
thefuck
];
}