-
Notifications
You must be signed in to change notification settings - Fork 105
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
Git sources in flakes #368
Comments
The problem here is that ansible doesn't have a Working flake using devel ref{
description = "Flake to manage k8s workspace";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
mach-nix.url = "github:DavHau/mach-nix?ref=3.3.0";
};
outputs = { self, nixpkgs, flake-utils, mach-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
python = "python39"; # <--- change here
pkgs = nixpkgs.legacyPackages.${system};
# https://github.com/DavHau/mach-nix/issues/153#issuecomment-717690154
mach-nix-wrapper = import mach-nix { inherit pkgs python; };
ansible-upstream = mach-nix-wrapper.buildPythonPackage {
src = builtins.fetchGit{
url = "https://github.com/ansible/ansible";
ref = "devel";
rev = "cd2d8b77fe699f7cc8529dfa296b0d2894630599";
};
};
pythonBuild = mach-nix-wrapper.mkPython {
packagesExtra = [
ansible-upstream
];
};
in {
devShell = pkgs.mkShell {
buildInputs = [
pkgs.kubectl
pkgs.pass
pkgs.k9s
pkgs.terraform
pkgs.envsubst
pkgs.pwgen
pythonBuild
];
};
packages = {
inherit ansible-upstream;
};
});
} The error message that $ nix build .#ansible-upstream
fetching Git repository 'https://github.com/ansible/ansible'fatal: couldn't find remote ref refs/heads/master
error: program 'git' failed with exit code 128
(use '--show-trace' to show detailed location information) DavHau was kind enough to merge the commit that resolved the |
Well, I guess that kind of counts as 'doing something stupidly wrong'. :-D Thanks a lot for helping me out, it's highly appreciated! I got lost in trying to understand how the Nix expression works and surely assumed my mistake was somewhere in the expression and not in something as 'trivial' as a branch name. (Although, you did change the expression somewhat so probably the mistake was in the expression and the branch name ;) ) Also, thank you for your work on making On another note (if you forgive a short OT question): You write commands like |
The expression was nearly there already; most of my changes were to demonstrate the branch name issue more easily. Your original flake works perfectly fine with And thanks for the kind words; As for your question, I personally run $ echo #text
#text
$ # echo text
#: command not found Commands in that form are meant to be run verbatim, such as the ones in the |
I've been trying to get this to work for days, but I'm kind of stuck. I'm fairly new to Nix, so the solution might be obvious.
So I'm starting with the following flake that I use in conjunction with
direnv
to set up a k8s workspace:Working flake using mach-nix
However, I need a feature from ansible's master branch which hasn't been released yet. I know I can't just list the github url in the requirements due to #36.
But when, instead, I try to add it to
packagesExtra
usingbuildPythonPackage
like this...Full flake with packagesExtra
...I get the following error:
Output of invocation with --show-trace
In #153 (comment), @nat543207 said that
buildPythonPackage
won't work with flakes because the extractor usesimport <nixpkgs>
, so I tried specifyingrequirements
,pname
andversion
, but that results in the same error.Flake with packagesExtra and requirements, pname and version
Please tell me if I'm doing something stupidly wrong or if this use case is simply not yet supported by mach-nix. In case of the latter, what would need to be done to make it possible or are there any alternatives to achieve something similar?
The text was updated successfully, but these errors were encountered: