Skip to content

Install without Flakes

There are various ways to use NixKraken without Flakes, depending on whether you rely on builtin Nix fetchers or a dedicated dependencies pinning tool.

WARNING

Configuration code beyond those specific to NixKraken are provided as example only, your configuration may vary. Feel free to open a discussion if you are stuck integrating NixKraken within your configuration.

Refer to Home Manager installation documentation as well as the NixOS manual for further details on each of these.

The simplest way to use NixKraken without Flakes is to fetch it directly from GitHub inside your Home Manager configuration.

nix
{ lib, pkgs, ... }:

let
  nixkraken = pkgs.fetchFromGitHub {
    owner = "nicolas-goudry";
    repo = "nixkraken";
    tag = "1.0.0";
    # rev = "<branch-name|commit-sha>";
    hash = lib.fakeHash; # Make sure to read the callout below
  };
in
{
  imports = [
    # Import the NixKraken module from the fetched source
    "${nixkraken}/module.nix"
  ];
}

See also: Fetcher reference

About lib.fakeHash

A common pattern in Nix is to use a fake hash like lib.fakeHash or an empty string as a placeholder to obtain a remote source hash.

When the configuration is built, the evaluation will fail. But the error message will output the expected hash, which can then be copied back into the configuration.

To get the hash without a failed evaluation, refer to the section on how to retrieve the release hash.

Alternative Methods

If other fetchers or a dependency pinning tool should be used, see the options below.

Using other Nix Fetchers

fetchzip
nix
{ lib, pkgs, ... }:

{
  imports = [
    "${pkgs.fetchzip {
      url = "https://github.com/nicolas-goudry/nixkraken/archive/1.0.0.zip";
      # url = "https://github.com/nicolas-goudry/nixkraken/archive/<branch-name|tag-name|commit-sha>.zip";
      hash = lib.fakeHash;
    }}/module.nix"
  ];
}

See also: Fetcher reference

fetchgit
nix
{ lib, pkgs, ... }:

{
  imports = [
    "${pkgs.fetchgit {
      url = "https://github.com/nicolas-goudry/nixkraken.git";
      tag = "1.0.0";
      # rev = "<branch-name|commit-sha>";
      hash = lib.fakeHash;
    }}/module.nix"
  ];
}

See also: Fetcher reference

fetchTarball
nix
{ lib, ... }:

{
  imports = [
    "${builtins.fetchTarball {
      url = "https://github.com/nicolas-goudry/nixkraken/archive/1.0.0.tar.gz";
      # url = "https://github.com/nicolas-goudry/nixkraken/archive/<branch-name|tag-name|commit-sha>.tar.gz";
      sha256 = lib.fakeSha256;
    }}/module.nix"
  ];
}

See also: Fetcher reference

Using Pinning Tools

niv

bash
niv add nicolas-goudry/nixkraken -r 1.0.0
# niv add nicolas-goudry/nixkraken -b <branch-name>
# niv add nicolas-goudry/nixkraken -r <tag-name|commit-sha>
nix
let
  sources = import ./nix/sources.nix;
in {
  imports = [
    sources.nixkraken + "/module.nix"
  ];
}

CAUTION

These instructions are untested. Please report an issue if they are not working, or send a PR fixing them.

npins

bash
npins add github nicolas-goudry nixkraken --at 1.0.0
# npins add github nicolas-goudry nixkraken -b <branch-name>
# npins add github nicolas-goudry nixkraken --at <tag-name|commit-sha>
nix
let
  sources = import ./npins;
in {
  imports = [
    sources.nixkraken + "/module.nix"
  ];
}

CAUTION

These instructions are untested. Please report an issue if they are not working, or send a PR fixing them.

Retrieve Release Hash

Users willing to avoid using lib.fakeHash can retrieve the release hash using either nix-prefetch-git or nix-prefetch-url, as shown below.

nix-prefetch-git

The command below outputs various information about NixKraken sources.

bash
nix-prefetch-git \
  --url git@github.com:nicolas-goudry/nixkraken.git \
  --rev 1.0.0 \
  --quiet

Example response with the relevant hash key:

json
{
  "url": "git@github.com:nicolas-goudry/nixkraken.git",
  "rev": "812365dfd82571d82751b192c90d3d6eca16d04c",
  "date": "2025-06-17T15:40:02+02:00",
  "path": "/nix/store/v42lgzcdygj8nyj193vrysi8il0aj8a5-nixkraken",
  "sha256": "1cpvfzdb7m16pj5ykj9dppyr1rm1gnzvhyb5qvvmg5ihbmqx6cgh",
  "hash": "sha256-8DHTcV0wllf3xmV5uL99oeaQ/b0tyemLvCbUs9p3+7I=",
  "fetchLFS": false,
  "fetchSubmodules": false,
  "deepClone": false,
  "leaveDotGit": false
}

Tools like jq can be used to extract it directly from the JSON output:

bash
nix-prefetch-git \
  --url git@github.com:nicolas-goudry/nixkraken.git \
  --rev 1.0.0 \
  --quiet \
| jq -r '.hash'

TIP

To retrieve the sources hash for a given tag or at a given point in history, use --rev <tag-name|commit-sha>.

To retrieve the sources hash for a given branch, use --rev refs/heads/<branch-name>. For the main branch, you can omit the --rev flag altogether.

nix-prefetch-url

The commands below use nix-prefetch-url and either nix-hash or Nix' hash convert commands, depending on Nix experimental feature being enabled.

nix-prefetch-url will download NixKraken source archive from GitHub into the store, extract it and compute its Nix base32 hash.

The hash is then handed to nix-hash / nix hash convert to get the final hash expected by fetchers.

bash
# Using new Nix commands
nix hash convert \
  --hash-algo sha256 \
  --from nix32 \
  "$(nix-prefetch-url \
       --unpack "https://github.com/nicolas-goudry/nixkraken/archive/1.0.0.tar.gz")"
bash
# ...or classic Nix commands
nix-hash \
  --to-sri \
  --type sha256 \
  "$(nix-prefetch-url \
       --unpack "https://github.com/nicolas-goudry/nixkraken/archive/1.0.0.tar.gz")"

TIP

To retrieve the sources hash at a given point in history (branch, tag or commit), replace 1.0.0.tar.gz by <branch-name|tag-name|commit-sha>.tar.gz.

Released under the MIT License