nixos: profiles: move from top-level
All checks were successful
ci/woodpecker/push/check Pipeline was successful
All checks were successful
ci/woodpecker/push/check Pipeline was successful
My profiles are actually just "special" NixOS modules in that they orchestrate settings that usually span the NixOS/home-manager boundary, or otherwise set up configurations from multiple modules at once.
This commit is contained in:
parent
82472288b7
commit
210878cd16
10 changed files with 1 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
|||
imports = [
|
||||
./hardware
|
||||
./home
|
||||
./profiles
|
||||
./programs
|
||||
./secrets
|
||||
./services
|
||||
|
|
|
|||
15
modules/nixos/profiles/bluetooth/default.nix
Normal file
15
modules/nixos/profiles/bluetooth/default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.bluetooth;
|
||||
in
|
||||
{
|
||||
options.my.profiles.bluetooth = with lib; {
|
||||
enable = mkEnableOption "bluetooth profile";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
my.hardware.bluetooth.enable = true;
|
||||
|
||||
my.home.bluetooth.enable = true;
|
||||
};
|
||||
}
|
||||
13
modules/nixos/profiles/default.nix
Normal file
13
modules/nixos/profiles/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Configuration that spans accross system and home, or are almagations of modules
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./bluetooth
|
||||
./devices
|
||||
./gtk
|
||||
./laptop
|
||||
./printing
|
||||
./wm
|
||||
./x
|
||||
];
|
||||
}
|
||||
20
modules/nixos/profiles/devices/default.nix
Normal file
20
modules/nixos/profiles/devices/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.devices;
|
||||
in
|
||||
{
|
||||
options.my.profiles.devices = with lib; {
|
||||
enable = mkEnableOption "devices profile";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
my.hardware = {
|
||||
ergodox.enable = true;
|
||||
|
||||
mx-ergo.enable = true;
|
||||
};
|
||||
|
||||
# MTP devices auto-mount via file explorers
|
||||
services.gvfs.enable = true;
|
||||
};
|
||||
}
|
||||
17
modules/nixos/profiles/gtk/default.nix
Normal file
17
modules/nixos/profiles/gtk/default.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.gtk;
|
||||
in
|
||||
{
|
||||
options.my.profiles.gtk = with lib; {
|
||||
enable = mkEnableOption "gtk profile";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Allow setting GTK configuration using home-manager
|
||||
programs.dconf.enable = true;
|
||||
|
||||
# GTK theme configuration
|
||||
my.home.gtk.enable = true;
|
||||
};
|
||||
}
|
||||
23
modules/nixos/profiles/laptop/default.nix
Normal file
23
modules/nixos/profiles/laptop/default.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.laptop;
|
||||
in
|
||||
{
|
||||
options.my.profiles.laptop = with lib; {
|
||||
enable = mkEnableOption "laptop profile";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Enable touchpad support
|
||||
services.xserver.libinput.enable = true;
|
||||
|
||||
# Enable TLP power management
|
||||
my.services.tlp.enable = true;
|
||||
|
||||
# Enable upower power management
|
||||
my.hardware.upower.enable = true;
|
||||
|
||||
# Enable battery notifications
|
||||
my.home.power-alert.enable = true;
|
||||
};
|
||||
}
|
||||
69
modules/nixos/profiles/printing/default.nix
Normal file
69
modules/nixos/profiles/printing/default.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.printing;
|
||||
in
|
||||
{
|
||||
options.my.profiles.printing = with lib; {
|
||||
enable = mkEnableOption "printing profile";
|
||||
|
||||
papersize = mkOption {
|
||||
type = with types; either str (enum [
|
||||
"a3"
|
||||
"a4"
|
||||
"a5"
|
||||
"b5"
|
||||
"letter"
|
||||
"legal"
|
||||
"executive"
|
||||
"note"
|
||||
"11x17"
|
||||
]);
|
||||
default = "a4";
|
||||
example = "paper";
|
||||
description = "preferred paper size";
|
||||
};
|
||||
|
||||
usb = {
|
||||
enable = my.mkDisableOption "USB printers";
|
||||
};
|
||||
|
||||
network = {
|
||||
enable = my.mkDisableOption "network printers";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Setup CUPS
|
||||
services.printing = {
|
||||
enable = true;
|
||||
|
||||
# Drivers are deprecated, but just in case
|
||||
drivers = with pkgs; [
|
||||
gutenprint # Base set of drivers
|
||||
brlaser # Brother drivers
|
||||
|
||||
# Brother MFC-L3770CDW
|
||||
mfcl3770cdwlpr
|
||||
mfcl3770cdwcupswrapper
|
||||
];
|
||||
};
|
||||
|
||||
# Setup paper size
|
||||
systemd.services.cups.serviceConfig.Environment = [
|
||||
"PAPERSIZE=${cfg.papersize}"
|
||||
];
|
||||
|
||||
# Allow using USB printers
|
||||
services.ipp-usb = lib.mkIf cfg.usb.enable {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Allow using WiFi printers
|
||||
services.avahi = lib.mkIf cfg.network.enable {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
# Allow resolution of '.local' addresses
|
||||
nssmdns = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
29
modules/nixos/profiles/wm/default.nix
Normal file
29
modules/nixos/profiles/wm/default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.wm;
|
||||
in
|
||||
{
|
||||
options.my.profiles.wm = with lib; {
|
||||
windowManager = mkOption {
|
||||
type = with types; nullOr (enum [ "i3" ]);
|
||||
default = null;
|
||||
example = "i3";
|
||||
description = "Which window manager to use";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (cfg.windowManager == "i3") {
|
||||
# Enable i3
|
||||
services.xserver.windowManager.i3.enable = true;
|
||||
# i3 settings
|
||||
my.home.wm.windowManager = "i3";
|
||||
# Screenshot tool
|
||||
my.home.flameshot.enable = true;
|
||||
# Auto disk mounter
|
||||
my.home.udiskie.enable = true;
|
||||
# udiskie fails if it can't find this dbus service
|
||||
services.udisks2.enable = true;
|
||||
})
|
||||
];
|
||||
}
|
||||
23
modules/nixos/profiles/x/default.nix
Normal file
23
modules/nixos/profiles/x/default.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.profiles.x;
|
||||
in
|
||||
{
|
||||
options.my.profiles.x = with lib; {
|
||||
enable = mkEnableOption "X profile";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver.enable = true;
|
||||
# Nice wallpaper
|
||||
services.xserver.displayManager.lightdm.background =
|
||||
let
|
||||
wallpapers = "${pkgs.plasma5Packages.plasma-workspace-wallpapers}/share/wallpapers";
|
||||
in
|
||||
"${wallpapers}/summer_1am/contents/images/2560x1600.jpg";
|
||||
|
||||
# X configuration
|
||||
my.home.x.enable = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue