]> Git — Sourcephile - julm/julm-nix.git/blob - flake.nix
replace unmaintained youtube-dl by yt-dlp
[julm/julm-nix.git] / flake.nix
1 {
2 inputs.nixpkgs.url = "github:NixOS/nixpkgs/2114075986ac3653d5a83e1c693b84d7197e7176";
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.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; };
13 outputs = inputs: let
14 remoteNixpkgsPatches = import nixpkgs/patches.nix;
15 localNixpkgsPatches = [
16 ];
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;
22 postPatch = ''
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
27 '';
28 };
29 lib = originPkgs.lib;
30 in {
31 nixosConfigurations = lib.genAttrs
32 (builtins.attrNames (lib.filterAttrs (n: v: v == "directory") (builtins.readDir ./hosts)))
33 (hostName: import (nixpkgsPath + "/nixos/lib/eval-config.nix") {
34 #inputs.nixpkgs.lib.nixosSystem {
35 system = "x86_64-linux";
36 extraArgs = {
37 inherit hostName inputs;
38 hosts = inputs.self.nixosConfigurations;
39 private = "/root/private"; # Kept out of /nix/store
40 };
41 modules = [
42 (import (./hosts + "/${hostName}.nix"))
43 inputs.nixpkgs.nixosModules.notDetected
44 inputs.home-manager.nixosModules.home-manager
45 ({ pkgs, ... }: {
46 nix.registry.nixpkgs.flake = inputs.nixpkgs;
47 nix.package = pkgs.nixFlakes;
48 nix.extraOptions = "experimental-features = nix-command flakes";
49 nixpkgs.overlays = import nixpkgs/overlays.nix;
50 /*
51 system.nixos.versionSuffix = ".${
52 lib.substring 0 8 (inputs.self.lastModifiedDate or inputs.self.lastModified)}.${
53 inputs.self.shortRev or "dirty"}";
54 system.nixos.revision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
55 */
56 # Let 'nixos-version --json' know about the Git revision of this flake.
57 system.configurationRevision = lib.mkIf (inputs.self ? rev) inputs.self.rev;
58 /*
59 system.configurationRevision =
60 if inputs.self ? rev
61 then inputs.self.rev
62 else throw "Refusing to build from a dirty Git tree!";
63 */
64 })
65 {
66 home-manager.useGlobalPkgs = true;
67 home-manager.useUserPackages = true;
68 home-manager.verbose = true;
69 home-manager.backupFileExtension = null;
70 home-manager.extraSpecialArgs = {
71 inherit hostName;
72 };
73 }
74 ];
75 });
76 } //
77 inputs.flake-utils.lib.eachDefaultSystem (system:
78 #let pkgs = inputs.nixpkgs.legacyPackages.${system}; in
79 let
80 pkgs = import nixpkgsPath {
81 inherit system;
82 config = {}; # Make the config pure, ignoring user's config.
83 overlays = import nixpkgs/overlays.nix;
84 }; in {
85 devShell = import ./shell.nix { inherit pkgs inputs system; };
86 }
87 );
88 }