[nix] support outputs for different architectures
This commit is contained in:
36
flake.lock
generated
36
flake.lock
generated
@@ -18,7 +18,41 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"utils": "utils"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1694529238,
|
||||||
|
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
114
flake.nix
114
flake.nix
@@ -4,13 +4,17 @@
|
|||||||
#nixpkgs for testing framework
|
#nixpkgs for testing framework
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }:
|
inputs.utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, utils, ... }:
|
||||||
|
|
||||||
|
nixpkgs.lib.attrsets.recursiveUpdate
|
||||||
|
(utils.lib.eachSystem (utils.lib.defaultSystems) ( system:
|
||||||
let
|
let
|
||||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ];
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
pkgs = nixpkgs.legacyPackages."x86_64-linux";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShell."x86_64-linux" = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
go
|
go
|
||||||
gotools
|
gotools
|
||||||
@@ -19,40 +23,52 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.x86_64-linux.gokill = nixpkgs.legacyPackages.x86_64-linux.buildGoModule rec {
|
packages = {
|
||||||
pname = "gokill";
|
gokill = pkgs.buildGoModule rec {
|
||||||
version = "1.0";
|
pname = "gokill";
|
||||||
vendorHash = "sha256-MVIvXxASUO33Ca34ruIz4S0QDJcW2unaG4+Zo73g/9o=";
|
version = "1.0";
|
||||||
src = ./.;
|
vendorHash = "sha256-8xHjVwNskgiSoDKbOpL2phHub1F21ios1t9BcZB944o=";
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.olm
|
pkgs.olm
|
||||||
];
|
];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
gokill-docbuilder = pkgs.buildGoModule rec {
|
||||||
|
pname = "docbuilder";
|
||||||
|
version = "1.0";
|
||||||
|
vendorHash = "sha256-8xHjVwNskgiSoDKbOpL2phHub1F21ios1t9BcZB944o=";
|
||||||
|
buildFLags = "-o . $dest/cmd/gokill/docbuilder";
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
pkgs.olm
|
||||||
|
];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
docs = pkgs.callPackage (import ./docs/default.nix) { self = self; };
|
||||||
|
|
||||||
|
default = self.packages.${system}.gokill;
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.x86_64-linux.gokill-docbuilder = nixpkgs.legacyPackages.x86_64-linux.buildGoModule rec {
|
apps = {
|
||||||
pname = "docbuilder";
|
docs = {
|
||||||
version = "1.0";
|
type = "app";
|
||||||
vendorHash = "sha256-MVIvXxASUO33Ca34ruIz4S0QDJcW2unaG4+Zo73g/9o=";
|
program = builtins.toString (pkgs.writeScript "docs" ''
|
||||||
buildFLags = "-o . $dest/cmd/gokill/docbuilder";
|
${pkgs.python3}/bin/python3 -m http.server --directory ${self.packages."${system}".docs}/share/doc'');
|
||||||
src = ./.;
|
};
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
pkgs.olm
|
|
||||||
];
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
})) ({
|
||||||
packages.x86_64-linux.docs = pkgs.callPackage (import ./docs/default.nix) { self = self; };
|
|
||||||
|
|
||||||
packages.x86_64-linux.default = self.packages.x86_64-linux.gokill;
|
|
||||||
|
|
||||||
nixosModules.gokill = import ./nixos-modules/gokill.nix { self = self; };
|
nixosModules.gokill = import ./nixos-modules/gokill.nix { self = self; };
|
||||||
|
|
||||||
packages.x86_64-linux.testVm =
|
packages.x86_64-linux.testVm =
|
||||||
@@ -64,6 +80,7 @@
|
|||||||
self.nixosModules.gokill
|
self.nixosModules.gokill
|
||||||
{
|
{
|
||||||
services.gokill.enable = true;
|
services.gokill.enable = true;
|
||||||
|
services.gokill.testRun = false;
|
||||||
services.gokill.triggers = [
|
services.gokill.triggers = [
|
||||||
{
|
{
|
||||||
type = "Timeout";
|
type = "Timeout";
|
||||||
@@ -72,19 +89,12 @@
|
|||||||
duration = 10;
|
duration = 10;
|
||||||
};
|
};
|
||||||
actions = [
|
actions = [
|
||||||
{
|
{
|
||||||
type = "Timeout";
|
type = "Shutdown";
|
||||||
options = {
|
options = {
|
||||||
duration = 5;
|
};
|
||||||
};
|
stage = 2;
|
||||||
stage = 1;
|
}
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "Shutdown";
|
|
||||||
options = {
|
|
||||||
};
|
|
||||||
stage = 2;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -104,19 +114,13 @@
|
|||||||
'');
|
'');
|
||||||
};
|
};
|
||||||
|
|
||||||
apps.x86_64-linux.docs = {
|
checks.x86_64-linux = let
|
||||||
type = "app";
|
|
||||||
program = builtins.toString (nixpkgs.legacyPackages."x86_64-linux".writeScript "docs" ''
|
|
||||||
${pkgs.python3}/bin/python3 -m http.server --directory ${self.packages."x86_64-linux".docs}/share/doc'');
|
|
||||||
};
|
|
||||||
|
|
||||||
checks = forAllSystems (system: let
|
|
||||||
checkArgs = {
|
checkArgs = {
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages."x86_64-linux";
|
||||||
inherit self;
|
inherit self;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
gokill = import ./test/test.nix checkArgs;
|
gokill = import ./test/test.nix checkArgs;
|
||||||
});
|
};
|
||||||
};
|
}) ;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user