about summary refs log tree commit diff
path: root/examples/types.csk
blob: d587e033e1b9e92c5beaee56f31dbe7c03388961 (plain)
1
2
3
4
5
6
7
8
9
10
11
Data = type {
  version int
  payload [byte]
}

main = fun () {
  data Data = {
    version = 1
    payload = [0 0 0 8]
  }
}
EEB } /* Literal.String.Char */ .highlight .dl { color: #87CEEB } /* Literal.String.Delimiter */ .highlight .sd { color: #87CEEB } /* Literal.String.Doc */ .highlight .s2 { color: #87CEEB } /* Literal.String.Double */ .highlight .se { color: #87CEEB } /* Literal.String.Escape */ .highlight .sh { color: #87CEEB } /* Literal.String.Heredoc */ .highlight .si { color: #87CEEB } /* Literal.String.Interpol */ .highlight .sx { color: #87CEEB } /* Literal.String.Other */ .highlight .sr { color: #87CEEB } /* Literal.String.Regex */ .highlight .s1 { color: #87CEEB } /* Literal.String.Single */ .highlight .ss { color: #87CEEB } /* Literal.String.Symbol */ .highlight .bp { color: #DDD } /* Name.Builtin.Pseudo */ .highlight .fm { color: #FF0 } /* Name.Function.Magic */ .highlight .vc { color: #EEDD82 } /* Name.Variable.Class */ .highlight .vg { color: #EEDD82 } /* Name.Variable.Global */ .highlight .vi { color: #EEDD82 } /* Name.Variable.Instance */ .highlight .vm { color: #EEDD82 } /* Name.Variable.Magic */ .highlight .il { color: #F0F } /* Literal.Number.Integer.Long */
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";

    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager/release-24.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    flake-compat.url = "github:edolstra/flake-compat";
  
    oisd = {
      url = "github:sjhgvr/oisd";
      flake = false;
    };
  };

  outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
  let
    systems = {
      x86 = "x86_64-linux";
      arm = "aarch64-linux";
    };

    machines = with systems; [
      { name = "corsac"; system = x86; }
      { name = "lapin"; system = arm; }
      { name = "renard"; system = x86; }
    ];
    
    packageSetsForSystem = system: let
      pkgsInputs = { inherit system; config = import ./config.nix; };
    in rec {
      pkgs = import nixpkgs pkgsInputs;
      unstablePkgs = import nixpkgs-unstable pkgsInputs;
      auxiliaryPkgs = import ./pkgs { inherit system pkgs unstablePkgs; };
    };

    inherit (nixpkgs) lib;
  in {
    nixosConfigurations = lib.mergeAttrsList (map (machine: {
      ${machine.name} = nixpkgs.lib.nixosSystem {
        inherit (machine) system;

        specialArgs = inputs // (packageSetsForSystem machine.system) // {
          me = machine.name;
          security = import ./security.nix;
          util = import ./util.nix { inherit lib; };
        };

        modules = [
          ./machines/${machine.name}
        
          home-manager.nixosModules.home-manager {
            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.mel = import ./machines/${machine.name}/home.nix;
          }
        ];
      };
    }) machines);

    # compatibility wrapper for nixos-option
    legacyPackages = lib.genAttrs (lib.attrValues systems) 
      (system: with packageSetsForSystem system; pkgs.recurseIntoAttrs pkgs);
  };
}