Code Monkey home page Code Monkey logo

Comments (4)

zimbatm avatar zimbatm commented on June 11, 2024

Hi, try putting the dockerImage attribute in the packages attrs.
nix build .#dockerImages looks in packages and legacyPackages only.

from flake-utils.

theduke avatar theduke commented on June 11, 2024

Your suggestion does make it work indeed.

But: when changing the above example to remove eachDefaultSystem, nix build .#dockerImage works just fine.

{
  description = "dynastic - Static Site Server";

  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
    flakeutils.url = "github:numtide/flake-utils";
    naersk.url = "github:nmattia/naersk";
  };

  outputs = { self, nixpkgs, flakeutils, naersk }: 
    # flakeutils.lib.eachDefaultSystem (system:
      let
        system = "x86_64-linux";
        pkgs = nixpkgs.legacyPackages."${system}";
        naersk-lib = naersk.lib."${system}";
      in rec {

        packages.dynastic = naersk-lib.buildPackage {
          pname = "dynastic";
          src = self;
          root = ./.;

          buildInputs = with pkgs; [
            pkgconfig
          ];
          propagatedBuildInputs = with pkgs; [
            openssl
            libgit2
          ];
          runtimeDependencies = with pkgs; [
            openssl
            libgit2
          ];
        };

        defaultPackage = packages.dynastic;

        apps.dynastic = flakeutils.lib.mkApp {
          drv = packages.dynastic;
        };
        defaultApp = apps.dynastic;

        devShell = pkgs.stdenv.mkDerivation {
            name = "dynastic";
            src = self;
            buildInputs = with pkgs; [
              pkgconfig
            ];
            propagatedBuildInputs = with pkgs; [
              openssl
              libgit2
            ];
            buildPhase = "";
            installPhase = "";

            RUST_BACKTRACE = "1";
            RUSTFLAGS="-C link-arg=-fuse-ld=lld";
            LD_LIBRARY_PATH="${pkgs.libgit2}/lib:${pkgs.openssl.out}/lib:${pkgs.sqlite.out}/lib";
        };

        dockerImage = pkgs.dockerTools.buildImage {
          name = "theduke/dynastic:0.0.1";
          config = {
            Cmd = [ "${packages.dynastic}/bin/dynastic" ];
          };
        };
      };
    # );
}  

from flake-utils.

zimbatm avatar zimbatm commented on June 11, 2024

I bet that .#dynastic also stops working since it will look for it in packages.x86_64-linux.dynastic. It's possible that flake has some other heuristics I am not aware of. The goal of eachDefaultSystem is just to automate converting prefix.foo into prefix.${system}.foo

from flake-utils.

zimbatm avatar zimbatm commented on June 11, 2024

I don't think this is related to flake-utils

from flake-utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.