From 220dde08b73ed0091fed2b5b5cefd59708366376 Mon Sep 17 00:00:00 2001 From: sefidel Date: Sat, 22 Jan 2022 22:17:22 +0900 Subject: flakes: pin registry and nix path --- nixos/default.nix | 4 ++-- nixos/modules/flake.nix | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'nixos') diff --git a/nixos/default.nix b/nixos/default.nix index edf3622..dd1dd18 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,9 +1,9 @@ -{ self, nixpkgs, ... } @ inputs: +{ self, unstable-small, ... } @ inputs: { alpha = self.lib.mkSystem { name = "alpha"; - nixpkgs = nixpkgs; + nixpkgs = unstable-small; overlays = with inputs; [ chaotic-nixpkgs.overlay ]; extraModules = [ inputs.sops-nix.nixosModules.sops diff --git a/nixos/modules/flake.nix b/nixos/modules/flake.nix index a88f9d0..7dc405b 100644 --- a/nixos/modules/flake.nix +++ b/nixos/modules/flake.nix @@ -1,5 +1,11 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, unstable, unstable-small, nixpkgs-2111, lib, ... }: +let + base = "/etc/nixpkgs/channels"; + nixpkgsPath = "${base}/nixpkgs"; + nixpkgsUnstablePath = "${base}/nixpkgsUnstable"; + nixpkgs2111Path = "${base}/nixpkgs2111"; +in { options.nix.flakes.enable = lib.mkEnableOption "nix flakes"; @@ -7,6 +13,23 @@ nix = { package = pkgs.nixUnstable; experimentalFeatures = "nix-command flakes"; + + registry.nixpkgs.flake = unstable-small; + registry.nixpkgsUnstable.flake = unstable; + registry.nixpkgs2111.flake = nixpkgs-2111; + + nixPath = [ + "nixpkgs=${nixpkgsPath}" + "nixpkgsUnstable=${nixpkgsUnstablePath}" + "nixpkgs2111=${nixpkgs2111Path}" + "/nix/var/nix/profiles/per-user/root/channels" + ]; }; + + systemd.tmpfiles.rules = [ + "L+ ${nixpkgsPath} - - - - ${unstable-small}" + "L+ ${nixpkgsUnstablePath} - - - - ${unstable}" + "L+ ${nixpkgs2111Path} - - - - ${nixpkgs-2111}" + ]; }; } -- cgit 1.4.1