nixos-config/flake.nix

202 lines
6.1 KiB
Nix
Raw Normal View History

2024-07-30 22:56:44 +02:00
{
description = "Moe.OS";
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";
};
2024-08-16 14:11:10 +02:00
jovian.url = "github:Jovian-Experiments/Jovian-NixOS/development";
2024-08-10 15:47:04 +02:00
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-07-30 22:56:44 +02:00
};
2024-08-16 22:28:06 +02:00
# Define Outputs, import Modules
outputs =
{
nixpkgs,
home-manager,
jovian,
plasma-manager,
...
}:
2024-08-16 16:37:35 +02:00
let
2024-08-16 22:28:06 +02:00
# Define system globally since I have no aarch devices
2024-08-16 16:37:35 +02:00
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
lib = nixpkgs.lib;
2024-08-16 22:28:06 +02:00
# NixOS Modules for all hosts
2024-08-16 16:37:35 +02:00
systemModules = [
home-manager.nixosModules.home-manager
./modules/system/apps-shell
./modules/system/boot
./modules/system/devices
2024-08-16 18:27:27 +02:00
./modules/system/home-manager
2024-08-16 16:37:35 +02:00
./modules/system/locale
./modules/system/networking
./modules/system/nixsettings
./modules/system/shell
./modules/system/systemversion
./modules/system/upgrades
./modules/system/users
];
2024-08-16 22:28:06 +02:00
# Home Manager Modules for all hosts
2024-08-16 16:37:35 +02:00
userModules = [
./modules/user/git
./modules/user/homeversion
2024-08-24 12:01:23 +02:00
./modules/user/shell
2024-08-16 16:37:35 +02:00
];
2024-08-16 22:28:06 +02:00
in
{
2024-08-16 16:37:35 +02:00
nixosConfigurations = {
2024-08-16 22:28:06 +02:00
# Workstation config
# user and hostName variable inside hostConfig so we can call it in other modules
workstation =
let
user = "mo";
hostName = "workstation";
in
2024-08-16 16:37:35 +02:00
lib.nixosSystem {
specialArgs = {
2024-08-16 22:28:06 +02:00
inherit systemModules;
inherit userModules;
inherit system;
inherit user;
inherit hostName;
2024-08-16 16:37:35 +02:00
};
2024-08-16 22:28:06 +02:00
system = system;
# Device specific NixOS Modules
2024-08-16 16:37:35 +02:00
modules = systemModules ++ [
jovian.nixosModules.jovian
./hosts/${hostName}
./modules/system/apps-misc
./modules/system/browser
./modules/system/controller
2024-08-23 14:44:05 +02:00
./modules/system/jovian-konsole
2024-08-16 16:37:35 +02:00
./modules/system/lact
2024-08-24 11:09:39 +02:00
./modules/system/syncthing
2024-08-16 16:37:35 +02:00
./modules/system/plasma
./modules/system/steam
{
2024-08-16 22:28:06 +02:00
# Device specific Home Manager Modules
2024-08-16 16:37:35 +02:00
home-manager.users.${user}.imports = userModules ++ [
./modules/user/plasma
];
2024-08-16 22:28:06 +02:00
# Issue with Plasma Manager, has to be imported in a special way
2024-08-16 16:37:35 +02:00
home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
}
2024-08-16 14:43:41 +02:00
];
2024-08-16 16:37:35 +02:00
};
2024-08-16 22:28:06 +02:00
};
# Steamdeck config
# user and hostName variable inside hostConfig so we can call it in other modules
steamdeck =
let
2024-08-16 16:37:35 +02:00
user = "deck";
hostName = "steamdeck";
in
2024-08-16 22:28:06 +02:00
lib.nixosSystem {
specialArgs = {
inherit systemModules;
inherit userModules;
2024-08-16 16:37:35 +02:00
inherit system;
2024-08-16 22:28:06 +02:00
inherit user;
inherit hostName;
2024-08-16 16:37:35 +02:00
};
2024-08-16 22:28:06 +02:00
system = system;
# Device specific NixOS Modules
modules = systemModules ++ [
jovian.nixosModules.jovian
./hosts/${hostName}
./modules/system/apps-misc
./modules/system/browser
./modules/system/controller
./modules/system/jovian-${hostName}
./modules/system/lact
./modules/system/plasma
./modules/system/steam
2024-08-24 11:09:39 +02:00
./modules/system/syncthing
2024-08-16 22:28:06 +02:00
{
# Device specific Home Manager Modules
home-manager.users.${user}.imports = userModules ++ [
./modules/user/plasma
];
# Issue with Plasma Manager, has to be imported in a special way
home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
}
];
};
2024-08-24 11:05:33 +02:00
konsole =
let
user = "deck";
hostName = "konsole";
in
lib.nixosSystem {
specialArgs = {
inherit systemModules;
inherit userModules;
inherit system;
inherit user;
inherit hostName;
};
system = system;
# Device specific NixOS Modules
modules = systemModules ++ [
jovian.nixosModules.jovian
./hosts/${hostName}
./modules/system/apps-misc
./modules/system/browser
./modules/system/controller
./modules/system/jovian-${hostName}
./modules/system/lact
./modules/system/plasma
./modules/system/steam
2024-08-24 11:09:39 +02:00
./modules/system/syncthing
2024-08-24 11:05:33 +02:00
{
# Device specific Home Manager Modules
home-manager.users.${user}.imports = userModules ++ [
./modules/user/plasma
];
# Issue with Plasma Manager, has to be imported in a special way
home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
}
];
};
2024-08-24 12:18:11 +02:00
server =
let
user = "administrator";
hostName = "server";
in
lib.nixosSystem {
specialArgs = {
inherit systemModules;
inherit userModules;
inherit system;
inherit user;
inherit hostName;
};
system = system;
# Device specific NixOS Modules
modules = systemModules ++ [
./hosts/${hostName}
./modules/docker
./modules/system/syncthing
{
# Device specific Home Manager Modules
home-manager.users.${user}.imports = userModules ++ [
];
# Issue with Plasma Manager, has to be imported in a special way
home-manager.sharedModules = [];
}
];
};
2024-07-30 22:56:44 +02:00
};
}