Reputation: 11
I want to modify a nix package and use the modified version on my system, simple right?
The active code builds with nix-build modified.nix
& nix-env -i ./result
works as expected. No errors 👍️
{ pkgs ? import <nixpkgs> { } }:
let
repo = pkgs.fetchFromGitHub {
owner = "TheCyberArcher";
repo = "Respect-My-Internet";
rev = "feb165acd4d39d61d5c29ad7450b14074f0fb031";
sha256 = "1hcd6dqjxi7jnrnd6n1h792qb6xwmiv855rfykh6rgzlwpgydrzk";
};
in
pkgs.opensnitch.overrideAttrs (oldAttrs: {
preBuild = ''
mkdir -p $out/etc/opensnitchd/rules/
mkdir -p $out/etc/opensnitchd/blocklist
cp -r ${repo}/blocklist/respect-my-internet.txt $out/etc/opensnitchd/blocklist/
cp -r ${repo}/blocklist/ip/ $out/etc/opensnitchd/
cp -r ${repo}/regex $out/etc/opensnitchd/
cp -r ${repo}/rules/*.json $out/etc/opensnitchd/rules/
'';
})
Next incorporated this file into configuration.nix by adding it as a system package.
environment.systemPackages = [
(import ./modifed.nix)
];
I am met with the error:
A definition for option `environment.systemPackages."[definition 1-entry 1]"' is not of type `package'. Definition values:
- In `/etc/nixos/host.nix': <function, args: {pkgs?}>
I'm not sure where my problem is, any insights would be greatly appreciated. I ran it through some code AIs and worked through those steps to no avail. The final response was reach out online lol
I was expecting the package to build when nixos-rebuild switch
was executed since nix-build
and nix-env -i results/
worked as expected.
I've tried to rewrite the nix code a few different ways but nothing seems to be working.
Tested on NixOS 23.11
& 24.05
current running system and a fresh/clean cloud image of NixOS 24.05
Upvotes: 0
Views: 18