feat: moving stuff from configuration to split modules \o/

This commit is contained in:
Yoru
2024-12-05 15:56:58 +01:00
parent d9c861d4b9
commit fb687d67f7
10 changed files with 320 additions and 119 deletions

12
flake.lock generated
View File

@@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1733043896,
"narHash": "sha256-UUACIrku5m2ENNr2opNY9dwZ3tHxHMI6yUhkUhM3v4E=",
"lastModified": 1733133928,
"narHash": "sha256-gU40r9AfpIr4eq+0noM8yH1Hxf+EA3dqfIpFtQl8Y1E=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8eeda281e70cbadabb7f0095c5f34e354e85f307",
"rev": "873e39d5f4437d2f3ab06881fea8e63e45e1d011",
"type": "github"
},
"original": {
@@ -22,11 +22,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1732837521,
"narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=",
"lastModified": 1733015953,
"narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370",
"rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
"type": "github"
},
"original": {

View File

@@ -3,7 +3,6 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# hyprpanel.url = "github:Jas-SinghFSU/HyprPanel";
home-manager = {
url = "github:nix-community/home-manager";
@@ -24,6 +23,12 @@
home = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
./modules/nixos/cli-environment.nix
./modules/nixos/desktop-apps.nix
./modules/nixos/dev-environment.nix
./modules/nixos/fonts.nix
./modules/nixos/gaming.nix
./modules/nixos/window-manager.nix
./hosts/home/configuration.nix
inputs.home-manager.nixosModules.default
];

View File

@@ -1,12 +1,8 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, inputs, ... }:
{
imports =
[ # Include the results of the hardware scan.
[
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
];
@@ -29,22 +25,17 @@
options = [ "rw" "uid=1000" ];
};
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
fileSystems."/mnt/ext" = {
device = "/dev/disk/by-label/Externe";
fsType = "ntfs-3g";
options = [ "rw" "uid=1000" ];
};
networking.hostName = "arcueid"; # Define your hostname.
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Paris";
# Select internationalisation properties.
i18n.defaultLocale = "fr_FR.UTF-8";
i18n.extraLocaleSettings = {
@@ -59,25 +50,14 @@
LC_TIME = "fr_FR.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
programs.hyprland.enable = true;
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;
# services.gnome3.gnome-keyring.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "altgr-intl";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# TODO Add Scanner configuration
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
@@ -85,25 +65,15 @@
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.yoru = {
shell = pkgs.fish;
isNormalUser = true;
description = "Yoru";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
# thunderbird
];
};
home-manager = {
@@ -112,83 +82,17 @@
"yoru" = import ./home.nix;
};
};
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
fish
wget
unzip
helix
firefox
kitty
# rofi
wofi
dolphin
waybar
skypeforlinux
steam
discord # here because somehow the 'allowUnfree' is not recognized in home.nix
pavucontrol
logiops
docker
docker-compose
git
cargo
];
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
fira-code
nerd-fonts.fira-code
nerd-fonts.hack
nerd-fonts.droid-sans-mono
nerd-fonts.jetbrains-mono
nerd-fonts.fantasque-sans-mono
];
programs.steam.enable = true;
programs.gamemode.enable = true;
# programs.gamescopeSession.enable = true;
programs.fish.enable = true;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?
services.cli-environment.enable = true;
services.desktop-apps.enable = true;
services.dev-environment.enable = true;
services.gaming.enable = true;
services.fonts.enable = true;
services.window-manager.enable = true;
system.stateVersion = "24.05";
}

View File

