diff --git a/.github/workflows/build_nix.yml b/.github/workflows/build_nix.yml index fa9dde2..827c725 100644 --- a/.github/workflows/build_nix.yml +++ b/.github/workflows/build_nix.yml @@ -10,8 +10,10 @@ jobs: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v12 - name: Building package - run: nix-build . -A defaultPackage.x86_64-linux + run: nix-build . -A packages.x86_64-linux.default + - name: Get commit hash + run: echo "COMMIT_HASH=${GITHUB_SHA::6}" >> $GITHUB_ENV - uses: actions/upload-artifact@v3 with: - name: url-eater-x86_64-linux + name: eleanor-server-${{ env.COMMIT_HASH }}-x86_64-linux path: result/bin/eleanor-server \ No newline at end of file diff --git a/flake.nix b/flake.nix index d6d8ea7..c5a7471 100644 --- a/flake.nix +++ b/flake.nix @@ -11,13 +11,13 @@ pkgs = import nixpkgs { inherit system; }; naersk-lib = pkgs.callPackage naersk { }; in { - defaultPackage = naersk-lib.buildPackage { + packages.default = naersk-lib.buildPackage { src = ./.; nativeBuildInputs = with pkgs; [ pkg-config ]; buildInputs = with pkgs; [ openssl ]; }; - devShell = with pkgs; - mkShell { + devShells = with pkgs; { + default = mkShell { buildInputs = [ openssl pkg-config @@ -30,5 +30,34 @@ ]; RUST_SRC_PATH = rustPlatform.rustLibSrc; }; + + dev = mkShell { + buildInputs = [ openssl pkg-config cargo ]; + shellHook = '' + testenv=$(mktemp -d --suffix "eleanor-server") + cargo build -Z unstable-options --out-dir $testenv + + echo -e 'Built eleanor-server\n' + + cd $testenv + cat << EOF >> settings.toml + port = 8008 + + [[sources]] + id = 0 + path = "~/Music" + EOF + + echo -e 'Generated settings.toml with source 0 pointing to `~/Music`\n' + + ./eleanor-server user add test password + + echo -e '\nAdded user with credentials `test:password`\n' + echo -e 'Running eleanor-server\n' + + exec ./eleanor-server + ''; + }; + }; }); }