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,15 +25,13 @@
}); });
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";
in
lib.warnIf (flakeLocation == "") "Flake Location is undefined. Are you building in the right directory?"
inputs.wrappers.wrappers.zsh.wrap { inputs.wrappers.wrappers.zsh.wrap {
inherit pkgs; inherit pkgs;
runtimePkgs = [pkgs.carapace pkgs.devenv pkgs.fzf]; runtimePkgs = [pkgs.carapace pkgs.devenv pkgs.fzf];

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,9 +1,13 @@
{inputs, ...}: { {inputs, ...}: {
perSystem = {system, ...}: { perSystem = {system, ...}: {
_module.args.unfreePkgs = import inputs.nixpkgs { _module.args = {
unfreePkgs = import inputs.nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
}; };
# Make flakeLocation universally addressable
flakeLocation = builtins.getEnv "PWD";
};
}; };
flake.nixosModules.nix = {...}: { flake.nixosModules.nix = {...}: {
nix = { nix = {