patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob 6e770066d100fc87303e03e9821ecbcc48e3a9f0 2890 bytes (raw)
name: flake.nix 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 
{
  description = "A compartmentalized operating system";

  # NOTE: Revision specification format is ?ref=refs%2fheads%2f<BRANCH>&rev=<COMMIT_REVISION>
  inputs.nixpkgs.url =
    "git+https://spectrum-os.org/git/nixpkgs/?ref=refs%2fheads%2frootfs";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        config = { inherit pkgs; };
        lib = pkgs.lib;

        mkEntryPoint = { name ? builtins.baseNameOf path, path
          , enableShell ? true, enablePackage ? true }:
          let
            shell = {
              # NOTE: https://stackoverflow.com/a/43850372
              devShells.${name} =
                import (path + "/shell.nix") { inherit config; };
            };
            package = { packages.${name} = import path { inherit config; }; };
          in (if enableShell then shell else { })
          // (if enablePackage then package else { });

        # Entry point is a directory with shell.nix and default.nix
        # This function maps every entry point to corresponding devShell and package
        mapEntryPoints = epoints:
          builtins.foldl' lib.recursiveUpdate { } (map mkEntryPoint epoints);
      in lib.recursiveUpdate (mapEntryPoints [
        {
          path = ./.;
          enablePackage = false;
        }
        { path = ./host/initramfs; }
        { path = ./host/rootfs; }
        { path = ./host/start-vm; }
        { path = ./img/app; }
        { path = ./release/live; }
        { path = ./vm/sys/net; }
      ]) {
        # Add some other flake schema related stuff here.
        # NOTE: flake-utils.lib.eachDefaultSystem automagically adds ${system}.
        devShells.documentation = import ./Documentation { inherit config; };
        packages.documentation = import ./Documentation { inherit config; };

        nixosModules = let
          substituters = [ "https://cache.dataaturservice.se/spectrum/" ];
          trusted-public-keys = [
            "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
            "spectrum-os.org-1:rnnSumz3+Dbs5uewPlwZSTP0k3g/5SRG4hD7Wbr9YuQ="
          ];
        in {
          # NOTE: See https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-substituters
          # and https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-trusted-substituters
          # to understand difference between these two modules.
          binary-cache = { ... }: {
            nix.settings = { inherit trusted-public-keys substituters; };
          };
          # Doesn't enabled by
          trusted-binary-cache = { ... }: {
            nix.settings = {
              inherit trusted-public-keys;
              trusted-substituters = substituters;
            };
          };
        };
      });
}

debug log:

solving 6e77006 ...
found 6e77006 in https://inbox.spectrum-os.org/spectrum-devel/20221214110954.141676-1-valentin.kharin@unikie.com/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20221214110954.141676-1-valentin.kharin@unikie.com/
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..6e77006

Checking patch flake.nix...
Applied patch flake.nix cleanly.

index at:
100644 6e770066d100fc87303e03e9821ecbcc48e3a9f0	flake.nix

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).