{ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09"; inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixos-hardware.url = github:NixOS/nixos-hardware/master; inputs.home-manager.url = "github:rycee/home-manager/master"; inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Remove nix overlay when pull request is resolved: # https://github.com/NixOS/nix/pull/4566 inputs.nix.url = "github:orbekk/nix/master"; inputs.nix.inputs.nixpkgs.follows = "nixpkgs"; outputs = { self, nixpkgs, nixpkgs-unstable, nix, nixos-hardware, home-manager }: let system = "x86_64-linux"; pkgs-module = {config, ...}: let cfg = config.nixpkgs; unstable-overlay = final: prev: { unstable = import nixpkgs-unstable { inherit (cfg) config localSystem crossSystem; }; }; in { nixpkgs.pkgs = import nixpkgs { inherit (cfg) config localSystem crossSystem; overlays = cfg.overlays ++ [ unstable-overlay ]; }; }; in { nixosModules = [ pkgs-module ./modules/common.nix ./modules/desktop.nix ./modules/gaming.nix ./modules/thinkpad.nix ./modules/users.nix ./modules/yubikey.nix ]; nixosConfigurations = let mkConfig = { hostName , module ? (./. + "/machines/${hostName}.nix") , system ? "x86_64-linux" }: { name = hostName; value = nixpkgs.lib.nixosSystem { inherit system; modules = self.nixosModules ++ [ pkgs-module module nixpkgs.nixosModules.notDetected ({config, pkgs, ...}: { # Let 'nixos-version --json' know about the Git revision # of this flake. system.configurationRevision = let lastModified = pkgs.lib.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101"); in "${lastModified}.${self.shortRev or "dirty"}"; nixpkgs.overlays = [ # Add unstable packages. (final: prev: { my-extras = { # inherit nixpkgs; # inherit nixpkgs-unstable; inherit nixos-hardware; }; }) # For git+file support with bare repo. nix.overlay (final: prev: { nixFlakes = final.nix; }) ]; }) ]; }; }; myMachines = [ { hostName = "pincer"; module = ./machines/x1-pincer.nix; } { hostName = "dragon"; } { hostName = "firelink"; } ]; in builtins.listToAttrs (map mkConfig myMachines); }; }