build: Add Nix flake for building x86_64- and aarch64-linux Nix packages

This commit is contained in:
June 2024-06-06 20:18:52 +02:00
parent 3410f647f5
commit 5c55bd3e97
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
3 changed files with 73 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
__pycache__ __pycache__
/dist/ /dist/
/.coverage* /.coverage*
/result

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1717428950,
"narHash": "sha256-Pr3lhu2No1GHJarhjt+Jsfxye1wNLoY12E44p0b3VO0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "4fad892a8f64635a55423e4acfefeefb6caf4d0d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11-small",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

45
flake.nix Normal file
View file

@ -0,0 +1,45 @@
{
description = "A simple NixOS deployment tool using nixos-rebuild internally, but trying to make infrastructure deployment more convenient.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
};
outputs = { nixpkgs, ... }:
let
version = "0.0.1";
in
{
packages = nixpkgs.lib.attrsets.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
in
rec {
infra-rebuild = pkgs.python3Packages.buildPythonApplication {
pname = "infra-rebuild";
inherit version;
pyproject = true;
src = ./.;
nativeBuildInputs = with pkgs.python3Packages; [
hatchling
];
propagatedBuildInputs = [
pkgs.python3Packages.click
pkgs.nixos-rebuild
];
meta = with nixpkgs.lib; {
description = "A simple NixOS deployment tool using nixos-rebuild internally";
longDescription = "A simple NixOS deployment tool using nixos-rebuild internally, but trying to make infrastructure deployment more convenient.";
homepage = "https://git.hamburg.ccc.de/CCCHH/infra-rebuild";
license = licenses.gpl3Plus;
};
};
default = infra-rebuild;
}
);
};
}