nixos-gitit/flake.nix
2021-12-31 15:40:53 +02:00

55 lines
1.7 KiB
Nix

{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: rec {
overlay = final: prev: {
gitit = prev.callPackage ./gitit {};
};
# Provide module for gitit
nixosModules = builtins.listToAttrs (map (x: {
name = x;
value = import (./modules + "/${x}");
}) (builtins.attrNames (builtins.readDir ./modules)));
# Provide the gitit binary. nixpkgs does provide the binary as well, but
# it's built from a version that has a critical bug, login doesn't work
packages.x86_64-linux.gitit = with nixpkgs.legacyPackages.x86_64-linux;
callPackage ./gitit {};
defaultPackage.x86_64-linux = packages.x86_64-linux.gitit;
# Nixos integration tests for basic functionality
checks.x86_64-linux.gitit =
nixpkgs.legacyPackages.x86_64-linux.nixosTest (
import ./test.nix { modules = builtins.attrValues self.nixosModules; }
);
# For playing around in a container
# sudo nixos-container create gitit --flake .
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
[ ({ pkgs, ... }: {
imports = builtins.attrValues self.nixosModules ++ [];
boot.isContainer = true;
environment.systemPackages = [
];
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
# Network configuration.
networking.useDHCP = false;
networking.firewall.allowedTCPPorts = [ 5001 ];
services.gitit = {
enable = true;
};
})
];
};
};
}