]> Git — Sourcephile - julm/julm-nix.git/blob - flake.nix
mpv: change Alt+v => Alt+a
[julm/julm-nix.git] / flake.nix
1 {
2 inputs.nixpkgs.url = "github:NixOS/nixpkgs/3a8d7958a610cd3fec3a6f424480f91a1b259185";
3 inputs.flake-utils.url = "github:numtide/flake-utils";
4 inputs.home-manager.url = "github:nix-community/home-manager/e0f2949c981a636ff1a75bd075e2a614af3bafb1";
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 ];
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;
16 postPatch = ''
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
21 '';
22 };
23 lib = originPkgs.lib;
24 in {
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";
30 extraArgs = {
31 inherit hostName inputs;
32 hosts = inputs.self.nixosConfigurations;
33 private = "/root/private"; # Kept out of /nix/store
34 };
35 modules = [
36 (import (./hosts + "/${hostName}.nix"))
37 inputs.nixpkgs.nixosModules.notDetected
38 inputs.home-manager.nixosModules.home-manager
39 ({ pkgs, ... }: {
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;
44 /*
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;
49 */
50 # Let 'nixos-version --json' know about the Git revision of this flake.
51 system.configurationRevision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
52 /*
53 system.configurationRevision =
54 if inputs.self ? rev
55 then inputs.self.rev
56 else throw "Refusing to build from a dirty Git tree!";
57 */
58 })
59 {
60 home-manager.useGlobalPkgs = true;
61 home-manager.useUserPackages = true;
62 }
63 ];
64 });
65 } //
66 inputs.flake-utils.lib.eachDefaultSystem (system:
67 #let pkgs = inputs.nixpkgs.legacyPackages.${system}; in
68 let
69 pkgs = import nixpkgsPath {
70 inherit system;
71 config = {}; # Make the config pure, ignoring user's config.
72 overlays = import nixpkgs/overlays.nix;
73 }; in {
74 devShell = import ./shell.nix { inherit pkgs inputs system; };
75 }
76 );
77 }