refactor: attempting to merge nix-starter-configs and chfour's nixos config together

This commit is contained in:
Ruben 2024-04-17 20:52:32 -05:00
commit ffc95db1f8
No known key found for this signature in database
GPG key ID: AE181294E97E4802
13 changed files with 330 additions and 228 deletions

View file

@ -1,98 +0,0 @@
{ config, pkgs, ... }:
{
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# auto optimize store and experimental features
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
# Enable networking
networking.networkmanager.enable = true;
# we're using/prioritizing dnscrypt!
networking.nameservers = [ "127.0.0.1" "::1" ];
# resolved and others conflicts with setting dns here
networking.resolvconf.enable = pkgs.lib.mkForce false;
networking.dhcpcd.extraConfig = "nohook resolv.conf";
services.resolved.enable = false;
# also ensuring that networkmanager doesn't modify dns settings
networking.networkmanager.dns = "none";
# dnscrypt settings
services.dnscrypt-proxy2 = {
enable = true;
settings = {
ipv6_servers = true;
require_dnssec = true;
sources.public-resolvers = {
# of course, sourcing from the main public lists
urls = [
"https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md"
"https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md"
];
cache_file = "/var/lib/dnscrypt-proxy2/public-resolvers.md";
minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
};
# You can choose a specific set of servers from https://github.com/DNSCrypt/dnscrypt-resolvers/blob/master/v3/public-resolvers.md
# prioritize quad9, then adguard, and cloudflare as last resort
server_names = [ "quad9-dnscrypt-ip4-filter-pri" "quad9-doh-ip4-port443-filter-pri" "quad9-doh-ip6-port443-filter-pri" "adguard-dns-doh" "adguard-dns-ipv6" "cloudflare" "cloudflare-ipv6" ];
};
};
systemd.services.dnscrypt-proxy2.serviceConfig = {
StateDirectory = "dnscrypt-proxy";
};
# enable plymouth because it looks cool :)))
boot.plymouth = {
enable = true;
theme = "bgrt";
};
# Enable CUPS to print documents.
services.printing = {
enable = true;
drivers = with pkgs; [ canon-cups-ufr2 ];
};
services.avahi.enable = true;
services.avahi.nssmdns4 = 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;
# wireplumber exists so, lets *not* use the example session
wireplumber.enable = true;
};
# gnupg is basically required for everything i use
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# virtualization stuff
virtualisation.libvirtd = {
enable = true;
#qemu.runAsRoot = false;
qemu.swtpm.enable = true;
};
virtualisation.spiceUSBRedirection.enable = true;
# waydroid
virtualisation.waydroid.enable = true;
}

View file

@ -1,33 +0,0 @@
{ config, pkgs, ... }:
{
# List packages installed in system profile. To search, run:
# $ nix search wget
#
# enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = with pkgs; [
# git is required for flakes, and either way i use it
git
wget
curl
jq
imagemagick
ffmpeg
virt-manager
];
# set the default editor to neovim
environment.variables.EDITOR = "nvim";
# we like flatpaks
services.flatpak.enable = true;
# steam
programs.steam = {
enable = true;
};
# android debugging tools
programs.adb.enable = true;
}

View file

@ -1,42 +0,0 @@
{ pkgs, ... }:
{
# so, funny thing i learned - "xserver" is basically the blanket term for all gui stuff in nixos.
# this really confuses me, because i'm trying to keep xorg out of this install and only wayland in.
# i may miss some spots though.
# see: https://www.reddit.com/r/NixOS/comments/17ia1g8/i_dont_understand_nixoss_wayland_setup/
services.xserver.enable = true;
# use sddm and only use its wayland session
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
# default to plasma wayland session
services.displayManager.defaultSession = "plasma";
# gyattde rizzma 6
services.desktopManager.plasma6 = {
enable = true;
};
programs.xwayland.enable = true;
# we use flatpak
programs.firefox.enable = false;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
};
# don't install some of the default packages since i don't need them
environment.plasma6.excludePackages = with pkgs.kdePackages; [
plasma-browser-integration
#konsole
#oxygen
];
# ensure we have dconf enabled
programs.dconf.enable = true;
# this enables the ozone stuff on wayland for chromium and electron and shit
environment.variables.NIXOS_OZONE_WL = "1";
}

