flake reorg

This commit is contained in:
Robin Appelman 2026-05-14 18:59:12 +02:00
commit 23fc8d2509
8 changed files with 123 additions and 105 deletions

View file

@ -1,12 +0,0 @@
FROM ekidd/rust-musl-builder AS build
ADD . ./
RUN sudo chown -R rust:rust .
RUN cargo build --release
FROM alpine:latest
COPY --from=build /home/rust/src/target/x86_64-unknown-linux-musl/release/backup /
ENV RUST_LOG=info
CMD ["/backup"]

View file

@ -1,12 +0,0 @@
{
dockerTools,
demostf-backup,
}:
dockerTools.buildImage {
name = "demostf/backup";
tag = "latest";
copyToRoot = [demostf-backup];
config = {
Cmd = ["${demostf-backup}/bin/demostf-backup"];
};
}

95
flake.lock generated
View file

@ -1,56 +1,103 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"crane": {
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"lastModified": 1774313767,
"narHash": "sha256-hy0XTQND6avzGEUFrJtYBBpFa/POiiaGBr2vpU6Y9tY=",
"owner": "ipetkov",
"repo": "crane",
"rev": "3d9df76e29656c679c744968b17fbaf28f0e923d",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flakelight": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1778512898,
"narHash": "sha256-kwq7PYUbP6jNM/YiDEo21vbzefr93SUe0NbmCJIMFNw=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "f91eac171176dca81cbb0ae64ed75a9143ded8ba",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1776692281,
"narHash": "sha256-DCCSbpTUDqRiHsTS/sIgCTwa1r4gsJlWSFE6difdWxk=",
"ref": "refs/heads/main",
"rev": "d1d0e0bb5b0acebed06ccced9cc27f82aafab058",
"revCount": 71,
"type": "git",
"url": "https://codeberg.org/icewind/mill-scale.git"
},
"original": {
"type": "git",
"url": "https://codeberg.org/icewind/mill-scale.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1705183652,
"narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=",
"lastModified": 1778430510,
"narHash": "sha256-Ti+ZBvW6yrWWAg2szExVTwCd4qOJ3KlVr1tFHfyfi8Q=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "428544ae95eec077c7f823b422afae5f174dee4b",
"rev": "8fd9daa3db09ced9700431c5b7ad0e8ba199b575",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.11",
"ref": "nixos-25.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"flakelight": "flakelight",
"mill-scale": "mill-scale",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"rust-overlay": {
"inputs": {
"nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs"
]
},
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"lastModified": 1774535687,
"narHash": "sha256-dpKS/8+uB0EoI4mCrpio+xs8Xxry6ZhLLwV8VIbbfrs=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "75900435aa883f84b038316864b3f60956681523",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}

View file

@ -1,47 +1,30 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/nixos-25.11";
flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [
(import ./overlay.nix)
];
pkgs = (import nixpkgs) {
inherit system overlays;
mill-scale = {
url = "git+https://codeberg.org/icewind/mill-scale.git";
inputs.flakelight.follows = "flakelight";
};
in rec {
packages = rec {
demostf-backup = pkgs.demostf-backup;
dockerImage = pkgs.callPackage ./docker.nix {};
default = demostf-backup;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [rustc cargo rustfmt clippy cargo-edit cargo-audit bacon];
};
}
)
// {
overlays.default = import ./overlay.nix;
nixosModules.default = {
outputs = {mill-scale, ...}:
mill-scale ./. {
nixosModules = {outputs, ...}: {
default = {
pkgs,
config,
lib,
...
}: {
imports = [./module.nix];
imports = [./nix/module.nix];
config = lib.mkIf config.services.demostf-backup.enable {
nixpkgs.overlays = [self.overlays.default];
nixpkgs.overlays = [outputs.overlays.default];
services.demostf-backup.package = lib.mkDefault pkgs.demostf-backup;
};
};
};
};
}

View file

@ -1,7 +1,6 @@
{
config,
lib,
pkgs,
...
}:
with lib; let

31
nix/package.nix Normal file
View file

@ -0,0 +1,31 @@
{
rustPlatform,
lib,
openssl,
pkg-config,
}: let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ../. ["Cargo.*" "(src)(/.*)?"];
cargoPackage = (fromTOML (readFile ../Cargo.toml)).package;
in
rustPlatform.buildRustPackage {
pname = cargoPackage.name;
inherit (cargoPackage) version;
inherit src;
buildInputs = [
openssl
];
nativeBuildInputs = [
pkg-config
];
cargoLock = {
lockFile = ../Cargo.lock;
};
meta.mainProgram = "demostf-backup";
}

View file

@ -1,18 +0,0 @@
{
stdenv,
rustPlatform,
lib,
}: let
inherit (lib.sources) sourceByRegex;
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
in
rustPlatform.buildRustPackage rec {
pname = "demostf-backup";
version = "0.1.0";
inherit src;
cargoLock = {
lockFile = ./Cargo.lock;
};
}