-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
81 lines (74 loc) · 2.98 KB
/
flake.nix
File metadata and controls
81 lines (74 loc) · 2.98 KB
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
{
description = "NixOS Configuration";
inputs = {
# NixOS official package source, using the nixos-unstable branch here
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
# The `follows` keyword in inputs is used for inheritance.
# Here, `inputs.nixpkgs` of home-manager is kept consistent with
# the `inputs.nixpkgs` of the current flake,
# to avoid problems caused by different versions of nixpkgs.
inputs.nixpkgs.follows = "nixpkgs";
};
flatpaks.url = "github:in-a-dil-emma/declarative-flatpak/latest";
matugen.url = "github:/InioX/Matugen";
swww.url = "github:LGFae/swww";
vhs-decode = {
url = "github:JuniorIsAJitterbug/nur-packages";
# inputs.nixpkgs.follows = "nixpkgs";
};
nix-snapd = {
url = "github:nix-community/nix-snapd";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixos-hardware, nix-index-database, home-manager, flatpaks, nix-snapd, rust-overlay, vhs-decode, ... }@inputs:
let
util = import ./util inputs;
specialArgs = inputs // { util = util; };
hosts = util.subdirectoriesOf ./hosts;
users = util.subdirectoriesOf ./users;
in {
nixosConfigurations = nixpkgs.lib.genAttrs hosts (hostname:
nixpkgs.lib.nixosSystem {
# pass all inputs to submodules
specialArgs = specialArgs;
modules = [
{ networking.hostName = hostname; }
# Import the previous configuration.nix we used,
# so the old configuration file still takes effect
./common
./hosts/${hostname}
# make home-manager as a module of nixos
# so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch`
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users = nixpkgs.lib.genAttrs users (username: import ./users/${username} );
home-manager.extraSpecialArgs = specialArgs;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to home.nix
}
nix-index-database.nixosModules.default
vhs-decode.outputs.nixosModules.default
flatpaks.nixosModules.default
nix-snapd.nixosModules.default
({ pkgs, ... }: {
nixpkgs.overlays = [ rust-overlay.overlays.default ];
environment.systemPackages = [ pkgs.rust-bin.stable.latest.default ];
})
];
}
);
};
}