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