I’ve been using NixOS for a month now and I love it, but some of the things I’m used to are missing. Of course I want to solve this by making derivations, and I decided to start with something “easy”. I’ve written a default.nix that builds correctly (using this one as a template), creating the files I want in the correct folder structure, but I think I’m missing the part where my derivation is actually added to the environment.
Here is my default.nix, it’s meant to compile the Sierra Breeze Enhanced titlebars for KDE. It runs alright with nix-build, but unfortunately once done it doesn’t appear in the KDE titlebar selection screen, even after a reboot. I’ve installed the same package on Arch as a chroot and end up with folders /usr/lib/ and /usr/share/. In Nix the folders I get under the nix store folder are instead lib/ and share/, but the files are the same.
My first suspicion is that the folder structure is wrong. From what I can understand of the documentation the nix store folder gets linked to /bin/, which would mean that none of these files are discovered by KDE, which presumably looks in /usr/.
propagate = out:
let setupHook = { writeScript }:
writeScript "setup-hook" ''
if [[ "''${hookName-}" != postHook ]]; then
postHooks+=("source @dev@/nix-support/setup-hook")
else
# Propagate $${out} output
propagatedUserEnvPkgs+=" @${out}@"
if [ -z "$outputDev" ]; then
echo "error: \$outputDev is unset!" >&2
exit 1
fi
# Propagate $dev so that this setup hook is propagated
# But only if there is a separate $dev output
if [ "$outputDev" != out ]; then
propagatedBuildInputs+=" @dev@"
fi
fi
'';
in callPackage setupHook {};
propagateBin = propagate "bin";
seems to be what I want to make KDE see it, it’s a block of code from this file, which apparently handles the default themes for KDE. However, it’s a bit beyond my level of understanding and I was really hoping there might be something easier for me to understand, like the GTK counterpart I found;
propagatedUserEnvPkgs = [ gtk-engine-murrine ];
Also, I’m not sure that the derivation is actually added to my environment. I’ve been unable to find any information on how to add a “private” repository to my configuration.nix, and adding it directly doesn’t seem to work.
Thank you, that’s what I thought. I mainly manage my system from configuration.nix so far, but I want to try home manager eventually. How would I go about adding my personal build to the configuration.nix environment? I’ve found nothing on Google and my own experiments (pasting the path to the default.nix and some variations on that) haven’t succeeded. I’m going to write more derivations in the future, could I somehow add the repo folder as a channel or such and just list the packages in environment.systemPackages?
Unfortunately I’ve been unable to make it work. I now get the error message:
error: attempt to call something which is not a function but a set, at /nix/store/m3i5xg983c73dx4x46vgbvgh9kbizj97-nixos-20.09.1500.edb26126d98/nixos/lib/customisation.nix:69:16
Line 69 defines my sudo, but the config works fine if I comment out the line for my own package (at 113).
–show-trace gives me:
error: while evaluating the attribute ‘activationScript’ of the derivation ‘nixos-system-nixbox-20.09.1500.edb26126d98’ at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-
level.nix:95:5:
while evaluating the attribute ‘system.activationScripts.script’ at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:68:9:
while evaluating ‘textClosureMap’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings-with-deps.nix:70:35, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activ
ation/activation-script.nix:89:18:
while evaluating ‘id’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:14:5, called from undefined position:
while evaluating the attribute ‘text’ at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:9:5:
while evaluating the attribute ‘text’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings-with-deps.nix:77:38:
while evaluating the attribute ‘sources’ of the derivation ‘etc’ at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix:12:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix:20:20, called from undefined position:
while evaluating the attribute ‘source’ at undefined position:
while evaluating ‘g’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:276:19, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:98:72, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:279:20:
while evaluating the attribute ‘value’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:465:9:
while evaluating the option environment.etc.dbus-1.source': while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:497:5: while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:499:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:499:12: while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:256:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:499:22: while evaluating the attribute 'serviceDirectories' of the derivation 'dbus-1' at /nix/store/m3i5xg983c73dx4x46vgbvgh9kbizj97-nixos-20.09.1500.edb26126d98/nixos/pkgs/build-support/trivial-builders.nix:7:7: while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:265:14, called from undefined position: while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:510:27: while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:499:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:499:12: while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:256:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:499:22: while evaluating the attribute 'passAsFile' of the derivation 'system-path' at /nix/store/m3i5xg983c73dx4x46vgbvgh9kbizj97-nixos-20.09.1500.edb26126d98/nixos/pkgs/build-support/trivial-builders.nix:7:7: while evaluating the attribute 'environment.systemPackages' at undefined position: while evaluating 'g' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:276:19, called from undefined position: while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:98:72, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:279:20: while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:465:9: while evaluating the option environment.systemPackages’:
while evaluating the attribute ‘mergedValue’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:497:5:
while evaluating ‘merge’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:264:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:499:59:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:265:35, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:116:29, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:267:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:116:32:
while evaluating the attribute ‘optionalValue’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:509:5:
while evaluating the attribute ‘values’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:491:9:
while evaluating the attribute ‘values’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:590:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:477:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:477:17:
while evaluating definitions from `/etc/nixos/configuration.nix’:
while evaluating ‘dischargeProperties’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:549:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:478:137:
while evaluating the attribute ‘value’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:271:40:
while evaluating ‘callPackageWith’ at /nix/store/m3i5xg983c73dx4x46vgbvgh9kbizj97-nixos-20.09.1500.edb26126d98/nixos/lib/customisation.nix:117:35, called from /etc/nixos/configuration.nix:101:4:
while evaluating ‘makeOverridable’ at /nix/store/m3i5xg983c73dx4x46vgbvgh9kbizj97-nixos-20.09.1500.edb26126d98/nixos/lib/customisation.nix:67:24, called from /nix/store/m3i5xg983c73dx4x46vgbvgh9kbizj97-nixos-20
.09.1500.edb26126d98/nixos/lib/customisation.nix:121:8:
attempt to call something which is not a function but a set, at /nix/store/m3i5xg983c73dx4x46vgbvgh9kbizj97-nixos-20.09.1500.edb26126d98/nixos/lib/customisation.nix:69:16
I have tried this with both variants I could find for using pkgs.callPackage:
environment.systemPackages = with pkgs; [
(pkgs.callPackage /home/probe/Scripts/Derivations/SierraBreezeEnhanced/default.nix {})
other things
];
environment.systemPackages = with pkgs; let
sierrabreezeenhanced = pkgs.callPackage /home/probe/Scripts/Derivations/SierraBreezeEnhanced/default.nix {};
in [
sierrabreezeenhanced
other things
];
I don’t know what making something callPackageable entails, and I haven’t found anything I can use with searches. I tried adding the path to “imports” in my configuration.nix, but now get the error:
error: value is a string while a set was expected, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:323:25
(use ‘–show-trace’ to show detailed location information)
building Nix…
error: value is a string while a set was expected, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:323:25
(use ‘–show-trace’ to show detailed location information)
building the system configuration…
error: value is a string while a set was expected, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:323:25
(use ‘–show-trace’ to show detailed location information)
It seems related to the error I got last time. I imagine this must be because of my default.nix somehow.
–show-trace:
error: while evaluating the attribute ‘config’ at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:64:5:
while evaluating ‘evalModules’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:21:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:58:12:
while evaluating the attribute ‘unmatchedDefns’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:10, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:59, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:16:
while evaluating the attribute ‘system’ at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:369:22, called from undefined position:
while evaluating the attribute ‘unmatchedDefns’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:7:
while evaluating ‘mapAttrsToList’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:233:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:37:
while evaluating ‘byName’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:321:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:337:22:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:22, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:9:
value is a string while a set was expected, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:323:25
building Nix…
error: while evaluating the attribute ‘config’ at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:64:5:
while evaluating ‘evalModules’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:21:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:58:12:
while evaluating the attribute ‘unmatchedDefns’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:10, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:59, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:16:
while evaluating the attribute ‘system’ at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:369:22, called from undefined position:
while evaluating the attribute ‘unmatchedDefns’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:7:
while evaluating ‘mapAttrsToList’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:233:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:37:
while evaluating ‘byName’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:321:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:337:22:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:22, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:9:
value is a string while a set was expected, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:323:25
building the system configuration…
error: while evaluating the attribute ‘config.system.build.toplevel’ at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:64:5:
while evaluating ‘evalModules’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:21:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:58:12:
while evaluating the attribute ‘unmatchedDefns’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:10, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:59, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:234:16:
while evaluating the attribute ‘system’ at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:369:22, called from undefined position:
while evaluating the attribute ‘unmatchedDefns’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:7:
while evaluating ‘mapAttrsToList’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:233:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:37:
while evaluating ‘byName’ at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:321:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:337:22:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:22, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:322:9:
value is a string while a set was expected, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:323:25
That worked, thanks a bunch!
I still can’t see it in the menu, but at least it builds and includes in the environment. It’s possibly because it builds for (with?) qt 5.15, which I’m having an enormous bug with on 20.09. I’ll give it another go when that gets fixed, there’s a pr up so it at least shouldn’t be long.
Depending on what you use as menu, it can take some time until software appears there, also the output needs to have a desktop file at a certain location, which I never remember.
I quickly skimmed the source repo, and I can’t find a Desktop file there. Though I have not looked at the build process if it is perhaps generated.
Same way I upgraded from 20.03 to 20.09 in the first place, which may have been completely wrong because I never found instructions for the “proper” way to do it and just did what I assumed I should.