Skip to content

Update compiler.md #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: docs
Choose a base branch
from

Conversation

EnderturtleOrz
Copy link

Add a tip for some cases when Nix doesn't allow you to write information in /etc.

Add a tip for some cases when Nix doesn't allow you to write information in /etc
@undefined-moe
Copy link
Member

Could you please provide more detail about this issue?
e.g screenshots, logs, etc

I'm unable to repro this error.

@EnderturtleOrz
Copy link
Author

Here are screenshots
terminal

@undefined-moe
Copy link
Member

image

maybe try nix build instead of nix-build ?

@EnderturtleOrz
Copy link
Author

root@1d49781b4824:/home/test# nix build default.nix
error: path '/home/test/default.nix' is not a flake (because it's not a directory)

Is there something I need to change in my default.nix?

{
  system ? builtins.currentSystem,
  pkgs ? import <nixpkgs> { system = system; }
}:

pkgs.buildEnv {
  name = "hydrojudge-rootfs";
  paths = with pkgs; [
    coreutils bash diffutils nix zip unzip gcc
    (python3.withPackages (ps: with ps; [ numpy scipy ]))
  ];
  ignoreCollisions = true;
  pathsToLink = [ "/" ];
  postBuild = ''
    mkdir -p $out/buildInfo
    echo 'root:x:0:0:root:/root:/bin/bash' >$out/etc/passwd
    date > $out/buildInfo/timestamp
  '';
}

@undefined-moe
Copy link
Member

undefined-moe commented Nov 25, 2024

simply use nix build github:hydro-dev/nix-channel#judge and everything should work as expected.

you can also create the following flake.nix file if you want to customize your judge environment:

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      {
        packages = let
          callPackage = file: args: import file (args // { pkgs = nixpkgs.legacyPackages.${system}; system = system; });
        in {
          judge = callPackage ./judge.nix {};
        };
      }
    );
}

@EnderturtleOrz
Copy link
Author

Thanks. I will try it the next day on our college's server. Btw, will this pr be merged? Or we just leave this pr open for further potential questions (that should be the issue)

@undefined-moe
Copy link
Member

Currently we would suggest users to use nix flake instead of the traditional way if possible.
Nix flake introduces lock file to support managing multiple environments seperately.

@undefined-moe
Copy link
Member

Any update for this? wonder if it works properly.

@EnderturtleOrz
Copy link
Author

Sorry for the late response. I still got errors, largely because I am not familiar with Flake😥. Nvm, I can still build a custom environment by manually inserting passwords.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants