Skip to content

Commit

Permalink
new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
vesdev authored and aumetra committed May 9, 2024
1 parent 4e9c829 commit 987f151
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 179 deletions.
210 changes: 125 additions & 85 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,23 @@
# like so `nix build --override-input debugBuild github:boolean-option/true`
debugBuild.url = "github:boolean-option/false/d06b4794a134686c70a1325df88a6e6768c6b212";
};
outputs = { self, devenv, flake-utils, nixpkgs, rust-overlay, crane, ... } @ inputs:
(flake-utils.lib.eachDefaultSystem
(system:
outputs =
{
self,
devenv,
flake-utils,
nixpkgs,
rust-overlay,
crane,
...
}@inputs:
(
flake-utils.lib.eachDefaultSystem (
system:
let
features = "--all-features";
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit overlays system;
};
pkgs = import nixpkgs { inherit overlays system; };
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.minimal;
Expand All @@ -57,62 +65,84 @@

src = pkgs.lib.cleanSourceWith {
src = pkgs.lib.cleanSource ./.;
filter = name: type:
let baseName = baseNameOf (toString name);
in !(baseName == "flake.lock" || pkgs.lib.hasSuffix ".nix" baseName);
filter =
name: type:
let
baseName = baseNameOf (toString name);
in
!(baseName == "flake.lock" || pkgs.lib.hasSuffix ".nix" baseName);
};

commonArgs = {
inherit src stdenv buildInputs nativeBuildInputs;

strictDeps = true;

meta = {
description = "ActivityPub-federated microblogging";
homepage = "https://joinkitsune.org";
};

OPENSSL_NO_VENDOR = 1;
NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa";
cargoExtraArgs = "--locked ${features}";
} // (pkgs.lib.optionalAttrs inputs.debugBuild.value {
# do a debug build, as `dev` is the default debug profile
CARGO_PROFILE = "dev";
});
commonArgs =
{
inherit
src
stdenv
buildInputs
nativeBuildInputs
;

strictDeps = true;

meta = {
description = "ActivityPub-federated microblogging";
homepage = "https://joinkitsune.org";
};

OPENSSL_NO_VENDOR = 1;
NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa";
cargoExtraArgs = "--locked ${features}";
}
// (pkgs.lib.optionalAttrs inputs.debugBuild.value {
# do a debug build, as `dev` is the default debug profile
CARGO_PROFILE = "dev";
});

cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
version = cargoToml.workspace.package.version;

cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "kitsune-workspace";
src = craneLib.cleanCargoSource src;
});
cargoArtifacts = craneLib.buildDepsOnly (
commonArgs
// {
pname = "kitsune-workspace";
src = craneLib.cleanCargoSource src;
}
);
in
{
formatter = pkgs.nixpkgs-fmt;
packages = rec {
default = main;

cli = craneLib.buildPackage (commonArgs // {
pname = "kitsune-cli";
cargoExtraArgs = commonArgs.cargoExtraArgs + " --bin kitsune-cli";
inherit cargoArtifacts;
doCheck = false;
});

mrf-tool = craneLib.buildPackage (commonArgs // {
pname = "mrf-tool";
cargoExtraArgs = commonArgs.cargoExtraArgs + " --bin mrf-tool";
inherit cargoArtifacts;
doCheck = false;
});

main = craneLib.buildPackage (commonArgs // rec {
pname = "kitsune";
cargoExtraArgs = commonArgs.cargoExtraArgs + " --bin kitsune --bin kitsune-job-runner";
inherit cargoArtifacts;
doCheck = false;
});
cli = craneLib.buildPackage (
commonArgs
// {
pname = "kitsune-cli";
cargoExtraArgs = commonArgs.cargoExtraArgs + " --bin kitsune-cli";
inherit cargoArtifacts;
doCheck = false;
}
);

mrf-tool = craneLib.buildPackage (
commonArgs
// {
pname = "mrf-tool";
cargoExtraArgs = commonArgs.cargoExtraArgs + " --bin mrf-tool";
inherit cargoArtifacts;
doCheck = false;
}
);

main = craneLib.buildPackage (
commonArgs
// {
pname = "kitsune";
cargoExtraArgs = commonArgs.cargoExtraArgs + " --bin kitsune --bin kitsune-job-runner";
inherit cargoArtifacts;
doCheck = false;
}
);

frontend = pkgs.mkYarnPackage {
inherit version;
Expand Down Expand Up @@ -141,54 +171,64 @@
inherit pkgs inputs;

modules = [
({ pkgs, ... }: {
packages = with pkgs; [
cargo-insta
diesel-cli
rust-bin.stable.latest.default
]
++
buildInputs ++ nativeBuildInputs;

enterShell = ''
export PG_HOST=127.0.0.1
export PG_PORT=5432
[ -z "$DATABASE_URL" ] && export DATABASE_URL=postgres://$USER@$PG_HOST:$PG_PORT/$USER
export REDIS_PORT=6379
[ -z "$REDIS_URL" ] && export REDIS_URL="redis://127.0.0.1:$REDIS_PORT"
'';

services = {
postgres = {
enable = true;
listen_addresses = "127.0.0.1";
(
{ pkgs, ... }:
{
packages =
with pkgs;
[
cargo-insta
diesel-cli
rust-bin.stable.latest.default
]
++ buildInputs
++ nativeBuildInputs;

enterShell = ''
export PG_HOST=127.0.0.1
export PG_PORT=5432
[ -z "$DATABASE_URL" ] && export DATABASE_URL=postgres://$USER@$PG_HOST:$PG_PORT/$USER
export REDIS_PORT=6379
[ -z "$REDIS_URL" ] && export REDIS_URL="redis://127.0.0.1:$REDIS_PORT"
'';

services = {
postgres = {
enable = true;
listen_addresses = "127.0.0.1";
};
redis.enable = true;
};
redis.enable = true;
};
})
}
)
];
};

frontend = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
yarn
nodePackages.svelte-language-server
nodePackages.typescript-language-server
];
};
};
}
) // {
overlays = rec {
default = kitsune;
kitsune = (import ./overlay.nix self);
};
)
// {
overlays = rec {
default = kitsune;
kitsune = (import ./overlay.nix self);
};

nixosModules = rec {
default = kitsune;
kitsune = (import ./module.nix);
};
}) // {
nixosModules = rec {
default = kitsune;
kitsune = (import ./module.nix);
};
}
)
// {
nixci.default = {
debug = {
dir = ".";
Expand Down
1 change: 1 addition & 0 deletions kitsune-fe/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion kitsune-fe/src/lib/components/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
cursor: pointer;
border: 0;
border-radius: 5px;
border-radius: 10px;
background-color: $shade1dark;
padding: 10px;
width: 100px;
height: 50px;
font-size: 16px;
&:hover {
Expand Down
Loading

0 comments on commit 987f151

Please sign in to comment.