Skip to content

Commit

Permalink
Filter src input to derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
jhh committed Feb 4, 2024
1 parent 6b19fa0 commit 1134e37
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 137 deletions.
21 changes: 11 additions & 10 deletions admin/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@
deadeye-admin = mkPoetryApplication { projectDir = self; };
default = self.packages.${system}.deadeye-admin;

venv = mkPoetryEnv
{
projectDir = self;
groups = [ "main" "dev" ];
};
venv = mkPoetryEnv {
projectDir = self;
groups = [ "main" "dev" ];
};

dockerImage = pkgs.dockerTools.streamLayeredImage {
dockerImage = pkgs.dockerTools.buildLayeredImage {
name = "j3ff/deadeye-admin";
tag = "latest";
contents = [
self.packages.${system}.deadeye-admin.dependencyEnv
];
config.Cmd = [ "/bin/deadeye-server" ];

config.Cmd =
let
deadeyePkg = self.packages.${system}.deadeye-admin.dependencyEnv;
in
[ "${deadeyePkg}/bin/deadeye-server" ];
};
};

Expand Down
4 changes: 2 additions & 2 deletions admin/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VERSION := `git rev-parse --short HEAD`

docker:
nix build .#dockerImage
./result | docker load
docker load < result
docker tag {{ IMAGE }}:latest {{ IMAGE }}:{{VERSION}}

run: docker
Expand All @@ -17,6 +17,6 @@ run: docker

deploy: docker
docker push {{ IMAGE }}:{{VERSION}}

venv:
nix build .#venv -o .venv
127 changes: 8 additions & 119 deletions daemon/flake.lock

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

13 changes: 10 additions & 3 deletions daemon/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
description = "Deadeye vision pipeline daemon";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
};

outputs = { self, nixpkgs, flake-utils, poetry2nix }:
outputs = { self, nixpkgs, flake-utils, nix-filter }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
filter = nix-filter.lib;
in
{
packages = {
Expand All @@ -28,7 +30,10 @@
{
pname = "deadeye-daemon";
version = "22.2.0";
src = self;
src = filter {
root = self;
include = [ ./src ./cmake "CMakeLists.txt" "version.cmake" ];
};

nativeBuildInputs = with pkgs; [
cmake
Expand Down Expand Up @@ -66,6 +71,8 @@

};

default = self.packages.${system}.deadeye-daemon;

dockerImage = pkgs.dockerTools.buildLayeredImage {
name = "j3ff/deadeye-daemon";
tag = "latest";
Expand Down
16 changes: 16 additions & 0 deletions web/flake.lock

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

20 changes: 17 additions & 3 deletions web/flake.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
{
description = "Deadeye vision system admin dashboard";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
};

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, nix-filter }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
version = "22.2.0";
nodeDependencies = (pkgs.callPackage config/default.nix { }).nodeDependencies;
filter = nix-filter.lib;
in
{
packages.nodeDependencies = nodeDependencies;

packages.deadeye-web = pkgs.stdenv.mkDerivation {
pname = "deadeye-web";
inherit version;
src = ./.;
src = filter {
root = self;
include = [
./config
"nginx.conf"
"package.json"
"package-lock.json"
"postcss.config.js"
./public
./src
];
};

buildInputs = with pkgs; [ nodejs_18 ];

Expand Down Expand Up @@ -71,7 +86,6 @@

packages.default = self.packages.${system}.deadeye-web;

#
devShells.default = pkgs.mkShell {
packages = with pkgs; [ just nodejs_18 node2nix ];
};
Expand Down

0 comments on commit 1134e37

Please sign in to comment.