]> Git — Sourcephile - julm/julm-nix.git/blob - flake.nix
init
[julm/julm-nix.git] / flake.nix
1 {
2 inputs.nixpkgs.url = "github:NixOS/nixpkgs/b69f140a8028e4718bde4e5082f8df38e50b7971";
3 inputs.flake-utils.url = "github:numtide/flake-utils";
4 outputs = inputs: let
5 remoteNixpkgsPatches = [
6 /*
7 { meta.description = "nixos-install: add support for inputs";
8 url = "https://github.com/NixOS/nixpkgs/pull/95194.diff";
9 sha256 = "sha256-R6LAHDM8FNQxsql5fiV16aDapKtZ7H/Q04pz1wjnSqQ";
10 }
11 */
12 ];
13 localNixpkgsPatches = [
14 ];
15 originPkgs = inputs.nixpkgs.legacyPackages."x86_64-linux";
16 nixpkgsPath = originPkgs.applyPatches {
17 name = "nixpkgs-patched";
18 src = inputs.nixpkgs.outPath;
19 patches = map originPkgs.fetchpatch remoteNixpkgsPatches ++ localNixpkgsPatches;
20 postPatch = ''
21 patch=$(printf '%s\n' ${builtins.concatStringsSep " "
22 (map (p: p.sha256) remoteNixpkgsPatches ++ localNixpkgsPatches)} |
23 sort | sha256sum | cut -c -7)
24 echo "+patch-$patch" >.version-suffix
25 '';
26 };
27 lib = originPkgs.lib;
28 in {
29 nixosConfigurations.oignon =
30 let machineName = "oignon"; in
31 #import (nixpkgsPath + "/nixos/lib/eval-config.nix") {
32 inputs.nixpkgs.lib.nixosSystem {
33 system = "x86_64-linux";
34 extraArgs = {
35 inherit machineName inputs;
36 machines = inputs.self.nixosConfigurations;
37 };
38 modules = [
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 (import (./machines + "/${machineName}.nix"))
60 inputs.nixpkgs.nixosModules.notDetected
61 ];
62 };
63 } //
64 inputs.flake-utils.lib.eachDefaultSystem (system:
65 #let pkgs = inputs.nixpkgs.legacyPackages.${system}; in
66 let
67 pkgs = import nixpkgsPath {
68 inherit system;
69 config = {}; # Make the config pure, ignoring user's config.
70 #overlays = import nixpkgs/overlays.nix;
71 }; in {
72 devShell = import ./shell.nix { inherit pkgs; };
73 }
74 );
75 }