View file

@ -3,9 +3,9 @@
# | '_ \| \ \/ / _ \/ __|
# | | | | |> < (_) \__ \
# |_| |_|_/_/\_\___/|___/
# this configuration file is copied/inspired from https://github.com/chfour/nixos
# with lots of examples and knowledge gained with the standard config from https://github.com/Misterio77/nix-starter-configs
# and also this wonderful book https://nixos-and-flakes.thiscute.world
# this configuration file is basically a mashup of https://github.com/chfour/nixos and https://github.com/Misterio77/nix-starter-configs
# with lots of examples and knowledge gained from both of them
# and also this wonderful book which helped get me started on nix https://nixos-and-flakes.thiscute.world
# shoutouts to yall 🙏
{
description = "Sneexy's custom nixos configs";
@ -37,6 +37,7 @@
# flake for 06cb:009a fingerprint scanners. to make the fingerprint scanner on my
# thinkpad t480 function.
# TODO: see if you can only add this for t480
nixos-06cb-009a-fingerprint-sensor = {
url = "github:ahbnr/nixos-06cb-009a-fingerprint-sensor";
inputs.nixpkgs.follows = "nixpkgs";
@ -66,15 +67,33 @@
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
# main laptop i use daily
"thunkpad" = nixpkgs.lib.nixosSystem rec {
specialArgs = {inherit inputs outputs;};
modules = with self.nixosModules; [
# nixos configuration file (and others) for thunkpad
modules = [
# specific configs for thunkpad/t480
./machines/thunkpad
# shared/common config
./nixos/configuration.nix
# fingerprint modules
nixos-06cb-009a-fingerprint-sensor.nixosModules.open-fprintd
nixos-06cb-009a-fingerprint-sensor.nixosModules.python-validity
@ -84,10 +103,12 @@
};
# secondary 2 in 1 device, not really used
"thonkpad" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = with self.nixosModules; [
specialArgs = {inherit inputs outputs;};
modules = [
# nixos configuration file (and others) for thonkpad
./machines/thonkpad
# shared/common config
./nixos/configuration.nix
# nyx repo
chaotic.nixosModules.default
];

View file

@ -4,7 +4,6 @@
inputs,
outputs,
lib,
osConfig,
config,
pkgs,
...
@ -22,6 +21,23 @@
];
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
@ -31,14 +47,12 @@
};
};
# meeee :333
# if this ain't you, you should probably change this
home = {
username = "ruben";
homeDirectory = "/home/ruben";
};
# this is a got damn NEO VIMME HOUSE !!
# this is a got damn NEO VIMME HOUSE !!
home.sessionVariables = {
EDITOR = "nvim";
};
@ -75,6 +89,7 @@
xdg.userDirs.enable = true;
# music!!
services.mpd = {
enable = true;
extraConfig = ''
@ -86,31 +101,33 @@
};
# Add stuff for your user as you see fit:
# programs.neovim.enable = true;
programs.neovim.enable = true;
home.packages = with pkgs; [
btop
sheldon
starship
zoxide
fzf
bat
duf
fastfetch
fd
delta
lsd
ripgrep
sd
starship
zoxide
usbutils
jq
ffmpeg_6-full
imagemagick
yt-dlp
mpv
];
# Enable home-manager and git
programs.home-manager.enable = true;
programs.git.enable = true;
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
# Enable home-manager
programs.home-manager.enable = true;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
# basically: don't touch this.
home.stateVersion = "23.05";
}

View file

@ -8,27 +8,11 @@
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
# KDE Plasma configuration
../../config/plasma.nix
# Shared/common configurations
../../config/common.nix
# Packages
../../config/packages.nix
];
# who up thunking they
# who up thonking they
networking.hostName = "thonkpad";
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# use linux-cachy from the nyx repo.
# is this actually "required"? no, not really. but i can have it, so why not?
# see nyx: https://www.nyx.chaotic.cx/
# see cachyos: https://github.com/CachyOS/linux-cachyos
boot.kernelPackages = pkgs.linuxPackages_cachyos;
# Set your time zone.
time.timeZone = "America/Chicago";

