-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
flake.nix
96 lines (91 loc) · 3.03 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager }:
let
username = "athena";
theme = "temple";
desktop = "gnome";
dmanager = "gdm";
mainShell = "fish";
terminal = "kitty";
browser = "firefox";
bootloader = if builtins.pathExists "/sys/firmware/efi" then "systemd" else "grub";
mkSystem = extraModules:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ lib, pkgs, config, ...}: let
hostname = "athenaos";
hashed = "$6$zjvJDfGSC93t8SIW$AHhNB.vDDPMoiZEG3Mv6UYvgUY6eya2UY5E2XA1lF7mOg6nHXUaaBmJYAMMQhvQcA54HJSLdkJ/zdy8UKX3xL1";
hashedRoot = "$6$zjvJDfGSC93t8SIW$AHhNB.vDDPMoiZEG3Mv6UYvgUY6eya2UY5E2XA1lF7mOg6nHXUaaBmJYAMMQhvQcA54HJSLdkJ/zdy8UKX3xL1";
in {
networking.hostName = "${hostname}";
users = lib.mkIf config.athena.enable {
mutableUsers = false;
extraUsers.root.hashedPassword = "${hashedRoot}";
users.${config.athena.homeManagerUser} = {
shell = pkgs.${config.athena.mainShell};
isNormalUser = true;
hashedPassword = "${hashed}";
extraGroups = [ "wheel" "input" "video" "render" "networkmanager" ];
};
};
})
] ++ extraModules;
};
in {
nixosConfigurations = {
# nix build .#nixosConfigurations.live-image.config.system.build.isoImage
"live-image" = mkSystem [
./nixos/installation/iso.nix
home-manager.nixosModules.home-manager
./nixos
{
athena = {
enable = true;
baseHosts = true;
baseLocale = true;
homeManagerUser = "athena";
desktopManager = "mate";
terminal = "alacritty";
theme = "graphite";
};
}
];
"runtime" = mkSystem [
"/etc/nixos/hardware-configuration.nix"
home-manager.nixosModules.home-manager
./nixos
{
athena = {
inherit bootloader terminal theme mainShell browser;
enable = true;
baseConfiguration = true;
baseSoftware = true;
baseLocale = true;
homeManagerUser = username;
desktopManager = desktop;
displayManager = dmanager;
};
}
];
"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";
};
nixosModules = rec {
athena = ./nixos;
default = athena;
};
};
}