generated from tweag/project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from tweag/nixos-module
NixOS module
- Loading branch information
Showing
8 changed files
with
208 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ ... }: | ||
|
||
{ | ||
virtualisation.vmVariant = { | ||
virtualisation = { | ||
memorySize = 2048; # Use 2048MiB memory. | ||
cores = 3; | ||
forwardPorts = [ | ||
{ | ||
from = "host"; | ||
guest.port = 8000; | ||
host.port = 8000; | ||
} | ||
]; | ||
}; | ||
}; | ||
|
||
users.users.alice = { | ||
isNormalUser = true; | ||
extraGroups = [ "wheel" ]; | ||
password = "genealogos"; | ||
}; | ||
|
||
services.genealogos.enable = true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# This file contains everything related to building our packages with crane. | ||
# It returns a few things; the build packages and the checks | ||
{ pkgs | ||
, crane-lib | ||
, nixtract-cli ? null | ||
, cyclonedx ? null | ||
}: | ||
let | ||
common-crane-args = { | ||
pname = "genealogos"; | ||
src = crane-lib.cleanCargoSource (crane-lib.path ../.); | ||
strictDeps = true; | ||
|
||
cargoArtifacts = cargo-artifacts; | ||
|
||
# Genealogos uses the reqwest crate to query for narinfo on the substituters. | ||
# reqwest depends on openssl. | ||
nativeBuildInputs = with pkgs; [ pkg-config ]; | ||
buildInputs = with pkgs; [ openssl ]; | ||
}; | ||
|
||
cargo-artifacts = crane-lib.buildDepsOnly common-crane-args; | ||
|
||
workspace = (common-crane-args // { | ||
cargoBuildCommand = "${pkgs.cargo-hack}/bin/cargo-hack hack build --profile release"; | ||
cargoTestCommand = "${pkgs.cargo-hack}/bin/cargo-hack hack test --profile release"; | ||
}); | ||
|
||
# Crane buildPackage arguments for every crate | ||
crates = { | ||
genealogos = (common-crane-args // { | ||
cargoExtraArgs = "-p genealogos"; | ||
}); | ||
genealogos-cli = (common-crane-args // { | ||
pname = "genealogos-cli"; | ||
cargoExtraArgs = "-p genealogos-cli"; | ||
passthru.exePath = "/bin/genealogos"; | ||
nativeBuildInputs = common-crane-args.nativeBuildInputs ++ [ pkgs.makeWrapper ]; | ||
preFixup = '' | ||
wrapProgram $out/bin/genealogos \ | ||
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.nix ]} | ||
''; | ||
}); | ||
genealogos-api = (common-crane-args // { | ||
pname = "genealogos-api"; | ||
cargoExtraArgs = "-p genealogos-api"; | ||
nativeBuildInputs = common-crane-args.nativeBuildInputs ++ [ pkgs.makeWrapper ]; | ||
preFixup = '' | ||
wrapProgram $out/bin/genealogos-api \ | ||
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.nix ]} | ||
''; | ||
}); | ||
}; | ||
rust-packages = | ||
builtins.mapAttrs (_: crane-lib.buildPackage) crates; | ||
in | ||
rec { | ||
checks = | ||
# Builds | ||
rust-packages | ||
# Clippy | ||
// builtins.mapAttrs | ||
(_: args: crane-lib.cargoClippy (args // { | ||
cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | ||
})) | ||
crates | ||
# Doc | ||
// builtins.mapAttrs (_: crane-lib.cargoDoc) crates | ||
# fmt | ||
// builtins.mapAttrs (_: crane-lib.cargoFmt) crates; | ||
|
||
packages = | ||
rust-packages // { | ||
default = packages.genealogos; | ||
|
||
workspace = crane-lib.buildPackage workspace; | ||
|
||
update-fixture-output-files = pkgs.writeShellApplication { | ||
name = "update-fixture-output-files"; | ||
runtimeInputs = [ (packages.genealogos-cli.overrideAttrs (_: { doCheck = false; })) pkgs.jq ]; | ||
text = builtins.readFile ../scripts/update-fixture-output-files.sh; | ||
}; | ||
update-fixture-input-files = pkgs.writeShellApplication { | ||
name = "update-fixture-input-files"; | ||
runtimeInputs = [ nixtract-cli ]; | ||
text = builtins.readFile ../scripts/update-fixture-input-files.sh; | ||
}; | ||
verify-fixture-files = pkgs.writeShellApplication { | ||
name = "verify-fixture-files"; | ||
runtimeInputs = [ cyclonedx ]; | ||
text = builtins.readFile ../scripts/verify-fixture-files.sh; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.