View file

@ -8,27 +8,11 @@
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
# KDE Plasma configuration
../../config/plasma.nix
# Shared/common configurations
../../config/common.nix
# Packages
../../config/packages.nix
];
# who up thunking they
networking.hostName = "thunkpad";
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# use linux-cachy from the nyx repo.
# is this actually "required"? no, not really. but i can have it, so why not?
# see nyx: https://www.nyx.chaotic.cx/
# see cachyos: https://github.com/CachyOS/linux-cachyos
boot.kernelPackages = pkgs.linuxPackages_cachyos;
# Set your time zone.
time.timeZone = "America/Chicago";

View file

@ -0,0 +1,6 @@
# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
# These should be stuff you would like to share with others, not your personal configurations.
{
# List your module files here
# my-module = import ./my-module.nix;
}

View file

@ -0,0 +1,6 @@
# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
# These should be stuff you would like to share with others, not your personal configurations.
{
# List your module files here
# my-module = import ./my-module.nix;
}

228
nixos/configuration.nix Normal file
View file

@ -0,0 +1,228 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
# You can import other NixOS modules here
imports = [
# If you want to use modules your own flake exports (from modules/nixos):
# outputs.nixosModules.example
# Or modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd
# You can also split up your configuration and import pieces of it here:
# ./users.nix
# specify users in a seperate config file (since its only me on this system, anyways)
./users.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
};
};
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs);
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
nix.nixPath = ["/etc/nix/path"];
environment.etc =
lib.mapAttrs'
(name: value: {
name = "nix/path/${name}";
value.source = value.flake;
})
config.nix.registry;
nix.settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
# Deduplicate and optimize nix store
auto-optimise-store = true;
};
# use linux-cachy from the nyx repo.
# is this actually "required"? no, not really. but i can have it, so why not?
# see nyx: https://www.nyx.chaotic.cx/
# see cachyos: https://github.com/CachyOS/linux-cachyos
boot.kernelPackages = pkgs.linuxPackages_cachyos;
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Enable networking
networking.networkmanager.enable = true;
# we're using/prioritizing dnscrypt!
networking.nameservers = [ "127.0.0.1" "::1" ];
# resolved and others conflicts with setting dns here
networking.resolvconf.enable = pkgs.lib.mkForce false;
networking.dhcpcd.extraConfig = "nohook resolv.conf";
services.resolved.enable = false;
# also ensuring that networkmanager doesn't modify dns settings
networking.networkmanager.dns = "none";
# dnscrypt settings
services.dnscrypt-proxy2 = {
enable = true;
settings = {
ipv6_servers = true;
require_dnssec = true;
sources.public-resolvers = {
# of course, sourcing from the main public lists
urls = [
"https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md"
"https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md"
];
cache_file = "/var/lib/dnscrypt-proxy2/public-resolvers.md";
minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
};
# You can choose a specific set of servers from https://github.com/DNSCrypt/dnscrypt-resolvers/blob/master/v3/public-resolvers.md
# prioritize quad9, then adguard, and cloudflare as last resort
server_names = [ "quad9-dnscrypt-ip4-filter-pri" "quad9-doh-ip4-port443-filter-pri" "quad9-doh-ip6-port443-filter-pri" "adguard-dns-doh" "adguard-dns-ipv6" "cloudflare" "cloudflare-ipv6" ];
};
};
systemd.services.dnscrypt-proxy2.serviceConfig = {
StateDirectory = "dnscrypt-proxy";
};
# enable plymouth because it looks cool :)))
boot.plymouth = {
enable = true;
theme = "bgrt";
};
# Enable CUPS to print documents.
services.printing = {
enable = true;
drivers = with pkgs; [ canon-cups-ufr2 ];
};
services.avahi.enable = true;
services.avahi.nssmdns4 = true;
# so, funny thing i learned - "xserver" is basically the blanket term for all gui stuff in nixos.
# this really confuses me, because i'm trying to keep xorg out of this install and only wayland in.
# i may miss some spots though.
# see: https://www.reddit.com/r/NixOS/comments/17ia1g8/i_dont_understand_nixoss_wayland_setup/
# EDIT: they changed it !!!!
services.xserver.enable = true;
# use sddm and only use its wayland session
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
# default to plasma wayland session
services.displayManager.defaultSession = "plasma";
# gyattde rizzma 6
services.desktopManager.plasma6 = {
enable = true;
};
programs.xwayland.enable = true;
# we use flatpak
programs.firefox.enable = false;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
};
# don't install some of the default packages since i don't need them
environment.plasma6.excludePackages = with pkgs.kdePackages; [
plasma-browser-integration
#konsole
#oxygen
];
# this enables the ozone stuff on wayland for chromium and electron and shit
environment.variables.NIXOS_OZONE_WL = "1";
# 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;
# wireplumber exists so, lets *not* use the example session
wireplumber.enable = true;
};
environment.systemPackages = with pkgs; [
git
wget fzf
curl curlHTTP3
virt-manager
pinentry-curses
kitty wezterm
ventoy
];
# we like flatpaks
services.flatpak.enable = true;
# steam
programs.steam.enable = true;
# android debugging tools
programs.adb.enable = true;
# gnupg is basically required for everything i use
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# virtualization stuff
virtualisation.libvirtd = {
enable = true;
#qemu.runAsRoot = false;
qemu.swtpm.enable = true;
};
virtualisation.spiceUSBRedirection.enable = true;
# waydroid
virtualisation.waydroid.enable = true;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "23.05";
}

