2 inputs.nixpkgs.url = "github:NixOS/nixpkgs/6b23e8fc7820366e489377b5b00890f088f36a01";
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.doom-emacs.url = "github:hlissner/doom-emacs";
7 inputs.doom-emacs.flake = false;
8 inputs.nix-doom-emacs.url = "github:vlaci/nix-doom-emacs";
9 inputs.nix-doom-emacs.inputs.nixpkgs.follows = "nixpkgs";
10 inputs.nix-doom-emacs.inputs.home-manager.follows = "home-manager";
11 inputs.nix-doom-emacs.inputs.flake-utils.follows = "flake-utils";
12 inputs.nix-doom-emacs.inputs.emacs-overlay.follows = "emacs-overlay";
13 inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/master";
14 #inputs.pass = { type = "path"; path = "./pass"; flake = false; };
16 remoteNixpkgsPatches = import nixpkgs/patches.nix;
17 localNixpkgsPatches = [
19 originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
20 nixpkgsPath = originPkgs.applyPatches {
21 name = "nixpkgs-patched";
22 src = inputs.nixpkgs.outPath;
23 patches = map originPkgs.fetchpatch remoteNixpkgsPatches ++ localNixpkgsPatches;
25 patch=$(printf '%s\n' ${builtins.concatStringsSep " "
26 (map (p: p.sha256) remoteNixpkgsPatches ++ localNixpkgsPatches)} |
27 sort | sha256sum | cut -c -7)
28 echo "+patch-$patch" >.version-suffix
32 nixosSystem = import (nixpkgsPath + "/nixos/lib/eval-config.nix");
33 #nixosSystem = inputs.nixpkgs.lib.nixosSystem;
35 nixosConfigurations = lib.genAttrs
36 (builtins.attrNames (lib.filterAttrs (n: v: v == "directory") (builtins.readDir ./hosts)))
37 (hostName: nixosSystem rec {
38 system = "x86_64-linux";
40 inherit hostName inputs;
41 private = "/root/private"; # Kept out of /nix/store
44 inherit hostName inputs;
45 hosts = inputs.self.nixosConfigurations;
47 pkgs = import nixpkgsPath {
49 config.allowUnfree = true; # For hplip
50 overlays = import nixpkgs/overlays.nix;
53 (import (./hosts + "/${hostName}.nix"))
54 inputs.nixpkgs.nixosModules.notDetected
55 inputs.home-manager.nixosModules.home-manager
57 nix.registry.nixpkgs.flake = inputs.nixpkgs;
58 nix.package = pkgs.nixFlakes;
59 nix.extraOptions = "experimental-features = nix-command flakes";
60 #nixpkgs.overlays = import nixpkgs/overlays.nix;
62 system.nixos.versionSuffix = ".${
63 lib.substring 0 8 (inputs.self.lastModifiedDate or inputs.self.lastModified)}.${
64 inputs.self.shortRev or "dirty"}";
65 system.nixos.revision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
67 # Let 'nixos-version --json' know about the Git revision of this flake.
68 system.configurationRevision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
70 system.configurationRevision =
73 else throw "Refusing to build from a dirty Git tree!";
77 home-manager.useGlobalPkgs = true;
78 home-manager.useUserPackages = true;
79 home-manager.verbose = true;
80 home-manager.backupFileExtension = null;
81 home-manager.extraSpecialArgs = {
82 inherit hostName inputs;
88 inputs.flake-utils.lib.eachDefaultSystem (system:
89 #let pkgs = inputs.nixpkgs.legacyPackages.${system}; in
91 pkgs = import nixpkgsPath {
93 config = {}; # Make the config pure, ignoring user's config.
94 overlays = import nixpkgs/overlays.nix;
96 devShell = import ./shell.nix { inherit pkgs inputs system; };