modularize config

This commit is contained in:
DashieTM 2024-07-10 17:03:31 +02:00
parent 09c4625fbb
commit 7a4e46e04f
33 changed files with 230 additions and 168 deletions

View file

@ -1,5 +1,10 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
{
imports = [
# is wrapped in if statement to enable when needed
../programs/gaming/default.nix
];
environment.systemPackages = with pkgs; [
openssl
dbus
@ -23,6 +28,9 @@
kdePackages.breeze-icons
seahorse
upower
(lib.mkIf config.conf.streamdeck.enable (callPackage
../override/streamdeck.nix
{ }))
];
gtk.iconCache.enable = false;
@ -32,19 +40,9 @@
];
nix.settings.experimental-features = "nix-command flakes";
programs.fish.enable = true;
programs.fish.promptInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
'';
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
jdk
zlib
];
virtualisation.docker.enable = true;
programs.dconf.enable = true;
services.upower.enable = true;
services.printing.enable = true;
services.dbus.enable = true;
@ -56,13 +54,17 @@
nssmdns4 = true;
openFirewall = true;
};
# services.xserver.desktopManager.gnome.extraGSettingsOverrides = ''
# [org.gnome.desktop.interface]
# gtk-theme='adw-gtk3'
# cursor-theme='Bibata-Modern-Classsic'
# cursor-size=24
# '';
programs.fish.enable = true;
programs.fish.promptInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
'';
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
jdk
zlib
];
programs.dconf.enable = true;
programs.direnv = {
package = pkgs.direnv;
silent = false;

View file

@ -7,7 +7,6 @@
];
gnome.gnome-keyring.enable = true;
gvfs.enable = true;
};
}

View file

@ -1,4 +1,7 @@
{ pkgs, config, username, ... }:
{ pkgs, config, ... }:
let
username = config.conf.username;
in
{
# Bootloader.
boot.loader.systemd-boot.enable = true;
@ -54,6 +57,14 @@
username
];
boot.kernelPackages = config.conf.kernel;
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.kernelParams = [
"resume=\"PARTLABEL=SWAP\""
] ++ config.conf.boot_params;
networking.hostName = config.conf.hostname;
# allows user change later on
users.mutableUsers = true;
users.users.${username} = {
@ -70,7 +81,6 @@
};
system.stateVersion = "unstable";
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
fileSystems."/" =
{
@ -103,8 +113,4 @@
swapDevices =
[{ device = "/dev/disk/by-label/SWAP"; }];
boot.kernelParams = [
"resume=\"PARTLABEL=SWAP\""
] ++ config.programs.boot.boot_params;
}

View file

@ -1,5 +1,5 @@
{ pkgs
, username
, config
, ...
}: {
environment.variables = {
@ -13,7 +13,7 @@
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
GOPATH = "$HOME/.go";
FLAKE = "home/${username}/gits/dotFiles/nix";
FLAKE = "home/${config.conf.username}/gits/dotFiles/nix";
# don't ask... marksman somehow requires this
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = 1;
};

View file

@ -1,10 +1,10 @@
{ lib
, config
, pkgs
, username
, ...
}:
let
username = config.conf.username;
session = {
command = "${lib.getExe pkgs.hyprland} --config /etc/greetd/hyprgreet.conf";
user = username;
@ -38,7 +38,7 @@ in
environment.etc."greetd/hyprgreet.conf".text = ''
exec-once=gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
monitor=${config.programs.ironbar.monitor},3440x1440@180,0x0,${config.programs.ironbar.scale}
monitor=${config.conf.monitor},3440x1440@180,0x0,${config.conf.scale}
monitor=_,disable
input {

View file

@ -1,6 +1,6 @@
{ pkgs, ... }:
let
dashie = pkgs.writeText "dashie" ''
layout = pkgs.writeText "dashie" ''
xkb_symbols "dashie"
{
include "us(basic)"
@ -16,7 +16,7 @@ in
services.xserver.xkb.extraLayouts.dashie = {
description = "US layout with 'umlaut'";
languages = [ "eng" ];
symbolsFile = "${dashie}";
symbolsFile = "${layout}";
};
}

View file

@ -55,22 +55,20 @@
./base/default.nix
./programs
];
username = "dashie";
in
{
nixosConfigurations."marmo" = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs pkgs username;
inherit inputs pkgs;
mod = ./hardware/marmo/base_config.nix;
};
modules = [
./hardware/marmo/default.nix
./programs/gaming/default.nix
] ++ base_imports;
};
nixosConfigurations."overheating" = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs pkgs username;
inherit inputs pkgs;
mod = ./hardware/overheating/base_config.nix;
};
modules = [
@ -79,13 +77,11 @@
};
nixosConfigurations."spaceship" = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs pkgs username;
inherit inputs pkgs;
mod = ./hardware/spaceship/base_config.nix;
};
modules = [
./hardware/spaceship/default.nix
./hardware/streamdeck.nix
./programs/gaming/default.nix
] ++ base_imports;
};
};

