nixified
This commit is contained in:
parent
f8e039cff5
commit
903b3aea98
3 changed files with 85 additions and 1 deletions
59
flake.nix
Normal file
59
flake.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
description = "An api to check when the ArmA reforger Dedicated Server needs updated";
|
||||
|
||||
# Nixpkgs / NixOS version to use.
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
# System types to support.
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
|
||||
# Nixpkgs instantiated for supported system types.
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
# Provide some binary packages for selected system types by mapping over each system architecture.
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
# Set pkgs = the correct version for a given architecture.
|
||||
pkgs = nixpkgsFor.${system};
|
||||
in
|
||||
{
|
||||
reforger-update-api = pkgs.callPackage ./package.nix { };
|
||||
}
|
||||
);
|
||||
|
||||
# Add dependencies that are only needed for development, this also allows for nix develop command to launch a devshell
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
go
|
||||
gopls
|
||||
gotools
|
||||
go-tools
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# The default package for 'nix build'. This makes sense if the
|
||||
# flake provides only one package or there is a clear "main"
|
||||
# package.
|
||||
defaultPackage = forAllSystems (system: self.packages.${system}.reforger-update-api);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue