Refactor every role to have .enable option

NOTE: any config other than stella will not be working for a while

Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
Ivan Bushchik 2023-08-22 19:39:11 +03:00
parent 595cc4d833
commit 4afe642684
No known key found for this signature in database
GPG key ID: 9F6DDABE11A2674D
13 changed files with 219 additions and 201 deletions

View file

@ -1,14 +1,22 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
powertop
lm_sensors
];
let
cfg = config.my.laptop;
in {
options = {
my.laptop.enable = lib.mkEnableOption "Laptop-specific configuration";
};
hardware.bluetooth.enable = true;
services.blueman.enable = true;
config = lib.mkIf (cfg.enable) {
environment.systemPackages = with pkgs; [
powertop
lm_sensors
];
services.tlp.enable = true;
services.upower.enable = true;
hardware.bluetooth.enable = true;
services.blueman.enable = true;
services.tlp.enable = true;
services.upower.enable = true;
};
}

View file

@ -5,7 +5,7 @@
i18n.defaultLocale = "ru_RU.UTF-8";
console = {
font = "${pkgs.terminus_font}/share/consolefonts/ter-u16b.psf.gz";
font = "${pkgs.terminus_font}/share/consolefonts/ter-u24b.psf.gz";
keyMap = "us";
packages = with pkgs; [ terminus_font ];
};

View file

@ -13,9 +13,7 @@
enable = true;
killUnconfinedConfinables = true;
};
allowUserNamespaces = true;
};
boot.kernel.sysctl = {

View file

@ -14,7 +14,7 @@ in rec {
cargo
rustc
neofetch
gitFull
htop
];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [

View file

@ -18,22 +18,7 @@
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
./common/base.nix
./common/laptop.nix
./common/locale.nix
./common/networking.nix
./common/remote-access.nix
./common/security.nix
./common/user.nix
./roles/design.nix
./roles/devel.nix
./roles/gaming.nix
./roles/graphical.nix
./roles/latex.nix
./roles/virtualisation.nix
./roles/yggdrasil-client.nix
./machines/stella/configuration.nix
./machines/stella/hardware.nix
./machines/stella
];
};

View file

@ -1,20 +0,0 @@
{ config, pkgs, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "stella";
services.xserver.videoDrivers=["amdgpu"];
boot.initrd.kernelModules=["amdgpu"];
powerManagement = {
enable = true;
cpuFreqGovernor = "performance";
};
system.stateVersion = "23.05";
}

View file

@ -1,9 +1,14 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
inkscape
gimp
imagemagick
];
let
cfg = config.my.roles.design;
in {
options.my.roles.design.enable = lib.mkEnableOption "Enable design-specific programs";
config = lib.mkIf (cfg.enable) {
environment.systemPackages = with pkgs; [
inkscape
gimp
imagemagick
];
};
}

View file

