mirror of
https://github.com/ivabus/nixos
synced 2024-11-22 00:15:06 +03:00
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:
parent
595cc4d833
commit
4afe642684
13 changed files with 219 additions and 201 deletions
|
@ -1,6 +1,13 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
let
|
||||
cfg = config.my.laptop;
|
||||
in {
|
||||
options = {
|
||||
my.laptop.enable = lib.mkEnableOption "Laptop-specific configuration";
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.enable) {
|
||||
environment.systemPackages = with pkgs; [
|
||||
powertop
|
||||
lm_sensors
|
||||
|
@ -11,4 +18,5 @@
|
|||
|
||||
services.tlp.enable = true;
|
||||
services.upower.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 ];
|
||||
};
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
enable = true;
|
||||
killUnconfinedConfinables = true;
|
||||
};
|
||||
|
||||
allowUserNamespaces = true;
|
||||
|
||||
};
|
||||
|
||||
boot.kernel.sysctl = {
|
||||
|
|
|
@ -14,7 +14,7 @@ in rec {
|
|||
cargo
|
||||
rustc
|
||||
neofetch
|
||||
gitFull
|
||||
htop
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
openssh.authorizedKeys.keys = [
|
||||
|
|
17
flake.nix
17
flake.nix
|
@ -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
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
@ -1,9 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
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
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
];
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -1,13 +1,15 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
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; [
|
||||
prismlauncher
|
||||
steam
|
||||
wineWowPackages.stable
|
||||
wine
|
||||
|
@ -16,4 +18,5 @@
|
|||
winetricks
|
||||
wineWowPackages.waylandFull
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
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
|
||||
|
@ -114,4 +118,5 @@
|
|||
x11.defaultCursor = "Catppuccin-Macchiato-Dark-Cursors";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,7 +1,12 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
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
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,5 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
{
|
||||
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
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,6 +1,10 @@
|
|||
{ ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
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;
|
||||
|
@ -10,4 +14,5 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue