My NixOS dotfiles
1{
2 nixpkgs,
3 pkgs,
4 homeDirectory,
5}:
6let
7 registry = {
8 flakes = [
9 {
10 exact = true;
11 from = {
12 id = "n";
13 type = "indirect";
14 };
15 to = {
16 path = "${nixpkgs}";
17 type = "path";
18 };
19 }
20 ];
21 version = 2;
22 };
23 registryFile = pkgs.writeTextFile {
24 name = "registry.json";
25 destination = "/.config/nix/registry.json";
26 text = builtins.toJSON registry;
27 };
28in
29pkgs.writeShellScriptBin "update-links" ''
30 #!/usr/bin/env bash
31 mkdir -p ${homeDirectory}/.config/nix
32 ln -sf ${registryFile}/.config/nix/registry.json ${homeDirectory}/.config/nix/registry.json
33''