@ -1,13 +1,15 @@
{ config, pkgs, lib, ... }:
{
config = lib.mkMerge [{
let
cfg = config.my.roles.devel;
in {
options.my.roles.devel.enable = lib.mkEnableOption "Enable tools for development programs";
config = lib.mkIf (cfg.enable) ( lib.mkMerge [{
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
rustc
cargo
rustup
vscode
clang
llvm
lld
@ -16,10 +18,23 @@
autoconf
meson
ninja
picocom
screen
];
}
# Architecture-specific packages and configuration
(lib.mkIf (!pkgs.stdenv.isAarch64) {boot.binfmt.emulatedSystems = [ "aarch64-linux" ];})
(lib.mkIf (!pkgs.stdenv.isx86_64) {boot.binfmt.emulatedSystems = [ "x86_64-linux" ];})
];
(lib.mkIf (!pkgs.stdenv.isx86_64) {boot.binfmt.emulatedSystems = [ "x86_64-linux" "i686-linux" ];})
# Remove CLion from builds while I'm semi-online
/*(lib.mkIf (pkgs.stdenv.isx86_64) {
environment.systemPackages = with pkgs; [
jetbrains.clion
];
})*/
(lib.mkIf (pkgs.stdenv.isx86_64 || pkgs.stdenv.isAarch64 || pkgs.stdenv.isAarch32) {
environment.systemPackages = with pkgs; [
vscode
];
})
]);
}

View file

@ -1,19 +1,22 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
hardware.opengl.driSupport32Bit = true;
services.pipewire.alsa.support32Bit = true;
programs.steam.enable = true;
environment.systemPackages = with pkgs; [
prismlauncher
steam
wineWowPackages.stable
wine
(wine.override { wineBuild = "wine64"; })
wineWowPackages.staging
winetricks
wineWowPackages.waylandFull
];
let
cfg = config.my.roles.gaming;
in {
options.my.roles.gaming.enable = lib.mkEnableOption "Enable wine & steam";
config = lib.mkIf (cfg.enable) {
nixpkgs.config.allowUnfree = true;
hardware.opengl.driSupport32Bit = true;
services.pipewire.alsa.support32Bit = true;
programs.steam.enable = true;
environment.systemPackages = with pkgs; [
steam
wineWowPackages.stable
wine
(wine.override { wineBuild = "wine64"; })
wineWowPackages.staging
winetricks
wineWowPackages.waylandFull
];
};
}

View file

@ -1,117 +1,122 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
firefox
alacritty
pavucontrol
bottom
mpv
glib
ffmpeg
cinnamon.nemo
usbmuxd
telegram-desktop
keepassxc
];
services.greetd = {
enable = true;
vt = 7;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway";
user = "greeter";
};
};
};
programs.sway = {
enable = true;
extraPackages = with pkgs; [
waybar
grim
slurp
wf-recorder
sway-launcher-desktop
swaybg
swayidle
swaylock
poweralertd
kanshi
libsForQt5.qt5ct
mako
brightnessctl
wdisplays
let
cfg = config.my.roles.graphical;
in {
options.my.roles.graphical.enable = lib.mkEnableOption "Enable GUI";
config = lib.mkIf (cfg.enable) {
environment.systemPackages = with pkgs; [
firefox
alacritty
pavucontrol
bottom
mpv
glib
ffmpeg
cinnamon.nemo
usbmuxd
telegram-desktop
keepassxc
];
wrapperFeatures.gtk = true;
};
xdg.portal = {
enable = true;
wlr.enable = true;
};
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
alsa.support32Bit = true;
jack.enable = true;
};
qt = {
enable = true;
platformTheme = "gtk2";
style = "gtk2";
};
services.dbus.enable = true;
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
jetbrains-mono
font-awesome
#google-fonts
liberation_ttf
open-sans
roboto
roboto-mono
kochi-substitute
];
home-manager.users.ivabus = {
gtk = {
services.greetd = {
enable = true;
theme = {
name = "Catppuccin-Macchiato-Standard-Blue-dark";
package = pkgs.catppuccin-gtk.override {
accents = [ "blue" ];
tweaks = [ "rimless" ];
size = "standard";
variant = "macchiato";
vt = 7;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway";
user = "greeter";
};
};
iconTheme = {
name = "Mint-Y-Blue";
package = pkgs.cinnamon.mint-y-icons;
};
programs.sway = {
enable = true;
extraPackages = with pkgs; [
waybar
grim
slurp
wf-recorder
sway-launcher-desktop
swaybg
swayidle
swaylock
poweralertd
kanshi
libsForQt5.qt5ct
mako
brightnessctl
wdisplays
];
wrapperFeatures.gtk = true;
};
xdg.portal = {
enable = true;
wlr.enable = true;
};
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
alsa.support32Bit = true;
jack.enable = true;
};
qt = {
enable = true;
platformTheme = "gtk2";
style = "gtk2";
};
services.dbus.enable = true;
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji
jetbrains-mono
font-awesome
#google-fonts
liberation_ttf
open-sans
roboto
roboto-mono
kochi-substitute
];
home-manager.users.ivabus = {
gtk = {
enable = true;
theme = {
name = "Catppuccin-Macchiato-Standard-Blue-dark";
package = pkgs.catppuccin-gtk.override {
accents = [ "blue" ];
tweaks = [ "rimless" ];
size = "standard";
variant = "macchiato";
};
};
iconTheme = {
name = "Mint-Y-Blue";
package = pkgs.cinnamon.mint-y-icons;
};
cursorTheme = {
name = "Catppuccin-Macchiato-Dark-Cursors";
package = pkgs.catppuccin-cursors.macchiatoDark;
};
font = {
name = "Ubuntu";
size = 9;
package = pkgs.ubuntu_font_family;
};
};
cursorTheme = {
home.pointerCursor = {
name = "Catppuccin-Macchiato-Dark-Cursors";
package = pkgs.catppuccin-cursors.macchiatoDark;
x11.defaultCursor = "Catppuccin-Macchiato-Dark-Cursors";
};
font = {
name = "Ubuntu";
size = 9;
package = pkgs.ubuntu_font_family;
};
};
home.pointerCursor = {
name = "Catppuccin-Macchiato-Dark-Cursors";
package = pkgs.catppuccin-cursors.macchiatoDark;
x11.defaultCursor = "Catppuccin-Macchiato-Dark-Cursors";
};
};
}

View file

@ -1,7 +1,12 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
texlive.combined.scheme-full
];
let
cfg = config.my.roles.latex;
in {
options.my.roles.latex.enable = lib.mkEnableOption "Enable latex stuff";
config = lib.mkIf (cfg.enable){
environment.systemPackages = with pkgs; [
texlive.combined.scheme-full
];
};
}

View file

@ -1,5 +1,14 @@
{ pkgs, ... }:
{ pkgs, config, lib, ... }:
{
virtualisation.libvirtd.enable = true;
let
cfg = config.my.roles.virtualisation;
in {
options.my.roles.virtualisation.enable = lib.mkEnableOption "Enable tools for virtualisation";
config = lib.mkIf (cfg.enable) {
virtualisation.libvirtd.enable = true;
environment.systemPackages = with pkgs; [
qemu_full
qemu-utils
];
};
}

View file

@ -1,13 +1,18 @@
{ ... }:
{ config, lib, ... }:
{
services.yggdrasil = {
enable = true;
persistentKeys = true;
settings = {
Peers = [
"tls://ygg.iva.bz:50002"
];
let
cfg = config.my.roles.yggdrasil-client;
in {
options.my.roles.yggdrasil-client.enable = lib.mkEnableOption "Enable yggdrasil";
config = lib.mkIf (cfg.enable) {
services.yggdrasil = {
enable = true;
persistentKeys = true;
settings = {
Peers = [
"tls://ygg.iva.bz:50002"
];
};
};
};
}