fix: resolve evaluation purity, missing packages, and brittle paths
This commit is contained in:
@@ -16,10 +16,6 @@
|
||||
|
||||
let
|
||||
configDir = ./config;
|
||||
overridesDir = "${config.home.homeDirectory}/.config/nomarchy/overrides";
|
||||
|
||||
# Check if user has an override for a specific config
|
||||
hasOverride = path: builtins.pathExists "${overridesDir}/${path}";
|
||||
|
||||
# Behavior config categories with their source paths
|
||||
behaviorConfigs = {
|
||||
|
||||
@@ -37,13 +37,11 @@ let
|
||||
|
||||
# Check for user overrides
|
||||
userConfigDir = config.nomarchy.configOverrides;
|
||||
hasUserOverrides = userConfigDir != null && builtins.pathExists userConfigDir;
|
||||
|
||||
# Generate the xdg.configFile attribute set
|
||||
makeMapping = name: type:
|
||||
let
|
||||
hasUserOverride = hasUserOverrides && builtins.pathExists "${userConfigDir}/${name}";
|
||||
source = if hasUserOverride then "${userConfigDir}/${name}" else "${configDir}/${name}";
|
||||
source = if userConfigDir != null then "${userConfigDir}/${name}" else "${configDir}/${name}";
|
||||
in {
|
||||
inherit name;
|
||||
value = lib.mkDefault {
|
||||
|
||||
@@ -20,14 +20,9 @@
|
||||
let
|
||||
overridesDir = "${config.home.homeDirectory}/.config/nomarchy/overrides";
|
||||
|
||||
# Check if a specific override exists
|
||||
hasOverride = path: builtins.pathExists "${overridesDir}/${path}";
|
||||
|
||||
# Get override source if it exists, otherwise use default
|
||||
# Helper to get override from options
|
||||
getOverrideOrDefault = { path, default }:
|
||||
if hasOverride path
|
||||
then "${overridesDir}/${path}"
|
||||
else default;
|
||||
config.nomarchy.overrides.paths.${path} or default;
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ in
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${config.users.users.${config.services.displayManager.autoLogin.user}.home}/.nix-profile/bin/nomarchy-haptic-touchpad";
|
||||
ExecStart = "${pkgs.nomarchy-system-scripts}/bin/nomarchy-haptic-touchpad";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "2";
|
||||
};
|
||||
|
||||
60
core/system/scripts-derivation.nix
Normal file
60
core/system/scripts-derivation.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
# System script dependencies
|
||||
systemScriptDeps = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
gnugrep
|
||||
findutils
|
||||
gawk
|
||||
jq
|
||||
nixos-rebuild
|
||||
pkgs.home-manager
|
||||
git
|
||||
sudo
|
||||
brightnessctl
|
||||
playerctl
|
||||
pamixer
|
||||
pciutils
|
||||
usbutils
|
||||
networkmanager
|
||||
lshw
|
||||
parted
|
||||
btrfs-progs
|
||||
cryptsetup
|
||||
gum
|
||||
curl
|
||||
wget
|
||||
libnotify
|
||||
bc
|
||||
supergfxctl
|
||||
systemd
|
||||
];
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "nomarchy-system-scripts";
|
||||
version = "1.0.0";
|
||||
src = ./scripts;
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp * $out/bin/
|
||||
|
||||
chmod +x $out/bin/*
|
||||
patchShebangs $out/bin
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
deps="${lib.makeBinPath systemScriptDeps}"
|
||||
for file in $out/bin/*; do
|
||||
if [ -f "$file" ]; then
|
||||
wrapProgram "$file" \
|
||||
--prefix PATH : "$deps" \
|
||||
--set NOMARCHY_PATH "/etc/nixos/nomarchy"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
}
|
||||
@@ -1,64 +1,5 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
# System script dependencies
|
||||
systemScriptDeps = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
gnugrep
|
||||
findutils
|
||||
gawk
|
||||
jq
|
||||
nixos-rebuild
|
||||
pkgs.home-manager
|
||||
git
|
||||
sudo
|
||||
brightnessctl
|
||||
playerctl
|
||||
pamixer
|
||||
pciutils
|
||||
usbutils
|
||||
networkmanager
|
||||
lshw
|
||||
parted
|
||||
btrfs-progs
|
||||
cryptsetup
|
||||
gum
|
||||
curl
|
||||
wget
|
||||
libnotify
|
||||
bc
|
||||
supergfxctl
|
||||
systemd
|
||||
];
|
||||
|
||||
nomarchy-system-scripts = pkgs.stdenv.mkDerivation {
|
||||
pname = "nomarchy-system-scripts";
|
||||
version = "1.0.0";
|
||||
src = ./scripts;
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp * $out/bin/
|
||||
|
||||
chmod +x $out/bin/*
|
||||
patchShebangs $out/bin
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
deps="${lib.makeBinPath systemScriptDeps}"
|
||||
for file in $out/bin/*; do
|
||||
if [ -f "$file" ]; then
|
||||
wrapProgram "$file" \
|
||||
--prefix PATH : "$deps" \
|
||||
--set NOMARCHY_PATH "/etc/nixos/nomarchy"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ nomarchy-system-scripts ];
|
||||
environment.systemPackages = [ pkgs.nomarchy-system-scripts ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user