64 lines
1.8 KiB
Nix
64 lines
1.8 KiB
Nix
{
|
|
description = "i-am-gcroot: list, filter and delete Nix GC roots from a TUI or web UI";
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
|
version = "0.1.0";
|
|
in {
|
|
packages = forAllSystems (pkgs: rec {
|
|
i-am-gcroot = pkgs.buildGoModule {
|
|
pname = "i-am-gcroot";
|
|
inherit version;
|
|
src = pkgs.lib.fileset.toSource {
|
|
root = ./.;
|
|
fileset = pkgs.lib.fileset.unions [
|
|
./go.mod
|
|
./go.sum
|
|
./main.go
|
|
./internal
|
|
];
|
|
};
|
|
vendorHash = "sha256-RNbS40G+8rtwlSJgYLN1puTCytGfXdagQTEs6sIXwnM=";
|
|
env.CGO_ENABLED = "0";
|
|
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
|
|
meta = {
|
|
description = "TUI and web UI to list, filter and delete Nix GC roots";
|
|
mainProgram = "i-am-gcroot";
|
|
platforms = pkgs.lib.platforms.linux;
|
|
};
|
|
};
|
|
default = i-am-gcroot;
|
|
});
|
|
|
|
apps = forAllSystems (pkgs: {
|
|
default = {
|
|
type = "app";
|
|
program = "${self.packages.${pkgs.system}.default}/bin/i-am-gcroot";
|
|
};
|
|
});
|
|
|
|
devShells = forAllSystems (pkgs: {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [ go gopls gotools ];
|
|
CGO_ENABLED = "0";
|
|
};
|
|
});
|
|
|
|
nixosModules.default = { config, lib, pkgs, ... }: {
|
|
options.programs.i-am-gcroot.enable = lib.mkEnableOption "i-am-gcroot";
|
|
config = lib.mkIf config.programs.i-am-gcroot.enable {
|
|
environment.systemPackages = [ self.packages.${pkgs.system}.default ];
|
|
};
|
|
};
|
|
|
|
checks = forAllSystems (pkgs: {
|
|
package = self.packages.${pkgs.system}.default;
|
|
vm = import ./nix/vm-test.nix { inherit pkgs self; };
|
|
});
|
|
};
|
|
}
|