refactor flake.nix and osConfig organization

This commit is contained in:
2025-02-09 03:02:57 +01:00
parent b61d654f08
commit a2037ffb56
19 changed files with 76 additions and 149 deletions

View File

@ -19,6 +19,7 @@ call plug#end()
colorscheme catppuccin-mocha
lua require'lspconfig'.clangd.setup{}
lua require'lspconfig'.nixd.setup{}
set signcolumn=no
let g:user42 = 'tomoron'

136
flake.nix
View File

@ -6,7 +6,7 @@
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/10/17 18:15:24 by tomoron #+# #+# #
# Updated: 2025/02/04 16:03:35 by tomoron ### ########.fr #
# Updated: 2025/02/09 02:55:40 by tomoron ### ########.fr #
# #
# **************************************************************************** #
@ -31,117 +31,39 @@
};
};
outputs = { self, nixpkgs, home-manager, nixos-hardware, plymouth-theme-ycontre-glow, ... }@inputs:
outputs = { nixpkgs, home-manager, nixos-hardware, ... }@inputs:
let
pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; };
username="tom";
homeDir="/home/tom";
in {
#NIXOS CONFIG
nixosConfigurations = {
default = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs; flakeName="default";};
modules = [
./configuration.nix
];
};
server = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs; flakeName="server";};
modules = [
./configuration.nix
./hosts/server.nix
];
};
vbox = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;flakeName="vbox";};
modules = [
./configuration.nix
./hosts/vbox.nix
];
};
laptop = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;flakeName="laptop";};
modules = [
./configuration.nix
./hosts/laptop.nix
nixos-hardware.nixosModules.asus-zephyrus-ga401
];
};
desktop = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;flakeName="desktop";};
modules = [
./configuration.nix
./hosts/desktop.nix
];
};
osConfig = {flakeName, extraModules ? []}: nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; flakeName = flakeName; };
modules = nixpkgs.lib.concatLists [ [./osConfigs/global.nix ./osConfigs/hosts/${flakeName}.nix ] extraModules];
};
#HOME CONFIG
homeConfig = {flakeName, extraModules ? [], username ? "tom", homeDir ? "/home/tom"}: home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; username = username; homeDir = homeDir; };
modules = nixpkgs.lib.concatLists [ [ ./home.nix ./homes/${flakeName}/home.nix] extraModules ];
};
in {
nixosConfigurations = {
server = osConfig {flakeName = "server";};
vbox = osConfig {flakeName = "vbox";};
laptop = osConfig {flakeName = "laptop"; extraModules = [ nixos-hardware.nixosModules.asus-zephyrus-ga401 ];};
desktop = osConfig {flakeName = "desktop";};
};
homeConfigurations = {
vbox = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
username = "${username}";
homeDir = "${homeDir}";
inherit inputs;
};
modules = [
./home.nix
./homes/vbox.nix
./modules/hyprland.nix
];
};
ft = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
username = "tomoron";
homeDir = "/nfs/homes/tomoron";
inherit inputs;
};
modules = [
./home.nix
./homes/ft/ft.nix
];
};
laptop = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
username = "${username}";
homeDir = "${homeDir}";
inherit inputs;
};
modules = [
./home.nix
./homes/laptop/home.nix
./modules/hyprland.nix
];
};
desktop = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
username = "${username}";
homeDir = "${homeDir}";
inherit inputs;
};
modules = [
./home.nix
./homes/desktop/home.nix
./modules/hyprland.nix
];
};
server = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
username = "${username}";
homeDir = "${homeDir}";
inherit inputs;
};
modules = [
./home.nix
./homes/server/home.nix
./modules/hyprland.nix
];
};
vbox = homeConfig { flakeName = "vbox"; };
ft = homeConfig { flakeName = "ft"; username = "tomoron"; homeDir = "/nfs/homes/tomoron";};
laptop = homeConfig { flakeName = "laptop"; };
desktop = homeConfig { flakeName = "desktop"; };
server = homeConfig { flakeName = "server"; };
};
};
}

View File

