about summary refs log tree commit diff
path: root/modules/flakes.nix
blob: 4297fda42c175b38d71e3011e2325bea20b40e21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ config, inputs, pkgs, lib, ... }:

with lib;
let
  base = "/etc/nixpkgs/channels";
  nixpkgsPath = "${base}/nixpkgs";
  nixpkgsSmallPath = "${base}/nixpkgsSmall";
  nixpkgs2111Path = "${base}/nixpkgs2111";
in
{
  options.nix.flakes.enable = mkEnableOption "nix flakes";

  config = lib.mkIf config.nix.flakes.enable {
    nix = {
      package = pkgs.nixUnstable;
      experimentalFeatures = "nix-command flakes";

      registry.nixpkgs.flake = inputs.unstable;
      registry.nixpkgsSmall.flake = inputs.unstable-small;
      registry.nixpkgs2111.flake = inputs.nixpkgs-2111;

      nixPath = [
        "nixpkgs=${nixpkgsPath}"
        "nixpkgsSmall=${nixpkgsSmallPath}"
        "nixpkgs2111=${nixpkgs2111Path}"
        "/nix/var/nix/profiles/per-user/root/channels"
      ];
    };

    systemd.tmpfiles.rules = [
      "L+ ${nixpkgsPath}      - - - - ${inputs.unstable}"
      "L+ ${nixpkgsSmallPath} - - - - ${inputs.unstable-small}"
      "L+ ${nixpkgs2111Path}  - - - - ${inputs.nixpkgs-2111}"
    ];
  };
}