aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: cffa90fcce6765df00f6963d3216a16f3dec0054 (plain)
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
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
    disko = {
      url = "github:nix-community/disko";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    inputs@{
      self,
      nixpkgs,
      disko,
      ...
    }:
    let
      mkPkgs =
        system:
        let
          overlays = [
            # Access helpful variables from nixpkgs
            (_: prev: prev // { inherit inputs self; })

            # Add our custom library functions
            (final: prev: prev // { lib = prev.lib // import ./lib.nix final; })
          ];
        in
        import nixpkgs { inherit system overlays; };

      mkSystem =
        system: config:
        let
          pkgs = mkPkgs system;
        in
        nixpkgs.lib.nixosSystem {
          inherit system;
          specialArgs = {
            inherit inputs self;
            lib = pkgs.lib // {
              our = import ./lib.nix pkgs;
            };
          };
          modules = [
            disko.nixosModules.default
            ./modules/kiosk
            config
          ];
        };
    in
    {
      devShells.x86_64-linux.default =
        let
          pkgs = mkPkgs "x86_64-linux";
        in
        pkgs.mkShell { buildInputs = with pkgs; [ gnumake ]; };

      nixosConfigurations = {
        g1-bigscreen = mkSystem "x86_64-linux" ./hosts/g1-bigscreen.nix;
      };
    };
}