Skip to content
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

[WIP] vscodium: init at 1.33.1 #60423

Merged
merged 17 commits into from May 21, 2019
Merged

[WIP] vscodium: init at 1.33.1 #60423

merged 17 commits into from May 21, 2019

Conversation

angristan
Copy link
Member

@angristan angristan commented Apr 29, 2019

Motivation for this change

Resolves: #59028

Things done

Based on the existing vscode expression

  • Removed insiders support
  • Updated names, executable name, description, paths...
  • Updated src
  • Updated sourceRoot because different archive format
  • Updated license (MIT)
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I'm very new to Nix packaging so please tell me if I made a mess 😄

@angristan
Copy link
Member Author

TBD(?) (maybe in another PR?):

  • vscodium-with-extensions
  • vscodium-utils
  • vscodium-extensions

@angristan
Copy link
Member Author

Should the target branch be staging?

@veprbl
Copy link
Member

veprbl commented Apr 29, 2019

This is not a source build, so it does the same thing as vscode. Would be nice to deduplicate this with the original as much as possible.

cc @eadwu

Should the target branch be staging?

Definitely no. There is no mass rebuild here, so this goes to master.

@eadwu
Copy link
Member

eadwu commented Apr 29, 2019

This looks fine, haven't built or tested it though. sourceRoot = "." shouldn't be necessary. If the differences between the files are mostly just vscode -> vscodium deduplicating would be better, though it's fine without it, if I remember I'll do it with the next update.

@angristan
Copy link
Member Author

To be honest, I'm not sure why sourceRoot = "."; fixes my issue. Without it, I get this:

stanislas@nixpsla ~/nixpkgs> nix-build $NIXPKGS -A vscodium
these derivations will be built:
  /nix/store/xjmg1ilpjny59s3pla2f605wc474vk8p-vscodium-1.33.1.drv
building '/nix/store/xjmg1ilpjny59s3pla2f605wc474vk8p-vscodium-1.33.1.drv'...
unpacking sources
unpacking source archive /nix/store/q8kp39vj2ifbl1mzbasf1lhlmjv56nyx-VSCodium_1.33.1_linux-x64.tar.gz
unpacker produced multiple directories
builder for '/nix/store/xjmg1ilpjny59s3pla2f605wc474vk8p-vscodium-1.33.1.drv' failed with exit code 1
error: build of '/nix/store/xjmg1ilpjny59s3pla2f605wc474vk8p-vscodium-1.33.1.drv' failed

The archive's architecture is the same though, the top-level directory just has a different name.

@veprbl
Copy link
Member

veprbl commented May 2, 2019

I checked the expressions for vscode and vscodium and they are really close to being identical at the moment. I think we should do the deduplication now, otherwise this will just push the work onto someone trying to improve vscode or vscodium in the future.

@veprbl
Copy link
Member

veprbl commented May 2, 2019

This would be a different story if you move to source based builds for vscodium (I assume this is possible).

@angristan
Copy link
Member Author

Do you have good deduplication examples I could learn from? 🙂

@veprbl
Copy link
Member

veprbl commented May 14, 2019

Do you have good deduplication examples I could learn from?

Good question! I think boost is a good example: https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/libraries/boost

@angristan angristan changed the title vscodium: init at 1.33.1 [WIP] vscodium: init at 1.33.1 May 15, 2019
@angristan
Copy link
Member Author

angristan commented May 15, 2019

