summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 933f462851e8d2d678020ed73f9f2795232693ba (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
# kops (krebs ops)

kops is a lightweigt toolkit to deploy nixos systems, remotely or locally.

fancy features include:
- store your secrets in passwordstore
- build your system remotely
- minimal overhead
- run from custom nixpkgs branch/checkout/fork

minimal example:

create a kops.nix somewhere
```
let
  kops = (import <nixpkgs> {}).fetchgit {
    url = https://cgit.krebsco.de/kops/;
    rev = "3022582ade8049e6ccf18f358cedb996d6716945";
    sha256 = "0wg8d80sxa46z4i7ir79sci2hwmv3qskzqdgksi64p6vazy8vckb";
  };

  lib = import "${kops}/lib";
  pkgs = import "${kops}/pkgs" {};

  source = lib.evalSource [{
    nixpkgs.git = {
      ref = "4b4bbce199d3b3a8001ee93495604289b01aaad3";
      url = https://github.com/NixOS/nixpkgs;
    };
    nixos-config.file = pkgs.writeText "nixos-config" ''
      { config, pkgs, ... }:
      {
        imports =
          [ # Include the results of the hardware scan.
            ./hardware-configuration.nix
          ];

        # Use the GRUB 2 boot loader.
        boot.loader.grub.enable = true;
        boot.loader.grub.version = 2;
        # boot.loader.grub.efiSupport = true;
        # boot.loader.grub.efiInstallAsRemovable = true;
        # boot.loader.efi.efiSysMountPoint = "/boot/efi";
        # Define on which hard drive you want to install Grub.
        boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
      }
    '';
  }];
in
  pkgs.kops.writeDeploy "deploy" {
    source = source;
    target = "localhost";
  }
```

and run `nix-build kops.nix`