1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +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: with:
name: ci name: ci
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#check - run: nix build .#check
clippy: clippy:
@ -26,7 +26,7 @@ jobs:
with: with:
name: ci name: ci
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#clippy - run: nix build .#clippy
test: test:
@ -39,7 +39,7 @@ jobs:
with: with:
name: ci name: ci
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#test - run: nix build .#test
matrix: matrix:
@ -65,9 +65,9 @@ jobs:
with: with:
name: ci name: ci
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#${{ matrix.target }} - run: nix build .#${{ matrix.target }}
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: haze-${{ matrix.target }} name: haze-${{ matrix.target }}
path: result/bin/* path: result/bin/*

View file

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

View file

@ -27,7 +27,7 @@ jobs:
with: with:
name: ci name: ci
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#${{ matrix.target }} - run: nix build .#${{ matrix.target }}
- name: Upload binary to release - name: Upload binary to release
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
@ -35,4 +35,4 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: result/bin/haze file: result/bin/haze
asset_name: haze-${{ matrix.target }} 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 ### Quick examples
- Start a Nextcloud instance with `postgresql`, `php 8.1` and `s3` primary storage: - Start a Nextcloud instance with `postgresql`, `php 8.1` and `s3` primary storage:
```bash ```bash
haze start pgsq s3 haze start pgsq s3
``` ```
- Start a Nextcloud instance with `sqlite`, `php 8.2` and an `smb` external storage: - Start a Nextcloud instance with `sqlite`, `php 8.2` and an `smb` external storage:
```bash ```bash
haze start 8.2 smb 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 name = "groupfolders" # name of the preset
apps = ["groupfolders"] # app to enable apps = ["groupfolders"] # app to enable
commands = ["occ groupfolders:create gf", "occ groupfolders:group 1 admin read write share delete"] # commands to run post-setup 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": { "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": { "inputs": {
"naersk": [ "nixpkgs": [
"naersk" "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": [ "rust-overlay": "rust-overlay"
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1717704286, "lastModified": 1735052218,
"narHash": "sha256-zrLB/FTKODEAlJjgO8TwbK7teTseYbjLESp8QJ/FJYc=", "narHash": "sha256-I30wh6G8fSUO4EseexxiDXcxyUhXR6C8BvEeKn6xyfE=",
"owner": "icewind1991", "owner": "icewind1991",
"repo": "cross-naersk", "repo": "mill-scale",
"rev": "9068daceb8f0d248dcf629944f60e92b81391bdb", "rev": "7e45bb598ff63a8416ee3c26743b20644563bd93",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "icewind1991", "owner": "icewind1991",
"repo": "cross-naersk", "repo": "mill-scale",
"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",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1733808091, "lastModified": 1739758141,
"narHash": "sha256-KWwINTQelKOoQgrXftxoqxmKFZb9pLVfnRvK270nkVk=", "narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a0f3e10d94359665dba45b71b4227b0aeb851f8e", "rev": "c618e28f70257593de75a7044438efc1c1fc0791",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -78,16 +74,16 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"cross-naersk": "cross-naersk", "flakelight": "flakelight",
"flake-utils": "flake-utils", "mill-scale": "mill-scale",
"naersk": "naersk", "nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs" "nixpkgs"
] ]
}, },
@ -104,21 +100,6 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "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", "root": "root",

115
flake.nix
View file

@ -1,99 +1,36 @@
{ {
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-24.11"; nixpkgs.url = "nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils"; flakelight = {
naersk.url = "github:nix-community/naersk"; url = "github:nix-community/flakelight";
naersk.inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay"; };
rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; mill-scale = {
rust-overlay.inputs.flake-utils.follows = "flake-utils"; url = "github:icewind1991/mill-scale";
cross-naersk.url = "github:icewind1991/cross-naersk"; inputs.flakelight.follows = "flakelight";
cross-naersk.inputs.nixpkgs.follows = "nixpkgs"; };
cross-naersk.inputs.naersk.follows = "naersk";
}; };
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 = { homeModules = {
self, default = {
nixpkgs, pkgs,
flake-utils, config,
naersk, lib,
rust-overlay, ...
cross-naersk, }: {
}: let imports = [./nix/hm-module.nix];
inherit (builtins) filter; config = lib.mkIf config.programs.haze.enable {
inherit (nixpkgs.lib.strings) hasInfix; programs.haze.package = lib.mkDefault pkgs.haze;
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;
}; };
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 }: let
inherit (lib.sources) sourceByRegex; inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile; inherit (builtins) fromTOML readFile;
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"]; src = sourceByRegex ../. ["Cargo.*" "(src)(/.*)?"];
version = (fromTOML (readFile ./Cargo.toml)).package.version; version = (fromTOML (readFile ../Cargo.toml)).package.version;
in in
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "haze"; pname = "haze";
@ -16,7 +16,7 @@ in
inherit src version; inherit src version;
cargoLock = { cargoLock = {
lockFile = ./Cargo.lock; lockFile = ../Cargo.lock;
outputHashes = { outputHashes = {
"hyper-reverse-proxy-0.5.2-dev" = "sha256-8yBpYQZJaNhaecjR2GhQytRM4jgS0GaKzAxRXFmIf8k="; "hyper-reverse-proxy-0.5.2-dev" = "sha256-8yBpYQZJaNhaecjR2GhQytRM4jgS0GaKzAxRXFmIf8k=";
}; };