aboutsummaryrefslogtreecommitdiff
path: root/modules/flakes.nix
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-08-21 19:20:36 +0900
committersefidel <contact@sefidel.net>2023-08-21 19:22:01 +0900
commitbc4039ae8c86f794cece9d9ceb43b838e61cf445 (patch)
tree3991ec87c676fcfbb22a72de866ca0e14b137403 /modules/flakes.nix
parent76dc3decd5e8b9d0494cd65be2303784f64d1a24 (diff)
downloadnixrc-bc4039ae8c86f794cece9d9ceb43b838e61cf445.zip
chore: nixos/modules -> modules
Diffstat (limited to 'modules/flakes.nix')
-rw-r--r--modules/flakes.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/flakes.nix b/modules/flakes.nix
new file mode 100644
index 0000000..76f89f3
--- /dev/null
+++ b/modules/flakes.nix
@@ -0,0 +1,35 @@
+{ config, pkgs, unstable, unstable-small, nixpkgs-2211, lib, ... }:
+
+let
+ base = "/etc/nixpkgs/channels";
+ nixpkgsPath = "${base}/nixpkgs";
+ nixpkgsSmallPath = "${base}/nixpkgsSmall";
+ nixpkgs2211Path = "${base}/nixpkgs2211";
+in
+{
+ options.nix.flakes.enable = lib.mkEnableOption "nix flakes";
+
+ config = lib.mkIf config.nix.flakes.enable {
+ nix = {
+ package = pkgs.nixUnstable;
+ experimentalFeatures = "nix-command flakes";
+
+ registry.nixpkgs.flake = unstable;
+ registry.nixpkgsSmall.flake = unstable-small;
+ registry.nixpkgs2211.flake = nixpkgs-2211;
+
+ nixPath = [
+ "nixpkgs=${nixpkgsPath}"
+ "nixpkgsSmall=${nixpkgsSmallPath}"
+ "nixpkgs2211=${nixpkgs2211Path}"
+ "/nix/var/nix/profiles/per-user/root/channels"
+ ];
+ };
+
+ systemd.tmpfiles.rules = [
+ "L+ ${nixpkgsPath} - - - - ${unstable}"
+ "L+ ${nixpkgsSmallPath} - - - - ${unstable-small}"
+ "L+ ${nixpkgs2211Path} - - - - ${nixpkgs-2211}"
+ ];
+ };
+}