{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; nur.url = "github:nix-community/NUR"; fzgo.url = "git+https://git.thomasave.be/thomasave/fzgo.git"; vicinae.url = "github:vicinaehq/vicinae"; worktimer = { type = "git"; url = "https://git.thomasave.be/thomasave/WorkTimer"; ref = "cli"; }; astal = { url = "github:aylur/astal"; inputs.nixpkgs.follows = "nixpkgs"; }; ags = { url = "github:aylur/ags"; inputs.nixpkgs.follows = "nixpkgs"; inputs.astal.follows = "astal"; }; nixos-06cb-009a-fingerprint-sensor = { url = "github:ahbnr/nixos-06cb-009a-fingerprint-sensor?ref=24.11"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, home-manager, nur, nixos-06cb-009a-fingerprint-sensor, ... } @ inputs: let supportedSystems = ["x86_64-linux" "aarch64-linux"]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; system = builtins.currentSystem; pkgs = nixpkgs.legacyPackages.${system}; commonModules = host: user: [ ./hosts/${host}/hardware-configuration.nix { nixpkgs.overlays = [ nur.overlays.default (self: super: {utillinux = super.util-linux;}) ]; } { networking.hostName = host; time.timeZone = "Asia/Bangkok"; nix.settings = { substituters = [ "https://nix-community.cachix.org" "https://cuda-maintainers.cachix.org" "https://vicinae.cachix.org" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" "vicinae.cachix.org-1:1kDrfienkGHPYbkpNj1mWTr7Fm1+zcenzgTizIcI3oc=" ]; experimental-features = ["nix-command" "flakes"]; trusted-users = ["root" user]; keep-outputs = true; keep-derivations = true; auto-optimise-store = true; }; users.users.${user} = { isNormalUser = true; extraGroups = ["wheel" "video"]; # Enable ‘sudo’ for the user. openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKAa3tMzSCRuprEACrBsKI0F/o73o6J9L1qR3TaZn/N8 user@Kell" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIByLwLAdJbmoDV5sx4hg5NbzKbOh1GmWEhDOUJ1GQBhK user@Riva" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBxMq4kubz4wWr4S8xU3GRkPcn6XRS3y7IP+qylN5QAp user@Aloria" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOAhFTJI49o+eS1kHs5XRrpCLLuhAE+JUCffusudyR88 user@Arendia" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHtzTFdvLEvXpv69qAWLTipl4hgsKgRrRrWJRecsFthG user@Arch" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOxtJRtlAphl8euicVUR/6C7o+tyhpYmcbMBLHnldEIX server@mallorea" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILazQU/Y9I5PkMZoG/Lzc6mDR7s+aRHzqJoFUhYSse4P PocoF1" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOetfiPyIQ8hbU4t87E0ZrgLqFW9YW09+MNNiusXwW0C user@Asturia" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFoUYcVMsDw6tmjfdOuQkwaXx8fohKJs/6/5HoLzTP6x Tablet" ]; shell = pkgs.zsh; }; system.stateVersion = "23.11"; } home-manager.nixosModules.home-manager { home-manager = { extraSpecialArgs = {inherit inputs;}; useGlobalPkgs = true; useUserPackages = true; users.${user} = {imports = [./home/${host}.nix];}; backupFileExtension = "bak"; }; } ./hosts/${host} ]; mkSystem = host: cfg: let system = cfg.system or "x86_64-linux"; in nixpkgs.lib.nixosSystem { modules = (commonModules host cfg.user) ++ (cfg.modules or []) ++ [ {nixpkgs.hostPlatform = system;} ]; specialArgs = inputs; }; systems = { Riva = {user = "user";}; Kell = {user = "user";}; Aloria = {user = "user";}; Arendia = { user = "user"; modules = [ nixos-06cb-009a-fingerprint-sensor.nixosModules."06cb-009a-fingerprint-sensor" ]; }; }; mkHome = architecture: modulePath: home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${architecture}; modules = [modulePath]; extraSpecialArgs = {inherit inputs;}; }; in { nixosConfigurations = nixpkgs.lib.mapAttrs mkSystem systems; # Automatically injects the correct pkgs and modules for each host homeConfigurations = { "user@Pi" = mkHome "aarch64-linux" ./home/Pi.nix; "ubuntu@Arm" = mkHome "aarch64-linux" ./home/Arm.nix; "user@Tolnedra" = mkHome "x86_64-linux" ./home/Tolnedra.nix; "server@Vault" = mkHome "x86_64-linux" ./home/Vault.nix; "user@Docker" = mkHome "x86_64-linux" ./home/Docker.nix; "server@Mallorea" = mkHome "x86_64-linux" ./home/Mallorea.nix; }; # Generic formatter across architectures formatter = forAllSystems ( system: nixpkgs.legacyPackages.${system}.alejandra ); }; }