summaryrefslogtreecommitdiff
path: root/examples/nixos/flake.nix
blob: 78bc39a07005634d761c5be68ecdaaf075da82fc (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
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    temp-postgres = {
      # Try adding "?ref=main&shallow=0" to the URL if you experience caching issues.
      url = "git+https://git.skreutz.com/temp-postgres.git";
      # Optionally use your global Nixpkgs input.
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    {
      self,
      nixpkgs,
      temp-postgres,
    }@inputs:
    {
      nixosConfigurations.myhost =
        let
          system = "x86_64-linux";
        in
        nixpkgs.lib.nixosSystem {
          inherit system;
          specialArgs = {
            inherit system inputs;
          };
          modules = [
            # The following goes typically into ./configuration.nix
            {
              environment.systemPackages = [
                inputs.temp-postgres.packages.${system}.default

                # Optionally select the PostgreSQL version provided by Nixpkgs.
                #inputs.temp-postgres.packages.${system}.temp-postgres_18
              ];

              users.users.stefan = {
                isNormalUser = true;
                extraGroups = [ "wheel" ];
                initialPassword = "sesame";
              };
              system.stateVersion = "26.05";

              # Dummy values to avoid failed assertions during `nix flake check`.
              fileSystems."/" = {
                device = "/dev/null";
                fsType = "ext4";
              };
              boot.loader.grub.devices = [ "/dev/null" ];
            }
          ];
        };
    };
}
Generated by cgit. See skreutz.com for my tech blog and contact information.