Refactor Nix configuration: reorganize module imports, add monitor options, and set default environment variables
This commit is contained in:
parent
176bb3eb1d
commit
e7e88a97d2
4 changed files with 96 additions and 13 deletions
|
@ -10,7 +10,8 @@
|
|||
{
|
||||
imports = lib.flatten [
|
||||
(map lib.custom.relativeToRoot [
|
||||
"modules/common/host-spec.nix"
|
||||
"modules/common"
|
||||
"modules/home"
|
||||
])
|
||||
./asdf.nix
|
||||
./bash.nix
|
||||
|
@ -37,11 +38,12 @@
|
|||
"$HOME/.local/bin"
|
||||
];
|
||||
sessionVariables = {
|
||||
FLAKE = "$HOME/git/dot.nix";
|
||||
SHELL = "fish";
|
||||
EDITOR = "micro";
|
||||
VISUAL = "micro";
|
||||
FLAKE = "$HOME/git/dot.nix";
|
||||
MANPAGER = "batman"; # see ./cli/bat.nix
|
||||
SHELL = "fish";
|
||||
TERM = "foot";
|
||||
VISUAL = "micro";
|
||||
};
|
||||
preferXdgDirectories = true; # whether to make programs use XDG directories whenever supported
|
||||
|
||||
|
@ -54,15 +56,6 @@
|
|||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
# desktop = "${config.home.homeDirectory}/.desktop";
|
||||
# documents = "${config.home.homeDirectory}/doc";
|
||||
# download = "${config.home.homeDirectory}/downloads";
|
||||
# music = "${config.home.homeDirectory}/media/audio";
|
||||
# pictures = "${config.home.homeDirectory}/media/images";
|
||||
# videos = "${config.home.homeDirectory}/media/video";
|
||||
# publicshare = "/var/empty"; #using this option with null or "/var/empty" barfs so it is set properly in extraConfig below
|
||||
# templates = "/var/empty"; #using this option with null or "/var/empty" barfs so it is set properly in extraConfig below
|
||||
|
||||
extraConfig = {
|
||||
# publicshare and templates defined as null here instead of as options because
|
||||
XDG_PUBLICSHARE_DIR = "/var/empty";
|
||||
|
|
|
@ -34,6 +34,7 @@ in
|
|||
|
||||
# System-wide packages, in case we log in as root
|
||||
environment.systemPackages = with pkgs; [
|
||||
micro
|
||||
plocate
|
||||
openssh
|
||||
ranger
|
||||
|
@ -107,6 +108,7 @@ in
|
|||
];
|
||||
|
||||
## NIX NIX NIX ##
|
||||
documentation.nixos.enable = false;
|
||||
nix = {
|
||||
# This will add each flake input as a registry
|
||||
# To make nix3 commands consistent with your flake
|
||||
|
@ -123,6 +125,9 @@ in
|
|||
min-free = 128000000; # 128MB
|
||||
max-free = 1000000000; # 1GB
|
||||
|
||||
substituters = [ "https://hyprland.cachix.org" ];
|
||||
trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
|
||||
|
||||
trusted-users = [ "@wheel" ];
|
||||
# Deduplicate and optimize nix store
|
||||
auto-optimise-store = true;
|
||||
|
|
7
modules/home/default.nix
Normal file
7
modules/home/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Add your reusable home-manager modules to this directory, on their own file (https://wiki.nixos.org/wiki/NixOS_modules).
|
||||
# These are modules you would share with others, not your personal configurations.
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.custom.scanPaths ./.;
|
||||
}
|
78
modules/home/monitors.nix
Normal file
78
modules/home/monitors.nix
Normal file
|
@ -0,0 +1,78 @@
|
|||
# The options set using this module are intended for use with logic defined in specific workspace management configurations. For example, see nix-config/home/ta/common/optional/hyprland/
|
||||
{ lib, config, ... }:
|
||||
{
|
||||
options.monitors = lib.mkOption {
|
||||
type = lib.types.listOf (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "DP-1";
|
||||
};
|
||||
primary = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
noBar = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
width = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
example = 1920;
|
||||
};
|
||||
height = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
example = 1080;
|
||||
};
|
||||
refreshRate = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 60;
|
||||
};
|
||||
x = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 0;
|
||||
};
|
||||
y = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 0;
|
||||
};
|
||||
scale = lib.mkOption {
|
||||
type = lib.types.number;
|
||||
default = 1.0;
|
||||
};
|
||||
transform = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 0;
|
||||
};
|
||||
enabled = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
workspace = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Defines a workspace that should persist on this monitor.";
|
||||
default = null;
|
||||
};
|
||||
vrr = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = "Variable Refresh Rate aka Adaptive Sync aka AMD FreeSync.\nValues are oriented towards hyprland's vrr values which are:\n0 = off, 1 = on, 2 = fullscreen only\nhttps://wiki.hyprland.org/Configuring/Variables/#misc";
|
||||
default = 0;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
);
|
||||
default = [ ];
|
||||
};
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
((lib.length config.monitors) != 0)
|
||||
-> ((lib.length (lib.filter (m: m.primary) config.monitors)) == 1);
|
||||
message = "Exactly one monitor must be set to primary.";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue