Compare commits
No commits in common. "main" and "configurable-service-names" have entirely different histories.
main
...
configurab
9 changed files with 27 additions and 47 deletions
|
@ -148,7 +148,7 @@ Describe containers using NixOS-style modules. There are a few options:
|
||||||
project.name = "full-nixos";
|
project.name = "full-nixos";
|
||||||
services.webserver = { pkgs, lib, ... }: {
|
services.webserver = { pkgs, lib, ... }: {
|
||||||
nixos.useSystemd = true;
|
nixos.useSystemd = true;
|
||||||
nixos.configuration.boot.tmp.useTmpfs = true;
|
nixos.configuration.boot.tmpOnTmpfs = true;
|
||||||
nixos.configuration.services.nginx.enable = true;
|
nixos.configuration.services.nginx.enable = true;
|
||||||
nixos.configuration.services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
nixos.configuration.services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
||||||
nixos.configuration.services.nscd.enable = false;
|
nixos.configuration.services.nscd.enable = false;
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
project.name = "full-nixos";
|
project.name = "full-nixos";
|
||||||
services.webserver = { pkgs, lib, ... }: {
|
services.webserver = { pkgs, lib, ... }: {
|
||||||
nixos.useSystemd = true;
|
nixos.useSystemd = true;
|
||||||
nixos.configuration.boot.tmp.useTmpfs = true;
|
nixos.configuration.boot.tmpOnTmpfs = true;
|
||||||
nixos.configuration.networking.useDHCP = false;
|
|
||||||
nixos.configuration.services.nginx.enable = true;
|
nixos.configuration.services.nginx.enable = true;
|
||||||
nixos.configuration.services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
nixos.configuration.services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
||||||
nixos.configuration.services.nscd.enable = false;
|
nixos.configuration.services.nscd.enable = false;
|
||||||
|
|
24
flake.lock
24
flake.lock
|
@ -7,11 +7,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722555600,
|
"lastModified": 1701473968,
|
||||||
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
|
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
|
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -28,11 +28,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1712014858,
|
"lastModified": 1696343447,
|
||||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
"narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
"rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -64,11 +64,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1719226092,
|
"lastModified": 1701009247,
|
||||||
"narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=",
|
"narHash": "sha256-GuX16rzRze2y7CsewJLTV6qXkXWyEwp6VCZXi8HLruU=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "hercules-ci-effects",
|
"repo": "hercules-ci-effects",
|
||||||
"rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5",
|
"rev": "31b6cd7569191bfcd0a548575b0e2ef953ed7d09",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -79,11 +79,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722630782,
|
"lastModified": 1701436327,
|
||||||
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
|
"narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
|
"rev": "91050ea1e57e50388fa87a3302ba12d188ef723a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -86,6 +86,12 @@
|
||||||
flake = {
|
flake = {
|
||||||
debug = { inherit inputs config lib; };
|
debug = { inherit inputs config lib; };
|
||||||
|
|
||||||
|
defaultPackage =
|
||||||
|
lib.mapAttrs
|
||||||
|
(ps: lib.warn "arion.defaultPackage has been removed in favor of arion.packages.\${system}.default"
|
||||||
|
ps.default)
|
||||||
|
config.flake.packages;
|
||||||
|
|
||||||
lib = {
|
lib = {
|
||||||
eval = import ./src/nix/eval-composition.nix;
|
eval = import ./src/nix/eval-composition.nix;
|
||||||
build = args@{ ... }:
|
build = args@{ ... }:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
project.name = "unit-test-data";
|
project.name = "unit-test-data";
|
||||||
services.webserver = { pkgs, ... }: {
|
services.webserver = { pkgs, ... }: {
|
||||||
nixos.useSystemd = true;
|
nixos.useSystemd = true;
|
||||||
nixos.configuration.boot.tmp.useTmpfs = true;
|
nixos.configuration.boot.tmpOnTmpfs = true;
|
||||||
nixos.configuration.services.nginx.enable = true;
|
nixos.configuration.services.nginx.enable = true;
|
||||||
nixos.configuration.services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
nixos.configuration.services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
||||||
service.useHostStore = true;
|
service.useHostStore = true;
|
||||||
|
|
|
@ -3,13 +3,11 @@ let
|
||||||
|
|
||||||
link = url: text: ''[${text}](${url})'';
|
link = url: text: ''[${text}](${url})'';
|
||||||
|
|
||||||
composeSpecRev = "55b450aee50799a2f33cc99e1d714518babe305e";
|
|
||||||
|
|
||||||
serviceRef = fragment:
|
serviceRef = fragment:
|
||||||
''See ${link "https://github.com/compose-spec/compose-spec/blob/${composeSpecRev}/05-services.md#${fragment}" "Compose Spec Services #${fragment}"}'';
|
''See ${link "https://docs.docker.com/compose/compose-file/05-services/#${fragment}" "Docker Compose Services #${fragment}"}'';
|
||||||
|
|
||||||
networkRef = fragment:
|
networkRef = fragment:
|
||||||
''See ${link "https://github.com/compose-spec/compose-spec/blob/${composeSpecRev}/06-networks.md#${fragment}" "Compose Spec Networks #${fragment}"}'';
|
''See ${link "https://docs.docker.com/compose/compose-file/06-networks/#${fragment}" "Docker Compose Network #${fragment}"}'';
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,22 +66,6 @@ in
|
||||||
https://docs.docker.com/compose/compose-file/build/#context
|
https://docs.docker.com/compose/compose-file/build/#context
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
service.build.dockerfile = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Sets an alternate Dockerfile. A relative path is resolved from the build context.
|
|
||||||
https://docs.docker.com/compose/compose-file/build/#dockerfile
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
service.build.target = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Defines the stage to build as defined inside a multi-stage Dockerfile.
|
|
||||||
https://docs.docker.com/compose/compose-file/build/#target
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
service.hostname = mkOption {
|
service.hostname = mkOption {
|
||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -210,11 +194,6 @@ in
|
||||||
default = [];
|
default = [];
|
||||||
description = serviceRef "external_links";
|
description = serviceRef "external_links";
|
||||||
};
|
};
|
||||||
service.profiles = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [];
|
|
||||||
description = serviceRef "profiles";
|
|
||||||
};
|
|
||||||
service.extra_hosts = mkOption {
|
service.extra_hosts = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
|
@ -359,7 +338,7 @@ in
|
||||||
} // lib.optionalAttrs (config.service.image != null) {
|
} // lib.optionalAttrs (config.service.image != null) {
|
||||||
inherit (config.service) image;
|
inherit (config.service) image;
|
||||||
} // lib.optionalAttrs (config.service.build.context != null) {
|
} // lib.optionalAttrs (config.service.build.context != null) {
|
||||||
build = lib.filterAttrs (n: v: v != null) config.service.build;
|
inherit (config.service) build;
|
||||||
} // lib.optionalAttrs (cap_add != []) {
|
} // lib.optionalAttrs (cap_add != []) {
|
||||||
inherit cap_add;
|
inherit cap_add;
|
||||||
} // lib.optionalAttrs (cap_drop != []) {
|
} // lib.optionalAttrs (cap_drop != []) {
|
||||||
|
@ -416,7 +395,5 @@ in
|
||||||
inherit (config.service) working_dir;
|
inherit (config.service) working_dir;
|
||||||
} // lib.optionalAttrs (config.service.user != null) {
|
} // lib.optionalAttrs (config.service.user != null) {
|
||||||
inherit (config.service) user;
|
inherit (config.service) user;
|
||||||
} // lib.optionalAttrs (config.service.profiles != []) {
|
|
||||||
inherit (config.service) profiles;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ in
|
||||||
pkgs.stdenv
|
pkgs.stdenv
|
||||||
];
|
];
|
||||||
|
|
||||||
virtualisation.memorySize = 2048;
|
virtualisation.memorySize = 1024;
|
||||||
virtualisation.diskSize = 8000;
|
virtualisation.diskSize = 8000;
|
||||||
};
|
};
|
||||||
testScript = ''
|
testScript = ''
|
||||||
|
|
|
@ -4,7 +4,7 @@ pkgs.nixosTest {
|
||||||
name = "test-basic-arion-kafka";
|
name = "test-basic-arion-kafka";
|
||||||
nodes = {
|
nodes = {
|
||||||
machine = { ... }: {
|
machine = { ... }: {
|
||||||
virtualisation.memorySize = 4096;
|
virtualisation.memorySize = 3000;
|
||||||
virtualisation.diskSize = 10000;
|
virtualisation.diskSize = 10000;
|
||||||
imports = [
|
imports = [
|
||||||
../../nixos-module.nix
|
../../nixos-module.nix
|
||||||
|
|
Loading…
Reference in a new issue