generated from nix-dot-dev/getting-started-devenv-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
55 lines (47 loc) · 1.97 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
{
description = "NixOS configs for my machines";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Home manager
home-manager.url = "github:nix-community/home-manager/";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# NixOS profiles to optimize settings for different hardware
hardware.url = "github:nixos/nixos-hardware";
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: let
inherit (self) outputs;
# Function for NixOS system configuration
nixosSystemFor = hostname: configurationFile:
nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [configurationFile];
};
# Function for Home Manager configuration
homeManagerFor = user: hostname: {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [./home/${user}/${hostname}.nix];
};
in {
nixosConfigurations = {
joonas-linux = nixosSystemFor "joonas-linux" ./hostnames/joonas-linux/configuration.nix;
matebook = nixosSystemFor "matebook" ./hostnames/matebook/configuration.nix;
work = nixosSystemFor "work" ./hostnames/work/configuration.nix;
tikinas = nixosSystemFor "tikinas" ./hostnames/tikinas/configuration.nix;
homeassistant = nixosSystemFor "homeassistant" ./hostnames/homeassistant/configuration.nix;
};
homeConfigurations = {
"joonas@joonas-linux" = home-manager.lib.homeManagerConfiguration (homeManagerFor "joonas" "joonas-linux");
"joonas@matebook" = home-manager.lib.homeManagerConfiguration (homeManagerFor "joonas" "matebook");
"joonas@work" = home-manager.lib.homeManagerConfiguration (homeManagerFor "joonas" "work");
"joonas@tikinas" = home-manager.lib.homeManagerConfiguration (homeManagerFor "joonas" "tikinas");
"joonas@homeassistant" = home-manager.lib.homeManagerConfiguration (homeManagerFor "joonas" "homeassistant");
};
};
}