initial commit

This commit is contained in:
2025-05-12 23:25:39 -03:00
parent bf178e3caa
commit dc6f6894e6
95 changed files with 3922 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
# This is an example nixos hosts module.
# They will automatically be imported below.
#############################################################
#
# Bellerophon - Example Desktop
#
###############################################################
{
inputs,
lib,
...
}:
{
imports = lib.flatten [
#
# ========== Hardware ==========
#
inputs.nixos-hardware.nixosModules.common-cpu-intel
inputs.nixos-hardware.nixosModules.common-hidpi
inputs.nixos-hardware.nixosModules.common-pc-laptop
inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
./hardware-configuration.nix
#
# ========== Disk Layout ==========
#
inputs.disko.nixosModules.disko
# FIXME(starter): modify with the disko spec file you want to use.
(lib.custom.relativeToRoot "hosts/common/disks/luks-btrfs-disk.nix")
# FIXME(starter): modify the options below to inform disko of the host's disk path and swap requirements.
# IMPORTANT: nix-config-starter assumes a single disk per host. If you require more disks, you
# must modify or create new dikso specs.
{
_module.args = {
disk = "/dev/nvme0n1";
withSwap = true;
swapSize = "64";
};
}
(map lib.custom.relativeToRoot [
#
# ========== Required Configs ==========
#
"hosts/common/core"
#
# ========== Non-Primary Users to Create ==========
#
# FIXME(starter): the primary user, defined in `nix-config/hosts/common/users`, is added by default, via
# `hosts/common/core` above.
# To create additional users, specify the path to their config file, as shown in the commented line below, and create/modify
# the specified file as required. See `nix-config/hosts/common/users/exampleSecondUser` for more info.
#"hosts/common/users/exampleSecondUser"
#
# ========== Optional Configs ==========
#
# FIXME(starter): add or remove any optional host-level configuration files the host will use
# The following are for example sake only and are not necessarily required.
"hosts/common/optional/services/openssh.nix" # allow remote SSH access
"hosts/common/optional/audio.nix" # pipewire and cli controls
"hosts/common/optional/kde.nix"
"hosts/common/optional/sddm.nix"
])
];
#
# ========== Host Specification ==========
#
# FIXME(starter): declare any host-specific hostSpec options. Note that hostSpec options pertaining to
# more than one host can be declared in `nix-config/hosts/common/core/` see the default.nix file there
# for examples.
hostSpec = {
hostName = "Bellerophon";
};
networking = {
networkmanager.enable = true;
enableIPv6 = false;
};
boot.loader = {
systemd-boot = {
enable = true;
# When using plymouth, initrd can expand by a lot each time, so limit how many we keep around
configurationLimit = lib.mkDefault 10;
};
efi.canTouchEfiVariables = true;
timeout = 3;
};
boot.initrd = {
systemd.enable = true;
};
hardware.graphics = {
enable = true;
};
# https://wiki.nixos.org/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "24.11";
}

View File

@@ -0,0 +1,49 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usbhid"];
boot.initrd.kernelModules = [];
boot.kernelPackages = pkgs.linuxPackages_6_12;
boot.kernelModules = ["kvm-intel"];
boot.kernelPatches = [
/*
{
name = "zenbook-asus-wmi";
patch = ./zenbook-asus-wmi.patch;
}
*/
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
#networking.useDHCP = lib.mkDefault true;
# networking.interfaces.docker0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
environment.systemPackages = with pkgs; [
sof-firmware
#rotation stuff
pkgs.gnome-monitor-config
pkgs.usbutils
pkgs.inotify-tools
pkgs.kdePackages.libkscreen
];
}

107
hosts/nixos/iso/default.nix Normal file
View File

@@ -0,0 +1,107 @@
#NOTE: This ISO is NOT minimal. We don't want a minimal environment when using the iso for recovery purposes.
{
inputs,
pkgs,
lib,
config,
...
}:
{
imports = lib.flatten [
# FIXME(starter): comment/uncomment the following two lines depending on if you want a cli-only, minimal iso, or a graphical iso that installs gnome
# If you are planning to make use of `nix-config/nixos-installer`, you will not require a graphical iso.
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
#"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix"
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix"
# This is overkill but I want my core home level utils if I need to use the iso environment for recovery purpose
inputs.home-manager.nixosModules.home-manager
(map lib.custom.relativeToRoot [
"modules/common/host-spec.nix"
# We want primary default so we get ssh authorized keys, zsh, and some basic tty tools. It also pulls in the hm spec for iso.
# Note that we are not pulling in "hosts/common/users/primary/nixos.nix" for the iso as it's not needed.
"hosts/common/users/primary/"
"hosts/common/optional/minimal-user.nix"
])
];
hostSpec = {
hostName = "iso";
# FIXME(starter): the username below will be available in additional the the standard `root` and `nixos` users from the nixos installation image.
username = "panotaka";
isProduction = lib.mkForce false;
# FIXME(starter): add your github username and github-noreply email address
handle = "panotaka";
#email.gitHub = "foo@users.noreply.github.com";
};
# root's ssh key are mainly used for remote deployment
users.extraUsers.root = {
inherit (config.users.users.${config.hostSpec.username}) hashedPassword;
openssh.authorizedKeys.keys =
config.users.users.${config.hostSpec.username}.openssh.authorizedKeys.keys;
};
environment.etc = {
isoBuildTime = {
#
text = lib.readFile (
"${pkgs.runCommand "timestamp" {
# builtins.currentTime requires --impure
env.when = builtins.currentTime;
} "echo -n `date -d @$when +%Y-%m-%d_%H-%M-%S` > $out"}"
);
};
};
# Add the build time to the prompt so it's easier to know the ISO age
programs.bash.promptInit = ''
export PS1="\\[\\033[01;32m\\]\\u@\\h-$(cat /etc/isoBuildTime)\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ "
'';
# The default compression-level is (6) and takes too long on some machines (>30m). 3 takes <2m
isoImage.squashfsCompression = "zstd -Xcompression-level 3";
nixpkgs = {
hostPlatform = lib.mkDefault "x86_64-linux";
config.allowUnfree = true;
};
nix = {
settings.experimental-features = [
"nix-command"
"flakes"
];
extraOptions = "experimental-features = nix-command flakes";
};
services = {
qemuGuest.enable = true;
openssh = {
settings.PermitRootLogin = lib.mkForce "yes";
};
};
boot = {
kernelPackages = pkgs.linuxPackages_latest;
supportedFilesystems = lib.mkForce [
"btrfs"
"vfat"
];
};
networking = {
hostName = "iso";
};
systemd = {
services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
# gnome power settings to not turn off screen
targets = {
sleep.enable = false;
suspend.enable = false;
hibernate.enable = false;
hybrid-sleep.enable = false;
};
};
}