nixos-config/flake.nix

151 lines
4.9 KiB
Nix
Raw Permalink Normal View History

2024-07-30 22:56:44 +02:00
{
description = "Moe.OS";
2024-08-28 19:10:11 +02:00
2024-08-16 22:28:06 +02:00
# Define Inputs
2024-07-30 22:56:44 +02:00
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
2024-08-10 15:47:04 +02:00
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
plasma-manager = {
2024-08-11 13:47:17 +02:00
url = "github:nix-community/plasma-manager/trunk";
2024-08-10 15:47:04 +02:00
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
2024-10-12 12:10:49 +02:00
jovian.url = "github:Jovian-Experiments/Jovian-NixOS/development";
2024-09-06 10:50:16 +02:00
agenix.url = "github:ryantm/agenix";
2024-10-12 13:12:47 +02:00
nur.url = "github:nix-community/NUR";
2024-07-30 22:56:44 +02:00
};
2024-10-12 13:12:47 +02:00
outputs = { nixpkgs, home-manager, plasma-manager, jovian, nur, ... }:
2024-08-28 19:10:11 +02:00
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
lib = nixpkgs.lib;
2024-08-30 21:34:02 +02:00
# External Modules
2024-08-31 11:54:39 +02:00
externalSystemModules = [
home-manager.nixosModules.home-manager
jovian.nixosModules.jovian
2024-10-12 13:12:47 +02:00
nur.nixosModules.nur
2024-08-31 11:54:39 +02:00
];
externalUserModules = [ plasma-manager.homeManagerModules.plasma-manager ];
2024-08-30 21:34:02 +02:00
# System Module groups
2024-09-08 00:00:11 +02:00
baseSystemModules = hostName:[
./hosts/${hostName}
2024-08-30 21:34:02 +02:00
./modules/system/apps-shell
./modules/system/boot
./modules/system/devices
./modules/system/home-manager
./modules/system/locale
./modules/system/networking
./modules/system/nixsettings
./modules/system/shell
2024-08-30 22:18:24 +02:00
./modules/system/ssh
2024-08-30 21:34:02 +02:00
./modules/system/systemversion
./modules/system/upgrades
./modules/system/users
];
2024-09-08 00:00:11 +02:00
desktopSystemModules = hostName:[
2024-08-30 21:34:02 +02:00
./modules/system/apps-misc
./modules/system/browser
2024-10-11 19:25:32 +02:00
./modules/system/plasma
2024-10-12 13:20:35 +02:00
./modules/system/plasma-nur
2024-08-30 21:34:02 +02:00
];
displaySystemModules = [
2024-10-11 19:25:32 +02:00
./modules/system/sddm
2024-08-30 21:34:02 +02:00
];
2024-09-08 00:00:11 +02:00
gamingSystemModules = hostName:[
2024-08-30 21:34:02 +02:00
./modules/system/controller
2024-09-08 00:00:11 +02:00
./modules/system/jovian-${hostName}
2024-08-30 21:34:02 +02:00
./modules/system/lact
./modules/system/steam
2024-08-28 19:10:11 +02:00
];
2024-08-30 21:34:02 +02:00
serverSystemModules = [
./modules/system/docker
];
# USER Module groups
baseUserModules = [
./modules/user/git
./modules/user/homeversion
./modules/user/shell
];
desktopUserModules = [
2024-10-11 19:25:32 +02:00
./modules/user/plasma
2024-08-28 19:10:11 +02:00
];
2024-09-06 19:36:45 +02:00
gamingUserModules = [
./modules/user/steam
];
2024-08-30 21:34:02 +02:00
serverUserModules = [];
2024-08-28 19:10:11 +02:00
in
{
nixosConfigurations = {
workstation =
let
user = "mo";
hostName = "workstation";
in
lib.nixosSystem {
2024-08-30 21:52:50 +02:00
specialArgs = {inherit user; inherit hostName; inherit system;};
2024-09-08 00:00:11 +02:00
modules = externalSystemModules ++ (baseSystemModules hostName) ++ (desktopSystemModules hostName) ++ displaySystemModules ++ (gamingSystemModules hostName) ++ [
2024-08-28 19:10:11 +02:00
{
2024-08-30 21:52:50 +02:00
home-manager.users.${user}.imports = baseUserModules ++ desktopUserModules ++ gamingUserModules ++ [
];
home-manager.extraSpecialArgs = { inherit user; inherit hostName;};
home-manager.sharedModules = externalUserModules;
}
];
};
konsole =
let
2024-10-05 00:22:16 +02:00
user = "mo";
2024-08-30 21:52:50 +02:00
hostName = "konsole";
in
lib.nixosSystem {
specialArgs = {inherit user; inherit hostName; inherit system;};
2024-09-08 00:00:11 +02:00
modules = externalSystemModules ++ (baseSystemModules hostName) ++ (desktopSystemModules hostName) ++ (gamingSystemModules hostName) ++ [
2024-08-30 21:52:50 +02:00
{
2024-09-29 14:34:34 +02:00
home-manager.users.${user}.imports = baseUserModules ++ desktopUserModules ++ gamingUserModules ++ [
2024-08-30 21:52:50 +02:00
];
home-manager.extraSpecialArgs = { inherit user; inherit hostName;};
home-manager.sharedModules = externalUserModules;
}
];
};
steamdeck =
let
user = "deck";
hostName = "steamdeck";
in
lib.nixosSystem {
specialArgs = {inherit user; inherit hostName; inherit system;};
2024-09-08 00:00:11 +02:00
modules = externalSystemModules ++ (baseSystemModules hostName) ++ (desktopSystemModules hostName) ++ (gamingSystemModules hostName) ++ [
2024-08-30 21:52:50 +02:00
{
home-manager.users.${user}.imports = baseUserModules ++ desktopUserModules ++ gamingUserModules ++ [
];
home-manager.extraSpecialArgs = { inherit user; inherit hostName;};
home-manager.sharedModules = externalUserModules;
}
];
};
server =
let
user = "administrator";
hostName = "server";
in
lib.nixosSystem {
specialArgs = {inherit user; inherit hostName; inherit system;};
2024-09-08 00:00:11 +02:00
modules = externalSystemModules ++ (baseSystemModules hostName) ++ serverSystemModules ++ [
2024-08-30 21:52:50 +02:00
{
home-manager.users.${user}.imports = baseUserModules ++ serverUserModules ++ [
2024-08-28 19:10:11 +02:00
];
2024-08-30 18:13:23 +02:00
home-manager.extraSpecialArgs = { inherit user; inherit hostName;};
2024-08-30 21:34:02 +02:00
home-manager.sharedModules = externalUserModules;
2024-08-24 12:18:11 +02:00
}
];
};
2024-07-30 22:56:44 +02:00
};
2024-08-28 19:10:11 +02:00
};
2024-07-30 22:56:44 +02:00
}