aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 8c8d07921b577cf0ef5653c26811fb1d44457337 (plain) (blame)
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
{
  description = "Flake for running Garage as a NixOS container";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    nomad-driver-nix.url = "github:input-output-hk/nomad-driver-nix";
    garage.url = "git+https://git.deuxfleurs.fr/Deuxfleurs/garage.git?ref=nix-remove-system&rev=60c26fbc628d7b450ae39214b578ab6a30583d5c";
  };

  outputs = { self, nixpkgs, nomad-driver-nix, garage }: {
      nixosConfigurations = {
        garage = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          specialArgs.self = self;
          modules = [
            nomad-driver-nix.nixosModules.nix-driver-nomad
            (nixpkgs + /nixos/modules/profiles/headless.nix)
            (nixpkgs + /nixos/modules/profiles/minimal.nix)
            (nixpkgs + /nixos/modules/misc/version.nix)
            ({ lib, pkgs, self, config, ... }: {
              nixpkgs.overlays = [ nomad-driver-nix.overlay ];
              networking.hostName = lib.mkDefault "garage-nixos";

              nix = {
                settings.system-features = [ "recursive-nix" "nixos-test" ];
                extraOptions = ''
                  experimental-features = nix-command flakes ca-references recursive-nix
                '';
              };

              users.users = {
                nixos = {
                  isNormalUser = true;
                  extraGroups = [ "wheel" ];
                  initialHashedPassword = "";
                };

                root.initialHashedPassword = "";
              };

              security.sudo = {
                enable = lib.mkDefault true;
                wheelNeedsPassword = lib.mkForce false;
              };

              system.stateVersion = "22.11";
            })
          ];
        };
      };
    };
}