diff --git a/default.nix b/default.nix index 066f435..2505a00 100755 --- a/default.nix +++ b/default.nix @@ -12,6 +12,10 @@ in { ] ++ (mapModulesRec' (toString ./modules) import); + environment.variables = { + NIXPKGS_ALLOW_UNFREE = "1"; + }; + nix = { package = pkgs.nix; @@ -32,11 +36,23 @@ in { "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; }; + + optimise.automatic = true; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; }; - # set our git revision inside `nixos-version` + system.stateVersion = mkDefault "23.11"; system.configurationRevision = with inputs; mkIf (self ? rev) self.rev; + boot = { + kernelPackages = mkDefault pkgs.linuxPackages_latest; + kernelParams = [ "pci_aspm.policy=performance" ]; + }; + time.timeZone = mkDefault "America/Los_Angeles"; i18n.defaultLocale = mkDefault "en_US.UTF-8"; @@ -47,10 +63,6 @@ in { unrar unzip micro curl wget - # im pretty sure removing this breaks nixos-rebuild - # have fun git ]; - - system.stateVersion = mkDefault "23.11"; } diff --git a/flake.nix b/flake.nix index a0b28de..fc5a260 100755 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,8 @@ home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + hardware.url = "github:nixos/nixos-hardware"; + vscode-server.url = "github:nix-community/nixos-vscode-server"; }; diff --git a/hosts/nixos-server-reid/default.nix b/hosts/nixos-server-reid/default.nix index 0c62ff6..d6c9ed7 100755 --- a/hosts/nixos-server-reid/default.nix +++ b/hosts/nixos-server-reid/default.nix @@ -1,8 +1,6 @@ { config, lib, pkgs, ... }: -let - -in { +{ imports = [ ./hardware.nix ./webapps/default.nix @@ -51,5 +49,6 @@ in { }; # enable network manager - probably not the best on a single server but Oh Well + # perhaps i could move it next to my router for easier ethernet access networking.networkmanager.enable = true; } diff --git a/hosts/nixos-server-reid/hardware.nix b/hosts/nixos-server-reid/hardware.nix index 25b9143..9d69a64 100755 --- a/hosts/nixos-server-reid/hardware.nix +++ b/hosts/nixos-server-reid/hardware.nix @@ -1,33 +1,34 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ inputs, config, lib, pkgs, modulesPath, ... }: { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + inputs.hardware.nixosModules.common-pc-ssd + inputs.hardware.nixosModules.common-pc + # uses mkDefault to set to a patched kernel, + # but it conflicts with one of our mkDefault settings + #inputs.hardware.nixosModules.raspberry-pi-4 - boot = { - initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; - initrd.kernelModules = [ ]; - kernelModules = [ ]; - extraModulePackages = [ ]; - # TODO: move bootloader, networking, boot speed to another file? - kernelPackages = pkgs.linuxPackages_latest; - loader = { - # use u-boot over grub - grub.enable = lib.mkForce false; - generic-extlinux-compatible.enable = true; - }; - }; + (modulesPath + "/installer/scan/not-detected.nix") + ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; + # use better power management for a device that's always on + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + # for some god forsaken reason, generic-extlinux-compatible doesn't disable grub like systemd-boot does + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; fsType = "ext4"; + options = [ "noatime" "nodiratime" "discard" ]; }; - swapDevices = - [ ]; - # 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 @@ -37,5 +38,4 @@ # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; } diff --git a/hosts/nixos-server-reid/webapps/default.nix b/hosts/nixos-server-reid/webapps/default.nix index 3e2adc0..336a23f 100755 --- a/hosts/nixos-server-reid/webapps/default.nix +++ b/hosts/nixos-server-reid/webapps/default.nix @@ -39,7 +39,7 @@ in { locations."/f/".extraConfig = '' add_header Access-Control-Allow-Origin "*"; ''; - # we should perhaps add something to help with this in staticsites? + # TODO: we should perhaps add something to help with this in staticSites? extraConfig = '' error_page 404 /404.html; ''; diff --git a/modules/users.nix b/modules/users.nix index f3116f0..a4c836c 100755 --- a/modules/users.nix +++ b/modules/users.nix @@ -1,9 +1,8 @@ { options, config, lib, pkgs, ... }: with lib; -let - -in { +{ + # TODO: what the hell is this options = { user = mkOption { type = types.attrs; @@ -35,10 +34,6 @@ in { description = "(XDG) Configuration files managed by home-manager"; }; }; - configDir = mkOption { - type = types.path; - default = ../config; - }; }; config = { @@ -56,16 +51,6 @@ in { xdg.configFile = mkAliasDefinitions options.home.configFile; }; - environment = { - sessionVariables = { - XDG_CACHE_HOME = "$HOME/.cache"; - XDG_CONFIG_HOME = "$HOME/.config"; - XDG_DATA_HOME = "$HOME/.local/share"; - XDG_BIN_HOME = "$HOME/.local/bin"; - XDG_DESKTOP_DIR = "$HOME"; - }; - }; - users.groups = mapAttrs (_: _: {}) config.normalUsers; users.users = mapAttrs (username: user: (mkMerge [