{ description = "My awesome system config"; /* ╔══════════════════════════════════════════════════════════╗ ║ Inputs ║ ╚══════════════════════════════════════════════════════════╝ */ inputs = { # Nix master.url = "github:nixos/nixpkgs"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; stable.url = "github:nixos/nixpkgs/nixos-23.05"; flake-utils.url = "github:numtide/flake-utils"; agenix.inputs.nixpkgs.follows = "nixpkgs"; agenix.url = "github:ryantm/agenix"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; nil.inputs.flake-utils.follows = "flake-utils"; nil.inputs.nixpkgs.follows = "nixpkgs"; nil.url = "github:oxalica/nil"; pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; nix-super.url = "github:privatevoid-net/nix-super"; nix-super.inputs.nixpkgs.follows = "stable"; rofi-wayland.url = "github:lbonn/rofi/wayland"; rofi-wayland.flake = false; # Neovim neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; smartcolumn-nvim.flake = false; smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim"; telekasten-nvim.flake = false; telekasten-nvim.url = "github:renerocksai/telekasten.nvim"; telescope-nvim.flake = false; telescope-nvim.url = "github:nvim-telescope/telescope.nvim"; nvim-treesitter.flake = false; nvim-treesitter.url = "github:nvim-treesitter/nvim-treesitter/v0.9.1"; # NOTE: to fix weird latest issues hmts-nvim.flake = false; hmts-nvim.url = "github:calops/hmts.nvim"; actions-preview-nvim.flake = false; actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim"; # Hyprland hypr-contrib.url = "github:hyprwm/contrib"; hyprland.url = "github:hyprwm/Hyprland"; hyprpaper.url = "github:hyprwm/hyprpaper"; # Laptop asus-touchpad-numpad-driver.url = "github:MoritzBoehme/asus-touchpad-numpad-driver/german-layout"; asus-touchpad-numpad-driver.flake = false; # Firefox user.js arkenfox-userjs.url = "github:arkenfox/user.js"; arkenfox-userjs.flake = false; timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git"; }; /* ╔══════════════════════════════════════════════════════════╗ ║ Outputs ║ ╚══════════════════════════════════════════════════════════╝ */ outputs = inputs@{ self, nixpkgs, ... }: let systems = [ "x86_64-linux" "aarch64-linux" ]; forEachSystem = lib.genAttrs systems; lib = nixpkgs.lib.extend (self: _: { my = import ./lib { lib = self; }; }); overlay = import ./overlays { inherit inputs; inherit (self) lib; }; config.allowUnfree = true; overlays = [ inputs.hypr-contrib.overlays.default inputs.hyprland.overlays.default inputs.neovim-nightly-overlay.overlay overlay ]; pkgsFor = system: import nixpkgs { inherit system config; overlays = overlays ++ [ ( _: prev: { master = import inputs.master { inherit (prev) system; inherit overlays config; }; stable = import inputs.stable { inherit (prev) system; inherit overlays config; }; } ) overlay ]; }; defaultModules = [ { nixpkgs = { inherit config; }; } ./modules inputs.home-manager.nixosModule { home-manager = { useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit inputs self; }; }; } inputs.agenix.nixosModules.age ]; hosts = self.lib.my.mapModules (path: let system = import "${path}/system.nix"; pkgs = pkgsFor system; in lib.nixosSystem { inherit pkgs system lib; specialArgs = { inherit inputs self; }; modules = defaultModules ++ [ path ]; }) ./hosts; pre-commit-check = system: inputs.pre-commit-hooks.lib."${system}".run { src = ./.; hooks = { nixpkgs-fmt.enable = true; statix.enable = true; shellcheck.enable = true; stylua.enable = true; }; }; in with lib; { inherit lib; # ╔══════════════════════════════════════════════════════════╗ # ║ NixOS Configurations ║ # ╚══════════════════════════════════════════════════════════╝ nixosConfigurations = hosts; # ╔══════════════════════════════════════════════════════════╗ # ║ Other Outputs ║ # ╚══════════════════════════════════════════════════════════╝ devShells = forEachSystem (system: let pkgs = pkgsFor system; in { default = pkgs.mkShell { inherit (pre-commit-check system) shellHook; name = "dotfiles"; packages = with pkgs; [ # Secrets agenix # cachix cachix ]; }; }); checks = forEachSystem (system: { pre-commit-check = pre-commit-check system; }); legacyPackages = forEachSystem pkgsFor; packages = forEachSystem (system: let pkgs = pkgsFor system; in filterAttrs (_: isDerivation) (overlay pkgs pkgs) ); overlays = let overlayNames = attrNames (overlay null null); mkOverlay = name: final: prev: (overlay final prev).${name}; in (genAttrs overlayNames mkOverlay) // { default = overlay; }; }; }