Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Pass through individual channel configuration #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lpchaim
Copy link

@lpchaim lpchaim commented Sep 18, 2024

While looking for a way to achieve per host nixpkgs configurations within snowfall a while ago (see #106), I found out it (very understandably) wasn't a supported use case. I've since familiarized myself some more with both nix and snowfall, so I figured I'd try and give solving that issue cleanly a shot. Hopefully the solution I came up with makes sense!

Essentially, channel-specific configuration is now passed through to flake-utils-plus.mkFlake, allowing channels to have distinct settings and making so individual hosts can have their channel changed. Additionally, the same overlays that were once applied only to the default nixpkgs channel are now also applied to any other user-specified channels automatically.

As a demonstration, the following is a minimal working snippet from my personal flake showcasing how I manage to enable cuda support for my one host with a NVIDIA GPU without affecting the other hosts.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs-cuda.follows = "nixpkgs";
    snowfall-lib.url = "github:snowfallorg/lib";
  };

  outputs = inputs @ {self, ...}:
    snowfallLib.mkFlake {
      inherit inputs;
      src = ./.;

      channels-config = {
        allowUnfree = true;
      };
      channels.nixpkgs-cuda.config = {
        allowUnfree = true;
        cudaSupport = true;
      };

      systems.hosts.desktop.channelName = "nixpkgs-cuda";
    }
}

Channel-specific configuration is now also passed through to
flake-utils-plus.mkFlake, allowing channels to have distinct settings and
allowing for channel selection for individual hosts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant