122 lines
3.5 KiB
Nix
122 lines
3.5 KiB
Nix
{
|
|
description = "Droidnix: A dendritic NixOS + Home Manager configuration";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
emacs-overlay = {
|
|
url = "github:nix-community/emacs-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
catppuccin = {
|
|
url = "github:catppuccin/nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
zen-browser = {
|
|
url = "github:youwen5/zen-browser-flake";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
hyprland.url = "github:hyprwm/Hyprland";
|
|
};
|
|
|
|
outputs =
|
|
inputs@{
|
|
self,
|
|
nixpkgs,
|
|
home-manager,
|
|
emacs-overlay,
|
|
catppuccin,
|
|
zen-browser,
|
|
hyprland,
|
|
...
|
|
}:
|
|
let
|
|
lib = nixpkgs.lib;
|
|
system = "x86_64-linux";
|
|
user = import ./assets/flake/users/henrov.nix;
|
|
machines = [
|
|
"traveldroid"
|
|
"maindroid"
|
|
];
|
|
in
|
|
{
|
|
nixosConfigurations = lib.genAttrs machines (
|
|
machine:
|
|
lib.nixosSystem {
|
|
inherit system;
|
|
modules = [
|
|
# Import machine-specific configurations
|
|
./assets/flake/machines/${machine}/top.nix
|
|
|
|
# Home Manager module
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.useGlobalPkgs = true;
|
|
home-manager.useUserPackages = true;
|
|
home-manager.extraSpecialArgs = {
|
|
inherit user inputs;
|
|
flakeRoot = ./.;
|
|
};
|
|
}
|
|
|
|
# Catppuccin theme module
|
|
inputs.catppuccin.nixosModules.catppuccin
|
|
|
|
# Anchoring all the other nixes
|
|
./generated/top.nix
|
|
|
|
# Enable Home Manager for the user
|
|
(
|
|
{ config, pkgs, ... }:
|
|
{
|
|
home-manager.users.${user.username} = {
|
|
enable = true;
|
|
homeDirectory = "/home/${user.username}";
|
|
};
|
|
systemd.users.services."home-manager-${user.username}" = {
|
|
description = "Home Manager service for ${user.username}";
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig.Type = "oneshot";
|
|
serviceConfig.RemainAfterExit = true;
|
|
serviceConfig.ExecStart = "${pkgs.home-manager}/bin/home-manager switch --flake ${self}#${user.username}@${machine}";
|
|
};
|
|
}
|
|
)
|
|
];
|
|
specialArgs = {
|
|
inherit user inputs;
|
|
flakeRoot = ./.;
|
|
};
|
|
}
|
|
);
|
|
|
|
# Home Manager configurations for each user/machine
|
|
homeConfigurations = lib.genAttrs (map (machine: user.username + "@" + machine) machines) (
|
|
userMachine:
|
|
let
|
|
parts = lib.splitString "@" userMachine;
|
|
username = builtins.elemAt parts 0;
|
|
machine = builtins.elemAt parts 1;
|
|
in
|
|
home-manager.lib.homeManagerConfiguration {
|
|
inherit system;
|
|
configuration = import ./assets/flake/users/${username}/home.nix {
|
|
inherit inputs user;
|
|
pkgs = import nixpkgs { inherit system; };
|
|
};
|
|
extraSpecialArgs = {
|
|
inherit user inputs;
|
|
flakeRoot = ./.;
|
|
};
|
|
}
|
|
);
|
|
|
|
devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix {
|
|
inherit (nixpkgs.legacyPackages.${system}) mkShell;
|
|
};
|
|
};
|
|
}
|