Compare commits
1 Commits
3e3725ec22
...
feat_packa
| Author | SHA1 | Date | |
|---|---|---|---|
| fde7d540ca |
18
etc/gokill/config.json
Normal file
18
etc/gokill/config.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
|
||||||
|
"type": "Timeout",
|
||||||
|
"name": "example trigger",
|
||||||
|
"options": {
|
||||||
|
"duration": 5
|
||||||
|
},
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"type": "Print",
|
||||||
|
"options": {
|
||||||
|
"message": "hello world"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
62
flake.nix
62
flake.nix
@@ -21,10 +21,12 @@
|
|||||||
gotools
|
gotools
|
||||||
mdbook
|
mdbook
|
||||||
olm
|
olm
|
||||||
|
|
||||||
|
dpkg
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = {
|
packages = rec {
|
||||||
gokill = pkgs.buildGoModule rec {
|
gokill = pkgs.buildGoModule rec {
|
||||||
pname = "gokill";
|
pname = "gokill";
|
||||||
version = "1.0";
|
version = "1.0";
|
||||||
@@ -36,6 +38,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
cp -r ./etc $out/ #for .deb packages
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,6 +57,16 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gokillSnap = pkgs.snapTools.makeSnap {
|
||||||
|
meta = {
|
||||||
|
name = "gokill";
|
||||||
|
summary = "simple but efficient";
|
||||||
|
description = "this should be longer";
|
||||||
|
architectures = [ "amd64" ];
|
||||||
|
confinement = "classic";
|
||||||
|
apps.gokill.command = "${gokill}/bin/gokill";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
docs = pkgs.callPackage (import ./docs/default.nix) { self = self; };
|
docs = pkgs.callPackage (import ./docs/default.nix) { self = self; };
|
||||||
|
|
||||||
@@ -61,12 +74,52 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bundlers.gokillDeb = pkg: pkgs.stdenv.mkDerivation {
|
||||||
|
name = "deb-single-${pkg.name}";
|
||||||
|
buildInputs = [
|
||||||
|
pkgs.fpm
|
||||||
|
];
|
||||||
|
|
||||||
|
unpackPhase = "true";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
export HOME=$PWD
|
||||||
|
mkdir -p ./nix/store/
|
||||||
|
for item in "$(cat ${pkgs.referencesByPopularity pkg})"
|
||||||
|
do
|
||||||
|
cp -r $item ./nix/store/
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p ./bin
|
||||||
|
cp -r ${pkg}/bin/* ./bin/
|
||||||
|
|
||||||
|
mkdir -p ./etc
|
||||||
|
cp -r ${pkg}/etc/* ./etc/
|
||||||
|
|
||||||
|
chmod -R a+rwx ./nix
|
||||||
|
chmod -R a+rwx ./bin
|
||||||
|
chmod -R a+rwx ./etc
|
||||||
|
fpm -s dir -t deb --name ${pkg.name} nix bin etc
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r *.deb $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
apps = {
|
apps = {
|
||||||
docs = {
|
docs = {
|
||||||
type = "app";
|
type = "app";
|
||||||
program = builtins.toString (pkgs.writeScript "docs" ''
|
program = builtins.toString (pkgs.writeScript "docs" ''
|
||||||
${pkgs.python3}/bin/python3 -m http.server --directory ${self.packages."${system}".docs}/share/doc'');
|
${pkgs.python3}/bin/python3 -m http.server --directory ${self.packages."${system}".docs}/share/doc'');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exportDEB = {
|
||||||
|
type = "app";
|
||||||
|
program = builtins.toString (pkgs.writeScript "docs" ''
|
||||||
|
${pkgs.nix}/bin/nix bundle --bundler .#bundlers.${system}.gokillDeb .#packages.${system}.gokill'');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
})) ({
|
})) ({
|
||||||
@@ -90,12 +143,6 @@
|
|||||||
duration = 10;
|
duration = 10;
|
||||||
};
|
};
|
||||||
actions = [
|
actions = [
|
||||||
{
|
|
||||||
type = "Shutdown";
|
|
||||||
options = {
|
|
||||||
};
|
|
||||||
stage = 2;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -103,7 +150,6 @@
|
|||||||
virtualisation.vmVariant.virtualisation.graphics = false;
|
virtualisation.vmVariant.virtualisation.graphics = false;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
nixos.config.system.build.vm;
|
nixos.config.system.build.vm;
|
||||||
|
|||||||
Reference in New Issue
Block a user