mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 04:19:19 -08:00
feat: provide wrapped packages
This commit is contained in:
parent
fb9e62db99
commit
845afbeaf5
12 changed files with 77 additions and 29 deletions
|
|
@ -7,18 +7,6 @@
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
inherit (channels.std) string list set;
|
inherit (channels.std) string list set;
|
||||||
enabledNixosSystems = filterAttrs (_: system: system.config.ci.enable && system.config.type == "NixOS") channels.nixfiles.systems;
|
|
||||||
exportsSystems = let
|
|
||||||
warnSystems = set.filter (_: system: system.config.ci.allowFailure) enabledNixosSystems;
|
|
||||||
toSystems = systems: string.concatMapSep " " string.escapeShellArg (set.keys systems);
|
|
||||||
in ''
|
|
||||||
NF_NIX_SYSTEMS=(${toSystems enabledNixosSystems})
|
|
||||||
NF_NIX_SYSTEMS_WARN=(${toSystems warnSystems})
|
|
||||||
'';
|
|
||||||
buildAllSystems = pkgs.writeShellScriptBin "build-systems" ''
|
|
||||||
${exportsSystems}
|
|
||||||
nix run .#nf-actions-test
|
|
||||||
'';
|
|
||||||
in {
|
in {
|
||||||
imports = [./common.nix];
|
imports = [./common.nix];
|
||||||
config = {
|
config = {
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,14 @@
|
||||||
shells = import ./shells {inherit inputs tree lib std pkgs;};
|
shells = import ./shells {inherit inputs tree lib std pkgs;};
|
||||||
inherit (import ./pkgs.nix {inherit inputs tree overlay;}) pkgs;
|
inherit (import ./pkgs.nix {inherit inputs tree overlay;}) pkgs;
|
||||||
formatter = import ./formatter.nix {inherit inputs pkgs;};
|
formatter = import ./formatter.nix {inherit inputs pkgs;};
|
||||||
|
wrappers = import ./wrappers {inherit inputs;};
|
||||||
inherit (std) set;
|
inherit (std) set;
|
||||||
checks = set.map (_: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib;
|
checks = set.map (_: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit inputs tree std pkgs formatter lib checks;
|
inherit inputs tree std pkgs formatter lib checks;
|
||||||
legacyPackages = pkgs;
|
legacyPackages = pkgs;
|
||||||
packages = pkgs;
|
packages = pkgs // wrappers;
|
||||||
}
|
}
|
||||||
// systems
|
// systems
|
||||||
// shells
|
// shells
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@
|
||||||
# formerly final: prev:, but deadnix
|
# formerly final: prev:, but deadnix
|
||||||
inherit (inputs.std.lib) set;
|
inherit (inputs.std.lib) set;
|
||||||
in
|
in
|
||||||
set.map (_: package: prev.callPackage package {}) (removeAttrs tree.packages ["default"])
|
(set.map (_: package: prev.callPackage package {}) (removeAttrs tree.packages ["default"]))
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
wrapShellScriptBin,
|
|
||||||
pkgs,
|
|
||||||
}:
|
|
||||||
wrapShellScriptBin "nf-actions-test" ./actions-test.sh {
|
|
||||||
depsRuntimePath = with pkgs; [
|
|
||||||
git
|
|
||||||
cachix
|
|
||||||
jq
|
|
||||||
nix
|
|
||||||
curl
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -8,6 +8,5 @@ wrapShellScriptBin "nf-update" ./update.sh {
|
||||||
cachix
|
cachix
|
||||||
jq
|
jq
|
||||||
curl
|
curl
|
||||||
nf-actions-test
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ echo "checking that nodes still build..." >&2
|
||||||
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
|
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
|
||||||
export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result}
|
export NF_ACTIONS_TEST_OUTLINK=${NF_ACTIONS_TEST_OUTLINK-result}
|
||||||
fi
|
fi
|
||||||
nf-actions-test -L
|
nix run .#nf-actions-test -- -L
|
||||||
|
|
||||||
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
|
if [[ -n ${NF_UPDATE_CACHIX_PUSH-} ]]; then
|
||||||
send_discord_message "Cachix pushing"
|
send_discord_message "Cachix pushing"
|
||||||
|
|
|
||||||
9
wrappers/default.nix
Normal file
9
wrappers/default.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}@args: let
|
||||||
|
in
|
||||||
|
inputs.utils.lib.eachDefaultSystem (system: {
|
||||||
|
nf-actions-test = import ./nf-actions-test.nix args;
|
||||||
|
nf-generate = import ./nf-generate.nix args;
|
||||||
|
})
|
||||||
20
wrappers/exports.nix
Normal file
20
wrappers/exports.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
system,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (inputs.std.lib) string list set;
|
||||||
|
systems = inputs.self.systems;
|
||||||
|
enabledNixosSystems = set.filter (_: system: system.config.ci.enable && system.config.type == "NixOS") systems;
|
||||||
|
in {
|
||||||
|
exports = ''
|
||||||
|
export NF_CONFIG_ROOT=''${NF_CONFIG_ROOT-${toString ../../.}}
|
||||||
|
'';
|
||||||
|
exportsSystems = let
|
||||||
|
warnSystems = set.filter (_: system: system.config.ci.allowFailure) enabledNixosSystems;
|
||||||
|
toSystems = systems: string.concatMapSep " " string.escapeShellArg (set.keys systems);
|
||||||
|
in ''
|
||||||
|
NF_NIX_SYSTEMS=(${toSystems enabledNixosSystems})
|
||||||
|
NF_NIX_SYSTEMS_WARN=(${toSystems warnSystems})
|
||||||
|
'';
|
||||||
|
}
|
||||||
7
wrappers/generate.sh
Normal file
7
wrappers/generate.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
for ciconfig in "${NF_CONFIG_FILES[@]}"; do
|
||||||
|
echo "processing ${ciconfig}..." >&2
|
||||||
|
nix run --argstr config "$NF_CONFIG_ROOT/ci/$ciconfig" -f "$NF_INPUT_CI" run.gh-actions-generate
|
||||||
|
done
|
||||||
17
wrappers/nf-actions-test.nix
Normal file
17
wrappers/nf-actions-test.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
system,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}@args: let
|
||||||
|
lib = inputs.nixpkgs.lib;
|
||||||
|
exportFile = import ./exports.nix args;
|
||||||
|
inherit (exportFile) exports exportsSystems;
|
||||||
|
inherit (inputs.std.lib) string list set;
|
||||||
|
packages = inputs.self.packages.${system};
|
||||||
|
inherit (inputs.self.legacyPackages.${system}) pkgs;
|
||||||
|
nf-actions-test = pkgs.writeShellScriptBin "nf-actions-test" ''
|
||||||
|
${exports}
|
||||||
|
${exportsSystems}
|
||||||
|
source ${./actions-test.sh}
|
||||||
|
'';
|
||||||
|
in nf-actions-test
|
||||||
20
wrappers/nf-generate.nix
Normal file
20
wrappers/nf-generate.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
system,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}@args: let
|
||||||
|
lib = inputs.nixpkgs.lib;
|
||||||
|
exportFile = import ./exports.nix args;
|
||||||
|
inherit (exportFile) exports exportsSystems;
|
||||||
|
inherit (lib.strings) makeBinPath;
|
||||||
|
inherit (inputs.std.lib) string list set;
|
||||||
|
packages = inputs.self.packages.${system};
|
||||||
|
inherit (inputs.self.legacyPackages.${system}) pkgs;
|
||||||
|
nf-generate = pkgs.writeShellScriptBin "nf-generate" ''
|
||||||
|
${exports}
|
||||||
|
export PATH="$PATH:${makeBinPath [pkgs.jq]}"
|
||||||
|
NF_INPUT_CI=${string.escapeShellArg inputs.ci}
|
||||||
|
NF_CONFIG_FILES=(${string.concatMapSep " " string.escapeShellArg ci.workflowConfigs})
|
||||||
|
source ${../ci/generate.sh}
|
||||||
|
'';
|
||||||
|
in nf-generate
|
||||||
Loading…
Add table
Add a link
Reference in a new issue