nixos-configs/modules/arion/default.nix
matt1432 b28f07d9db
All checks were successful
Discord / discord commits (push) Has been skipped
chore: update flake.lock
Flake inputs:
• Updated input 'Hyprspace':
    'github:KZDKM/Hyprspace/2f3edb68f47a8f5d99d10b322e9a85a285f53cc7?narHash=sha256-iyj4D6c77uROAH9QdZjPd9SKnS/DuACMESqaEKnBgI8%3D' (2024-06-17)
  → 'github:KZDKM/Hyprspace/e8662093ae5b6e13a3cf1145d21d4804a3e84aeb?narHash=sha256-9aM4MCBJn4UstcsSdukOFTxg79keUMTw9Kmqr7Wsfmw%3D' (2024-07-09)

• Updated input 'discord-overlay':
    'github:matt1432/discord-nightly-overlay/d01718cae1920c0304dba16c8a579d7e309dd91e?narHash=sha256-7BmikJsEItlCGd3ppAB6sn8EXNB08U4pRXttoSQGN0Q%3D' (2024-07-07)
  → 'github:matt1432/discord-nightly-overlay/012ca035ff0e7eb8d8663674645e00f8cea5757e?narHash=sha256-A1gms/3YZLz%2B6E2RQoR/aCRApz6imSy9KOlct8QY1hs%3D' (2024-07-09)

• Updated input 'home-manager':
    'github:nix-community/home-manager/6b7ce96f34b324e4e104abc30d06955d216bac71?narHash=sha256-kAsg3Lg4YKKpGw%2Bf1W2s5hzjP8B0y/juowvjK8utIag%3D' (2024-07-07)
  → 'github:nix-community/home-manager/2fb5c1e0a17bc6059fa09dc411a43d75f35bb192?narHash=sha256-7ftA4Bv5KfH4QdTRxqe8/Hz2YTKo%2B7IQ9n7vbNWgv28%3D' (2024-07-08)

• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=22138ac259b2f4253be29311f6b60fbd675074b4&submodules=1' (2024-07-07)
  → 'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=b03f41efec14273cf25c42d4cef326acc36cb319&submodules=1' (2024-07-08)

• Updated input 'hyprland/hyprcursor':
    'github:hyprwm/hyprcursor/66d5b46ff94efbfa6fa3d1d1b66735f1779c34a6?narHash=sha256-jpsns6buS4bK%2B1sF8sL8AaixAiCRjA%2BnldTKvcwmvUs%3D' (2024-06-15)
  → 'github:hyprwm/hyprcursor/a5c0d57325c5f0814c39110a70ca19c070ae9486?narHash=sha256-AxRkTJlbB8r7aG6gvc7IaLhc2T9TO4/8uqanKRxukBQ%3D' (2024-07-04)

• Updated input 'hyprland/hyprlang':
    'github:hyprwm/hyprlang/ec6938c66253429192274d612912649a0cfe4d28?narHash=sha256-XeeVoKHQgfKuXoP6q90sUqKyl7EYy3ol2dVZGM%2BJj94%3D' (2024-06-08)
  → 'github:hyprwm/hyprlang/5df0174fd09de4ac5475233d65ffc703e89b82eb?narHash=sha256-lyC/EZdHULsaAKVryK11lgHY9u6pXr7qR4irnxNWC7k%3D' (2024-07-07)

• Updated input 'hyprland/hyprutils':
    'github:hyprwm/hyprutils/1f6bbec5954f623ff8d68e567bddcce97cd2f085?narHash=sha256-dmRz128j/lJmMuTYeCYPfSBRHHQO3VeH4PbmoyAhHzw%3D' (2024-06-25)
  → 'github:hyprwm/hyprutils/a8c3a135701a7b64db0a88ec353a392f402d2a87?narHash=sha256-lq2dPPPcwMHTLsFrQ2pRp4c2LwDZWoqzSyjuPdeJCP4%3D' (2024-07-05)

• Updated input 'hyprland/hyprwayland-scanner':
    'github:hyprwm/hyprwayland-scanner/914f083741e694092ee60a39d31f693d0a6dc734?narHash=sha256-mAnZG/eQy72Fp1ImGtqCgUrDumnR1rMZv2E/zgP4U74%3D' (2024-06-22)
  → 'github:hyprwm/hyprwayland-scanner/d5fa094ca27e0039be5e94c0a80ae433145af8bb?narHash=sha256-JPdL%2BQul%2BjEueAn8CARfcWP83eJgwkhMejQYfDvrgvU%3D' (2024-07-05)