View file

@ -8,5 +8,5 @@
# all others
",highrr,auto,1"
];
programs.ironbar.monitor = "DP-1";
conf.monitor = "DP-1";
}

View file

@ -1,17 +1,14 @@
{ pkgs, ... }:
{
imports = [
../../modules/gamemode.nix
../../modules/boot_params.nix
../../modules/ironbar_config.nix
../../modules/conf.nix
];
boot.kernelPackages = pkgs.linuxPackages_zen;
programs.boot.boot_params = [
"amdgpu.ppfeaturemask=0xffffffff"
];
networking.hostName = "marmo";
programs.ironbar.monitor = "DP-1";
programs.gamemode = {
# variables for system
conf = {
monitor = "DP-1";
gaming = {
enable = true;
device = 1;
};
hostname = "marmo";
};
}

View file

@ -9,9 +9,11 @@
# all others
",highres,auto,1"
];
programs.ironbar.monitor = "eDP-1";
programs.ironbar.battery = [
conf = {
monitor = "eDP-1";
battery = [
{ type = "upower"; class = "memory-usage"; }
];
};
programs.hyprland.extra_autostart = [ "hyprdock --server" ];
}

View file

@ -1,16 +1,16 @@
{ pkgs, ... }:
{
imports = [
../../modules/ironbar_config.nix
../../modules/boot_params.nix
../../modules/conf.nix
./dsdt.nix
./firmware.nix
];
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "overheating";
programs.ironbar.monitor = "eDP-1";
programs.ironbar.scale = "2.0";
programs.boot.boot_params = [ "rtc_cmos.use_acpi_alarm=1" ];
conf = {
monitor = "eDP-1";
scale = "2.0";
hostname = "overheating";
boot_params = [ "rtc_cmos.use_acpi_alarm=1" ];
};
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, modulesPath, ... }:
{ config, lib, modulesPath, ... }:
{
imports =
[

View file

@ -1,4 +1,8 @@
{ username, ... }: {
{ config, ... }:
let
username = config.conf.username;
in
{
imports = [
../../modules
];
@ -30,7 +34,7 @@
# monitor right
"3,monitor:HDMI-A-1, default:true"
];
programs.ironbar.monitor = "DP-1";
conf.monitor = "DP-1";
programs.hyprland.hyprpaper = ''
#load
preload = /home/${username}/Pictures/backgrounds/shinobu_2k.jpg

View file

@ -1,19 +1,19 @@
{ pkgs, lib, ... }:
{
imports = [
../../modules/gamemode.nix
../../modules/boot_params.nix
../../modules/ironbar_config.nix
../../modules/conf.nix
];
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
programs.boot.boot_params = [
"amdgpu.ppfeaturemask=0xffffffff"
];
networking.hostName = "spaceship";
programs.gamemode = {
device = 0;
# config variables
conf = {
monitor = "DP-1";
gaming = {
enable = true;
};
streamdeck.enable = true;
hostname = "spaceship";
};
virtualisation.virtualbox.host.enable = true;
# enable hardware acceleration and rocm
@ -28,6 +28,12 @@
enable = true;
enable32Bit = lib.mkDefault true;
};
boot.initrd.kernelModules = [ "amdgpu" ];
programs.ironbar.monitor = "DP-1";
networking.firewall = {
allowedTCPPortRanges = [
{ from = 1714; to = 1764; } # KDE Connect
];
allowedUDPPortRanges = [
{ from = 1714; to = 1764; } # KDE Connect
];
};
}

View file

@ -1,6 +0,0 @@
{
#programs.streamdeck-ui = {
# enable = true;
# autoStart = false; # optional
#};
}

View file

@ -1,11 +0,0 @@
{ lib, ... }: {
options.programs.boot = {
boot_params = lib.mkOption {
default = [ ];
example = [ "resume=something" ];
description = ''
Boot params
'';
};
};
}

106
nix/modules/conf.nix Normal file
View file

@ -0,0 +1,106 @@
{ lib, config, pkgs, ... }: {
options.conf = {
monitor = lib.mkOption {
default = "";
example = "eDP-1";
type = lib.types.str;
description = ''
main monitor
'';
};
scale = lib.mkOption {
default = "1.0";
example = "1.0";
type = lib.types.str;
description = ''
Scale for the monitor
'';
};
battery = lib.mkOption {
default = [ ];
example = [ ];
};
amdGpu = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Enables drivers, optimizations and kernel parameters for AMD gpus.
'';
};
boot_params = lib.mkOption {
default = [ ];
example = [ "resume=something" ];
description = ''
Boot params
'';
};
gaming = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Install gaming related programs such as steam, gamemode, and more
'';
};
device = lib.mkOption {
default = 0;
example = 0;
description = ''
GPU device number
'';
};
};
streamdeck = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Install streamdeck configuration program.
'';
};
};
kernel = lib.mkOption {
default = pkgs.linuxPackages_latest;
example = pkgs.linuxPackages_xanmod_latest;
# type = lib.types.package;
description = ''
kernel to be used
'';
};
hostname = lib.mkOption {
default = "nixos";
example = "spaceship";
type = lib.types.str;
description = ''
The name of the system
'';
};
username = lib.mkOption {
default = "dashie";
example = "pingpang";
type = lib.types.str;
description = ''
The username.
'';
};
};
config = {
conf.boot_params = lib.mkIf config.conf.amdGpu [
"amdgpu.ppfeaturemask=0xffffffff"
];
conf.kernel = lib.mkIf config.conf.gaming.enable pkgs.linuxPackages_xanmod_latest;
};
}

