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, ... }:
{ let
environment.systemPackages = with pkgs; [ cfg = config.my.laptop;
powertop in {
lm_sensors options = {
]; my.laptop.enable = lib.mkEnableOption "Laptop-specific configuration";
};
hardware.bluetooth.enable = true; config = lib.mkIf (cfg.enable) {
services.blueman.enable = true; environment.systemPackages = with pkgs; [
powertop
lm_sensors
];
services.tlp.enable = true; hardware.bluetooth.enable = true;
services.upower.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"; i18n.defaultLocale = "ru_RU.UTF-8";
console = { console = {
font = "${pkgs.terminus_font}/share/consolefonts/ter-u16b.psf.gz"; font = "${pkgs.terminus_font}/share/consolefonts/ter-u24b.psf.gz";
keyMap = "us"; keyMap = "us";
packages = with pkgs; [ terminus_font ]; packages = with pkgs; [ terminus_font ];
}; };

View file

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

View file

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

View file

@ -18,22 +18,7 @@
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
./common/base.nix ./machines/stella
./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
]; ];
}; };

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, ... }:
{ let
environment.systemPackages = with pkgs; [ cfg = config.my.roles.design;
inkscape in {
gimp options.my.roles.design.enable = lib.mkEnableOption "Enable design-specific programs";
imagemagick config = lib.mkIf (cfg.enable) {
]; environment.systemPackages = with pkgs; [
inkscape
gimp
imagemagick
];
};
} }

View file

@ -1,13 +1,15 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ let
config = lib.mkMerge [{ 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; nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
rustc rustc
cargo cargo
rustup rustup
vscode
clang clang
llvm llvm
lld lld
@ -16,10 +18,23 @@
autoconf autoconf
meson meson
ninja ninja
picocom
screen
]; ];
} }
# Architecture-specific packages and configuration
(lib.mkIf (!pkgs.stdenv.isAarch64) {boot.binfmt.emulatedSystems = [ "aarch64-linux" ];}) (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, ... }: let
cfg = config.my.roles.gaming;
{ in {
nixpkgs.config.allowUnfree = true; options.my.roles.gaming.enable = lib.mkEnableOption "Enable wine & steam";
hardware.opengl.driSupport32Bit = true; config = lib.mkIf (cfg.enable) {
services.pipewire.alsa.support32Bit = true; nixpkgs.config.allowUnfree = true;
programs.steam.enable = true; hardware.opengl.driSupport32Bit = true;
environment.systemPackages = with pkgs; [ services.pipewire.alsa.support32Bit = true;
prismlauncher programs.steam.enable = true;
steam environment.systemPackages = with pkgs; [
wineWowPackages.stable steam
wine wineWowPackages.stable
(wine.override { wineBuild = "wine64"; }) wine
wineWowPackages.staging (wine.override { wineBuild = "wine64"; })
winetricks wineWowPackages.staging
wineWowPackages.waylandFull winetricks
]; wineWowPackages.waylandFull
];
};
} }

View file

@ -1,117 +1,122 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ let
environment.systemPackages = with pkgs; [ cfg = config.my.roles.graphical;
firefox in {
alacritty options.my.roles.graphical.enable = lib.mkEnableOption "Enable GUI";
pavucontrol config = lib.mkIf (cfg.enable) {
bottom environment.systemPackages = with pkgs; [
mpv firefox
glib alacritty
ffmpeg pavucontrol
cinnamon.nemo bottom
usbmuxd mpv
telegram-desktop glib
keepassxc ffmpeg
]; cinnamon.nemo
usbmuxd
services.greetd = { telegram-desktop
enable = true; keepassxc
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
]; ];
wrapperFeatures.gtk = true;
};
xdg.portal = { services.greetd = {
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; enable = true;
theme = { vt = 7;
name = "Catppuccin-Macchiato-Standard-Blue-dark"; settings = {
package = pkgs.catppuccin-gtk.override { default_session = {
accents = [ "blue" ]; command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway";
tweaks = [ "rimless" ]; user = "greeter";
size = "standard";
variant = "macchiato";
}; };
}; };
iconTheme = { };
name = "Mint-Y-Blue"; programs.sway = {
package = pkgs.cinnamon.mint-y-icons; 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"; name = "Catppuccin-Macchiato-Dark-Cursors";
package = pkgs.catppuccin-cursors.macchiatoDark; 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, ... }:
{ let
environment.systemPackages = with pkgs; [ cfg = config.my.roles.latex;
texlive.combined.scheme-full 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, ... }:
{ let
virtualisation.libvirtd.enable = true; 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, ... }:
{ let
services.yggdrasil = { cfg = config.my.roles.yggdrasil-client;
enable = true; in {
persistentKeys = true; options.my.roles.yggdrasil-client.enable = lib.mkEnableOption "Enable yggdrasil";
settings = { config = lib.mkIf (cfg.enable) {
Peers = [ services.yggdrasil = {
"tls://ygg.iva.bz:50002" enable = true;
]; persistentKeys = true;
settings = {
Peers = [
"tls://ygg.iva.bz:50002"
];
};
}; };
}; };
} }