OS: macOS
Setup: flake.nix (nix-darwin) > home.nix (home manager) > mise.nix, using nixpkgs stable.
Goal:
I’m trying to install mise (an alternative to asdf) via nixpkgs-unstable.
Problem:
I’ve tried overlays
to specialArgs
in nix-darwin’s flake.nix and extraSpecialArgs
in its home manager module and alternatively in home manager’s home.nix, but failed. I’d post the errors, but I’ve tried this so many ways as per tutorials, that I’ve lost track of errors related to each attempt.
Files:
.config/nix-darwin/flake.nix (nix-darwin)
.config/nix-darwin/nixpkgs/home.nix (home manager)
.config/nix-darwin/nixpkgs/home_manager/modules/cli/mise.nix
Here’s the nix-darwin template with the home manager module added, and a barebones home.nix and mise.nix module. The nix-darwin flake has nix-darwin’s configuration inline because I used the flake template from scratch as opposed to starting with a nix-darwin configuration.nix file.
Can someone please point out how they have achieved this goal?
Thanks
flake.nix
{
description = "Example Darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-23.11-darwin";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs, nixpkgs-unstable, home-manager, ... }:
let
configuration = { pkgs, ... }: {
environment.systemPackages =
[ pkgs.vim
];
services.nix-daemon.enable = true;
nix.settings.experimental-features = "nix-command flakes";
programs.zsh.enable = true; # default shell on catalina
system.configurationRevision = self.rev or self.dirtyRev or null;
system.stateVersion = 4;
nixpkgs.hostPlatform = "aarch64-darwin";
};
in
{
darwinConfigurations."myhostname" = nix-darwin.lib.darwinSystem {
modules = [
configuration
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.xxx = import ./nixpkgs/home.nix;
};
users.users.xxx.home = "/Users/xxx";
}
];
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations."myhostname".pkgs;
};
}
home.nix
{ pkgs, inputs, ... }: {
home = {
enableNixpkgsReleaseCheck = true;
stateVersion = "23.11";
packages = with pkgs; [
nurl
];
};
programs.home-manager.enable = true;
programs.home-manager.path = "$HOME/.config/nix-darwin/nixpkgs/";
imports = [
./home_manager/modules/cli/mise.nix
];
}
mise.nix
{ config, pkgs, libs, ... }:
{
# Mise
# The front-end to your dev env.
# https://github.com/jdx/mise
programs.mise = {
enable = true;
package = unstable.mise;
enableZshIntegration = true;
globalConfig = {
tools = {
dart = ["latest" "2.19.2"];
elixir = ["latest" "1.14.3-otp-25" "1.12.0-otp-22"];
erlang = ["latest" "25.2.3"];
flutter = ["latest" "3.7.5-stable"];
java = ["adoptopenjdk-latest" "adoptopenjdk-19.0.2+7"];
kotlin = ["latest" "1.8.0"];
node = ["latest" "lts"];
postgres = ["latest" "14.8"];
sqlite = ["latest" "3.39.4"];
python = ["latest" "3.10.12"];
ruby = ["latest" "3.1.4"];
};
};
settings = {
always_keep_download = true;
plugin_autoupdate_last_check_duration = "6 hours";
trusted_config_paths = ["~/.config" "~/dev"];
verbose = false;
asdf_compat = false;
jobs = 1;
raw = false;
disable_tools = [ "node" ];
experimental = false;
log_level = "debug";
};
};
}