2 inputs.nixpkgs.url = "github:NixOS/nixpkgs/34f85de51bbc74595e63b22ee089adbb31f7c7a2";
3 inputs.flake-utils.url = "github:numtide/flake-utils";
4 inputs.home-manager.url = "github:nix-community/home-manager/release-20.09";
5 #inputs.pass = { type = "path"; path = "./pass"; flake = false; };
7 remoteNixpkgsPatches = import nixpkgs/patches.nix;
8 localNixpkgsPatches = [
9 nixpkgs/patches/sanoid.diff
11 originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
12 nixpkgsPath = originPkgs.applyPatches {
13 name = "nixpkgs-patched";
14 src = inputs.nixpkgs.outPath;
15 patches = map originPkgs.fetchpatch remoteNixpkgsPatches ++ localNixpkgsPatches;
17 patch=$(printf '%s\n' ${builtins.concatStringsSep " "
18 (map (p: p.sha256) remoteNixpkgsPatches ++ localNixpkgsPatches)} |
19 sort | sha256sum | cut -c -7)
20 echo "+patch-$patch" >.version-suffix
25 nixosConfigurations = lib.genAttrs
26 (builtins.attrNames (lib.filterAttrs (n: v: v == "directory") (builtins.readDir ./hosts)))
27 (hostName: import (nixpkgsPath + "/nixos/lib/eval-config.nix") {
28 #inputs.nixpkgs.lib.nixosSystem {
29 system = "x86_64-linux";
31 inherit hostName inputs;
32 hosts = inputs.self.nixosConfigurations;
33 private = "/root/private"; # Kept out of /nix/store
36 (import (./hosts + "/${hostName}.nix"))
37 inputs.nixpkgs.nixosModules.notDetected
38 inputs.home-manager.nixosModules.home-manager
40 nix.registry.nixpkgs.flake = inputs.nixpkgs;
41 nix.package = pkgs.nixFlakes;
42 nix.extraOptions = "experimental-features = nix-command flakes";
43 nixpkgs.overlays = import nixpkgs/overlays.nix;
45 system.nixos.versionSuffix = ".${
46 lib.substring 0 8 (inputs.self.lastModifiedDate or inputs.self.lastModified)}.${
47 inputs.self.shortRev or "dirty"}";
48 system.nixos.revision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
50 # Let 'nixos-version --json' know about the Git revision of this flake.
51 system.configurationRevision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
53 system.configurationRevision =
56 else throw "Refusing to build from a dirty Git tree!";
60 home-manager.useGlobalPkgs = true;
61 home-manager.useUserPackages = true;
66 inputs.flake-utils.lib.eachDefaultSystem (system:
67 #let pkgs = inputs.nixpkgs.legacyPackages.${system}; in
69 pkgs = import nixpkgsPath {
71 config = {}; # Make the config pure, ignoring user's config.
72 #overlays = import nixpkgs/overlays.nix;
74 devShell = import ./shell.nix { inherit pkgs; };