• Updated input 'hyprland/xdph':
    'github:hyprwm/xdg-desktop-portal-hyprland/c7894aa54f9a7dbd16df5cd24d420c8af22d5623?narHash=sha256-FWW68AVYmB91ZDQnhLMBNCUUTCjb1ZpO2k2KIytHtkA%3D' (2024-06-17)
  → 'github:hyprwm/xdg-desktop-portal-hyprland/b9b97e5ba23fe7bd5fa4df54696102e8aa863cf6?narHash=sha256-Rizg9efi6ue95zOp0MeIV2ZedNo%2B5U9G2l6yirgBUnA%3D' (2024-07-05)
• Updated input 'hyprland/xdph/hyprland-protocols':
    'github:hyprwm/hyprland-protocols/e06482e0e611130cd1929f75e8c1cf679e57d161?narHash=sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM%3D' (2024-05-05)
  → 'github:hyprwm/hyprland-protocols/1b61f0093afff20ab44d88ad707aed8bf2215290?narHash=sha256-HUklK5u86w2Yh9dOkk4FdsL8eehcOZ95jPhLixGDRQY%3D' (2024-06-18)

• Updated input 'jovian':
    'github:Jovian-Experiments/Jovian-NixOS/fdcaab38857f221eea20a0073f891feb36ea8e99?narHash=sha256-KqGnYAKWxwRgWxc/78HbL3PHeuDJOSS/9%2BPkm5doUk8%3D' (2024-07-05)
  → 'github:Jovian-Experiments/Jovian-NixOS/5d1928b925da7390eae3e369e6808d64cf916ed7?narHash=sha256-rw8s4EsRSVtlAGNd5ttO4Ynb/eq0rMJsqG9zyREK3sk%3D' (2024-07-08)

• Updated input 'neovim-nightly':
    'github:nix-community/neovim-nightly-overlay/9822e0611d49ae70278ac20c9d7b68e4797b2fab?narHash=sha256-ihHXj%2Bfp/BVpc86rCNN%2BQbnpg6OrbeI%2Bjxz6VRyzcy0%3D' (2024-07-06)
  → 'github:nix-community/neovim-nightly-overlay/b6b51915180e6d2eac488d6f882e4ba36bad380d?narHash=sha256-IG/g4l/W0R2M/jxEyu/Sl3BmR/OK5D1jiahpc0wlpvE%3D' (2024-07-09)

• Updated input 'neovim-nightly/git-hooks':
    'github:cachix/git-hooks.nix/0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07?narHash=sha256-F1h%2BXIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4%3D' (2024-06-24)
  → 'github:cachix/git-hooks.nix/2b6bd3c87d3a66fb0b8f2f06c985995e04b4fb96?narHash=sha256-1in42htN3g3MnE3/AO5Qgs6pMWUzmtPQ7s675brO8uw%3D' (2024-07-08)

• Updated input 'neovim-nightly/neovim-src':
    'github:neovim/neovim/3c53e8f78511d6db9a6c804e5a479ba38c33102d?narHash=sha256-9tiW0rkQZGhnNaIP6gWj7N/iTlCLFdD5r37R1jVOs3s%3D' (2024-07-05)
  → 'github:neovim/neovim/fb6c059dc55c8d594102937be4dd70f5ff51614a?narHash=sha256-66u%2Byzjk6NrFr2jj2svD3jwNX8P2B8/DNH9A51V4kh8%3D' (2024-07-08)

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9f4128e00b0ae8ec65918efeba59db998750ead6?narHash=sha256-rwz8NJZV%2B387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ%3D' (2024-07-03)
  → 'github:NixOS/nixpkgs/655a58a72a6601292512670343087c2d75d859c1?narHash=sha256-cPJoFPXU44GlhWg4pUk9oUPqurPlCFZ11ZQPk21GTPU%3D' (2024-07-08)

• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/2e42a42b46fd0e79306cf9207b00a7364e77c1ab?narHash=sha256-DMmXUEesU/CGtnOiXkMZYJvXf%2BTJNZnKxIuiuA6ssZs%3D' (2024-07-07)
  → 'github:nix-community/nixpkgs-wayland/813f608e25bc14b16053c005b05ebf8b18d25503?narHash=sha256-05wIPweI6ts1BtVaMYbdL5KEelMfM4g5f/Z/xQzXRQI%3D' (2024-07-08)

• Updated input 'sops-nix':
    'github:Mic92/sops-nix/c184aca4db5d71c3db0c8cbfcaaec337a5d065ea?narHash=sha256-kcI8q9Nh8/CSj0ygfWq1DLckHl8IHhFarL8ie6g7OEk%3D' (2024-07-07)
  → 'github:Mic92/sops-nix/67035a355b1d52d2d238501f8cc1a18706979760?narHash=sha256-jqvhLDXzTLTHq9ZviFOpcTmXXmnbLfz7mWhgMNipMN4%3D' (2024-07-08)