@ -6,11 +6,11 @@
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/10/17 18:15:38 by tomoron #+# #+# #
# Updated: 2025/02/04 16:02:21 by tomoron ### ########.fr #
# Updated: 2025/02/09 02:42:49 by tomoron ### ########.fr #
# #
# **************************************************************************** #
{ config, lib, pkgs, username,homeDir, ... }:
{lib, pkgs, username,homeDir, ... }:
{
imports = [
@ -80,6 +80,7 @@
nix-index
yubikey-manager
yubico-pam
wl-clipboard
];
home.file = {

View File

@ -1,10 +1,26 @@
{ config, lib, pkgs, ... }:
{ ... }:
{
imports = [
../modules/nitrogen.nix
./hyprland.nix
];
wayland.windowManager.hyprland.settings = {
monitor = [
"HDMI-A-1, 1920x1080@60, 0x0, auto"
"HDMI-A-3, 1920x1080@60, 1920x0, auto"
"DP-1, 1280x1024@60, 3840x0, auto"
"DP-3, 1280x1024@60, 5120x0, auto"
];
workspace = [
"1, monitor:HDMI-A-1"
"2, monitor:HDMI-A-3, default:true"
"3, monitor:DP-1"
"4, monitor:DP-3"
];
};
home.file = {
".config/bspwm/screenlayout.sh".source = ./bspwm/screenlayout.sh;
".config/bspwm/host.sh".source = ./bspwm/host.sh;

View File

@ -1,18 +0,0 @@
{ config, lib, pkgs, ... }:
{
wayland.windowManager.hyprland.settings = {
monitor = [
"HDMI-A-1, 1920x1080@60, 0x0, auto"
"HDMI-A-3, 1920x1080@60, 1920x0, auto"
"DP-1, 1280x1024@60, 3840x0, auto"
"DP-3, 1280x1024@60, 5120x0, auto"
];
workspace = [
"1, monitor:HDMI-A-1"
"2, monitor:HDMI-A-3, default:true"
"3, monitor:DP-1"
"4, monitor:DP-3"
];
};
}

View File

@ -4,6 +4,7 @@
imports = [
../modules/game.nix
../modules/nitrogen.nix
../../modules/hyprland.nix
./hyprland.nix
./waybar.nix
];

View File

@ -3,6 +3,7 @@
{
home.packages = with pkgs;[
clang-tools
nixd
nodejs_23
];

View File

@ -1,5 +1,14 @@
# Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
# **************************************************************************** #
# #
# ::: :::::::: #
# configuration.nix :+: :+: :+: #
# +:+ +:+ +:+ #
# By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/02/09 01:43:46 by tomoron #+# #+# #
# Updated: 2025/02/09 01:50:15 by tomoron ### ########.fr #
# #
# **************************************************************************** #
{ config, lib, inputs, pkgs, flakeName, ... }:
@ -64,13 +73,7 @@
ffmpeg
];
#Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
#Or disable the firewall altogether.
# networking.firewall.enable = false;
system.stateVersion = "24.05"; # Did you read the comment?
system.stateVersion = "24.05";
environment.etc.nixosFlakeName.text = "${flakeName}";

View File

@ -3,9 +3,9 @@
{
imports = [
modules/game.nix
modules/nvidia.nix
modules/vboxHost.nix
../modules/game.nix
../modules/nvidia.nix
../modules/vboxHost.nix
];
environment.systemPackages = with pkgs; [

View File

@ -2,9 +2,9 @@
{
imports = [
modules/game.nix
modules/nvidia.nix
modules/vboxHost.nix
../modules/game.nix
../modules/nvidia.nix
../modules/vboxHost.nix
];
boot.kernelParams = [ "kvm.enable_virt_at_load=0" ];
# systemd.tmpfiles.rules = [

View File

@ -3,12 +3,12 @@
{
imports = [
modules/game.nix
modules/vboxHost.nix
modules/nvidia.nix
../modules/game.nix
../modules/vboxHost.nix
../modules/nvidia.nix
];
boot.kernelPackages = pkgs.linuxPackages;
boot.extraModulePackages = with config.boot.kernelPackages; [gasket];
boot.extraModulePackages = [ config.boot.kernelPackages.gasket ];
networking.hostName = "server";
services.openssh.enable = true;