-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
150 lines (126 loc) · 4.03 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
142
143
144
145
146
147
148
149
150
{
description = "GGORG's Nix configuration";
inputs = {
# Principle inputs (updated by `nix run .#update`)
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Management of this flake
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-unified.url = "github:srid/nixos-unified";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Rust managed by Nix
rust-overlay.url = "github:oxalica/rust-overlay";
# Neovim managed by Nix
nixvim = {
url = "github:nix-community/nixvim";
# inputs.nixpkgs.follows = "nixpkgs"; # https://github.com/nix-community/nixvim/issues/1699
};
# Run non-NixOS, dynamically compiled programs easily
nix-alien.url = "github:thiagokokada/nix-alien";
# Find which package has a file in it
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
imports = [
inputs.nixos-unified.flakeModule
inputs.pre-commit-hooks.flakeModule
];
perSystem =
{ self'
, config
, pkgs
, ...
}: {
packages.default = self'.packages.activate;
formatter = pkgs.nixpkgs-fmt;
pre-commit.settings = {
hooks = {
nixpkgs-fmt.enable = true;
statix.enable = true;
deadnix.enable = true;
nil.enable = true;
};
};
devShells.default = pkgs.mkShell {
shellHook = ''
${config.pre-commit.installationScript}
'';
packages = with pkgs; [
nixpkgs-fmt # formatter
statix # linter
deadnix # scan for dead code
nil # language server
];
};
};
flake =
let
username = "ggorg";
stateVersion = "24.05";
mkNixosSystem =
{ hostname
, hostPlatform
,
}:
self.nixos-unified.lib.mkLinuxSystem { home-manager = true; } {
nixpkgs = {
inherit hostPlatform;
config.allowUnfree = true;
};
system = {
inherit stateVersion;
};
networking.hostName = hostname;
imports = [
./hosts/${hostname}/configuration.nix
./nixosModules
{
home-manager = {
users.${username} = {
home = {
inherit stateVersion;
};
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
nixpkgs.config = {
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
imports = [
./hosts/${hostname}/home.nix
./homeModules
];
};
useGlobalPkgs = true;
useUserPackages = true;
};
}
];
};
in
{
nixosConfigurations = {
ggorg-elitebook = mkNixosSystem {
hostname = "ggorg-elitebook";
hostPlatform = "x86_64-linux";
};
ggorg-x1tablet = mkNixosSystem {
hostname = "ggorg-x1tablet";
hostPlatform = "x86_64-linux";
};
};
};
};
}