config/modules/nix-register-flakes/default.nix

54 lines
1.5 KiB
Nix

{ config, inputs, lib, pkgs, ... }:
with inputs;
{
nix.nixPath = [
"repl=/etc/nix/flake-channels/system/repl.nix"
"nixpkgs=/etc/nix/flake-channels/nixpkgs"
"home-manager=/etc/nix/flake-channels/home-manager"
];
nix.registry = {
system.flake = self;
nixpkgs.to = {
owner = "NixOS";
repo = "nixpkgs";
rev = nixpkgs.rev;
type = "github";
};
default.flake = nixpkgs;
home-manager.flake = home-manager;
vim.flake = let
nixpkgsSelfLock = lib.importJSON "${self}/flake.lock";
vimLock = lib.importJSON "${modular-nvim}/flake.lock";
patchedLock = lib.recursiveUpdate vimLock { nodes.nixpkgs.locked = (nixpkgsSelfLock.nodes.nixpkgs.locked); };
patchedLockFile = pkgs.writeText "patched-flake.lock" (builtins.toJSON patchedLock);
in pkgs.runCommand "vim-flake" {} ''
cp -vr ${modular-nvim} $out
chmod +w $out
rm $out/flake.lock
cp -v ${patchedLockFile} $out/flake.lock
'';
templates.to = {
owner = "max";
repo = "flake-templates";
ref = "master";
host = "git.privatevoid.net";
type = "gitlab";
};
config.to = {
owner = "max";
repo = "config";
ref = "master";
host = "git.privatevoid.net";
type = "gitlab";
};
};
environment.etc = {
"nix/flake-channels/system".source = inputs.self;
"nix/flake-channels/nixpkgs".source = nixpkgs;
"nix/flake-channels/home-manager".source = home-manager;
};
}