forked from mrkuz/nixos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
118 lines (112 loc) · 3.96 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
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:rycee/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# nixpkgs-wayland.url = "github:colemickens/nixpkgs-wayland";
# nixpkgs-wayland.inputs.nixpkgs.follows = "nixpkgs";
# nixos-hardware.url = "github:NixOS/nixos-hardware/master";
emacs-overlay.url = "github:nix-community/emacs-overlay";
nix-alien = {
url = "github:thiagokokada/nix-alien";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
dotfiles = {
# url = "github:mrkuz/dotfiles";
url = "/home/markus/etc/nixos/repos/dotfiles";
flake = false;
};
credentials = {
url = "/home/markus/etc/nixos/repos/credentials";
flake = false;
};
};
outputs = { self, nixpkgs, nixos-generators, ... } @ inputs:
let
vars = {
stateVersion = "22.05";
emacs = "emacsPgtkNativeComp";
};
mkPkgs = system: import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
inputs.nix-alien.overlay
inputs.emacs-overlay.overlay
# inputs.nixpkgs-wayland.overlay
(import ./overlays/applications/networking/browsers/chromium)
(import ./overlays/tools/package-management/nix)
(import ./overlays/desktops/gnome/core/gnome-terminal)
(import ./overlays/desktops/gnome/core/nautilus)
];
};
mkNixOSModules = name: system: [
{
nixpkgs.pkgs = mkPkgs system;
_module.args.nixpkgs = nixpkgs;
_module.args.self = self;
_module.args.inputs = inputs;
_module.args.credentials = import inputs.credentials;
_module.args.configName = name;
_module.args.vars = vars;
}
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = false;
extraSpecialArgs = { inherit inputs vars; };
};
}
(./hosts + "/${name}" + /configuration.nix)
];
setUpNixOS = name: system: nixpkgs.lib.nixosSystem {
inherit system;
modules = mkNixOSModules name system;
};
setUpDocker = name: system: nixos-generators.nixosGenerate {
inherit system;
modules = mkNixOSModules name system;
format = "docker";
};
setUpNix = name: user: system: inputs.home-manager.lib.homeManagerConfiguration {
pkgs = mkPkgs system;
modules = [
{
_module.args.nixpkgs = nixpkgs;
_module.args.inputs = inputs;
_module.args.vars = vars;
}
{
home = {
homeDirectory = "/home/${user}";
username = user;
};
}
(./users + "/${name}" + /home.nix)
];
};
in
{
nixosConfigurations."virtualbox" = setUpNixOS "virtualbox" "x86_64-linux";
nixosConfigurations."xps15@home" = setUpNixOS "xps15@home" "x86_64-linux";
defaultPackage.x86_64-linux = (mkPkgs "x86_64-linux").nix;
homeConfigurations."markus@ubuntu" = setUpNix "markus@ubuntu" "markus" "x86_64-linux";
packages.x86_64-linux."markus@ubuntu" = self.homeConfigurations."markus@ubuntu".activationPackage;
homeConfigurations."markus@chromeos" = setUpNix "markus@chromeos" "markus" "aarch64-linux";
packages.aarch64-linux."markus@chromeos" = self.homeConfigurations."markus@chromeos".activationPackage;
packages.x86_64-linux."docker" = setUpDocker "docker" "x86_64-linux";
packages.x86_64-linux."docker-desktop" = setUpDocker "docker-desktop" "x86_64-linux";
# packages.x86_64-linux.? = ((mkPkgs "x86_64-linux").callPackage pkgs/? { });
};
}