| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- {
- description = "Nix Dotfiles with flake";
- inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
- home-manager = {
- url = "github:nix-community/home-manager/release-26.05";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.7.0";
- dms = {
- url = "github:AvengeMedia/DankMaterialShell/stable";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- dank-greeter = {
- url = "github:AvengeMedia/dank-greeter";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- mangowm = {
- url = "github:mangowm/mango";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- nixvim = {
- url = "github:nix-community/nixvim";
- };
- };
- outputs =
- {
- self,
- nix-flatpak,
- ...
- }@inputs:
- let
- lib = inputs.nixpkgs.lib;
- hosts = import ./config/hosts.nix;
- mkHomeConfigurations =
- {
- host,
- nixpkgs,
- home-manager,
- modules ? [ ],
- }:
- home-manager.lib.homeManagerConfiguration {
- pkgs = import nixpkgs {
- system = host.arch;
- config = {
- allowUnfree = true;
- };
- };
- extraSpecialArgs = { inherit inputs host; };
- modules = [
- ./hosts/${host.dir}/home
- ] ++ modules;
- };
- mkNixOSConfigurations =
- {
- host,
- nixpkgs,
- home-manager,
- modules ? [ ],
- overlays ? [],
- }:
- nixpkgs.lib.nixosSystem {
- system = host.arch;
- specialArgs = {
- inherit inputs host;
- };
- modules = [
- nix-flatpak.nixosModules.nix-flatpak
- ./hosts/${host.dir}/nixos
- { nixpkgs.overlays = overlays; }
- home-manager.nixosModules.home-manager
- {
- home-manager.extraSpecialArgs = { inherit inputs host; };
- home-manager.useGlobalPkgs = true;
- home-manager.useUserPackages = true;
- home-manager.backupFileExtension = "backup";
- home-manager.users."${host.user}" = import ./hosts/${host.dir}/home;
- }
- ] ++ modules;
- };
- mkISOConfiguration = # Build with: nix build .#nixosConfigurations.<hostname>-iso.config.system.build.isoImage
- {
- host,
- nixpkgs,
- }:
- nixpkgs.lib.nixosSystem {
- system = host.arch;
- modules = [
- ./hosts/${host.dir}/iso.nix
- { networking.hostName = "${host.hostname}-iso"; }
- ];
- };
- in
- {
- nixosConfigurations =
- lib.mapAttrs
- (name: host:
- mkNixOSConfigurations {
- inherit host;
- nixpkgs = inputs.nixpkgs;
- home-manager = inputs.home-manager;
- }
- )
- hosts
- // lib.mapAttrs'
- (name: host:
- lib.nameValuePair
- "${host.hostname}-iso"
- (mkISOConfiguration {
- inherit host;
- nixpkgs = inputs.nixpkgs;
- })
- )
- hosts;
- homeConfigurations = lib.mapAttrs'
- (name: host:
- lib.nameValuePair
- "${host.user}@${host.hostname}"
- (mkHomeConfigurations {
- inherit host;
- nixpkgs = inputs.nixpkgs;
- home-manager = inputs.home-manager;
- })
- )
- hosts;
- };
- }
|