Hey, I’m pretty new to NIX and have got the following, basic, flake-based configuration going which works good. However I’m trying to include a custom derivation into it, that gets built to be available when rebuilding the system with nixos-rebuild
, but it doesn’t seem to work. The custom derivation file seems to get totally ignored…
flake.nix
:
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, home-manager, ... }: {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs;};
modules = [
./configuration.nix
];
};
};
default.x86_64-linux = home-manager.default.x86_64-linux;
homeConfigurations = {
"myhost" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
};
modules = [./home/myhost.nix];
};
};
defaultPackage.x86_64-linux = nixpkgs.lib.mkDefault {
hello = import ./pkgs/hello.nix { inherit nixpkgs; };
};
};
}
And the custom derivation in ./pkgs/hello.nix
:
{ stdenv }:
stdenv.mkDerivation rec {
name = "hello-2.10";
src = fetchurl {
url = mirror://gnu/hello/hello-2.10.tar.gz;
sha256 = "0z2c7x6iywzynf22pby5wszfvrxmi8f4g82kmn25hbwjv9b5myaa";
};
buildPhase = ''
echo "Building hello..."
make
'';
installPhase = ''
echo "Installing hello..."
make install DESTDIR=$out
'';
}