Docker Images:
• craumix/jmusicbot 0.4.1:
   sha256:3d93112ea5318eb527b9dd599e7fd5540fee8e6f481769a86f225e6d715d91b2
 → sha256:560d380cbe9e90fd51e420eb060d5780dca07a5e04457b221f72e89210d23eb2

• quay.io/vaultwarden/server latest:
   sha256:edb8e2bab9cbca22e555638294db9b3657ffbb6e5d149a29d7ccdb243e3c71e0
 → sha256:4e28425bad4bd13568e1779f682ff7e441eca2ecd079bd77cfcba6e4eaf1b999

• ghcr.io/linuxserver/bazarr latest:
   sha256:86ad012fc31e974dcf0147900a202443d92d12f4334a9e4ec89baa2052fb12fa
 → sha256:5da74fc1bbd5da69e3b4f9b2376f6ccfbe3b47f143e6eb5651ed37cc1d4412dd

• ghcr.io/linuxserver/calibre-web latest:
   sha256:2de4ab91f2768c6db32d083a5935663fcc0eded1a67a4fdc2c1f705f7bb24d2d
 → sha256:73aa52c663537a21d0b2e5315ba1080aeaecff1fa29dc7c020a4107f64e96490
2024-07-09 18:35:28 -04:00

135 lines
3.5 KiB
Nix

{
arion,
config,
lib,
pkgs,
...
}: let
inherit
(lib)
filterAttrs
hasAttr
mapAttrs
mkEnableOption
mkForce
mkIf
mkOption
optionalAttrs
types
;
inherit (config.vars) mainUser;
cfg = config.arion;
in {
imports = [arion.nixosModules.arion];
options.arion = {
enable = mkEnableOption "My custom arion config layer module";
rwDataDir = mkOption {
default = "/var/lib/arion";
type = types.str;
description = ''
Directory to place persistent data in
'';
};
projects = mkOption {
default = {};
description = ''
Declarative specification of docker-compose in nix.
'';
type = types.attrs;
};
};
config = mkIf cfg.enable {
users.extraUsers.${mainUser}.extraGroups = ["docker"];
virtualisation = {
docker = {
enable = true;
storageDriver = "btrfs";
};
arion = {
backend = "docker";
projects =
mapAttrs (n: v: {
# https://docs.hercules-ci.com/arion/options
settings = {
enableDefaultNetwork = v.enableDefaultNetwork or true;
networks =
optionalAttrs (hasAttr "networks" v)
v.networks;
services =
mapAttrs (n': v': {
# https://github.com/hercules-ci/arion/issues/169#issuecomment-1301370634
build.image = let
importImage = file: pkgs.callPackage file pkgs;
in
mkForce (importImage v'.image);
service =
(filterAttrs (attrName: _:
attrName != "image" && attrName != "extraOptions")
v')
# By default set the container_name to the attrset's name
// (optionalAttrs (! hasAttr "container_name" v') {
container_name = n';
});
out.service =
optionalAttrs
(hasAttr "extraOptions" v')
v'.extraOptions;
})
v;
};
})
cfg.projects;
};
};
# Script for updating the images of all images of a compose.nix file
environment.systemPackages = with pkgs; [
(writeShellApplication {
name = "updateImages";
runtimeInputs = [
(writeShellApplication {
name = "pullImage";
runtimeInputs = [nix-prefetch-docker skopeo];
text = ''
FILE="$1"
IMAGE=$(sed -n 's/.*imageName = "\([^"]*\).*/\1/p' "$FILE")
TAG=$(sed -n 's/.*finalImageTag = "\([^"]*\).*/\1/p' "$FILE")
CURRENT_DIGEST=$(sed -n 's/.*imageDigest = "\([^"]*\).*/\1/p' "$FILE")
NEW_DIGEST=$(skopeo inspect "docker://$IMAGE:$TAG" | jq '.Digest' -r)
output="$IMAGE $TAG"
if ! grep "Locked" "$FILE"; then
if [[ "$CURRENT_DIGEST" != "$NEW_DIGEST" ]]; then
echo -e " $output:\n $CURRENT_DIGEST\n $NEW_DIGEST\n"
PREFETCH=$(nix-prefetch-docker "$IMAGE" "$TAG")
echo -e "pkgs:\npkgs.dockerTools.pullImage $PREFETCH" > "$FILE"
fi
fi
'';
})
];
text = ''
DIR=''${1:-"."}
find "$DIR"/images -type f -exec pullImage {} \;
'';
})
];
};
}