{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; nixvim = { url = "github:nix-community/nixvim"; inputs.nixpkgs.follows = "nixpkgs"; }; t.url = "github:jdonszelmann/t-rs"; dumpasm.url = "github:jdonszelmann/dumpasm"; kitty-search = { url = "github:trygveaa/kitty-kitten-search"; flake = false; }; jujutsu = { url = "github:martinvonz/jj"; inputs.nixpkgs.follows = "nixpkgs"; }; ghostty = { url = "github:ghostty-org/ghostty"; inputs.nixpkgs-stable.follows = "nixpkgs"; inputs.nixpkgs-unstable.follows = "nixpkgs"; }; # sorry, secret... for now noteslsp.url = "git+ssh://git@github.com/jdonszelmann/notes"; }; outputs = { home-manager, nixpkgs, flake-utils, nixvim, t, dumpasm, jujutsu, ghostty, noteslsp, ... }@inputs: let homeManagerModules = [ nixvim.homeManagerModules.nixvim ]; pkgsForSystem = system: import nixpkgs { inherit system; config.allowUnfree = true; overlays = [ (_: _: { custom = { t = t.packages.${system}.default; inherit (dumpasm.packages.${system}) dumpasm; inherit (jujutsu.packages.${system}) jujutsu; inherit (ghostty.packages.${system}) ghostty; inherit (noteslsp.packages.${system}) noteslsp; }; }) ]; }; mkHomeConfiguration = root: args: home-manager.lib.homeManagerConfiguration ( { modules = [ root ] ++ homeManagerModules ++ (args.modules or [ ]); pkgs = pkgsForSystem (args.system or "x86_64-linux"); } // { inherit (args) extraSpecialArgs; } ); in flake-utils.lib.eachDefaultSystem (system: rec { formatter = legacyPackages.nixfmt-classic; legacyPackages = pkgsForSystem system; pkgs = legacyPackages; devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ (pkgs.writeShellScriptBin "fast-repl" '' source /etc/set-environment nix repl --file "${./.}/repl.nix" $@ '') (pkgs.writeShellScriptBin "apply-home" '' export NIX_BUILD_CORES=$(($(nproc) * 2)) nix run .#home-manager -j $NIX_BUILD_CORES --cores $NIX_BUILD_CORES -- switch --flake .#$@ --max-jobs $NIX_BUILD_CORES '') (pkgs.writeShellScriptBin "apply" '' apply-home $(hostname -f) '') ]; }; }) // { homeConfigurations = { kili = mkHomeConfiguration (import ./hosts/kili/home.nix) { extraSpecialArgs = { inherit inputs; }; }; ori = mkHomeConfiguration (import ./hosts/ori/home.nix) { extraSpecialArgs = { inherit inputs; }; }; icecube = mkHomeConfiguration (import ./hosts/icecube/home.nix) { extraSpecialArgs = { inherit inputs; }; }; }; inherit home-manager; inherit (home-manager) packages; }; }