]> Git — Sourcephile - julm/julm-nix.git/blob - flake.nix
nix: update to latest nixos-unstable
[julm/julm-nix.git] / flake.nix
1 {
2 inputs.nixpkgs.url = "github:NixOS/nixpkgs/7013a0f2791da4c38c7e6f56d48139aeb344991b";
3 inputs.flake-utils.url = "github:numtide/flake-utils";
4 inputs.home-manager.url = "github:nix-community/home-manager/release-20.09";
5 inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
6 #inputs.pass = { type = "path"; path = "./pass"; flake = false; };
7 outputs = inputs: let
8 remoteNixpkgsPatches = import nixpkgs/patches.nix;
9 localNixpkgsPatches = [
10 nixpkgs/patches/sanoid.diff
11 ];
12 originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
13 nixpkgsPath = originPkgs.applyPatches {
14 name = "nixpkgs-patched";
15 src = inputs.nixpkgs.outPath;
16 patches = map originPkgs.fetchpatch remoteNixpkgsPatches ++ localNixpkgsPatches;
17 postPatch = ''
18 patch=$(printf '%s\n' ${builtins.concatStringsSep " "
19 (map (p: p.sha256) remoteNixpkgsPatches ++ localNixpkgsPatches)} |
20 sort | sha256sum | cut -c -7)
21 echo "+patch-$patch" >.version-suffix
22 '';
23 };
24 lib = originPkgs.lib;
25 in {
26 nixosConfigurations = lib.genAttrs
27 (builtins.attrNames (lib.filterAttrs (n: v: v == "directory") (builtins.readDir ./hosts)))
28 (hostName: import (nixpkgsPath + "/nixos/lib/eval-config.nix") {
29 #inputs.nixpkgs.lib.nixosSystem {
30 system = "x86_64-linux";
31 extraArgs = {
32 inherit hostName inputs;
33 hosts = inputs.self.nixosConfigurations;
34 private = "/root/private"; # Kept out of /nix/store
35 };
36 modules = [
37 (import (./hosts + "/${hostName}.nix"))
38 inputs.nixpkgs.nixosModules.notDetected
39 inputs.home-manager.nixosModules.home-manager
40 ({ pkgs, ... }: {
41 nix.registry.nixpkgs.flake = inputs.nixpkgs;
42 nix.package = pkgs.nixFlakes;
43 nix.extraOptions = "experimental-features = nix-command flakes";
44 nixpkgs.overlays = import nixpkgs/overlays.nix;
45 /*
46 system.nixos.versionSuffix = ".${
47 lib.substring 0 8 (inputs.self.lastModifiedDate or inputs.self.lastModified)}.${
48 inputs.self.shortRev or "dirty"}";
49 system.nixos.revision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
50 */
51 # Let 'nixos-version --json' know about the Git revision of this flake.
52 system.configurationRevision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
53 /*
54 system.configurationRevision =
55 if inputs.self ? rev
56 then inputs.self.rev
57 else throw "Refusing to build from a dirty Git tree!";
58 */
59 })
60 {
61 home-manager.useGlobalPkgs = true;
62 home-manager.useUserPackages = true;
63 }
64 ];
65 });
66 } //
67 inputs.flake-utils.lib.eachDefaultSystem (system:
68 #let pkgs = inputs.nixpkgs.legacyPackages.${system}; in
69 let
70 pkgs = import nixpkgsPath {
71 inherit system;
72 config = {}; # Make the config pure, ignoring user's config.
73 #overlays = import nixpkgs/overlays.nix;
74 }; in {
75 devShell = import ./shell.nix { inherit pkgs; };
76 }
77 );
78 }