Initial commit

This commit is contained in:
marc
2022-10-02 20:33:40 +02:00
commit a1d321316c
30 changed files with 2492 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
{ config, pkgs, lib, ... }:
{
imports = [
./hardware.nix
];
# - Basic --------------------------------------
networking.hostName = "kopavogur";
samfelag.modules.user = {
name = "marc";
};
# - Bootloader ---------------------------------
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
# - Services -----------------------------------
samfelag.profiles.desktop.enable = true;
system.stateVersion = "22.05";
}

View File

@@ -0,0 +1,40 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd = {
availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "ahci" "xhci_pci" "pata_jmicron" "firewire_ohci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
kernelModules = [ ];
};
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ config.boot.kernelPackages.rtl88xxau-aircrack ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
};
swapDevices = [
{ device = "/dev/disk/by-label/swap"; }
];
networking = {
useDHCP = lib.mkDefault true;
interfaces = {
enp7s0.useDHCP = lib.mkDefault true;
wlp0s26f7u2.useDHCP = lib.mkDefault true;
};
};
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,2 @@
* Kopavogur
Ordinador (torre) de l'Ajuntament

View File

@@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./user.nix
];
}

36
system/modules/user.nix Normal file
View File

@@ -0,0 +1,36 @@
{ config, lib, pkgs, self, ... }:
let
cfg = config.samfelag.modules.user;
in
{
options.samfelag.modules.user = {
name = lib.mkOption {
type = lib.types.str;
default = "marc";
description = ''
Specifies the user name
'';
};
};
config = lib.mkMerge [
{
programs.zsh.enable = true;
users = {
defaultUserShell = pkgs.zsh;
users."${cfg.name}" = with cfg; {
description = "Marc Sastre Rienitz";
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" ];
};
# Do not allow users to be added or modified except through Nix configuration.
# mutableUsers = false;
};
nix.settings.trusted-users = [ "${cfg.name}" ];
}
];
}

View File

@@ -0,0 +1,46 @@
{ config, pkgs, lib, ... }:
{
# - Nix ----------------------------------------
nix = {
package = pkgs.nixFlakes;
extraOptions = lib.optionalString (config.nix.package == pkgs.nixFlakes)
"experimental-features = nix-command flakes";
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
};
# - Locale -------------------------------------
time.timeZone = "Europe/Madrid";
i18n.defaultLocale = "ca_ES.utf8";
console.keyMap = "es";
services.xserver = {
layout = "es";
xkbVariant = "cat";
};
# - Packages -----------------------------------
environment.pathsToLink = [ "/libexec" ];
environment.systemPackages = with pkgs; [
curl
git
pciutils
vim
];
# - Other --------------------------------------
networking.networkmanager.enable = true;
system.stateVersion = "22.05";
}

View File

@@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./common.nix
./desktop.nix
];
}

View File

@@ -0,0 +1,74 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.samfelag.profiles.desktop;
in
{
options.samfelag.profiles.desktop = {
enable = mkEnableOption "desktop profile";
laptop = mkOption {
description = "Enable features for a laptop (trackpad, battery, etc...)";
type = types.bool;
default = false;
};
};
config = mkIf cfg.enable {
# - Packages ---------------------------------
environment.systemPackages = with pkgs; [
pamixer
];
# - Audio ------------------------------------
sound.enable = true;
hardware = {
pulseaudio = {
enable = true;
support32Bit = true;
package = pkgs.pulseaudioFull;
};
};
# - Window + Display Manager -----------------
environment.pathsToLink = [ "/libexec" ];
services.xserver = {
enable = true;
libinput = mkIf cfg.laptop {
enable = true;
touchpad.tapping = true;
};
desktopManager = {
xterm.enable = false;
};
displayManager = {
defaultSession = "none+i3";
lightdm = {
enable = true;
greeters.mini = {
enable = true;
user = "marc";
extraConfig = ''
[greeter]
show-sys-info = true
'';
};
};
};
windowManager.i3.enable = true;
};
};
}