From 393bda608b823f820fa1cb2ff6b34fe479ee144f Mon Sep 17 00:00:00 2001 From: Mira Date: Wed, 3 Jul 2024 12:58:48 -0400 Subject: [PATCH] updates --- configuration.nix | 136 ++++++++++++++++++++++++------------- flake.lock | 27 ++++++++ flake.nix | 24 +++++++ hardware-configuration.nix | 82 +++++++++++----------- 4 files changed, 184 insertions(+), 85 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/configuration.nix b/configuration.nix index 1a4d962..26893e8 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,21 +1,25 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ config, lib, pkgs, ... }: - { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; + config, + lib, + pkgs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; -# nix = { -# package = pkgs.nixFlakes; -# extraOptions = '' -# experimental-features = nix-command flakes -# ''; -# }; + nix = { + package = pkgs.nixFlakes; + optimise.automatic = true; + gc.automatic = true; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -23,7 +27,7 @@ networking.hostName = "auxin"; # Define your hostname. # Pick only one of the below networking options. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. # Set your time zone. time.timeZone = "America/New_York"; @@ -44,18 +48,18 @@ services.xserver.enable = true; services.xserver.displayManager.sddm = { - enable = true; - settings = { + enable = true; + settings = { Autologin = { Session = "kodi.desktop"; - User = "mira"; - }; - }; + User = "mira"; + }; + }; }; services.xserver.desktopManager.xfce.enable = true; # Kodi - services.xserver.desktopManager.kodi.enable = true; + services.xserver.desktopManager.kodi.enable = true; # smartd services.smartd.enable = true; @@ -63,6 +67,8 @@ # BTRFS scrub services.btrfs.autoScrub.enable = true; + services.avahi.enable = true; + # Configure keymap in X11 # services.xserver.xkb.layout = "us"; # services.xserver.xkb.options = "eurosign:e,caps:escape"; @@ -80,7 +86,7 @@ # Define a user account. Don't forget to set a password with ‘passwd’. users.users.mira = { isNormalUser = true; - extraGroups = [ "wheel" "docker" ]; # Enable ‘sudo’ for the user. + extraGroups = ["wheel" "docker"]; # Enable ‘sudo’ for the user. packages = with pkgs; [ firefox tree @@ -105,29 +111,42 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ + go + alejandra alacritty bat btdu + chezmoi btop btrbk + cargo czkawka docker + file fzf + gcc + git + fastfetch hyfetch hyperfine jellyfin-media-player lazydocker lazygit - git lsd mcfly - neovim + neovim + nodePackages.pnpm + nodePackages.nodejs + kodiPackages.jellyfin + kodiPackages.steam-controller sheldon starship tmux viddy wget + zoxide zsh + nil ]; # Some programs need SUID wrappers, can be configured further or are @@ -140,26 +159,36 @@ programs.zsh.enable = true; -# programs.zoxide = { -# enable = true; -# enableBashIntegration = true; -# enableFishIntegration = true; -# enableZshIntegration = true; -# }; + programs.neovim = { + enable = true; + configure = { + customRC = '' + set number relativenumber + ''; + }; -# programs.fzf = { -# enable = true; -# enableBashIntegration = true; -# enableFishIntegration = true; -# enableZshIntegration = true; -# }; + defaultEditor = true; + }; + # programs.zoxide = { + # enable = true; + # enableBashIntegration = true; + # enableFishIntegration = true; + # enableZshIntegration = true; + # }; -# programs.mcfly = { -# enable = true; -# enableBashIntegration = true; -# enableZshIntegration = true; -# enableFishIntegration = true; -# }; + # programs.fzf = { + # enable = true; + # enableBashIntegration = true; + # enableFishIntegration = true; + # enableZshIntegration = true; + # }; + + # programs.mcfly = { + # enable = true; + # enableBashIntegration = true; + # enableZshIntegration = true; + # enableFishIntegration = true; + # }; # List services that you want to enable: @@ -170,7 +199,6 @@ PermitRootLogin = "prohibit-password"; PasswordAuthentication = false; }; - }; virtualisation.docker = { @@ -184,12 +212,30 @@ # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. - # networking.firewall.enable = false; + networking.firewall = { + enable = false; + }; + systemd.timers."qbittorrent-healthcheck" = { + wantedBy = ["timers.target"]; + timerConfig = { + OnCalendar = "*/5 * * * *"; + Unit = "qbittorrent-healthcheck"; + }; + }; + systemd.services."qbittorrent-healthcheck" = { + script = '' + ${pkgs.docker} exec qbittorrent ping -c 1 -w 5 -I protonwire0 8.8.8.8 || ${pkgs.docker} restart qbittorrent + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you # accidentally delete configuration.nix. - system.copySystemConfiguration = true; + # system.copySystemConfiguration = true; # This option defines the first version of NixOS you have installed on this particular machine, # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. @@ -208,6 +254,4 @@ # # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . system.stateVersion = "23.11"; # Did you read the comment? - } - diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fa62f4a --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1710272261, + "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a7399b0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +# /etc/nixos/flake.nix +{ + description = "flake for mira::auxin"; + + inputs = { + nixpkgs = { + url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + }; + + outputs = { + self, + nixpkgs, + }: { + nixosConfigurations = { + auxin = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 39df066..aa3c9ac 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -1,53 +1,57 @@ # 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") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; - fsType = "btrfs"; - options = [ "subvol=@nixos" "noatime" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; + fsType = "btrfs"; + options = ["subvol=@nixos" "noatime"]; + }; - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; - fsType = "btrfs"; - options = [ "subvol=@nix" "noatime" ]; - }; + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; + fsType = "btrfs"; + options = ["subvol=@nix" "noatime"]; + }; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; - fsType = "btrfs"; - options = [ "subvol=@home" "noatime" "compress=zstd" ]; - }; - fileSystems."/swap" = - { device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; - fsType = "btrfs"; - options = [ "subvol=@swap" ]; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; + fsType = "btrfs"; + options = ["subvol=@home" "noatime" "compress=zstd"]; + }; + fileSystems."/swap" = { + device = "/dev/disk/by-uuid/b6931dc5-1ccb-4d81-abf6-38b6febc6176"; + fsType = "btrfs"; + options = ["subvol=@swap"]; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/34E4-E112"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/34E4-E112"; + fsType = "vfat"; + }; - fileSystems."/raid" = - { device = "/dev/sdb1"; - fsType = "btrfs"; - # options = [ "noatime" "noauto" "x-systemd.automount" "nofail" "space_cache=v2" "compress=zstd"]; - }; + fileSystems."/raid" = { + device = "/dev/sdb1"; + fsType = "btrfs"; + options = ["noatime" "noauto" "x-systemd.automount" "nofail" "space_cache=v2" "compress=zstd"]; + }; -# swapDevices = [ "/swap/swapfile" ]; + # swapDevices = [ "/swap/swapfile" ]; # 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