From ae81bfe6eb05859fdce2906a949d7eb657fac552 Mon Sep 17 00:00:00 2001 From: Sneexy Date: Wed, 17 Apr 2024 15:43:14 -0500 Subject: [PATCH] refactor new dots (wip) --- README.md | 4 +- wip/config/common.nix | 83 ++++++++++ wip/config/packages.nix | 36 +++++ wip/config/plasma.nix | 43 +++++ wip/flake.nix | 118 +++++++++----- wip/home-manager/home.nix | 69 -------- wip/machines/thonkpad/default.nix | 150 ++++++++++++++++++ .../thonkpad/hardware-configuration.nix | 42 +++++ wip/machines/thunkpad/default.nix | 63 ++++++++ wip/modules/home-manager/default.nix | 6 - wip/modules/nixos/default.nix | 6 - wip/nixos/configuration.nix | 113 ------------- wip/nixos/hardware-configuration.nix | 10 -- wip/overlays/default.nix | 23 --- wip/pkgs/default.nix | 5 - wip/users/ruben/default.nix | 18 +++ wip/users/ruben/home.nix | 116 ++++++++++++++ 17 files changed, 629 insertions(+), 276 deletions(-) create mode 100644 wip/config/common.nix create mode 100644 wip/config/packages.nix create mode 100644 wip/config/plasma.nix delete mode 100644 wip/home-manager/home.nix create mode 100644 wip/machines/thonkpad/default.nix create mode 100644 wip/machines/thonkpad/hardware-configuration.nix create mode 100644 wip/machines/thunkpad/default.nix delete mode 100644 wip/modules/home-manager/default.nix delete mode 100644 wip/modules/nixos/default.nix delete mode 100644 wip/nixos/configuration.nix delete mode 100644 wip/nixos/hardware-configuration.nix delete mode 100644 wip/overlays/default.nix delete mode 100644 wip/pkgs/default.nix create mode 100644 wip/users/ruben/default.nix create mode 100644 wip/users/ruben/home.nix diff --git a/README.md b/README.md index 0cf6e8f..4a22a31 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # sn(ixos)eexy -my custom nixos config !!! +my custom nixos config !!! i am still new to nix as a whole so a lot of this is either pretty basic or messy + +self reference: use `git+https://git.gay/sneexy/nixos` when referring to this repo. # resources diff --git a/wip/config/common.nix b/wip/config/common.nix new file mode 100644 index 0000000..62181d2 --- /dev/null +++ b/wip/config/common.nix @@ -0,0 +1,83 @@ +{ config, pkgs, ... }: + +{ + # 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 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; +} diff --git a/wip/config/packages.nix b/wip/config/packages.nix new file mode 100644 index 0000000..7344110 --- /dev/null +++ b/wip/config/packages.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: + +{ + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # 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; +} diff --git a/wip/config/plasma.nix b/wip/config/plasma.nix new file mode 100644 index 0000000..b850350 --- /dev/null +++ b/wip/config/plasma.nix @@ -0,0 +1,43 @@ +{ 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.xserver.displayManager.sddm.enable = true; + services.xserver.displayManager.sddm.wayland.enable = true; + # default to plasma wayland session + services.xserver.displayManager.defaultSession = "plasma"; + # gyattde rizzma 6 + services.xserver.desktopManager.plasma6 = { + enable = true; + }; + + programs.xwayland.enable = true; + # we use flatpak + programs.firefox.enable = false; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # 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"; +} diff --git a/wip/flake.nix b/wip/flake.nix index 8eb393e..be5c14e 100644 --- a/wip/flake.nix +++ b/wip/flake.nix @@ -1,39 +1,64 @@ +# _ +# _ __ (_)_ _____ ___ +# | '_ \| \ \/ / _ \/ __| +# | | | | |> < (_) \__ \ +# |_| |_|_/_/\_\___/|___/ +# 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 +# shoutouts to yall 🙏 { - description = "Sneexy's custom system setup"; + description = "Sneexy's custom nixos configs"; inputs = { - # nixpkgs from the unstable branch, since default release packages are a bit - # too dated for my taste + # nixpkgs from the unstable branch. since stable is a bit too dated + # for my personal taste nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - # nixpkgs from the chaotic team. usually contains packages like unstable or "fresh - # from git" packages as well as others like custom linux kernels (which we use) + # "fresh from git" master branch of nixpkgs. for packages not yet in unstable + nixpkgs-master.url = "github:NixOS/nixpkgs/master"; + + # chaotic's team nyx repo which usually contains unstable git packages or custom + # packages, such as modified linux kernels (which we do use here) chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; - # nixpkgs fresh from the main git repository. only for packages not yet available - # within the unstable branch - nixpkgs-master.url = "github:nixos/nixpkgs/master"; + # home manager for managing user specific stuff + home-manager = { + url = "github:nix-community/home-manager/release-23.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - # hardware configs - nixos-hardware.url = "github:nixos/nixos-hardware/master"; + # plasma manager to allow configuring plasma within nix config + plasma-manager = { + url = "github:pjones/plasma-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; - # home manager; https://github.com/nix-community/home-manager - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; + # flake for 06cb:009a fingerprint scanners. to make the fingerprint scanner on my + # thinkpad t480 function. + nixos-06cb-009a-fingerprint-sensor = { + url = "github:ahbnr/nixos-06cb-009a-fingerprint-sensor"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # hardware flakes for some devices + hardware.url = "github:nixos/nixos-hardware"; }; - outputs = { self, nixpkgs, chaotic, nixpkgs-master, nixos-hardware, home-manager, ... }@inputs: { - - } - outputs = { self, nixpkgs, + nixpkgs-master, + chaotic, home-manager, + plasma-manager, + nixos-06cb-009a-fingerprint-sensor, + hardware, ... } @ inputs: let inherit (self) outputs; - # Supported systems for your flake packages, shell, etc. + # our systems are all x86_64 unfortunately systems = [ "x86_64-linux" ]; @@ -41,31 +66,28 @@ # 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 = { - # FIXME replace with your hostname - your-hostname = nixpkgs.lib.nixosSystem { + # main laptop i use daily + "thunkpad" = nixpkgs.lib.nixosSystem rec { specialArgs = {inherit inputs outputs;}; - modules = [ - # > Our main nixos configuration file < - ./nixos/configuration.nix + modules = with self.nixosModules; [ + # nixos configuration file (and others) for thunkpad + ./machines/thunkpad + declarativeHome ./users/ruben + # fingerprint modules + nixos-06cb-009a-fingerprint-sensor.nixosModules.open-fprintd + nixos-06cb-009a-fingerprint-sensor.nixosModules.python-validity + ]; + }; + # secondary 2 in 1 device, not really used + "thonkpad" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = with self.nixosModules; [ + # nixos configuration file (and others) for thonkpad + ./machines/thonkpad + declarativeHome ./users/ruben ]; }; }; @@ -73,13 +95,23 @@ # Standalone home-manager configuration entrypoint # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { - # FIXME replace with your username@hostname - "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { + # TODO: theres probably a better way to do this/specify one home config for all devices + # main device + "thunkpad" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance extraSpecialArgs = {inherit inputs outputs;}; modules = [ - # > Our main home-manager configuration file < - ./home-manager/home.nix + ./machines/thunkpad + declarativeHome ./users/ruben + ]; + }; + # secondary device + "thonkpad" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + ./machines/thonkpad + declarativeHome ./users/ruben ]; }; }; diff --git a/wip/home-manager/home.nix b/wip/home-manager/home.nix deleted file mode 100644 index eedacc2..0000000 --- a/wip/home-manager/home.nix +++ /dev/null @@ -1,69 +0,0 @@ -# This is your home-manager configuration file -# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{ - inputs, - outputs, - lib, - config, - pkgs, - ... -}: { - # You can import other home-manager modules here - imports = [ - # If you want to use modules your own flake exports (from modules/home-manager): - # outputs.homeManagerModules.example - - # Or modules exported from other flakes (such as nix-colors): - # inputs.nix-colors.homeManagerModules.default - - # You can also split up your configuration and import pieces of it here: - # ./nvim.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; - # Workaround for https://github.com/nix-community/home-manager/issues/2942 - allowUnfreePredicate = _: true; - }; - }; - - # TODO: Set your username - home = { - username = "your-username"; - homeDirectory = "/home/your-username"; - }; - - # Add stuff for your user as you see fit: - # programs.neovim.enable = true; - # home.packages = with pkgs; [ steam ]; - - # 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"; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "23.05"; -} diff --git a/wip/machines/thonkpad/default.nix b/wip/machines/thonkpad/default.nix new file mode 100644 index 0000000..05f4b81 --- /dev/null +++ b/wip/machines/thonkpad/default.nix @@ -0,0 +1,150 @@ +# 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, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # 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; + + # 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"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/Chicago"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # so, funny thing i learned - "xserver" is basically the blanket term for all gui stuff in nixos. + # this kind of confuses me, but i try to keep a lot of xorg stuff disabled and only the wayland stuff + # enabled. see: https://www.reddit.com/r/NixOS/comments/17ia1g8/i_dont_understand_nixoss_wayland_setup/ + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the KDE Plasma Desktop Environment. + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # 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; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.ruben = { + isNormalUser = true; + description = "Ruben"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + firefox + kate + # thunderbird + ]; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # 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 + neovim + wget + curl + ]; + # set the default editor to neovim + environment.variables.EDITOR = "nvim"; + + # 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. It‘s 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? + +} diff --git a/wip/machines/thonkpad/hardware-configuration.nix b/wip/machines/thonkpad/hardware-configuration.nix new file mode 100644 index 0000000..515e856 --- /dev/null +++ b/wip/machines/thonkpad/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/dcbcf320-de12-4231-b6de-31e906800cc0"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D09A-8677"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/76cd7c6e-ea9b-46e2-bcac-6f84e56f6b0d"; } + ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/wip/machines/thunkpad/default.nix b/wip/machines/thunkpad/default.nix new file mode 100644 index 0000000..b704bcd --- /dev/null +++ b/wip/machines/thunkpad/default.nix @@ -0,0 +1,63 @@ +# 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, ... }: + +{ + 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"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # enable the proper fingerprint drivers, ensuring the default fprintd + # package is disabled. + services.fprintd.enable = false; + services.open-fprintd.enable = true; + services.python-validity.enable = true; + + # 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. It‘s 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? +} diff --git a/wip/modules/home-manager/default.nix b/wip/modules/home-manager/default.nix deleted file mode 100644 index 45aae31..0000000 --- a/wip/modules/home-manager/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -# 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; -} diff --git a/wip/modules/nixos/default.nix b/wip/modules/nixos/default.nix deleted file mode 100644 index 8605069..0000000 --- a/wip/modules/nixos/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -# 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; -} diff --git a/wip/nixos/configuration.nix b/wip/nixos/configuration.nix deleted file mode 100644 index c8b7600..0000000 --- a/wip/nixos/configuration.nix +++ /dev/null @@ -1,113 +0,0 @@ -# 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 - - # Import your generated (nixos-generate-config) hardware configuration - ./hardware-configuration.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; - }; - - # FIXME: Add the rest of your current configuration - - # TODO: Set your hostname - networking.hostName = "your-hostname"; - - # TODO: This is just an example, be sure to use whatever bootloader you prefer - boot.loader.systemd-boot.enable = true; - - # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. - users.users = { - # FIXME: Replace with your username - your-username = { - # TODO: You can set an initial password for your user. - # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. - # Be sure to change it (using passwd) after rebooting! - initialPassword = "correcthorsebatterystaple"; - isNormalUser = true; - openssh.authorizedKeys.keys = [ - # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect - ]; - # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) - extraGroups = ["wheel"]; - }; - }; - - # This setups a SSH server. Very important if you're setting up a headless system. - # Feel free to remove if you don't need it. - services.openssh = { - enable = true; - settings = { - # Forbid root login through SSH. - PermitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - PasswordAuthentication = false; - }; - }; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "23.05"; -} diff --git a/wip/nixos/hardware-configuration.nix b/wip/nixos/hardware-configuration.nix deleted file mode 100644 index dd00939..0000000 --- a/wip/nixos/hardware-configuration.nix +++ /dev/null @@ -1,10 +0,0 @@ -# This is just an example, you should generate yours with nixos-generate-config and put it in here. -{ - fileSystems."/" = { - device = "/dev/sda1"; - fsType = "ext4"; - }; - - # Set your system kind (needed for flakes) - nixpkgs.hostPlatform = "x86_64-linux"; -} diff --git a/wip/overlays/default.nix b/wip/overlays/default.nix deleted file mode 100644 index a13ea3c..0000000 --- a/wip/overlays/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -# 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; - }; - }; -} diff --git a/wip/pkgs/default.nix b/wip/pkgs/default.nix deleted file mode 100644 index 3d9e23c..0000000 --- a/wip/pkgs/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -# Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' -pkgs: { - # example = pkgs.callPackage ./example { }; -} diff --git a/wip/users/ruben/default.nix b/wip/users/ruben/default.nix new file mode 100644 index 0000000..90e8bcf --- /dev/null +++ b/wip/users/ruben/default.nix @@ -0,0 +1,18 @@ +# default config loads everything else +{ config, pkgs, lib, ... }: + +{ + home-manager.users.ruben = ./home.nix; + + users.users."ruben" = { + isNormalUser = true; + description = "Ruben"; + shell = pkgs.zsh; + extraGroups = [ "wheel" "plugdev" "dialout" "libvirtd" ] ++ (lib.optional config.networking.networkmanager.enable "networkmanager"); + + 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 + environment.shells = with pkgs; [ zsh ]; +} diff --git a/wip/users/ruben/home.nix b/wip/users/ruben/home.nix new file mode 100644 index 0000000..77b0238 --- /dev/null +++ b/wip/users/ruben/home.nix @@ -0,0 +1,116 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + outputs, + lib, + osConfig, + config, + pkgs, + ... +}: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ]; + + nixpkgs = { + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + # 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 !! + home.sessionVariables = { + EDITOR = "nvim"; + }; + + # fuzzy command finder, required by a decent amount of things + programs.fzf = { + enable = true; + enableZshIntegration = true; + }; + + # my preferred shell customized to my needs + # TODO: theres only oh-my-zsh support out of the box, figure out + # how to customize sheldon and starship + programs.zsh = { + enable = true; + history.size = 50000; + syntaxHighlighting.enable = true; + }; + + programs.git = { + enable = true; + + userName = "Sneexy"; + userEmail = "sneexy@disroot.org"; + + signing.signByDefault = true; + #signing.key = ""; # TODO: fill this out + + extraConfig = { + commit.verbose = true; + init.defaultBranch = "main"; + }; + }; + + xdg.userDirs.enable = true; + + services.mpd = { + enable = true; + extraConfig = '' + ''audio_output { + type "pipewire" + name "PipeWire" + }'' + ''; + }; + + # Add stuff for your user as you see fit: + # programs.neovim.enable = true; + home.packages = with pkgs; [ + btop + sheldon + starship + zoxide + fzf + bat + duf + fd + delta + lsd + ripgrep + sd + yt-dlp + ]; + + # 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"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + # basically: don't touch this. + home.stateVersion = "23.05"; +}