-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
136 lines (120 loc) · 4.36 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
{
description = "My NixOS configurations IaC";
inputs = {
# nixpkgs and unstable
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# flake-parts - very lightweight flake framework
# https://flake.parts
flake-parts.url = "github:hercules-ci/flake-parts";
# home-manager - home user modules
# https://github.com/nix-community/home-manager
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# sops-nix - secrets with `sops`
# https://github.com/Mic92/sops-nix
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Disko - declarative disk partitioning and formatting
# https://github.com/nix-community/disko
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# NUR - Nix User Repository
# https://github.com/nix-community/NUR
nur.url = "github:nix-community/NUR";
# nvfetcher - tool to automate nix packages updates
# https://github.com/berberman/nvfetcher
nvfetcher = {
url = "github:berberman/nvfetcher";
inputs.nixpkgs.follows = "nixpkgs";
};
# nixvim - Neovim distribution built around Nix modules
# https://github.com/nix-community/nixvim
nixvim = {
url = "github:nix-community/nixvim/nixos-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# Talhelper - A tool to help creating Talos Kubernetes cluster
# https://github.com/budimanjojo/talhelper
talhelper = {
url = "github:budimanjojo/talhelper";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# Catppuccin for Nix - Soothing pastel theme for Nix
# https://github.com/catppuccin/nix
catppuccin.url = "github:catppuccin/nix";
# nixGL - A wrapper tool for nix OpenGL application
# https://github.com/nix-community/nixGL
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ flake-parts, ... }@inputs:
let
# function to make `pkgs` for defined system with my overlays
mkPkgsWithSystem =
system:
import inputs.nixpkgs {
inherit system;
overlays = builtins.attrValues (import ./overlays { inherit inputs; });
config = {
allowUnfree = true;
allowUnfreePredicate = _: true;
};
};
flakeLib = import ./flakeLib.nix { inherit inputs mkPkgsWithSystem; };
in
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
# systems for which you want to build the `perSystem` attributes
systems = [ "x86_64-linux" ];
# everything below `perSystem` will be enumerated and have `${system}`
# added in the middle by `flake-parts`
perSystem =
{
system,
inputs',
self',
pkgs,
...
}:
{
# override pkgs used by everything in `perSystem` to have my overlays
_module.args.pkgs = mkPkgsWithSystem system;
# accessible via `nix fmt` to format code
formatter = pkgs.nixfmt-rfc-style;
# accessible via `nix build .#<name>`
legacyPackages = import ./packages { inherit inputs' self' pkgs; };
# accessible via `nix develop`
devShells.default = import ./shell.nix { inherit inputs' pkgs; };
};
# all the other flake outputs those don't require `${system}`
# string will be here and handled by `flake-parts`
flake = {
nixosConfigurations = {
# this is a NixOS live CD that has SSH enabled and some of my stuffs baked in
# build with `nix build .#nixosConfigurations.livecd.config.system.build.isoImage`
nixos-livecd = flakeLib.mkSystem {
hostname = "nixos-livecd";
homeUsers = [ ];
baseModules = [ ./system/hosts ];
};
budimanjojo-main = flakeLib.mkSystem { hostname = "budimanjojo-main"; };
budimanjojo-nas = flakeLib.mkSystem {
hostname = "budimanjojo-nas";
extraModules = [ inputs.disko.nixosModules.disko ];
};
};
homeConfigurations = {
"budiman@budimanjojo-ubuntu" = flakeLib.mkHome { hostname = "budimanjojo-ubuntu"; };
};
};
};
}