Compare commits

...

3 Commits

4 changed files with 95 additions and 89 deletions

View File

@@ -8,6 +8,7 @@
self', self',
pkgs, pkgs,
inputs', inputs',
flakeLocation,
... ...
}: {config, ...}: let }: {config, ...}: let
modules = with self.nixosModules; [ modules = with self.nixosModules; [
@@ -65,12 +66,22 @@
''} ''}
end) end)
''; '';
# Easy way to get nix runtime info (ie the directory the config is at)
# into hyprland to run commands and stuff
runtimeFile = pkgs.writeText "runtime.lua" ''
hl.on("hyprland.start", function ()
${lib.optionalString (flakeLocation != "") ''
hl.exec_cmd( 'curl -X POST -H "Content-Type: application/json" -d "{\"ref\":\"$(git -C ${flakeLocation} rev-parse HEAD)\", \"status\":\"$(git -C ${flakeLocation} diff --quiet && echo "clean" || echo "dirty")\"}" https://n8n.voidarc.co.uk/webhook/config-checker' )
''}
end)
'';
in in
lib.stringAfter ["specialfs"] '' lib.stringAfter ["specialfs"] ''
mkdir -p /run/hypr/config mkdir -p /run/hypr/config
rm -rf /run/hypr/config/* rm -rf /run/hypr/config/*
ln -sfn ${inputs'.hyprland.packages.repo-files}/* /run/hypr/config ln -sfn ${inputs'.hyprland.packages.repo-files}/* /run/hypr/config
ln -sfn ${pluginFile} /run/hypr/config/plugins.lua ln -sfn ${pluginFile} /run/hypr/config/plugins.lua
ln -sfn ${runtimeFile} /run/hypr/config/runtime.lua
''; '';
}; };
}); });

View File

@@ -25,87 +25,85 @@
}); });
perSystem = { perSystem = {
pkgs, pkgs,
lib,
self', self',
lib,
flakeLocation,
... ...
}: { }: {
packages = { packages = {
zsh = let zsh = lib.warnIf (flakeLocation == "") "Flake Location is undefined. Are you building in the right directory?"
flakeLocation = builtins.getEnv "PWD"; inputs.wrappers.wrappers.zsh.wrap {
in inherit pkgs;
lib.warnIf (flakeLocation == "") "Flake Location is undefined. Are you building in the right directory?" runtimePkgs = [pkgs.carapace pkgs.devenv pkgs.fzf];
inputs.wrappers.wrappers.zsh.wrap { zshAliases = {
inherit pkgs; ls = "${lib.getExe pkgs.lsd} -l";
runtimePkgs = [pkgs.carapace pkgs.devenv pkgs.fzf]; v = lib.getExe self'.packages.nvim;
zshAliases = { cat = lib.getExe pkgs.bat;
ls = "${lib.getExe pkgs.lsd} -l"; lg = lib.getExe pkgs.lazygit;
v = lib.getExe self'.packages.nvim; man = "man -P \"${lib.getExe pkgs.bat} -p\"";
cat = lib.getExe pkgs.bat; nsh = "nix-shell -p";
lg = lib.getExe pkgs.lazygit; nrs =
man = "man -P \"${lib.getExe pkgs.bat} -p\""; if flakeLocation != ""
nsh = "nix-shell -p"; then "( cd ${flakeLocation} && sudo nixos-rebuild switch --impure --flake . )"
nrs = else "echo 'Flake location not specified. Did you build with --impure?'";
if flakeLocation != "" vinix =
then "( cd ${flakeLocation} && sudo nixos-rebuild switch --impure --flake . )" if flakeLocation != ""
else "echo 'Flake location not specified. Did you build with --impure?'"; then "nvim --cmd 'cd ${flakeLocation}'"
vinix = else "echo 'Flake location not specified. Did you build with --impure?'";
if flakeLocation != ""
then "nvim --cmd 'cd ${flakeLocation}'"
else "echo 'Flake location not specified. Did you build with --impure?'";
};
zshrc.content = ''
source ${./devenv.zsh}
if (( ''${+terminfo[smkx]} )) && (( ''${+terminfo[rmkx]} )); then
function zle-line-init() { echoti smkx }
function zle-line-finish() { echoti rmkx }
zle -N zle-line-init
zle -N zle-line-finish
fi
autoload -U compinit && compinit
export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional
zstyle ':completion:*' format $'\e[2;37mCompleting %d\e[m'
source <(${lib.getExe pkgs.carapace} _carapace)
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
autoload -U select-word-style
select-word-style bash
autoload -U up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[OA" up-line-or-beginning-search
bindkey "^[OB" down-line-or-beginning-search
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[3;5~" kill-word
bindkey "^H" backward-kill-word
source <(${lib.getExe pkgs.fzf} --zsh)
setopt NO_CASE_GLOB
if command -v ${lib.getExe pkgs.nix-your-shell} > /dev/null; then
${lib.getExe pkgs.nix-your-shell} -- zsh | source /dev/stdin
fi
export EDITOR=nvim
eval "$(${lib.getExe self'.packages.ohMyPosh} init zsh)"
eval "$(${lib.getExe pkgs.devenv} hook zsh)"
typeset -ag precmd_functions
if (( ! ''${precmd_functions[(I)__devenv_reload_apply]} )); then
precmd_functions+=(__devenv_reload_apply)
fi
if (( ! ''${precmd_functions[(I)__devenv_restore_path]} )); then
precmd_functions+=(__devenv_restore_path)
fi
'';
}; };
zshrc.content = ''
source ${./devenv.zsh}
if (( ''${+terminfo[smkx]} )) && (( ''${+terminfo[rmkx]} )); then
function zle-line-init() { echoti smkx }
function zle-line-finish() { echoti rmkx }
zle -N zle-line-init
zle -N zle-line-finish
fi
autoload -U compinit && compinit
export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional
zstyle ':completion:*' format $'\e[2;37mCompleting %d\e[m'
source <(${lib.getExe pkgs.carapace} _carapace)
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
autoload -U select-word-style
select-word-style bash
autoload -U up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[OA" up-line-or-beginning-search
bindkey "^[OB" down-line-or-beginning-search
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[3;5~" kill-word
bindkey "^H" backward-kill-word
source <(${lib.getExe pkgs.fzf} --zsh)
setopt NO_CASE_GLOB
if command -v ${lib.getExe pkgs.nix-your-shell} > /dev/null; then
${lib.getExe pkgs.nix-your-shell} -- zsh | source /dev/stdin
fi
export EDITOR=nvim
eval "$(${lib.getExe self'.packages.ohMyPosh} init zsh)"
eval "$(${lib.getExe pkgs.devenv} hook zsh)"
typeset -ag precmd_functions
if (( ! ''${precmd_functions[(I)__devenv_reload_apply]} )); then
precmd_functions+=(__devenv_reload_apply)
fi
if (( ! ''${precmd_functions[(I)__devenv_restore_path]} )); then
precmd_functions+=(__devenv_restore_path)
fi
'';
};
ohMyPosh = inputs.wrappers.wrappers.oh-my-posh.wrap { ohMyPosh = inputs.wrappers.wrappers.oh-my-posh.wrap {
inherit pkgs; inherit pkgs;
configFile = ./config.toml; configFile = ./config.toml;

View File

@@ -1,13 +1,5 @@
{ {self, ...}: {
self, flake.nixosModules.core = {pkgs, ...}: let
inputs,
...
}: {
flake.nixosModules.core = {
pkgs,
lib,
...
}: let
modules = with self.nixosModules; [ modules = with self.nixosModules; [
user user
bootloader bootloader
@@ -21,6 +13,7 @@
/etc/nixos/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
] ]
++ modules; ++ modules;
services = { services = {
openssh.enable = true; openssh.enable = true;
avahi.enable = true; avahi.enable = true;

View File

@@ -1,8 +1,12 @@
{inputs, ...}: { {inputs, ...}: {
perSystem = {system, ...}: { perSystem = {system, ...}: {
_module.args.unfreePkgs = import inputs.nixpkgs { _module.args = {
inherit system; unfreePkgs = import inputs.nixpkgs {
config.allowUnfree = true; inherit system;
config.allowUnfree = true;
};
# Make flakeLocation universally addressable
flakeLocation = builtins.getEnv "PWD";
}; };
}; };
flake.nixosModules.nix = {...}: { flake.nixosModules.nix = {...}: {