-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
141 lines (128 loc) · 3.76 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
description = "ozwaldorf's flake";
inputs = {
# Nix libraries
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
carburetor = {
url = "github:ozwaldorf/carburetor";
};
# Applications
ags = {
url = "github:ozwaldorf/ags";
inputs.nixpkgs.follows = "nixpkgs";
};
wezterm = {
url = "github:wez/wezterm?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# lutgen = {
# url = "github:ozwaldorf/lutgen-rs";
# inputs.nixpkgs.follows = "nixpkgs";
# };
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# hyprland {
# url = "github:vaxry/hyprland";
# inputs.nixpkgs.follows = "nixpkgs";
# };
};
nixConfig = {
extra-substituters = [ "https://cache.garnix.io" ];
extra-trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
};
outputs =
{
self,
nixpkgs,
home-manager,
...
}@inputs:
let
# Nixos system variables
hostname = "onix";
username = "oz";
# Absolute path to the directory containing this flake.
# Used for creating "out of store" symlinks. For example, mostly
# in order to allow in-app setting changes to modify the flake.
flakeDirectory = "/etc/nixos";
# Flake utilities
overlay = import ./pkgs inputs;
pkgsFor =
system:
import nixpkgs {
inherit system;
overlays = [
inputs.neovim-nightly-overlay.overlays.default
overlay
# inputs.lutgen.overlays.default
inputs.carburetor.overlays.insert
(final: prev: {
# Force insert flake packages that dont have builtin overlays.
ags = inputs.ags.packages.${prev.system}.default;
# wezterm = inputs.wezterm.packages.${prev.system}.default;
})
];
config.allowUnfree = true;
};
forAllSystems =
f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: f (pkgsFor system));
in
{
# Full nixos system and home configuration
nixosConfigurations = {
${hostname} = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
inherit
inputs
system
username
hostname
flakeDirectory
;
pkgs = pkgsFor system;
homeDirectory = "/home/" + username;
};
modules = [
# System level config
./system/configuration.nix
# User level config
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = specialArgs;
users.${username} = import ./home;
};
}
# Modules
home-manager.nixosModules.home-manager
];
};
};
# Flake outputs
overlays.default = overlay;
packages = forAllSystems (
pkgs: (pkgs.lib.attrsets.getAttrs (builtins.attrNames (self.overlays.default null null)) pkgs)
);
# `nix run` for a standalone headless environment starting with zsh
apps = forAllSystems (pkgs: {
default = {
type = "app";
program = "${pkgs.standalone}/bin/zsh";
};
});
# `nix fmt`
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
};
}