View file

@ -4,6 +4,7 @@
{
home-manager.users.ruben = ./home.nix;
# myself :D
users.users."ruben" = {
isNormalUser = true;
description = "Ruben";
@ -13,6 +14,6 @@
openssh.authorizedKeys.keys = [ ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO+V3b6oKMTLEBq8AKjdNF5ZwJGXuWTrS2u9QaEypBYP sneexy@disroot.org'' ''ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCtpoR3fGHuHv55u1rhY4YVm4rz49/i78IQa3Lv7GsaJXse5nswkBW2fl4zXjBOorKBLPDBqgYZDFOxbjXTQq+zTrEN3qggp5W1kQXMuTqh3iyaseavwt7FM70IziAOkfYyJdAvLsoBymFLLXnVSYY5ZdxiRK6S+1ud64OAw2/wigk5KxPEjnL1Q8a9S1xpCWLVBNNTL0qYneFezHApN3lijeotcBVYhpQmxtifebeeom0J7KE3ivYW/mh7tTk2DZVAQPRKPC1Szk2TdWuUw8i5Ybdjc8lSNgDHBFzGexxIDeRJMaaQP5wDdTxIrIWAIXREkOd4soijaK09bRD4d4Xi6qeCRWoARrsyEzWASpXpNN7yVta6JVe1r+QdNYFol9K0ojqQHsjYJpskTpBCXCLlmQCzRcAuAyf9Poj+l3Z8L65/T7Mucm5+/3Z3HQK99sDx0i4NmueBiDrkdm159K8w/iG08d9H4kD0wu1RAaIzCkKENF/LS9Ut207w0qbwak= ruben@thunkpad'' ];
};
programs.zsh.enable = true; # "TODO: get rid of this if possible" thanks chfour
programs.zsh.enable = true;
environment.shells = with pkgs; [ zsh ];
}

23
overlays/default.nix Normal file
View file

@ -0,0 +1,23 @@
# This file defines overlays
{inputs, ...}: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs {pkgs = final;};
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
}

5
pkgs/default.nix Normal file
View file

@ -0,0 +1,5 @@
# Custom packages, that can be defined similarly to ones from nixpkgs
# You can build them using 'nix build .#example'
pkgs: {
# example = pkgs.callPackage ./example { };
}