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