-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
80 lines (79 loc) · 2.38 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
{
description = "My NixOS flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
# nixpkgs-23.url = "github:NixOS/nixpkgs/nixos-23.11";
# Unstable
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# HomeManager
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
# NUR
nur = {
url = "github:nix-community/NUR";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, nur, ... }@inputs:
let
system = "x86_64-linux";
# Packages Setting
pkg-settings = import ./settings/pkgs-settings.nix {
inherit nixpkgs;
inherit system;
inherit nixpkgs-unstable;
inherit nur;
};
# Host Config
hosts-conf = import ./settings/hosts-conf.nix { inherit pkg-settings; };
# Generate Function
system-gen = {host-conf}: with pkg-settings; nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit allowed-unfree-packages;
inherit allowed-insecure-packages;
opt-config = host-conf.config;
hostname = host-conf.name;
inherit custom-pkgs;
};
modules = [
# Add NUR
{ nixpkgs.overlays = [ nur.overlay ]; }
# Add Unstable Nixpkg
({
nixpkgs.overlays = [
(final: prev: {
unstable = unstable-pkgs;
})
];
})
# System Configuration
./system/configuration.nix
# User's Services
./user/services/default.nix
# Home Manager
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${host-conf.config.username} = import ./user/home;
home-manager.extraSpecialArgs = {
inherit inputs;
opt-config = host-conf.config;
inherit modify-pkgs;
inherit custom-pkgs;
};
}
];
};
in
{
# Main Config Fuction
nixosConfigurations = with hosts-conf;{
# "${Default-conf.name}" = system-gen { host-conf = Default-conf; };
"${ThinkPad-X230.name}" = system-gen { host-conf = ThinkPad-X230; };
"${MAXSUN-b450m.name}" = system-gen { host-conf = MAXSUN-b450m; };
"${ASUSTek.name}" = system-gen { host-conf = ASUSTek; };
};
};
}