2024-07-11 01:10:35 +09:00
|
|
|
{
|
2024-09-04 17:03:21 +09:00
|
|
|
description = "fortify sandbox tool and nixos module";
|
2024-07-11 01:10:35 +09:00
|
|
|
|
|
|
|
inputs = {
|
2024-12-06 00:44:04 +09:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11-small";
|
2024-12-16 22:56:10 +09:00
|
|
|
|
|
|
|
home-manager = {
|
|
|
|
url = "github:nix-community/home-manager/release-24.11";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-07-11 01:10:35 +09:00
|
|
|
};
|
|
|
|
|
2024-07-16 21:54:44 +09:00
|
|
|
outputs =
|
2024-12-16 22:56:10 +09:00
|
|
|
{
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
home-manager,
|
|
|
|
}:
|
2024-07-11 01:10:35 +09:00
|
|
|
let
|
2024-09-04 17:03:21 +09:00
|
|
|
supportedSystems = [
|
|
|
|
"aarch64-linux"
|
|
|
|
"i686-linux"
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
|
|
|
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
2024-07-11 01:10:35 +09:00
|
|
|
in
|
|
|
|
{
|
2024-09-04 17:03:21 +09:00
|
|
|
nixosModules.fortify = import ./nixos.nix;
|
|
|
|
|
2024-12-16 20:54:28 +09:00
|
|
|
checks = forAllSystems (
|
|
|
|
system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgsFor.${system};
|
|
|
|
|
|
|
|
inherit (pkgs)
|
|
|
|
runCommandLocal
|
2024-12-16 22:56:10 +09:00
|
|
|
callPackage
|
2024-12-16 20:54:28 +09:00
|
|
|
nixfmt-rfc-style
|
|
|
|
deadnix
|
|
|
|
statix
|
|
|
|
;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
check-formatting =
|
|
|
|
runCommandLocal "check-formatting" { nativeBuildInputs = [ nixfmt-rfc-style ]; }
|
|
|
|
''
|
|
|
|
cd ${./.}
|
|
|
|
|
|
|
|
echo "running nixfmt..."
|
|
|
|
nixfmt --check .
|
|
|
|
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
check-lint =
|
|
|
|
runCommandLocal "check-lint"
|
|
|
|
{
|
|
|
|
nativeBuildInputs = [
|
|
|
|
deadnix
|
|
|
|
statix
|
|
|
|
];
|
|
|
|
}
|
|
|
|
''
|
|
|
|
cd ${./.}
|
|
|
|
|
|
|
|
echo "running deadnix..."
|
|
|
|
deadnix --fail
|
|
|
|
|
|
|
|
echo "running statix..."
|
|
|
|
statix check .
|
|
|
|
|
|
|
|
touch $out
|
|
|
|
'';
|
2024-12-16 22:56:10 +09:00
|
|
|
|
2024-12-17 21:16:55 +09:00
|
|
|
nixos-tests = callPackage ./test.nix { inherit system self home-manager; };
|
2024-12-16 20:54:28 +09:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2024-09-04 17:03:21 +09:00
|
|
|
packages = forAllSystems (
|
2024-07-16 21:54:44 +09:00
|
|
|
system:
|
|
|
|
let
|
2024-09-04 17:03:21 +09:00
|
|
|
pkgs = nixpkgsFor.${system};
|
2024-07-16 21:54:44 +09:00
|
|
|
in
|
|
|
|
{
|
2024-09-04 17:03:21 +09:00
|
|
|
default = self.packages.${system}.fortify;
|
2024-07-16 21:54:44 +09:00
|
|
|
|
2024-09-04 17:03:21 +09:00
|
|
|
fortify = pkgs.callPackage ./package.nix { };
|
2024-07-16 21:54:44 +09:00
|
|
|
}
|
|
|
|
);
|
2024-09-04 17:03:21 +09:00
|
|
|
|
|
|
|
devShells = forAllSystems (system: {
|
|
|
|
default = nixpkgsFor.${system}.mkShell {
|
2024-10-27 23:45:52 +09:00
|
|
|
buildInputs = with nixpkgsFor.${system}; self.packages.${system}.fortify.buildInputs;
|
2024-10-17 20:35:10 +09:00
|
|
|
};
|
|
|
|
|
2024-12-17 21:16:55 +09:00
|
|
|
fhs = nixpkgsFor.${system}.buildFHSEnv {
|
|
|
|
pname = "fortify-fhs";
|
|
|
|
inherit (self.packages.${system}.fortify) version;
|
|
|
|
targetPkgs =
|
|
|
|
pkgs: with pkgs; [
|
|
|
|
go
|
|
|
|
gcc
|
|
|
|
pkg-config
|
|
|
|
acl
|
|
|
|
wayland
|
|
|
|
wayland-scanner
|
|
|
|
wayland-protocols
|
|
|
|
xorg.libxcb
|
|
|
|
];
|
|
|
|
extraOutputsToInstall = [ "dev" ];
|
|
|
|
profile = ''
|
|
|
|
export PKG_CONFIG_PATH="/usr/share/pkgconfig:$PKG_CONFIG_PATH"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-10-17 20:35:10 +09:00
|
|
|
withPackage = nixpkgsFor.${system}.mkShell {
|
2024-09-17 23:15:33 +09:00
|
|
|
buildInputs =
|
|
|
|
with nixpkgsFor.${system};
|
2024-09-28 00:06:16 +09:00
|
|
|
self.packages.${system}.fortify.buildInputs ++ [ self.packages.${system}.fortify ];
|
2024-09-04 17:03:21 +09:00
|
|
|
};
|
2024-11-19 18:12:35 +09:00
|
|
|
|
|
|
|
generateDoc =
|
|
|
|
let
|
|
|
|
pkgs = nixpkgsFor.${system};
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
|
|
|
doc =
|
|
|
|
let
|
|
|
|
eval = lib.evalModules {
|
|
|
|
specialArgs = {
|
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
modules = [ ./options.nix ];
|
|
|
|
};
|
2024-12-16 20:54:28 +09:00
|
|
|
cleanEval = lib.filterAttrsRecursive (n: _: n != "_module") eval;
|
2024-11-19 18:12:35 +09:00
|
|
|
in
|
|
|
|
pkgs.nixosOptionsDoc { inherit (cleanEval) options; };
|
|
|
|
docText = pkgs.runCommand "fortify-module-docs.md" { } ''
|
|
|
|
cat ${doc.optionsCommonMark} > $out
|
|
|
|
sed -i '/*Declared by:*/,+1 d' $out
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
nixpkgsFor.${system}.mkShell {
|
|
|
|
shellHook = ''
|
|
|
|
exec cat ${docText} > options.md
|
|
|
|
'';
|
|
|
|
};
|
2024-09-04 17:03:21 +09:00
|
|
|
});
|
2024-07-11 01:10:35 +09:00
|
|
|
};
|
2024-07-16 21:54:44 +09:00
|
|
|
}
|