285 lines
7.1 KiB
Plaintext
285 lines
7.1 KiB
Plaintext
Rewrite my ./generated/modules/traveldroid/desktop/stylix.nix to integrate nicely with my existing flake.nix en host.nix
|
|
Avoid infinite recursion
|
|
Just look at how to rewrite this, ignore previous interactions around this nix.
|
|
Solve the error. That is really important.
|
|
Look at hyprland.nix to see how to avoid the home error
|
|
|
|
{ lib, config, pkgs, flakeRoot, ... }:
|
|
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
moduleName = "stylix";
|
|
|
|
# Path to stylix assets
|
|
assetPath = "${flakeRoot}/assets/system/conf/${moduleName}";
|
|
|
|
# Read all files in the asset directory
|
|
programFiles = builtins.readDir assetPath;
|
|
|
|
files = lib.genAttrs (builtins.attrNames programFiles) (name: {
|
|
source = "${assetPath}/${name}";
|
|
});
|
|
|
|
# Optional stylix.conf
|
|
stylixConfFile = "${assetPath}/stylix.conf";
|
|
stylixConf =
|
|
if builtins.pathExists stylixConfFile
|
|
then builtins.readFile stylixConfFile
|
|
else "";
|
|
|
|
# Cursor defaults
|
|
cursorName = "phinger-cursors-light";
|
|
cursorSize = 24;
|
|
in
|
|
{
|
|
#################################
|
|
# System packages
|
|
#################################
|
|
environment.systemPackages = [
|
|
pkgs.feh
|
|
pkgs.st
|
|
];
|
|
|
|
#################################
|
|
# Home Manager user-level configuration
|
|
#################################
|
|
_module.args.hmUsers = {
|
|
"${username}" = {
|
|
# Copy all stylix config files into ~/.config/stylix/
|
|
home.file = lib.mkMerge (lib.mapAttrs' (name: value: {
|
|
name = "${moduleName}/${name}";
|
|
value = { inherit (value) source; };
|
|
}) files);
|
|
|
|
# Include stylix.conf if it exists
|
|
home.file."${moduleName}/stylix.conf".text = stylixConf;
|
|
|
|
# Session variables for Stylix & cursors
|
|
home.sessionVariables = {
|
|
STYLIX_CONF = "$HOME/.config/stylix/stylix.conf";
|
|
XCURSOR_THEME = cursorName;
|
|
XCURSOR_SIZE = toString cursorSize;
|
|
HYPRCURSOR_THEME = cursorName;
|
|
HYPRCURSOR_SIZE = toString cursorSize;
|
|
};
|
|
};
|
|
};
|
|
}
|
|
------------------------------------------------------------------------
|
|
{ lib, config, pkgs, flakeRoot, ... }:
|
|
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
moduleName = "stylix";
|
|
|
|
# Path to stylix assets
|
|
assetPath = ../../../assets/system/conf/${moduleName};
|
|
|
|
# Read all files in the asset directory
|
|
programFiles = builtins.readDir assetPath;
|
|
|
|
files = lib.genAttrs (builtins.attrNames programFiles) (name: {
|
|
source = "${assetPath}/${name}";
|
|
});
|
|
|
|
# Optional stylix.conf
|
|
stylixConfFile = "${assetPath}/stylix.conf";
|
|
stylixConf =
|
|
if builtins.pathExists stylixConfFile
|
|
then builtins.readFile stylixConfFile
|
|
else "";
|
|
|
|
# Cursor defaults
|
|
cursorName = "phinger-cursors-light";
|
|
cursorSize = 24;
|
|
in
|
|
{
|
|
############################
|
|
# System packages
|
|
############################
|
|
environment.systemPackages = [
|
|
pkgs.feh
|
|
pkgs.st
|
|
];
|
|
|
|
stylix = {
|
|
enable = true;
|
|
base16Scheme = "${flakeRoot}/assets/system/theming/stylix/catppuccin-mocha.yaml";
|
|
polarity = "dark";
|
|
targets = {
|
|
gtk = { enable = true; };
|
|
};
|
|
};
|
|
|
|
############################
|
|
# Home Manager user settings
|
|
############################
|
|
# Use the _module.args.hmUsers style to avoid "option does not exist"
|
|
_module.args.hmUsers = {
|
|
"${username}" = {
|
|
# Copy all stylix config files into ~/.config/stylix/
|
|
xdg.configFile =
|
|
lib.mapAttrs' (name: value: {
|
|
name = "${moduleName}/${name}";
|
|
value = { inherit (value) source; };
|
|
}) files;
|
|
|
|
# Optionally include stylix.conf
|
|
home.file."${moduleName}/stylix.conf".text = stylixConf;
|
|
|
|
# Session variables
|
|
home.sessionVariables = {
|
|
STYLIX_CONF = "$HOME/.config/stylix/stylix.conf";
|
|
|
|
XCURSOR_THEME = cursorName;
|
|
XCURSOR_SIZE = toString cursorSize;
|
|
HYPRCURSOR_THEME = cursorName;
|
|
HYPRCURSOR_SIZE = toString cursorSize;
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
flake.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";
|
|
};
|
|
|
|
import-tree.url = "github:vic/import-tree";
|
|
|
|
stylix = {
|
|
url = "github:nix-community/stylix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
zen-browser = {
|
|
url = "github:youwen5/zen-browser-flake";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
hyprland.url = "github:hyprwm/Hyprland";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, home-manager, import-tree, stylix, hyprland, zen-browser, ... }:
|
|
let
|
|
system = "x86_64-linux";
|
|
flakeRoot = self;
|
|
in {
|
|
nixosConfigurations = {
|
|
traveldroid = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
|
|
modules = [
|
|
./generated/hosts/traveldroid/host.nix
|
|
];
|
|
|
|
specialArgs = {
|
|
inherit flakeRoot;
|
|
inherit home-manager import-tree stylix hyprland zen-browser;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
host.nix
|
|
|
|
{ lib, config, pkgs, flakeRoot, import-tree, home-manager, ... }:
|
|
|
|
let
|
|
hostname = "traveldroid";
|
|
|
|
modulesPath = "${flakeRoot}/generated/modules/${hostname}";
|
|
usersPath = "${flakeRoot}/generated/users";
|
|
|
|
hostModules = import-tree modulesPath;
|
|
globalUsers = import-tree usersPath;
|
|
|
|
allModules = hostModules.imports ++ globalUsers.imports;
|
|
|
|
in
|
|
{
|
|
#################################
|
|
# Core system config
|
|
#################################
|
|
|
|
networking.hostName = hostname;
|
|
system.stateVersion = "26.05";
|
|
|
|
#################################
|
|
# Imports
|
|
#################################
|
|
|
|
imports =
|
|
[
|
|
./boot.nix
|
|
./hardware-configuration.nix
|
|
|
|
# REQUIRED for Home Manager
|
|
home-manager.nixosModules.home-manager
|
|
]
|
|
++ allModules;
|
|
|
|
#################################
|
|
# Home Manager integration
|
|
#################################
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
home-manager.useUserPackages = true;
|
|
}
|
|
|
|
|
|
hyprland.Nix
|
|
|
|
|
|
{ lib, config, pkgs, flakeRoot, home-manager, inputs, ... }:
|
|
|
|
let
|
|
username = config.defaultUser or "henrov";
|
|
assetPath = "${flakeRoot}/assets/traveldroid/conf/hypr/";
|
|
|
|
# Read all files in the asset directory
|
|
assetFiles = builtins.attrNames (builtins.readDir assetPath);
|
|
|
|
# Convert files to Home Manager xdg config entries
|
|
hyprFiles = lib.genAttrs assetFiles (f: {
|
|
# Destination path in home directory
|
|
name = ".config/hypr/${f}";
|
|
# Source file path
|
|
value = { source = "${assetPath}/${f}"; };
|
|
});
|
|
|
|
# Determine Hyprland package
|
|
hyprlandPkg =
|
|
pkgs.hyprland or
|
|
pkgs.hyprland-git or
|
|
inputs.hyprland.packages.${pkgs.system}.default;
|
|
in
|
|
{
|
|
environment.systemPackages = [ hyprlandPkg ];
|
|
|
|
_module.args.hmUsers = {
|
|
${username} = {
|
|
home.packages = [ hyprlandPkg ];
|
|
|
|
# Merge all files in the asset folder into ~/.config/hypr/
|
|
home.file = lib.mkMerge hyprFiles;
|
|
|
|
# Optional: Hyprland settings
|
|
settings.general."col.active_border" = "0xff97cbcd 0xff89b4fa";
|
|
};
|
|
};
|
|
}
|