From a3304265d2129ead379f700b098d1790f83764cf Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 3 Oct 2023 13:18:12 -0500 Subject: [PATCH] Maybe working? --- flake.lock | 16 ++++ flake.nix | 34 ++++--- {nixos => modules/nixos}/common.nix | 94 ++++++++++---------- modules/nixos/default.nix | 1 + modules/nixos/desktop-usage.nix | 3 +- nixos/{beefcake.nix => beefcake/default.nix} | 0 nixos/dragon/default.nix | 1 - nixos/{musicbox.nix => musicbox/default.nix} | 0 nixos/{rascal.nix => rascal/default.nix} | 0 nixos/{thinker.nix => thinker/default.nix} | 38 ++++---- 10 files changed, 114 insertions(+), 73 deletions(-) rename {nixos => modules/nixos}/common.nix (80%) rename nixos/{beefcake.nix => beefcake/default.nix} (100%) rename nixos/{musicbox.nix => musicbox/default.nix} (100%) rename nixos/{rascal.nix => rascal/default.nix} (100%) rename nixos/{thinker.nix => thinker/default.nix} (63%) diff --git a/flake.lock b/flake.lock index e12422d..1b4101c 100644 --- a/flake.lock +++ b/flake.lock @@ -120,6 +120,21 @@ "type": "github" } }, + "hardware": { + "locked": { + "lastModified": 1696161939, + "narHash": "sha256-HI1DxS//s46/qv9dcW06TzXaBjxL2DVTQP8R1QsnHzM=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "0ab3ee718e964fb42dc57ace6170f19cb0b66532", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, "helix": { "inputs": { "crane": "crane", @@ -279,6 +294,7 @@ "inputs": { "api-lyte-dev": "api-lyte-dev", "disko": "disko", + "hardware": "hardware", "helix": "helix", "home-manager": "home-manager", "nixpkgs": "nixpkgs_4", diff --git a/flake.nix b/flake.nix index 73c9a2d..94f6d40 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,8 @@ # TODO: do I really need this in the root of my flake if _only_ beefcake uses it? api-lyte-dev.url = "git+ssh://gitea@git.lyte.dev/lytedev/api.lyte.dev.git"; - # TODO: hardware.url = "github:nixos/nixos-hardware"; # might be useful for laptops + hardware.url = "github:nixos/nixos-hardware"; + # TODO: hyprland.url = "github:hyprwm/Hyprland"; # TODO: nix-colors.url = "github:misterio77/nix-colors"; }; @@ -23,6 +24,7 @@ outputs = { self, nixpkgs, + nixpkgs-unstable, home-manager, ... } @ inputs: let @@ -59,16 +61,28 @@ # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - dragon = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs outputs; - flake = self; + nixosConfigurations = let + mkNixosSystem = system: modules: + nixpkgs.lib.nixosSystem { + system = system; + specialArgs = { + inherit inputs outputs system; + flake = self; + }; + modules = [self.nixosModules.common] ++ modules; }; - modules = [ - ./nixos/dragon - ]; - }; + # mkNixosUnstableSystem = system: modules: + # nixpkgs-unstable.lib.nixosSystem { + # system = system; + # specialArgs = { + # inherit inputs outputs system; + # flake = self; + # }; + # modules = [ self.nixosModules.common ] ++ modules; + # }; + in { + dragon = mkNixosSystem "x86_64-linux" [./nixos/dragon]; + thinker = mkNixosSystem "x86_64-linux" [./nixos/thinker]; }; # Standalone home-manager configuration entrypoint diff --git a/nixos/common.nix b/modules/nixos/common.nix similarity index 80% rename from nixos/common.nix rename to modules/nixos/common.nix index 066a26b..cf77755 100644 --- a/nixos/common.nix +++ b/modules/nixos/common.nix @@ -6,6 +6,7 @@ ... }: let pkgs = inputs.nixpkgs.legacyPackages.${system}; + unstable-pkgs = inputs.nixpkgs-unstable.legacyPackages.${system}; in { services.journald.extraConfig = "SystemMaxUse=1G"; @@ -17,51 +18,54 @@ in { MANPAGER = "less"; }; - systemPackages = with pkgs; [ - age - bat - bc - bind - bottom - btrfs-progs - cue - curl - dog - dua - eza - fd - file - gnumake - gron - helix - hexyl - htop - iputils - jq - killall - less - mosh - nmap - openssl - pciutils - pv - rclone - restic - ripgrep - rsync - rtx - sd - sops - smartmontools - sqlite - sysstat - unzip - watchexec - wget - xh - zellij - zstd - ]; + systemPackages = with pkgs; + [ + age + bat + bc + bind + bottom + btrfs-progs + cue + curl + dog + dua + fd + file + gnumake + gron + helix + hexyl + htop + iputils + jq + killall + less + mosh + nmap + openssl + pciutils + pv + rclone + restic + ripgrep + rsync + rtx + sd + sops + smartmontools + sqlite + sysstat + unzip + watchexec + wget + xh + zellij + zstd + ] + ++ (with unstable-pkgs; [ + eza + ]); }; users.users = { diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index eecfc87..ea528a5 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,6 +1,7 @@ # 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. { + common = import ./common.nix; amd = import ./amd.nix; desktop-usage = import ./desktop-usage.nix; intel = import ./intel.nix; diff --git a/modules/nixos/desktop-usage.nix b/modules/nixos/desktop-usage.nix index 458ef4d..4f9eac4 100644 --- a/modules/nixos/desktop-usage.nix +++ b/modules/nixos/desktop-usage.nix @@ -6,7 +6,8 @@ ./user-installed-applications.nix ]; - fonts.packages = with pkgs; [ + # fonts.packages if unstable? + fonts.fonts = with pkgs; [ (nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) (iosevka.override { set = "lyteterm"; diff --git a/nixos/beefcake.nix b/nixos/beefcake/default.nix similarity index 100% rename from nixos/beefcake.nix rename to nixos/beefcake/default.nix diff --git a/nixos/dragon/default.nix b/nixos/dragon/default.nix index 38832ab..0ee46b1 100644 --- a/nixos/dragon/default.nix +++ b/nixos/dragon/default.nix @@ -8,7 +8,6 @@ ... }: { networking.hostName = "dragon"; - nixpkgs.hostPlatform = "x86_64-linux"; imports = [ diff --git a/nixos/musicbox.nix b/nixos/musicbox/default.nix similarity index 100% rename from nixos/musicbox.nix rename to nixos/musicbox/default.nix diff --git a/nixos/rascal.nix b/nixos/rascal/default.nix similarity index 100% rename from nixos/rascal.nix rename to nixos/rascal/default.nix diff --git a/nixos/thinker.nix b/nixos/thinker/default.nix similarity index 63% rename from nixos/thinker.nix rename to nixos/thinker/default.nix index b12a5f2..bf7587a 100644 --- a/nixos/thinker.nix +++ b/nixos/thinker/default.nix @@ -1,32 +1,38 @@ { - modulesPath, + flake, + inputs, + outputs, lib, + config, + pkgs, ... }: { - imports = [ - ../modules/intel.nix - ../modules/desktop-usage.nix - ../modules/podman.nix - ../modules/wifi.nix + networking.hostName = "thinker"; - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - # TODO: https://github.com/NixOS/nixos-hardware/blob/master/lenovo/thinkpad/t480/default.nix + imports = + [ + inputs.disko.nixosModules.disko + flake.diskoConfigurations.thinker + ] + ++ (with outputs.nixosModules; [ + # If you want to use modules your own flake exports (from modules/nixos): + desktop-usage + podman + postgres + wifi + ]) + ++ [ + inputs.hardware.nixosModules.lenovo-thinkpad-t480 + # ./relative-module.nix + ]; # TODO: hibernation? I've been using [deep] in /sys/power/mem_sleep alright # with this machine so it may not be necessary? # need to measure percentage lost per day, but I think it's around 10%/day # it looks like I may have had hibernation working -- see ../old/third.nix - # hardware boot.loader.efi.canTouchEfiVariables = true; boot.loader.systemd-boot.enable = true; - boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"]; - - networking.hostName = "thinker"; - - services.pcscd.enable = true; # why do I need this? SD card slot? hardware.bluetooth.enable = true; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; services.printing.enable = true; # I own a printer in the year of our Lord 2023