{ config, pkgs, unstable, unstable-small, nixpkgs-master, nixpkgs-2311, lib, ... }: let base = "/etc/nixpkgs/channels"; nixpkgsPath = "${base}/nixpkgs"; nixpkgsSmallPath = "${base}/nixpkgsSmall"; nixpkgsMasterPath = "${base}/nixpkgsMaster"; nixpkgs2311Path = "${base}/nixpkgs2311"; in { options.nix.flakes.enable = lib.mkEnableOption "nix flakes"; config = lib.mkIf config.nix.flakes.enable { nix = { package = pkgs.nixVersions.latest; experimentalFeatures = "nix-command flakes"; registry.nixpkgs.flake = unstable; registry.nixpkgsSmall.flake = unstable-small; registry.nixpkgsMaster.flake = nixpkgs-master; registry.nixpkgs2311.flake = nixpkgs-2311; nixPath = [ "nixpkgs=${nixpkgsPath}" "nixpkgsSmall=${nixpkgsSmallPath}" "nixpkgs2311=${nixpkgs2311Path}" "/nix/var/nix/profiles/per-user/root/channels" ]; }; systemd.tmpfiles.rules = [ "L+ ${nixpkgsPath} - - - - ${unstable}" "L+ ${nixpkgsSmallPath} - - - - ${unstable-small}" "L+ ${nixpkgsMasterPath} - - - - ${nixpkgs-master}" "L+ ${nixpkgs2311Path} - - - - ${nixpkgs-2311}" ]; }; }