chore: rename system to systems

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-01-07 13:51:15 -03:00
parent 05d556b5f9
commit 9e30b049a4
7 changed files with 232 additions and 172 deletions

View File

@@ -23,22 +23,13 @@
};
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
inputs.home-manager.nixosModules.default
./hosts/default/configuration.nix
];
};
homeConfiguration."guz" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs; };
};
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
inputs.home-manager.nixosModules.default
./hosts/desktop/configuration.nix
];
};
};
}

View File

@@ -1,155 +0,0 @@
# 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, lib, ... }:
{
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Sao_Paulo";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "pt_BR.UTF-8";
LC_IDENTIFICATION = "pt_BR.UTF-8";
LC_MEASUREMENT = "pt_BR.UTF-8";
LC_MONETARY = "pt_BR.UTF-8";
LC_NAME = "pt_BR.UTF-8";
LC_NUMERIC = "pt_BR.UTF-8";
LC_PAPER = "pt_BR.UTF-8";
LC_TELEPHONE = "pt_BR.UTF-8";
LC_TIME = "pt_BR.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "br";
xkbVariant = "";
};
# Configure console keymap
console.keyMap = "br-abnt2";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
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;
programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users."guz" = {
isNormalUser = true;
description = "Guz";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
# thunderbird
];
shell = pkgs.zsh;
};
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
"guz" = import ./home.nix;
};
};
services.flatpak.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim
neovim
git
lazygit
gcc # Added temporally so my neovim config doesn't break
wget
nixpkgs-fmt
nixpkgs-lint
];
environment.sessionVariables = {
EDITOR = "nvim";
};
environment.pathsToLink = [ "/share/zsh" ];
# 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 = "23.11"; # Did you read the comment?
}

View File

@@ -0,0 +1,71 @@
# 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, lib, ... }:
{
imports = [
../../modules/nixos/config/host.nix
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users."guz" = {
isNormalUser = true;
description = "Guz";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
# thunderbird
];
shell = pkgs.zsh;
};
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
"guz" = import ./home.nix;
};
};
services.flatpak.enable = true;
environment.pathsToLink = [ "/share/zsh" ];
# 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;
}

View File

@@ -0,0 +1,88 @@
# Config shared between all host's configuration.nix (NixOS config)
{ config, pkgs, inputs, lib, ... }:
let
cfg = config.host;
in
{
imports = [
inputs.home-manager.nixosModules.default
../systems/localization.nix
];
options.host = {
networking = {
hostName = lib.mkOption {
default = "nixos";
type = lib.types.str;
description = "Define the host's network name";
};
wireless.enable = lib.mkOption {
default = false;
type = lib.types.bool;
description = "Enables wireless support";
};
};
time = {
timeZone = lib.mkOption {
type = lib.types.str;
description = "Sets host's time zone";
};
};
};
config = {
# Nix configuration
nix.settings.experimental-features = [ "nix-command" "flakes" ];
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
};
networking = {
networkmanager.enable = true;
hostName = cfg.networking.hostName;
wireless.enable = cfg.networking.wireless.enable;
# Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/";
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
};
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
#jack.enable = true;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim
neovim
git
lazygit
gcc # Added temporally so my neovim config doesn't break
wget
nixpkgs-fmt
nixpkgs-lint
];
environment.sessionVariables = {
EDITOR = "nvim";
};
# 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 = "23.11"; # Did you read the comment?
};
}

View File

@@ -0,0 +1,65 @@
{ config, pkgs, inputs, lib, ... }:
let
cfg = config.localization;
in
{
options.localization = {
locale = lib.mkOption {
default = "en_US.UTF-8";
type = lib.types.str;
description = "Sets default locale of the host";
};
extraLocales = lib.mkOption {
default = rec {
LC_ADDRESS = "pt_BR.UTF-8";
LC_IDENTIFICATION = LC_ADDRESS;
LC_MEASUREMENT = LC_ADDRESS;
LC_MONETARY = LC_ADDRESS;
LC_NAME = LC_ADDRESS;
LC_NUMERIC = LC_ADDRESS;
LC_PAPER = LC_ADDRESS;
LC_TELEPHONE = LC_ADDRESS;
LC_TIME = LC_ADDRESS;
};
description = "Extra localization settings";
};
keymap.layout = lib.mkOption {
default = "br";
type = lib.types.str;
};
keymap.variant = lib.mkOption {
default = "";
type = lib.types.str;
};
keymap.console = lib.mkOption {
default = "br-abnt2";
type = lib.types.str;
};
time = {
zone = lib.mkOption {
default = "America/Sao_Paulo";
type = lib.types.str;
};
};
};
config = {
i18n = {
defaultLocale = cfg.locale;
extraLocaleSettings = cfg.extraLocales;
};
services.xserver = {
layout = cfg.keymap.layout;
xkbVariant = cfg.keymap.variant;
};
console.keyMap = cfg.keymap.console;
time = {
timeZone = cfg.time.zone;
};
};
}