1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 17:14:08 +02:00

flake reorg

This commit is contained in:
Robin Appelman 2025-02-19 16:24:13 +01:00
commit c28a81a661
9 changed files with 84 additions and 164 deletions

View file

@ -13,7 +13,7 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#check
clippy:
@ -26,7 +26,7 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#clippy
test:
@ -39,7 +39,7 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#test
matrix:
@ -65,9 +65,9 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: haze-${{ matrix.target }}
path: result/bin/*
path: result/bin/*

View file

@ -2,10 +2,10 @@ name: Build haze images
on:
push:
branches: ['main']
branches: ["main"]
paths:
- '.github/**'
- 'images/**'
- ".github/**"
- "images/**"
permissions:
contents: read
@ -16,8 +16,8 @@ jobs:
strategy:
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
variant: [ '', '-dbg' ]
php-version: ["8.1", "8.2", "8.3"]
variant: ["", "-dbg"]
name: haze-${{ matrix.php-version }}${{ matrix.variant }}

View file

@ -27,7 +27,7 @@ jobs:
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#${{ matrix.target }}
- name: Upload binary to release
uses: svenstaro/upload-release-action@v2
@ -35,4 +35,4 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: result/bin/haze
asset_name: haze-${{ matrix.target }}
tag: ${{ github.ref }}
tag: ${{ github.ref }}

View file

@ -32,11 +32,13 @@ See the [configuration section](#configuration) for more options.
### Quick examples
- Start a Nextcloud instance with `postgresql`, `php 8.1` and `s3` primary storage:
```bash
haze start pgsq s3
```
- Start a Nextcloud instance with `sqlite`, `php 8.2` and an `smb` external storage:
```bash
haze start 8.2 smb
```
@ -265,4 +267,4 @@ listen = "/run/haze/haze.sock" # either a unix socket path
name = "groupfolders" # name of the preset
apps = ["groupfolders"] # app to enable
commands = ["occ groupfolders:create gf", "occ groupfolders:group 1 admin read write share delete"] # commands to run post-setup
```
```

125
flake.lock generated
View file

@ -1,73 +1,69 @@
{
"nodes": {
"cross-naersk": {
"crane": {
"locked": {
"lastModified": 1733688869,
"narHash": "sha256-KrhxxFj1CjESDrL5+u/zsVH0K+Ik9tvoac/oFPoxSB8=",
"owner": "ipetkov",
"repo": "crane",
"rev": "604637106e420ad99907cae401e13ab6b452e7d9",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flakelight": {
"inputs": {
"naersk": [
"naersk"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1739796086,
"narHash": "sha256-jxpUiVJ6O+V1YsXsvWdMgqnv8zk9TFiqF86CRdGGGH4=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "540efca2f9015aff7dc574c7a03404e5fa72d42f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"nixpkgs": [
"nixpkgs"
]
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1717704286,
"narHash": "sha256-zrLB/FTKODEAlJjgO8TwbK7teTseYbjLESp8QJ/FJYc=",
"lastModified": 1735052218,
"narHash": "sha256-I30wh6G8fSUO4EseexxiDXcxyUhXR6C8BvEeKn6xyfE=",
"owner": "icewind1991",
"repo": "cross-naersk",
"rev": "9068daceb8f0d248dcf629944f60e92b81391bdb",
"repo": "mill-scale",
"rev": "7e45bb598ff63a8416ee3c26743b20644563bd93",
"type": "github"
},
"original": {
"owner": "icewind1991",
"repo": "cross-naersk",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1733346208,
"narHash": "sha256-a4WZp1xQkrnA4BbnKrzJNr+dYoQr5Xneh2syJoddFyE=",
"owner": "nix-community",
"repo": "naersk",
"rev": "378614f37a6bee5a3f2ef4f825a73d948d3ae921",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"repo": "mill-scale",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1733808091,
"narHash": "sha256-KWwINTQelKOoQgrXftxoqxmKFZb9pLVfnRvK270nkVk=",
"lastModified": 1739758141,
"narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a0f3e10d94359665dba45b71b4227b0aeb851f8e",
"rev": "c618e28f70257593de75a7044438efc1c1fc0791",
"type": "github"
},
"original": {
@ -78,16 +74,16 @@
},
"root": {
"inputs": {
"cross-naersk": "cross-naersk",
"flake-utils": "flake-utils",
"naersk": "naersk",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
"flakelight": "flakelight",
"mill-scale": "mill-scale",
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs"
]
},
@ -104,21 +100,6 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

115
flake.nix
View file

@ -1,99 +1,36 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.inputs.flake-utils.follows = "flake-utils";
cross-naersk.url = "github:icewind1991/cross-naersk";
cross-naersk.inputs.nixpkgs.follows = "nixpkgs";
cross-naersk.inputs.naersk.follows = "naersk";
flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
};
mill-scale = {
url = "github:icewind1991/mill-scale";
inputs.flakelight.follows = "flakelight";
};
};
outputs = {mill-scale, ...}:
mill-scale ./. {
crossTargets = [
"x86_64-unknown-linux-gnu"
"x86_64-unknown-linux-musl"
"aarch64-unknown-linux-gnu"
"aarch64-unknown-linux-musl"
];
outputs = {
self,
nixpkgs,
flake-utils,
naersk,
rust-overlay,
cross-naersk,
}: let
inherit (builtins) filter;
inherit (nixpkgs.lib.strings) hasInfix;
targets = [
"x86_64-unknown-linux-gnu"
"x86_64-unknown-linux-musl"
"aarch64-unknown-linux-gnu"
"aarch64-unknown-linux-musl"
];
releaseTargets = filter (hasInfix "-musl") targets;
in
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [
(import rust-overlay)
(import ./overlay.nix)
];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
inherit (pkgs) lib callPackage;
inherit (lib.sources) sourceByRegex;
inherit (lib.attrsets) genAttrs;
hostTarget = pkgs.hostPlatform.config;
cross-naersk' = callPackage cross-naersk {inherit naersk;};
nearskOpt = {
inherit (pkgs.haze) src pname;
};
buildTarget = target: (cross-naersk'.buildPackage target) nearskOpt;
hostNaersk = cross-naersk'.hostNaersk;
toolchain = pkgs.rust-bin.stable.latest.default;
in rec {
# `nix build`
packages =
genAttrs targets buildTarget
// rec {
inherit (pkgs) haze;
check = hostNaersk.buildPackage (nearskOpt
// {
mode = "check";
});
test = hostNaersk.buildPackage (nearskOpt
// {
mode = "test";
});
clippy = hostNaersk.buildPackage (nearskOpt
// {
mode = "clippy";
});
default = haze;
homeModules = {
default = {
pkgs,
config,
lib,
...
}: {
imports = [./nix/hm-module.nix];
config = lib.mkIf config.programs.haze.enable {
programs.haze.package = lib.mkDefault pkgs.haze;
};
devShells = {
default = cross-naersk'.mkShell targets {
nativeBuildInputs = with pkgs; [toolchain bacon cargo-edit cargo-outdated clippy];
};
};
}
)
// {
overlays.default = import ./overlay.nix;
homeManagerModules.default = {
pkgs,
config,
lib,
...
}: {
imports = [./hm-module.nix];
config = lib.mkIf config.programs.haze.enable {
programs.haze.package = lib.mkDefault pkgs.haze;
};
};
inherit targets releaseTargets;
};
}

View file

@ -7,8 +7,8 @@
}: let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
version = (fromTOML (readFile ./Cargo.toml)).package.version;
src = sourceByRegex ../. ["Cargo.*" "(src)(/.*)?"];
version = (fromTOML (readFile ../Cargo.toml)).package.version;
in
rustPlatform.buildRustPackage rec {
pname = "haze";
@ -16,7 +16,7 @@ in
inherit src version;
cargoLock = {
lockFile = ./Cargo.lock;
lockFile = ../Cargo.lock;
outputHashes = {
"hyper-reverse-proxy-0.5.2-dev" = "sha256-8yBpYQZJaNhaecjR2GhQytRM4jgS0GaKzAxRXFmIf8k=";
};