-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
102 lines (92 loc) · 3.44 KB
/
flake.nix
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
description = "dotfiles";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
# nixpkgs.url = github:nixos/nixpkgs/nixpkgs-21.11-darwin;
darwin = {
url = github:lnl7/nix-darwin/master;
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
neovim.url = github:nix-community/neovim-nightly-overlay;
flake-utils.url = github:numtide/flake-utils;
nur.url = github:nix-community/NUR;
kitty.url = github:kovidgoyal/kitty;
kitty.flake = false;
};
outputs = { nixpkgs, darwin, home-manager, neovim, kitty, ... } @ inputs:
let
union = z: s: z ++ builtins.filter (e: !builtins.elem e z) s;
kittyOverlay = self: super: {
kitty = super.kitty.overrideAttrs ( old:
let
kittyShell = super.callPackage "${kitty}/shell.nix" {}; # is this safe? who knows
in {
name = "${old.name}-nightly"; # this should always be kitty-nightly but whatever
version = "${old.version}-nightly"; # eventually I'd like to generate this from kitty/constants.py:25
src = kitty;
# this could pottentially lead to a few unnecessary inputs but considering
# my alternative way of installing kitty is just using nix-shell I'd be
# building them anyway
buildInputs = union old.buildInputs kittyShell.buildInputs;
nativeBuildInputs = union old.nativeBuildInputs kittyShell.nativeBuildInputs;
propagatedBuildInputs = union old.propagatedBuildInputs kittyShell.propagatedBuildInputs;
# can't just add this here, changes to the build phase are needed
# outputs = union old.outputs ["shell_integration"]; # nixpkgs#153999
# https://github.com/NixOS/nixpkgs/pull/153999
});
};
nixpkgsConfig = {
config.allowUnfree = true;
overlays = [ neovim.overlay kittyOverlay ];
};
homeManagerConfig =
{ user, userConfig ? ./home + "/user-${user}.nix", ... }: {
imports = [ userConfig ./home ];
};
mkDarwinModules =
{ user, host, hostConfig ? ./config + "/host-${host}.nix", ... } @ args: [
home-manager.darwinModules.home-manager
{
nix.nixPath = {
inherit nixpkgs darwin;
darwin-config = ./config/darwin.nix;
};
nixpkgs = nixpkgsConfig;
}
./config/darwin.nix
# hostConfig
{
users.users.${user}.home = "/Users/${user}";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = homeManagerConfig args;
}
];
in
{
darwinConfigurations = {
"harrys-mbp" = darwin.lib.darwinSystem {
system = "x86_64-darwin";
inputs = { inherit darwin nixpkgs; };
modules = mkDarwinModules {
user = "harry";
host = "harrys-mbp";
};
};
};
# this is only here because I stole this file from someone else
# maybe in the future I'll use it
overlays =
let path = ./overlays; in
with builtins;
map (n: import (path + ("/" + n))) (filter
(n:
match ".*\\.nix" n != null
|| pathExists (path + ("/" + n + "/default.nix")))
(attrNames (readDir path)));
};
}