psychonix-install/flake.nix

44 lines
1.1 KiB
Nix

{
description = "Install script flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = {self, ...} @ inputs: let
# Systems that can run the install script:
supportedSystems = ["aarch64-linux" "i686-linux" "x86_64-linux"];
# Function to generate a set based on supported systems:
forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems;
# Attribute set of nixpkgs for each system:
nixpkgsFor =
forAllSystems (system: import inputs.nixpkgs {inherit system;});
in {
# Install script
packages = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
in {
default = self.packages.${system}.nix-install;
nix-install = pkgs.writeShellApplication {
name = "nix-install";
runtimeInputs = with pkgs; [git busybox gum];
text = ''
${./install.sh} "$@"
'';
};
});
apps = forAllSystems (system: {
default = self.apps.${system}.nix-install;
nix-install = {
type = "app";
program = "${self.packages.${system}.nix-install}/bin/nix-install";
};
});
};
}