diff --git a/flake.nix b/flake.nix index f4a88fc..5e6ab8a 100644 --- a/flake.nix +++ b/flake.nix @@ -38,8 +38,12 @@ nixpkgs, home-manager, ... - } @ inputs: let - inherit (self) outputs; + }: let + inherit (self) outputs inputs; + + # a wrapper around all the stuff we might hand off to modules so they can + # effectively reference this flake's inputs and outputs + thisFlake = {inherit outputs inputs;}; systems = [ "aarch64-linux" @@ -60,22 +64,26 @@ # Your custom packages # Acessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: import ./pkgs {pkgs = nixpkgs.legacyPackages.${system};}); + packages = forAllSystems (system: + import ./pkgs { + inherit thisFlake; + 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;}; + overlays = import ./overlays thisFlake; # Reusable nixos modules you might want to export # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; + nixosModules = import ./modules/nixos thisFlake; # Reusable home-manager modules you might want to export # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; + homeManagerModules = import ./modules/home-manager thisFlake; # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' @@ -86,16 +94,12 @@ }: nixpkgs.lib.nixosSystem { inherit system; - specialArgs = { - inherit inputs outputs system; - flake = self; - }; modules = [ - self.nixosModules.common + outputs.nixosModules.common ] ++ modules; - }) (import ./nixos); + }) (import ./nixos thisFlake); # Standalone home-manager configuration entrypoint # Available through 'home-manager --flake .#your-username@your-hostname' @@ -106,18 +110,14 @@ in home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; - extraSpecialArgs = { - inherit inputs outputs system; - inherit (outputs) colors font; - }; modules = with outputs.homeManagerModules; [ common + linux { home.homeDirectory = "/home/deck"; home.username = "deck"; home.stateVersion = "24.05"; } - linux ]; }; workm1 = let @@ -125,18 +125,14 @@ in home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; - extraSpecialArgs = { - inherit inputs outputs system; - inherit (outputs) colors font; - }; modules = with outputs.homeManagerModules; [ common + macos { home.homeDirectory = "/Users/daniel.flanagan"; home.username = "daniel.flanagan"; home.stateVersion = "24.05"; } - macos ]; }; }; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 66ea0bc..e50c531 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,3 +1,4 @@ +_thisFlake: with builtins; listToAttrs (map (name: { name = name; diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix index 993949c..93fd721 100644 --- a/modules/nixos/common.nix +++ b/modules/nixos/common.nix @@ -1,26 +1,23 @@ { - config, - lib, - inputs, - outputs, - system, + # config, + # inputs, + # outputs, pkgs, - modulesPath, + # modulesPath, ... -}: { +}: let + lib = pkgs.lib; +in { networking.hostName = lib.mkDefault "nixoslyte"; - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - inputs.sops-nix.nixosModules.sops - inputs.disko.nixosModules.disko - inputs.home-manager.nixosModules.home-manager - ] - ++ (with outputs.nixosModules; [ - avahi - daniel - ]); + imports = [ + # (modulesPath + "/installer/scan/not-detected.nix") + # inputs.sops-nix.nixosModules.sops + # inputs.disko.nixosModules.disko + # inputs.home-manager.nixosModules.home-manager + # ./avahi.nix + # ./daniel.nix + ]; hardware.enableRedistributableFirmware = true; @@ -108,7 +105,7 @@ }; root = { - openssh.authorizedKeys.keys = config.users.users.daniel.openssh.authorizedKeys.keys; + # openssh.authorizedKeys.keys = config.users.users.daniel.openssh.authorizedKeys.keys; }; }; @@ -157,24 +154,24 @@ useXkbConfig = true; earlySetup = true; - colors = with outputs.colors; [ - bg - red - green - orange - blue - purple - yellow - fg3 - fgdim - red - green - orange - blue - purple - yellow - fg - ]; + # colors = with outputs.colors; [ + # bg + # red + # green + # orange + # blue + # purple + # yellow + # fg3 + # fgdim + # red + # green + # orange + # blue + # purple + # yellow + # fg + # ]; }; networking = { @@ -239,9 +236,9 @@ # 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 + # outputs.overlays.additions + # outputs.overlays.modifications + # outputs.overlays.unstable-packages # You can also add overlays exported from other flakes: # neovim-nightly-overlay.overlays.default @@ -263,11 +260,11 @@ nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + # registry = lib.mapAttrs (_: value: {flake = value;}) inputs; # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + # nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; settings = { trusted-users = ["root" "daniel"]; diff --git a/modules/nixos/daniel.nix b/modules/nixos/daniel.nix index 16814dd..f8a4f3b 100644 --- a/modules/nixos/daniel.nix +++ b/modules/nixos/daniel.nix @@ -1,15 +1,5 @@ { - pkgs, - inputs, - system, - outputs, - ... -}: { home-manager = { - extraSpecialArgs = { - inherit inputs outputs system; - inherit (outputs) colors font; - }; users.daniel = { accounts.email.accounts = { primary = { @@ -34,12 +24,12 @@ homeDirectory = "/home/daniel/.home"; }; - imports = with outputs.homeManagerModules; [ - common - gnome - senpai - iex - cargo + imports = [ + ./common.nix + ./gnome.nix + ./senpai.nix + ./iex.nix + ./cargo.nix ]; }; }; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index f6fbbe2..70daa36 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,3 +1,4 @@ +_thisFlake: with builtins; listToAttrs (map (name: { name = name; diff --git a/modules/nixos/desktop-usage.nix b/modules/nixos/desktop-usage.nix index bb4ef02..3d53029 100644 --- a/modules/nixos/desktop-usage.nix +++ b/modules/nixos/desktop-usage.nix @@ -1,10 +1,4 @@ { - pkgs, - inputs, - outputs, - system, - ... -}: { imports = [ ./sway.nix # ./hyprland.nix @@ -15,8 +9,6 @@ ./kde-connect.nix ]; - nixpkgs.overlays = [outputs.overlays.modifications]; - hardware = { opengl = { enable = true; diff --git a/nixos/base.nix b/nixos/base.nix index 332c866..abd6464 100644 --- a/nixos/base.nix +++ b/nixos/base.nix @@ -1,14 +1,10 @@ -{ - outputs, - flake, - ... -}: { +{outputs, ...}: { # a minimal, familiar setup that I can bootstrap atop imports = with outputs.nixosModules; [ # may need to be tweaked based on the machine's paritioning scheme - flake.diskoConfigurations.standard - desktop-usage - wifi + # outputs.diskoConfigurations.standard + # desktop-usage + # wifi ]; # TODO: may not work for non-UEFI? diff --git a/nixos/default.nix b/nixos/default.nix index 66cd29c..a43b179 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,7 +1,9 @@ +thisFlake: with builtins; (listToAttrs (map (name: { name = name; value = { system = "x86_64-linux"; + # specialArgs = thisFlake; modules = [./${name}.nix]; }; }) [ diff --git a/nixos/dragon.nix b/nixos/dragon.nix index ae3d7c8..25cc8f1 100644 --- a/nixos/dragon.nix +++ b/nixos/dragon.nix @@ -17,14 +17,14 @@ inputs.hardware.nixosModules.common-pc-ssd outputs.nixosModules.pipewire-low-latency - desktop-usage - podman - postgres - wifi - hyprland - printing - ewwbar - melee + # desktop-usage + # podman + # postgres + # wifi + # hyprland + # printing + # ewwbar + # melee ]; programs.steam.enable = true; @@ -32,12 +32,12 @@ home-manager.users.daniel = { imports = with outputs.homeManagerModules; [ - sway - pass - firefox-no-tabs - melee - # sway-laptop - hyprland + # sway + # pass + # firefox-no-tabs + # melee + # # sway-laptop + # hyprland ]; ssbm = { diff --git a/nixos/htpc.nix b/nixos/htpc.nix index 1645281..d87786e 100644 --- a/nixos/htpc.nix +++ b/nixos/htpc.nix @@ -85,7 +85,7 @@ powerManagement.enable = false; - boot.loader.grub.enable = true; + # boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/sda"; boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"];