(I'll squash everything later)

So I tried to do something, both vscodium and vscode can build atm but I am wondering how I can access variables from generix.nix in vscodium.nix and vscode.nix, like plat or package_fmt. (c.f. my comments in these files)

@veprbl
Copy link
Member

veprbl commented May 15, 2019

So I tried to do something, both vscodium and vscode can build atm but I am wondering how I can access variables from generix.nix in vscodium.nix and vscode.nix, like plat or package_fmt. (c.f. my comments in these files)

You could put those definitions into a separate "common.nix" as an attrset and then import that.

@angristan
Copy link
Member Author

With my latest commit:

error: anonymous function at /home/stanislas/nixpkgs/pkgs/applications/editors/vscode/generic.nix:1:1 called without required argument 'sha256', at /home/stanislas/nixpkgs/lib/customisation.nix:69:12

If I drop rec as you suggested above:

error: undefined variable 'version' at /home/stanislas/nixpkgs/pkgs/applications/editors/vscode/vscode.nix:32:22

@veprbl
Copy link
Member

veprbl commented May 15, 2019

@angristan You can drop name = "vscode-${version}; and use pname = "vscode"; instead

@veprbl
Copy link
Member

veprbl commented May 15, 2019

There is also version in the definition of url, so I guess we can keep rec.

@angristan
Copy link
Member Author

OK, thanks. What's pname?

Also I still have this issue with sha256 which I have trouble understanding 🤔

@veprbl
Copy link
Member

veprbl commented May 15, 2019

OK, thanks. What's pname?

Just another way to set name with version. These two are equivalent:

stdenv.mkDerivation {
  name = "example-1.0.0";
  # ...
}
stdenv.mkDerivation {
  pname = "example";
  version = "1.0.0";
  # ...
}

@veprbl
Copy link
Member

veprbl commented May 15, 2019

OK, last commit is building.

Can squash the current progress then. Ideally we want to see that the deduplication doesn't change the hash of the derivation for vscode (the "name to pname" change will need to be split off before we can see that).

Now, I created a common.nix file. Is this what you had in mind? I tried to import it but without luck.

Yes. Though, I think we can leave it without it. The pieces for plat and archive_fmt are quite small and they are not as important.

@angristan
Copy link
Member Author

Can squash the current progress then. Ideally we want to see that the deduplication doesn't change the hash of the derivation for vscode (the "name to pname" change will need to be split off before we can see that).

Can you clarify this? I agree with " Ideally we want to see that the deduplication doesn't change the hash of the derivation for vscode", but how? ''the "name to pname" change will need to be split off before we can see that'' -> does it change the derivation?

@veprbl
Copy link
Member

veprbl commented May 15, 2019

'the "name to pname" change will need to be split off before we can see that'' -> does it change the derivation?

Yes, in a minor way:

# cat test.nix
with import <nixpkgs> {};

{
  name = stdenv.mkDerivation rec {
    name = "test-${version}";
    version = "1.0";
  };
  pname = stdenv.mkDerivation {
    pname = "test";
    version = "1.0";
  };
}
# nix-instantiate test.nix
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/6vjcwl20a12nwbxlzfjd6rxk15m0iynw-test-1.0.drv
/nix/store/rwr296152lpmyr3f7glldk5xyqa1pgqj-test-1.0.drv

Easy to see that this is an effect of adding additional pname attribute to the call of derivation

# diff <(nix show-derivation /nix/store/6vjcwl20a12nwbxlzfjd6rxk15m0iynw-test-1.0.drv) \
       <(nix show-derivation /nix/store/rwr296152lpmyr3f7glldk5xyqa1pgqj-test-1.0.drv)
2c2
<   "/nix/store/6vjcwl20a12nwbxlzfjd6rxk15m0iynw-test-1.0.drv": {
---
>   "/nix/store/rwr296152lpmyr3f7glldk5xyqa1pgqj-test-1.0.drv": {
5c5
<         "path": "/nix/store/vvbjxpf3ajnc4p3vdbwl3qiav9sixyax-test-1.0"
---
>         "path": "/nix/store/fhim0c4222m3vi3znqcyf57h6ixc6n8g-test-1.0"
46c46
<       "out": "/nix/store/vvbjxpf3ajnc4p3vdbwl3qiav9sixyax-test-1.0",
---
>       "out": "/nix/store/fhim0c4222m3vi3znqcyf57h6ixc6n8g-test-1.0",
48a49
>       "pname": "test",

I guess we just run similar diff on vscode derivation before and after your PR and see if anything other than added pname is changed.

pkgs/applications/editors/vscode/vscode.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscode.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscode.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscodium.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscodium.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscode.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscode.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscodium.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscodium.nix Outdated Show resolved Hide resolved
pkgs/applications/editors/vscode/vscodium.nix Outdated Show resolved Hide resolved
@eadwu
Copy link
Member

eadwu commented May 17, 2019

1.34.0 has been released for both vscode and vscodium.

@angristan
Copy link
Member Author

Should I update both?

angristan and others added 6 commits May 20, 2019 11:59
Co-Authored-By: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-Authored-By: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-Authored-By: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-Authored-By: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-Authored-By: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Co-Authored-By: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
@veprbl
Copy link
Member

veprbl commented May 21, 2019

2c2
<   "/nix/store/xi9vz6lxps7qycrdn9894p7wzxc34pnb-vscode-1.33.1.drv": {
---
>   "/nix/store/g5hh6cmzkpvd983kdgyiaq3fw4l5z81p-vscode-1.33.1.drv": {
5c5
<         "path": "/nix/store/2chk74hmkyc6z8f29w68bn8a15mfk5h2-vscode-1.33.1"
---
>         "path": "/nix/store/26mdg2gr5k2k14q9vkxvn1azj5fzsapc-vscode-1.33.1"
176c176
<       "out": "/nix/store/2chk74hmkyc6z8f29w68bn8a15mfk5h2-vscode-1.33.1",
---
>       "out": "/nix/store/26mdg2gr5k2k14q9vkxvn1azj5fzsapc-vscode-1.33.1",
178a179
>       "pname": "vscode",
181a183
>       "sourceRoot": "",

setting sourceRoot="" should be safe enough given that we do

# set to empty if unset
: ${sourceRoot=}

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be in a good shape now.

@veprbl veprbl merged commit e4b146b into NixOS:master May 21, 2019
@veprbl
Copy link
Member

veprbl commented May 21, 2019

cc @Synthetica9 as maintainer (sorry, missed you earlier)

@Synthetica9
Copy link
Member

Synthetica9 commented May 21, 2019

@angristan @veprbl Awesome, thank you!

@angristan
Copy link
Member Author

Thank you everyone, especially @veprbl for your help and patience on this PR. 🙂

worldofpeace pushed a commit that referenced this pull request Jun 6, 2019
(cherry picked from commit e4b146b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package VSCodium
4 participants