2 inputs.nixpkgs.url = "github:NixOS/nixpkgs/2b24fa4db8e5f4e3b3873d020b9cd2d3111005af";
3 inputs.flake-utils.url = "github:numtide/flake-utils";
4 inputs.home-manager.url = "github:nix-community/home-manager";
5 inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
6 inputs.nix-doom-emacs.url = "github:vlaci/nix-doom-emacs";
7 inputs.nix-doom-emacs.inputs.nixpkgs.follows = "nixpkgs";
8 inputs.nix-doom-emacs.inputs.home-manager.follows = "home-manager";
9 inputs.nix-doom-emacs.inputs.flake-utils.follows = "flake-utils";
10 inputs.nix-doom-emacs.inputs.emacs-overlay.follows = "emacs-overlay";
11 inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/master";
12 #inputs.pass = { type = "path"; path = "./pass"; flake = false; };
14 remoteNixpkgsPatches = import nixpkgs/patches.nix;
15 localNixpkgsPatches = [
17 originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
18 nixpkgsPath = originPkgs.applyPatches {
19 name = "nixpkgs-patched";
20 src = inputs.nixpkgs.outPath;
21 patches = map originPkgs.fetchpatch remoteNixpkgsPatches ++ localNixpkgsPatches;
23 patch=$(printf '%s\n' ${builtins.concatStringsSep " "
24 (map (p: p.sha256) remoteNixpkgsPatches ++ localNixpkgsPatches)} |
25 sort | sha256sum | cut -c -7)
26 echo "+patch-$patch" >.version-suffix
30 nixosSystem = import (nixpkgsPath + "/nixos/lib/eval-config.nix");
31 #nixosSystem = inputs.nixpkgs.lib.nixosSystem;
33 nixosConfigurations = lib.genAttrs
34 (builtins.attrNames (lib.filterAttrs (n: v: v == "directory") (builtins.readDir ./hosts)))
35 (hostName: nixosSystem rec {
36 system = "x86_64-linux";
38 inherit hostName inputs;
39 private = "/root/private"; # Kept out of /nix/store
42 hosts = inputs.self.nixosConfigurations;
44 pkgs = import nixpkgsPath {
46 config.allowUnfree = true; # For hplip
47 overlays = import nixpkgs/overlays.nix;
50 (import (./hosts + "/${hostName}.nix"))
51 inputs.nixpkgs.nixosModules.notDetected
52 inputs.home-manager.nixosModules.home-manager
54 nix.registry.nixpkgs.flake = inputs.nixpkgs;
55 nix.package = pkgs.nixFlakes;
56 nix.extraOptions = "experimental-features = nix-command flakes";
57 #nixpkgs.overlays = import nixpkgs/overlays.nix;
59 system.nixos.versionSuffix = ".${
60 lib.substring 0 8 (inputs.self.lastModifiedDate or inputs.self.lastModified)}.${
61 inputs.self.shortRev or "dirty"}";
62 system.nixos.revision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
64 # Let 'nixos-version --json' know about the Git revision of this flake.
65 system.configurationRevision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
67 system.configurationRevision =
70 else throw "Refusing to build from a dirty Git tree!";
74 home-manager.useGlobalPkgs = true;
75 home-manager.useUserPackages = true;
76 home-manager.verbose = true;
77 home-manager.backupFileExtension = null;
78 home-manager.extraSpecialArgs = {
85 inputs.flake-utils.lib.eachDefaultSystem (system:
86 #let pkgs = inputs.nixpkgs.legacyPackages.${system}; in
88 pkgs = import nixpkgsPath {
90 config = {}; # Make the config pure, ignoring user's config.
91 overlays = import nixpkgs/overlays.nix;
93 devShell = import ./shell.nix { inherit pkgs inputs system; };