forked from Athena-OS/athena-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
89 lines (86 loc) · 3.39 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
{
# If change version variable, change inputs manually
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master"; #master or release-23.11
home-manager = {
url = "github:nix-community/home-manager/master"; #master or release-23.11
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {self, nixpkgs, home-manager}@inputs:
let
version = "unstable"; # unstable or 23.11
theme = "graphite";
desktop = "mate";
dmanager = "lightdm";
shell = "bash";
terminal = "alacritty";
browser = "firefox";
bootloader = "systemd";
mkSystem = extraModules:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
username = "athena";
hostname = "athenaos";
hashed = "$6$zjvJDfGSC93t8SIW$AHhNB.vDDPMoiZEG3Mv6UYvgUY6eya2UY5E2XA1lF7mOg6nHXUaaBmJYAMMQhvQcA54HJSLdkJ/zdy8UKX3xL1";
hashedRoot = "$6$zjvJDfGSC93t8SIW$AHhNB.vDDPMoiZEG3Mv6UYvgUY6eya2UY5E2XA1lF7mOg6nHXUaaBmJYAMMQhvQcA54HJSLdkJ/zdy8UKX3xL1";
inherit (inputs) home-manager;
}; # Using // attrs prevents the error 'infinite recursion due to home-manager usage in root default.nix
modules = let
#modulesPath = "./nixos/installation";
#modulesPathNixPkgs = "${nixpkgs}/nixos/modules"; # Accessing remote NixOS/nixpkgs modules
in
[
{
_module.args.version = version;
_module.args.theme = theme;
_module.args.dmanager = dmanager;
_module.args.desktop = desktop;
_module.args.shell = shell;
_module.args.terminal = terminal;
_module.args.browser = browser;
_module.args.bootloader = bootloader;
}
]
++ extraModules;
};
in {
nixosConfigurations = let
modulesPath = "./nixos/installation";
in {
# nix build .#nixosConfigurations.live-image.config.system.build.isoImage
"live-image" = mkSystem [
# Note that if one of the following modules need to input parameters like 'terminal' and 'shell', these are taken in the code above
./nixos/installation/iso.nix
./nixos/home-manager/desktops/mate
./nixos/home-manager/terminals/alacritty
./nixos/modules/themes/graphite
./nixos/hosts
home-manager.nixosModules.home-manager
];
"runtime" = mkSystem [
"/etc/nixos/hardware-configuration.nix"
home-manager.nixosModules.home-manager
./nixos/. # It refers to the default.nix at nixos/ directory that imports in chain all the subfolder contents containing default.nix
./nixos/hosts/software
./nixos/modules/boot/${bootloader}
./nixos/home-manager/desktops/${desktop}
./nixos/modules/dms/${dmanager}
./nixos/modules/themes/${theme}
./nixos/home-manager/terminals/${terminal}
./nixos/home-manager/browsers/${browser}
./nixos/home-manager/shells/${shell}
];
"student" = mkSystem [
"/etc/nixos/hardware-configuration.nix"
./nixos/modules/roles/student
];
};
packages."x86_64-linux" =
(builtins.mapAttrs (n: v: v.config.system.build.isoImage) self.nixosConfigurations)
// {
default = self.packages."x86_64-linux"."live-image";
};
};
}