moving towards modules...

This commit is contained in:
Gerg-L 2023-02-20 22:28:01 -05:00
parent 32bf78aa36
commit f911f3f44d
18 changed files with 288 additions and 237 deletions

View file

@ -0,0 +1,7 @@
inputs: {
imports = [
(import ./gnome.nix inputs)
(import ./xfce.nix inputs)
(import ./dwm.nix inputs)
];
}

32
modules/DE-WM/dwm.nix Normal file
View file

@ -0,0 +1,32 @@
{suckless, ...}: {
pkgs,
config,
options,
lib,
self,
...
}:
with lib; let
cfg = config.localModules.dwm;
in {
options.localModules.dwm = {
enable = mkEnableOption "";
};
config = mkIf cfg.enable {
environment.systemPackages = [suckless.packages.${pkgs.system}.dmenu];
services.xserver = {
enable = true;
windowManager.dwm = {
enable = true;
package = suckless.packages.${pkgs.system}.dwm;
};
displayManager = {
sessionCommands = ''
feh --bg-scale ${self + /misc/recursion.png}
'';
defaultSession = "none+dwm";
};
};
};
}

53
modules/DE-WM/gnome.nix Normal file
View file

@ -0,0 +1,53 @@
_: {
config,
lib,
options,
pkgs,
...
}:
with lib; let
cfg = config.localModules.gnome;
in {
options.localModules.gnome = {
enable = mkEnableOption "";
};
config = mkIf cfg.enable {
environment.gnome.excludePackages =
(with pkgs; [
gnome-photos
gnome-tour
gnome-console
gnome-text-editor
gnome-online-accounts
])
++ (with pkgs.gnome; [
gnome-terminal
gnome-weather
gnome-shell
gnome-calculator
gnome-disk-utility
gnome-maps
gnome-clocks
gnome-remote-desktop
gnome-calendar
gnome-music
simple-scan
cheese # webcam tool
gedit # text editor
epiphany # web browser
geary # email reader
evince # document viewer
gnome-characters
totem # video player
tali # poker game
iagno # go game
hitori # sudoku game
atomix # puzzle game
]);
services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.defaultSession = "gnome";
};
};
}

23
modules/DE-WM/xfce.nix Normal file
View file

@ -0,0 +1,23 @@
_: {
config,
lib,
options,
...
}:
with lib; let
cfg = config.localModules.xfce;
in {
options.localModules.xfce = {
enable = mkEnableOption "";
};
config = mkIf cfg.enable {
services.xserver = {
enable = true;
desktopManager.xfce = {
enable = true;
enableScreensaver = true;
};
displayManager.defaultSession = "xfce";
};
};
}

22
modules/DM/autoLogin.nix Normal file
View file

@ -0,0 +1,22 @@
_: {
config,
lib,
options,
settings,
...
}:
with lib; let
cfg = config.localModules.autoLogin;
in {
options.localModules.autoLogin = {
enable = mkEnableOption "";
};
config = mkIf cfg.enable {
services.xserver.displayManager = {
autoLogin = {
enable = true;
user = settings.username;
};
};
};
}

6
modules/DM/default.nix Normal file
View file

@ -0,0 +1,6 @@
inputs: {
imports = [
(import ./lightDM.nix inputs)
(import ./autoLogin.nix inputs)
];
}

55
modules/DM/lightDM.nix Normal file
View file

@ -0,0 +1,55 @@
_: {
config,
lib,
options,
settings,
self,
...
}:
with lib; let
cfg = config.localModules.lightdm;
in {
options.localModules.lightdm = {
enable = mkEnableOption "";
};
config = mkIf cfg.enable {
services.xserver = {
displayManager = {
lightdm = {
enable = true;
background = self + /misc/recursion.png;
extraConfig = "minimum-vt=1";
greeters.mini = {
enable = true;
user = settings.username;
extraConfig = ''
[greeter]
show-password-label = false
password-label-text =
invalid-password-text =
show-input-cursor = false
password-alignment = center
password-input-width = 19
show-image-on-all-monitors = true
[greeter-theme]
font = "OverpassMono Nerd Font"
font-size = 1.1em
text-color = "#7AA2F7"
error-color = "#DB4B4B"
background-color = "#000000"
window-color = "#000000"
border-color = "#000000"
password-character = -1
password-color = "#7AA2F7"
password-background-color = "#24283B"
password-border-color = "#000000"
password-border-radius = 0.341125em
'';
};
};
};
};
};
}

View file

@ -0,0 +1,6 @@
inputs: {
imports = [
(import ./nix.nix inputs)
(import ./x.nix inputs)
];
}

53
modules/common/nix.nix Normal file
View file

@ -0,0 +1,53 @@
{
nix,
unstable,
...
}: {
inputs,
lib,
self,
settings,
...
}: {
nix = {
# package = nix.packages.${pkgs.system}.nix;
#automatically get registry from input flakes
registry =
(
lib.attrsets.mapAttrs (
_: value: {
flake = value;
}
) (
lib.attrsets.filterAttrs (
_: value: (
!(lib.attrsets.hasAttrByPath ["flake"] value) || value.flake == false
)
)
inputs
)
// {
nixpkgs.flake = unstable;
system.flake = self;
}
)
// {system = {flake = self;};};
#automatically add registry entries to nixPath
nixPath = (lib.mapAttrsToList (name: value: name + "=" + value) inputs) ++ ["system=${self}" "nixpkgs=${unstable}"];
settings = {
experimental-features = ["nix-command" "flakes" "repl-flake"];
auto-optimise-store = true;
warn-dirty = false;
flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}'';
keep-outputs = true;
keep-derivations = true;
trusted-users = [
"root"
"@wheel"
];
allowed-users = [
];
};
};
environment.etc."booted-system".source = self;
}

15
modules/common/x.nix Normal file
View file

@ -0,0 +1,15 @@
_: {
lib,
pkgs,
...
}:
with lib; {
services.xserver = {
exportConfiguration = mkDefault true;
layout = mkDefault "us";
libinput.enable = mkDefault true;
xautolock.enable = mkDefault false;
desktopManager.xterm.enable = mkDefault false;
excludePackages = mkDefault [pkgs.xterm];
};
}

View file

@ -1,6 +1,10 @@
inputs: {
imports = [
(import ./sxhkd.nix inputs)
(import ./common inputs)
(import ./unfree.nix inputs)
(import ./DE-WM inputs)
(import ./DM inputs)
(import ./hardware.nix inputs)
];
}

59
modules/hardware.nix Normal file
View file

@ -0,0 +1,59 @@
_: {
config,
options,
...
}: let
cfg = config.localModules.hardware;
in {
options.localModules.hardware = {
gpuAcceleration = {
disable = mkOption {
type = types.bool;
default = false;
};
};
sound = {
disable = mkOption {
type = types.bool;
default = false;
};
};
};
config =
mkMerge [
(
mkIf (! cfg.gpuAcceleration.disable) {
hardware = {
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
}
)
(mkIf (! cfg.sound.disable) {
security.rtkit.enable = true;
sound.enable = lib.mkForce false; #disable alsa
hardware.pulseaudio.enable = lib.mkForce false; #disable pulseAudio
services.pipewire = {
enable = true;
audio.enable = true;
wireplumber.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
})
]
++ {
hardware = {
cpu = {
intel.updateMicrocode = true;
amd.updateMicrocode = true;
enableRedistributableFirmware = true;
};
};
};
}