-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
187 lines (175 loc) · 5.95 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
{
description = "My personnal configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
my-dotfiles = {
url = "github:adfaure/dotfiles";
# url = "/home/adfaure/code/dotfiles";
# It is possible to pin the revision with:
# To be fully reproducible, I can pin my repos
# "github:/adfaure/dotfiles?rev=602790e25de91ae166c10b93735bbaea667f7a49";
flake = false;
};
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim-config.url = "github:adfaure/nixvim-config";
catppuccin.url = "github:catppuccin/nix/a48e70a31616cb63e4794fd3465bff1835cc4246";
};
outputs = inputs @ {
self,
nixpkgs,
nixos-unstable,
my-dotfiles,
home-manager,
catppuccin,
nixvim-config,
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ ];
};
unstable = import nixos-unstable {
inherit system;
config.allowUnfree = true;
overlays = [];
};
in {
packages.${system} = rec {
# Programs
cgvg = pkgs.callPackage ./pkgs/cgvg {};
myVscode = unstable.callPackage ./pkgs/vscode {};
simplematch = pkgs.callPackage ./pkgs/simplematch {};
ExifRead = pkgs.callPackage ./pkgs/exifread {};
organize = pkgs.callPackage ./pkgs/organize {inherit simplematch ExifRead;};
obsidian-nvim = pkgs.callPackage ./pkgs/obsidian-nvim {};
cgvg-rs = pkgs.callPackage ./pkgs/rgvg {};
nix = unstable.nix;
};
# Separated home-manager config for non-nixos machines.
# Activate with: home-manager --flake .#adfaure switch
homeConfigurations = let
home-module = {
nixpkgs.overlays = [self.overlays.default];
nixpkgs.config.allowUnfree = true;
home = rec {
username = "adfaure";
homeDirectory = "/home/${username}";
stateVersion = "20.09";
};
};
extraSpecialArgs = {
inherit my-dotfiles home-module unstable nixvim-config system;
};
in {
# Include programs that need X or wayland
graphical = home-manager.lib.homeManagerConfiguration {
inherit extraSpecialArgs pkgs;
modules = [
home-module
catppuccin.homeManagerModules.catppuccin
./homes/graphical.nix
./homes/base.nix
];
};
# Can be use in VPS for instance without graphical installation
base = home-manager.lib.homeManagerConfiguration {
inherit extraSpecialArgs;
modules = [
home-module
./homes/base.nix
];
};
wsl = home-manager.lib.homeManagerConfiguration {
inherit extraSpecialArgs;
pkgs = unstable;
modules = [
home-module
./homes/wsl.nix
];
};
};
# Overlay to inject my packages in the different modules
overlays.default = final: prev: {
cgvg = self.packages.${system}.cgvg;
myVscode = self.packages.${system}.myVscode;
organize = self.packages.${system}.organize;
nixFlakes = self.packages.${system}.nix;
obsidian-nvim = self.packages.${system}.obsidian-nvim;
cgvg-rs = self.packages.${system}.cgvg-rs;
};
nixosModules.overlay = {...}: {
nixpkgs.overlays = [self.overlays.default];
};
nixosConfigurations = {
gouttelette = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit my-dotfiles;};
modules = [
self.nixosModules.overlay
# Main configuration, includes the hardware file and the module list
./deployments/configuration-gouttelette.nix
];
};
# Simple VM so I don't need to reboot when I am experimenting
# nix build .#'nixosConfigurations.vm.config.system.build.vm' ; ./result/bin/run-nixos-vm
vm = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit my-dotfiles catppuccin nixvim-config;};
modules = [
# My overlay
self.nixosModules.overlay
# Import home-manager module
home-manager.nixosModules.home-manager
# top level module for this configuration
({
modulesPath,
...
}: {
imports = [(modulesPath + "/virtualisation/qemu-vm.nix")];
nixpkgs.hostPlatform = "x86_64-linux";
virtualisation.memorySize = 4096;
virtualisation.cores = 4;
hardware.pulseaudio = {
enable = false;
# NixOS allows either a lightweight build (default) or full build of PulseAudio to be installed.
# Only the full build has Bluetooth support, so it must be selected here.
package = pkgs.pulseaudioFull;
extraModules = [];
extraConfig = ''
load-module module-udev-detect ignore_dB=1
'';
};
})
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.adfaure = {...}: {
imports = [
catppuccin.homeManagerModules.catppuccin
./homes/graphical.nix
./homes/base.nix
];
};
home-manager.extraSpecialArgs = {
inherit catppuccin unstable my-dotfiles nixvim-config system;
};
}
# Default linux configuration: users, fonts etc
nixos/profiles/common
# Server X configuration, also activate i3
nixos/profiles/graphical
];
};
};
formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra;
checks.${system} = builtins.listToAttrs (map (name: {
name = name;
value = self.packages.${system}.${name};
}) (builtins.attrNames self.packages.${system}));
};
}