I wanted to add GitHub - oxalica/nil: Language Server for Nix Expression Language to my home-manager config, and so I first tried to add it as a flake and add the flake to home.packages
. However, that didn’t work, instead I had to manually add the packages.system.default bit.
Is there a nicer way? This is my home-manager flake, other comments welcome:
{
description = "A Home Manager flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nil.url = "github:oxalica/nil";
nil.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home-manager, nil, ... }:
let
system = "x86_64-linux";
username = "wmertens";
homeDirectory = "/home/${username}";
pkgs = import nixpkgs {
overlays = [ self.overlays.default ];
};
in
{
overlays.default = (final: prev: {
wout-scripts = final.callPackage ./wout-scripts.nix { };
google-chrome = prev.google-chrome.override { commandLineArgs = "--enable-features=TouchpadOverscrollHistoryNavigation"; };
});
homeConfigurations = {
wmertens = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
{
# home-manager config
home = {
inherit username homeDirectory;
stateVersion = "22.05";
};
}
{
home.packages = [ nil.packages.${system}.default ];
}
./home.nix
];
};
};
};
}
PS: Since nil
will be in nixpkgs soon, this question is somewhat academic, for future reference.