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

Nixos support #171

Open
MyGitHubBlueberry opened this issue May 15, 2024 · 2 comments
Open

Nixos support #171

MyGitHubBlueberry opened this issue May 15, 2024 · 2 comments

Comments

@MyGitHubBlueberry
Copy link

MyGitHubBlueberry commented May 15, 2024

Hello there. I'm trying to make this package work with nixos.
Here to ask for small script changes to make installation truly effortless.
I attach flake.nix and default.nix to this post.

What is the problem, exactly? After running nix build, I should run nix run from the package directory. Here it is:

.
├── default.nix
├── flake.lock
├── flake.nix
└── result -> /nix/store/19h0gfn3wyr7n34iddgyfdxlmpvn0007-rofi-extended

result folder auto-generates after nix build. And nix run (also from the same directory because it relies on flakes) launches the installation process. The problem is that install script in the repo has $pwd varriable in it which represents the current directory. And then the script relies on folders which should be in that directory, namely fonts and files.

As you can see, looking at the tree, there is no such directories (they are in result folder).

Work around is to go to result and then ./bin/rofi-extended and then all installs as should, but i don't like this approach, so here I am, asking for help :)

Btw, I not feel like maintaining this nix package myself, so if there are volunteers or developers themselves, please, feel free to take my code.

default.nix

{
    stdenv,
    fetchFromGitHub,
    ...
}:

stdenv.mkDerivation {
  name = "rofi-extended";
  version = "0.0.1";

  src = fetchFromGitHub {
    owner = "adi1090x";
    repo = "rofi";
    rev = "7e236dd67fd98304e1be9e9adc2bed9106cf895b";
    hash = "sha256-K6WQ+olSy6Rorof/EGi9hP2WQpRONjuGREby+aBlzYg=";
  };
  # "sha256": "126dcnhgkwj68j33ndjfji19dzc4pml11zw7mrla9jsji7x9199b",

  # pwd = toString ./. + "";

  buildPhase = ''
    chmod +x setup.sh
  '';


  installPhase = ''
    mkdir -p $out/bin
    mv setup.sh $out/bin/rofi-extended
    mv files $out/bin
    mv fonts $out/bin
  '';
}

flake.nix

{
  description = "A huge collection of Rofi based custom Applets, Launchers & Powermenus.";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs = { self, nixpkgs }:
  let
    system = "x86_64-linux";
    pkgs = import nixpkgs { inherit system; };
  in {
      packages.${system} = {
          rofi-extended = pkgs.callPackage ./. {}; #extra inputs
          default = self.packages.${system}.rofi-extended;
      };
  };
}
@MyGitHubBlueberry
Copy link
Author

MyGitHubBlueberry commented May 15, 2024

Maybe you could provide script for nixos install?
In your start.sh:

...
## Directories ----------------------------
DIR=`pwd/result`
...

This should work, I think.

Please, let me know if you solve the problem :)

@olaberglund
Copy link

This is not an appropriate way of creating a nix derivation. Feel free to take inspiration from my package.nix for these launchers and themes.

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

No branches or pull requests

2 participants