@@ -0,0 +1,156 @@
{
pkgs,
lib,
config,
...
}: let
waybarConfig = {
"layer" = "top";
"position" = "top";
modules-left = [
"hyprland/workspaces"
"custom/media"
];
modules-center = [
"hyprland/window"
];
modules-right = [
"mpd"
"idle_inhibitor"
"pulseaudio"
"network"
"power-profiles-daemon"
"cpu"
"memory"
"temperature"
# "backlight"
"keyboard-state"
"clock"
"tray"
"custom/power"
];
"hyprland/workspaces" = {
"format" = "{icon}";
"on-scroll-up" = "hyprctl dispatch workspace e+1";
"on-scroll-down" = "hyprctl dispatch workspace e-1";
};
"idle_inhibitor" = {
"format" = "{icon}";
"format-icons" = {
"activated" = "";
"deactivated" = "";
};
};
"tray" = {
"spacing" = 10;
};
"cpu" = {
"format" = "{usage}% ";
"tooltip" = false;
};
"memory" = {
"format" = "{}% ";
};
"temperature" = {
# // "thermal-zone" = 2;
# // "hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
"critical-threshold" = 80;
# // "format-critical" = "{temperatureC}°C {icon}";
"format" = "{temperatureC}°C {icon}";
"format-icons" = ["" "" ""];
};
"network" = {
# // "interface" = "wlp2*"; // (Optional) To force the use of this interface
"format-wifi" = "{essid} ({signalStrength}%) ";
"format-ethernet" = "{ipaddr}/{cidr} ";
"tooltip-format" = "{ifname} via {gwaddr} ";
"format-linked" = "{ifname} (No IP) ";
"format-disconnected" = "Disconnected ";
"format-alt" = "{ifname}: {ipaddr}/{cidr}";
};
"pulseaudio" = {
# // "scroll-step" = 1; // %, can be a float
"format" = "{volume}% {icon} {format_source}";
"format-bluetooth" = "{volume}% {icon} {format_source}";
"format-bluetooth-muted" = " {icon} {format_source}";
"format-muted" = " {format_source}";
"format-source" = "{volume}% ";
"format-source-muted" = "";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = ["" "" ""];
};
"on-click" = "pavucontrol";
};
"custom/media" = {
"format" = "{icon} {text}";
"return-type" = "json";
"max-length" = 40;
"format-icons" = {
"spotify" = "";
"default" = "🎜";
};
"escape" = true;
"exec" = "$HOME/.config/waybar/mediaplayer.py 2> /dev/null"; # // Script in resources folder
# // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
};
"custom/power" = {
"format" = " ";
"tooltip" = false;
"menu" = "on-click";
"menu-file" = "$HOME/.config/waybar/power_menu.xml"; # // Menu file in resources folder
"menu-actions" = {
"shutdown" = "shutdown";
"reboot" = "reboot";
"suspend" = "systemctl suspend";
"hibernate" = "systemctl hibernate";
};
};
};
css = ''
* {
font-family: 'Fira Code', 'Symbols Nerd Font Mono';
font-size: 16px;
min-height: 45px;
}
window#waybar {
background: transparent;
}
#workspaces, #clock, #pulseaudio, #network, #cpu, #memory, #backlight, #idle_inhibitor, #temperature, #custom-power {
border-radius: 10px;
background-color: rgba(10, 10, 10, 0.5);
margin-top: 1px;
padding-top: 5px;
padding-left: 15px;
padding-right: 10px;
padding-bottom: 5px;
}
#workspaces button.active {
color: #ebebeb;
}
'';
in {
options = {
myHome.waybar.enable = lib.mkEnableOption "enables waybar";
};
config = lib.mkIf config.myHome.waybar.enable {
programs.waybar = {
enable = true;
systemd = {
enable = false;
target = "graphical-session.target";
};
style = css;
settings = {
mainBar = waybarConfig;
};
};
};
}

View File

@@ -0,0 +1,22 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.cli-environment;
in
{
imports = [];
options.services.cli-environment = {
enable = mkEnableOption "enable cli-environment";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
wget
unzip
helix
git
];
programs.fish.enable = true;
};
}

View File

@@ -0,0 +1,20 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.desktop-apps;
in
{
imports = [];
options.services.desktop-apps = {
enable = mkEnableOption "enable desktop-apps";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
kitty
skypeforlinux
];
programs.firefox.enable = true;
};
}

View File

@@ -0,0 +1,22 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.dev-environment;
in
{
imports = [];
options.services.dev-environment = {
enable = mkEnableOption "enable dev-environment";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
docker
docker-compose
git
cargo
rustup
];
};
}

27
modules/nixos/fonts.nix Normal file
View File

@@ -0,0 +1,27 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.fonts;
in
{
imports = [];
options.services.fonts = {
enable = mkEnableOption "enable fonts";
};
config = mkIf cfg.enable {
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
fira-code
nerd-fonts.fira-code
nerd-fonts.hack
nerd-fonts.droid-sans-mono
nerd-fonts.jetbrains-mono
nerd-fonts.fantasque-sans-mono
];
};
}

21
modules/nixos/gaming.nix Normal file
View File

@@ -0,0 +1,21 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.gaming;
in
{
imports = [];
options.services.gaming = {
enable = mkEnableOption "enable gaming";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
steam
discord
];
programs.steam.enable = true;
programs.gamemode.enable = true;
};
}

View File

@@ -0,0 +1,24 @@
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.services.window-manager;
in
{
imports = [];
options.services.window-manager = {
enable = mkEnableOption "enable window-manager";
};
config = mkIf cfg.enable {
programs.hyprland.enable = true;
programs.hyprlock.enable = true;
security.pam.services.hyprlock = {};
environment.systemPackages = with pkgs; [
wofi
dolphin
waybar
pavucontrol
];
};
}