{ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11"; inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master"; inputs.pms7003.url = "github:orbekk/pms7003/master"; inputs.pms7003.inputs.nixpkgs.follows = "nixpkgs"; inputs.emacs-overlay.url = "github:nix-community/emacs-overlay"; outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, pms7003, emacs-overlay }: let pkgs-module = { config, ... }: let cfg = config.nixpkgs; ppp = pms7003; extra-packages = final: prev: { pms7003 = ppp.packages.${final.system}.pms7003; }; unstable-overlay = final: prev: rec { unstable = import nixpkgs-unstable { inherit (cfg) config localSystem crossSystem; }; }; in { nixpkgs.pkgs = import nixpkgs { inherit (cfg) config localSystem crossSystem; overlays = cfg.overlays ++ [ unstable-overlay extra-packages emacs-overlay.overlay ]; }; }; registry-module = { ... }: { nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs-unstable.flake = nixpkgs-unstable; }; lib = nixpkgs.lib; orbekk-modules = let moduleFiles = lib.attrNames (lib.filterAttrs (n: v: lib.hasSuffix ".nix" n && v == "regular") (builtins.readDir ./modules)); moduleNames = map (lib.removeSuffix ".nix") moduleFiles; mkModule = name: { inherit name; value = import (./. + "/modules/${name}.nix"); }; in lib.listToAttrs (map mkModule moduleNames); in { nixosModules = orbekk-modules // { inherit pkgs-module registry-module; }; packages."x86_64-linux" = let pkgs = import nixpkgs { system = "x86_64-linux"; }; in { }; nixosConfigurations = let mkConfig = { hostName, module ? (./. + "/machines/${hostName}.nix") , system ? "x86_64-linux" }: { name = hostName; value = lib.nixosSystem { inherit system; modules = (lib.attrValues 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"}"; }) ]; }; }; myMachines = [ { hostName = "pincer"; module = ./machines/x1-pincer.nix; } { hostName = "dragon"; } { hostName = "firelink"; } { hostName = "tiny1"; } # { hostName = "testvm"; module = { # users.users.orbekk.initialHashedPassword = ""; # }; } ]; in builtins.listToAttrs (map mkConfig myMachines); }; }