Home

ugit @68992f08078cf7278bed3e59ffd85ae5502fbfcd - refs - log -
-
https://git.jolheiser.com/ugit.git
The code powering this h*ckin' site
ugit / flake.nix
- raw
 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
  description = "Minimal git server";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    tailwind-ctp = {
      url = "git+https://git.jolheiser.com/tailwind-ctp";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    tailwind-ctp-lsp = {
      url = "git+https://git.jolheiser.com/tailwind-ctp-intellisense";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    {
      self,
      nixpkgs,
      tailwind-ctp,
      tailwind-ctp-lsp,
    }:
    let
      systems = [
        "x86_64-linux"
        "i686-linux"
        "x86_64-darwin"
        "aarch64-linux"
        "armv6l-linux"
        "armv7l-linux"
      ];
      forAllSystems = f: nixpkgs.lib.genAttrs systems f;
      tctp = forAllSystems (system: tailwind-ctp.packages.${system}.default);
      tctpl = forAllSystems (system: tailwind-ctp-lsp.packages.${system}.default);
    in
    {
      packages = forAllSystems (system: import ./nix { pkgs = import nixpkgs { inherit system; }; });
      devShells = forAllSystems (
        system:
        let
          pkgs = import nixpkgs { inherit system; };
        in
        {
          default = pkgs.mkShell {
            nativeBuildInputs = with pkgs; [
              go
              gopls
              air
              tctp.${system}
              tctpl.${system}
              vscode-langservers-extracted
            ];
          };
        }
      );
      nixosModules.default = import ./nix/module.nix;
      nixosConfigurations.ugitVM = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          ./nix/vm.nix
          {
            virtualisation.vmVariant.virtualisation = {
              cores = 2;
              memorySize = 2048;
              graphics = false;
            };
            system.stateVersion = "23.11";
          }
        ];
      };
      apps = forAllSystems (
        system:
        let
          pkgs = import nixpkgs { inherit system; };
        in
        {
          vm = {
            type = "app";
            program = "${pkgs.writeShellScript "vm" ''
              nixos-rebuild build-vm --flake .#ugitVM
              ./result/bin/run-nixos-vm
              rm nixos.qcow2
            ''}";
          };
        }
      );
    };
}