View file

@ -1,6 +1,6 @@
{
imports = [
./ironbar_config.nix
./hyprpaper_config.nix
./conf.nix
];
}

View file

@ -1,11 +0,0 @@
{ lib, ... }: {
options.programs.gamemode = {
device = lib.mkOption {
default = 0;
example = 0;
description = ''
GPU device number
'';
};
};
}

View file

@ -1,25 +0,0 @@
{ lib, ... }: {
options.programs.ironbar = {
monitor = lib.mkOption {
default = "";
example = "eDP-1";
type = lib.types.str;
description = ''
main monitor
'';
};
scale = lib.mkOption {
default = "1.0";
example = "1.0";
type = lib.types.str;
description = ''
Scale for the monitor
'';
};
battery = lib.mkOption {
default = [ ];
example = [ ];
};
};
}

View file

@ -91,8 +91,7 @@
#typst
typst
typst-lsp
typstfmt
tinymist
ltex-ls
#java

View file

@ -1,10 +1,12 @@
{ pkgs
, inputs
, lib
, username
, config
, ...
}:
let callPackage = lib.callPackageWith (pkgs);
let
callPackage = lib.callPackageWith (pkgs);
username = config.conf.username;
in
{
manual = {
@ -53,9 +55,6 @@ in
flake-checker
ffmpeg
system-config-printer
(callPackage
../override/streamdeck.nix
{ })
(callPackage
../override/cambalache.nix
{ })

View file

@ -1,4 +1,4 @@
{ inputs, pkgs, mod, username, ... }:
{ inputs, pkgs, mod, config, ... }:
let
base_imports = [
inputs.anyrun.homeManagerModules.default
@ -14,6 +14,7 @@ let
inputs.nix-flatpak.homeManagerModules.nix-flatpak
inputs.sops-nix.homeManagerModules.sops
];
username = config.conf.username;
in
{
xdg.portal.config.common.default = "*";

View file

@ -1,12 +1,8 @@
{ pkgs
, lib
, config
, ...
}: {
imports = [
# ./anyrun.nix
# ./config.nix
];
}: lib.mkIf config.conf.gaming.enable {
environment.systemPackages = with pkgs; [
gamemode
steam
@ -25,7 +21,7 @@
};
gpu = {
apply_gpu_optimisations = "accept-responsibility";
gpu_device = config.programs.gamemode.device;
gpu_device = config.conf.gaming.device;
amd_performance_level = "high";
};
custom = {

View file

@ -1,14 +1,11 @@
{ pkgs
, inputs
, username
, config
{ config
, ...
}:
{
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.settings = {
"$mod" = "SUPER";
"source" = "/home/${username}/.config/reset/keyboard.conf";
"source" = "/home/${config.conf.username}/.config/reset/keyboard.conf";
bindm = [
"$mod, mouse:272, movewindow"

View file

@ -15,7 +15,7 @@
input-field = [
{
monitor = "${config.programs.ironbar.monitor}";
monitor = "${config.conf.monitor}";
placeholder_text = "password or something";
}
@ -23,7 +23,7 @@
label = [
{
monitor = "${config.programs.ironbar.monitor}";
monitor = "${config.conf.monitor}";
text = "$TIME";
font_size = 50;
position = "0, 200";

View file

@ -1,4 +1,8 @@
{ config, username, ... }: {
{ config, ... }:
let
username = config.conf.username;
in
{
programs.ironbar =
{
@ -141,8 +145,8 @@
#"another_feature"
];
config = {
monitors."${config.programs.ironbar.monitor}" = {
end = config.programs.ironbar.battery ++ [
monitors."${config.conf.monitor}" = {
end = config.conf.battery ++ [
{
type = "sys_info";
format = [

View file

@ -1,4 +1,4 @@
{ pkgs, username, ... }: {
{ pkgs, config, ... }: {
programs.firefox = {
enable = true;
@ -13,7 +13,7 @@
DisplayBookmarksToolbar = "never";
DisplayMenuBar = "default-off";
};
profiles.${username} = {
profiles.${config.conf.username} = {
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
darkreader

View file

@ -1,4 +1,4 @@
{ username, ... }: {
{ config, ... }: {
xdg.configFile."fish/config.fish" = {
text =
''
@ -15,7 +15,7 @@
set EDITOR "neovide --no-fork"
alias rebuild='sudo nixos-rebuild switch --flake /home/${username}/gits/dotFiles/nix/.'
alias rebuild='sudo nixos-rebuild switch --flake /home/${config.conf.username}/gits/dotFiles/nix/.'
abbr --add ls 'lsd'
abbr --add :q 'exit'
abbr --add gh 'git push origin'

View file

@ -114,9 +114,9 @@ return {
"Sdk:IncludePrereleases=true",
},
},
typst_lsp = {
tinymist = {
settings = {
experimentalFormatterMode = "on",
formatterMode = "typstyle",
exportPdf = "onSave",
},
mason = false,
@ -225,7 +225,6 @@ return {
},
},
formatters_by_ft = {
typst = { "typstfmt" },
nix = { "nixpkgs-fmt" },
lua = { "stylua" },
sh = { "shfmt" },

View file

@ -1,8 +1,8 @@
{ username, ... }: {
{ config, ... }: {
xdg.configFile."oxinoti/style.css" = {
text = /*css*/
''
@import url("/home/${username}/.config/gtk-3.0/gtk.css");
@import url("/home/${config.conf.username}/.config/gtk-3.0/gtk.css");
#MainWindow {
background-color: transparent;

View file

@ -1,5 +1,6 @@
{ username, ... }:
{ config, ... }:
let
username = config.conf.username;
color = ''
[ColorScheme]
active_colors=#ffc0caf5, #ff1a1b26, #ff373949, #ff2b2c3b, #ff1a1b26, #ff2b2c3b, #ffc0caf5, #ffc0caf5, #ffc0caf5, #ff1a1b26, #ff1a1b26, #19000000, #ff2b2c3b, #ffc0caf5, #ff3584e4, #ff1b6acb, #ff1a1b26, #ff242530, #ff1a1b26, #ffc0caf5, #ffc0caf5

View file

@ -4,14 +4,15 @@ dashie: ENC[AES256_GCM,data:P/+ZEelpLFrcsk8hx7CF999Wlv5OWiybjPVT1ULogCECpBAxYJgl
hub_pub: ENC[AES256_GCM,data:6vIAQWFMIR+HnERg+A4jKu/MW+e7eLQplmdJyBeuBL9tvxH1idT8C6zvMEyIPhelU6+ZYQghAlvuC4MtktI/Te0f40XvdK3Gq/DmfBrLRUgLdSjUvMeGuuKnpRX0mjCaw77YW5ES4ptZ,iv:PC9hELA0234JCk2rx6FJhMlKKaKO8WrIezJ2Q2nv6EE=,tag:R8oPaH3Sbr23oRX++OP/qg==,type:str]
lab_pub: ENC[AES256_GCM,data:rlHCiqGnoaPiQBaZQRT+bEjfNF7jNO4CGPoCOKJ1o7nv7i2jPy6Bq9OMBHXsMHI9oGfEhyKCDHdpJ65aI07KJC/fMoMoAyiNmalwNOn26jbgj84mfENS3IYbfKxQVXAUCJHE5m1cFsm7,iv:8SLdHLYq2tlfHBjdeDoByEzGuu3TURj4+KJvQfPuaWA=,tag:mmGXlRwQ0UoVIAJE6d1OUQ==,type:str]
dashie_pub: ENC[AES256_GCM,data:k6JIJOKDJcGSW47Z8y0EYxNl/vaPRVbIn35CSA57snEzYnk5GpU+1NfPDniWoAGRkpIwicgN6kpzssRlKOmVudvwMejSLv4VkLRBjrsApVFECwoIBLUNGUSDaMcIwC/BYu4jfjGaozBj,iv:0EZ0rptLdmcuTU1BGOILaaDTrc7aZGJCCxgjUESqi0M=,tag:dlQs/ugBGxnSrNj/bRSJSw==,type:str]
server_pub: ENC[AES256_GCM,data:87nTYzA8CykOPjfZS2As8+JB/ysJvHXFYbPIBA8Nus8Y3nI3Tl2F/f7mUVFBT+4mmOFTTwxghEnkpgTg/vzUm6W4wb19rIcv11eM7HYaGl5oI44a44rBJn2+PKlfIgXVgaY=,iv:O7I7kkZ44McXzCt3wH1cM3MJCShxu2O+0U0+Y6rwePo=,tag:q5D5AGMmFyiNhQNR8dRB+g==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age: []
lastmodified: "2024-05-14T18:34:33Z"
mac: ENC[AES256_GCM,data:ZOmH7VOtapecA3wr0p4M8SfC5zKybsXZdI67rE8SHFyeHDq+6In0ekPs4uTun1lBT4ly4ijjK2XWsRdrkTI76P4yKD5o850Mi7RDHTZzzP3AmlIrMgFbKTZkxuY1wnLJvcuHnbzq4e7s5ZJYPRx/lDd5dnYB+Xa5yyv4zCXXwqg=,iv:cqSPKZp/SNYnKU1QT2eOmKPe0oFTgVI6r8UMTYModnk=,tag:bHUhfnlHq8UGG8Z50cCQcw==,type:str]
lastmodified: "2024-07-08T18:00:49Z"
mac: ENC[AES256_GCM,data:66P0uEUhQit+EjBEhAoQP3yVAt988eYwwxnOPGahPfKDw5ud+b8atc9mT6vGK3TfQFoZfjwhRxEOmc/Wx/PA+L01S7gAFctKrnbADAfRn7HJmtX3pXunhDxI6hGyJW+CrFNiLhViMJSXHljhj/QfDmxkJ/6TSSi8uMr2iNlLA3I=,iv:AJ4RB0CV0QAumZ6o36loeR51GUxQKnEsUklIGJnn5qI=,tag:or1MamtafGlwBRr/JsL9Eg==,type:str]
pgp:
- created_at: "2024-05-14T14:35:02Z"
enc: |-