aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/nix/flake.nix
blob: ca2ad66d46fc79d0f6ef6cdff02b4b2323c5fb7e (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  description = "Home-Manager profiles for the Arch host and the Ubuntu remote-dev VM.";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager/master";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    # tuicr: TUI git-change reviewer. Upstream flake exposes
    # `packages.<system>.default`. Pulled here instead of nixpkgs because
    # it's not packaged there. The skill files under
    # `dot_claude/skills/tuicr/` rely on the `tuicr` binary being on PATH.
    tuicr = {
      url = "github:agavra/tuicr";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, home-manager, tuicr, ... }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        overlays = [
          # Expose `pkgs.tuicr` so common.nix can list it next to other
          # packages without threading inputs into every module.
          # tuicr's flake uses the legacy `defaultPackage.<system>`
          # schema (not `packages.<system>.default`); see its flake.nix.
          (final: prev: { tuicr = tuicr.defaultPackage.${system}; })
        ];
        # Whitelist specific unfree packages (claude-code,
        # github-copilot-cli) instead of globally setting allowUnfree,
        # so a typo elsewhere can't silently pull in additional unfree
        # deps.
        config.allowUnfreePredicate = pkg:
          builtins.elem (nixpkgs.lib.getName pkg) [
            "claude-code"
            "github-copilot-cli"
          ];
      };

      mkProfile = module: home-manager.lib.homeManagerConfiguration {
        inherit pkgs;
        modules = [ module ];
        # Path to the cloned dotfiles checkout — passed in so the
        # modules can symlink shared configs from the same repo.
        extraSpecialArgs = {
          dotfilesRoot = ../.;
        };
      };
    in
    {
      homeConfigurations = {
        vm   = mkProfile ./vm.nix;
        host = mkProfile ./host.nix;
      };
    };
}