Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rejected] style: nixfmt #40

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 48 additions & 44 deletions containers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,62 @@
self,
lib,
...
}: {
imports = [];
}:
{
imports = [ ];

perSystem = {
self',
pkgs,
lib,
system,
inputs',
...
}: let
skopeo-push = pkgs.writeShellScriptBin "skopeo-push" ''
set -euo pipefail
# copy an image to a docker registry
# 1. image - Given as a path to an image archive
# 2. registry - The registry to push to
${pkgs.skopeo}/bin/skopeo copy --insecure-policy "docker-archive:$1" "docker://$2"
'';
perSystem =
{
self',
pkgs,
lib,
system,
inputs',
...
}:
let
skopeo-push = pkgs.writeShellScriptBin "skopeo-push" ''
set -euo pipefail
# copy an image to a docker registry
# 1. image - Given as a path to an image archive
# 2. registry - The registry to push to
${pkgs.skopeo}/bin/skopeo copy --insecure-policy "docker-archive:$1" "docker://$2"
'';

paperless-base = pkgs.dockerTools.pullImage {
imageName = "paperlessngx/paperless-ngx";
imageDigest = "sha256:9948208107c66a63ca6ea987197a20a3d49bddd28cebf768be53b191dc54a9b7";
sha256 = "sha256-w8189iaojdptL4JItHhCFVdTEX+A02TrKpzqCxXOB60=";
finalImageTag = "paperless-base";
finalImageName = "paperless";
};
in {
apps = {
skopeo-push = {
type = "app";
program = "${skopeo-push}/bin/skopeo-push";
paperless-base = pkgs.dockerTools.pullImage {
imageName = "paperlessngx/paperless-ngx";
imageDigest = "sha256:9948208107c66a63ca6ea987197a20a3d49bddd28cebf768be53b191dc54a9b7";
sha256 = "sha256-w8189iaojdptL4JItHhCFVdTEX+A02TrKpzqCxXOB60=";
finalImageTag = "paperless-base";
finalImageName = "paperless";
};
};
packages = {
"scripts/skopeo-push" = skopeo-push;
in
{
apps = {
skopeo-push = {
type = "app";
program = "${skopeo-push}/bin/skopeo-push";
};
};
packages = {
"scripts/skopeo-push" = skopeo-push;

"image/paperless" = pkgs.dockerTools.buildImage {
name = "paperless";
tag = "latest";

"image/paperless" = pkgs.dockerTools.buildImage {
name = "paperless";
tag = "latest";
fromImage = paperless-base;

fromImage = paperless-base;
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ pkgs.redis ];
pathsToLink = [ "/bin" ];
};

copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [pkgs.redis];
pathsToLink = ["/bin"];
config.Cmd = [ "/usr/local/bin/paperless_cmd.sh" ];
};

config.Cmd = ["/usr/local/bin/paperless_cmd.sh"];
"image/conduit" = inputs'.conduit.packages."image/conduit";
};

"image/conduit" = inputs'.conduit.packages."image/conduit";
};
};
}
50 changes: 28 additions & 22 deletions deploy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,37 @@
inputs,
config,
...
}: let
mkDeployNode = {
hostname,
address ? hostname,
}: {
hostname = address;
profiles.system = {
sshUser = "admin";
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${hostname};
user = "root";
}:
let
mkDeployNode =
{
hostname,
address ? hostname,
}:
{
hostname = address;
profiles.system = {
sshUser = "admin";
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${hostname};
user = "root";
};
profiles.justin = {
sshUser = "admin";
path =
inputs.deploy-rs.lib.x86_64-linux.activate.home-manager
self.homeConfigurations."justin@${hostname}";
user = "justin";
};
};
profiles.justin = {
sshUser = "admin";
path = inputs.deploy-rs.lib.x86_64-linux.activate.home-manager self.homeConfigurations."justin@${hostname}";
user = "justin";
};
};
in {
in
{
flake.deploy = {
nodes = {
bunky = mkDeployNode {hostname = "bunky";};
pyxis = mkDeployNode {hostname = "pyxis";};
ceylon = mkDeployNode {hostname = "ceylon";};
huginn = mkDeployNode {hostname = "huginn";};
alex = mkDeployNode {hostname = "alex";};
bunky = mkDeployNode { hostname = "bunky"; };
pyxis = mkDeployNode { hostname = "pyxis"; };
ceylon = mkDeployNode { hostname = "ceylon"; };
huginn = mkDeployNode { hostname = "huginn"; };
alex = mkDeployNode { hostname = "alex"; };
};
};
}
46 changes: 24 additions & 22 deletions flake-parts/ci.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
{inputs, ...}: {
perSystem = {
config,
pkgs,
system,
inputs',
self',
...
}: let
ciPackages = [
pkgs.skopeo
];
{ inputs, ... }:
{
perSystem =
{
config,
pkgs,
system,
inputs',
self',
...
}:
let
ciPackages = [ pkgs.skopeo ];

devShells = {
ci = pkgs.mkShell rec {
packages = ciPackages;
devShells = {
ci = pkgs.mkShell rec {
packages = ciPackages;

LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
};
};
};
in rec {
inherit devShells;
in
rec {
inherit devShells;

legacyPackages = {
inherit ciPackages;
legacyPackages = {
inherit ciPackages;
};
};
};
}
46 changes: 20 additions & 26 deletions flake-parts/formatting.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
{ inputs, self, ... }:
{
inputs,
self,
...
}: {
perSystem = {
pkgs,
lib,
...
}: let
formatters = [
pkgs.alejandra
];
perSystem =
{ pkgs, lib, ... }:
let
formatters = [ pkgs.alejandra ];

treefmt = pkgs.writeShellApplication {
name = "treefmt";
runtimeInputs = [pkgs.treefmt] ++ formatters;
text = ''
exec treefmt "$@"
'';
};
in {
packages = {
inherit treefmt;
};
treefmt = pkgs.writeShellApplication {
name = "treefmt";
runtimeInputs = [ pkgs.treefmt ] ++ formatters;
text = ''
exec treefmt "$@"
'';
};
in
{
packages = {
inherit treefmt;
};

legacyPackages = {
inherit formatters;
legacyPackages = {
inherit formatters;
};
};
};
}
Loading