-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
133 lines (111 loc) · 3.89 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
# SPDX-License-Identifier: MIT
# Copyright (c) 2021, 2022, 2023 Chua Hou
{
inputs = {
nixpkgs = { url = "nixpkgs/nixos-24.11"; };
nixpkgs-prev = { url = "nixpkgs/nixos-23.11"; };
nixpkgs-unstable = { url = "nixpkgs/nixpkgs-unstable"; };
nixos-hardware = { url = "github:NixOS/nixos-hardware"; };
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
impermanence = { url = "github:nix-community/impermanence"; };
# zsh-vim-mode plugin
zsh-vim-mode = { url = "github:softmoth/zsh-vim-mode"; flake = false; };
# latex.sty styles
latex-sty = { url = "github:chuahou/latex.sty"; flake = false; };
# nix-index database
nix-index-database = { url = "github:Mic92/nix-index-database"; };
# secure boot
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.3.0";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
overlays = with inputs; {
# Nix helper functions.
helpers = import pkgs/helpers.nix;
zsh-vim-mode = self: super: {
zsh-vim-mode = { name = "zsh-vim-mode"; src = zsh-vim-mode; };
};
# Enable fenced syntax for vim-nix.
vim-nix-fenced-syntax = self: super: {
vimPlugins = super.vimPlugins // {
vim-nix = super.vimPlugins.vim-nix.overrideAttrs (old: {
patches = (old.patches or []) ++ [
./pkgs/vim-nix.patch # Modified from #28 to resolve conflicts.
];
});
};
};
# Packages to overlay from other branches to avoid bugs and the like.
nixpkgs-branches = self: super:
let
prev = import nixpkgs-prev { inherit (super) config system; };
unstable = import nixpkgs-unstable { inherit (super) config system; };
in {
ibus-engines = super.ibus-engines // {
inherit (prev.ibus-engines) mozc;
};
inherit (prev) ibus-with-plugins;
inherit (unstable) joplin-desktop fzf;
};
};
in {
# Forward inputs for easier debugging. To access each input simply use
# .#inputs.[input].
inherit inputs;
# Hosts to generate configs over.
hosts = [ "CH-23" ];
nixosConfigurations =
let
base = {
inherit system;
modules = [
# enable nix flakes
({ ... }: {
nix.extraOptions = "experimental-features = nix-command flakes";
})
# nixpkgs configuration
({ ... }: {
nixpkgs = {
overlays = builtins.attrValues overlays;
config.allowUnfree = true;
};
})
# main NixOS configuration
(import ./nixos)
# impermanence opt-in persistence
inputs.impermanence.nixosModules.impermanence
# home-manager
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
users.user = import ./home;
};
}
];
specialArgs = { inherit inputs; };
};
in
builtins.listToAttrs (builtins.map (host: {
name = host;
value = nixpkgs.lib.nixosSystem (base // {
modules = (base.modules or []) ++ [ (import ./nixos/${host}) ];
});
}) self.hosts);
};
}