Hello, I’ve recently been trying to use a flake that I’ve developed for a personal project and deploy it as a service to a server running nixos through a nix module. When I attempt this I get an error saying that my custom flake isn’t in the inputs. Here is the error
error:
… while checking flake output 'nixosConfigurations'
at /nix/store/q2jy6sqlxq7rk7ilvaih7gk9vpmmxi59-source/flake.nix:11:5:
10| outputs = { self, nixpkgs, ... }@inputs: {
11| nixosConfigurations.catsinabox = nixpkgs.lib.nixosSystem {
| ^
12| system = "x86_64-linux";
… while checking the NixOS configuration 'nixosConfigurations.catsinabox'
at /nix/store/q2jy6sqlxq7rk7ilvaih7gk9vpmmxi59-source/flake.nix:11:5:
10| outputs = { self, nixpkgs, ... }@inputs: {
11| nixosConfigurations.catsinabox = nixpkgs.lib.nixosSystem {
| ^
12| system = "x86_64-linux";
(stack trace truncated; use '--show-trace' to show the full trace)
error: attribute 'uml-kitchen' missing
at /nix/store/q2jy6sqlxq7rk7ilvaih7gk9vpmmxi59-source/uml-kitchen.nix:3:5:
2| imports = [
3| inputs.uml-kitchen.nixosModules.uml-kitchen
| ^
4| ];
this is my server’s flake:
{
description = "A flake representing the general configuration of the server";
inputs = {
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
uml-kitchen.url = "git+ssh://git@github.com/nemears/uml-kitchen";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, ... }@inputs: {
nixosConfigurations.catsinabox = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
./minecraft.nix
./uml-kitchen.nix
];
};
};
}
and then finally my module where it seems to break uml-kitchen.nix
:
{ inputs, ... } : {
imports = [
inputs.uml-kitchen.nixosModules.uml-kitchen #this line is the one being pointed to during error
];
services.uml-kitchen = {
enable = true;
};
}
Here is my personal projects flake.nix, it is in a private repository as of now.
{
description = "A flake for building deploying and developing uml-kitchen/uml-cafe with nix";
inputs = {
#nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
nixpkgs.follows = "rust-overlay/nixpkgs";
uml-server.url = "git+ssh://git@github.com/nemears/uml-server";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, uml-server }:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays uml-server;
};
systemdAfter = "network.target";
systemdDescription = "Host uml projects";
systemdServiceConfigExecStart = out : "${out}/bin/uml-kitchen ${out}/etc/uml-kitchen/config.json";
systemdServiceConfigType = "simple";
systemdWantedBy = "default.target";
nginxRootEnd = "/var/uml-kitchen/public";
nginxTryFiles = "\$uri /index.html =404";
nginxApiProxyPass = "http://localhost:1672";
in
{
# dev shell for nix develop (good for commandline dev)
devShells.default = pkgs.mkShell {
name="uml-kitchen";
buildInputs = with pkgs; [
openssl
pkg-config
fd
rust-bin.stable.latest.default
rust-analyzer
lldb
gdb
];
};
packages.uml-cafe = pkgs.buildNpmPackage rec {
pname = "uml-cafe";
version = "0.5.2";
src = pkgs.fetchFromGitHub {
owner = "nemears";
repo = pname;
rev = "v${version}";
hash = "sha256-id+9gfEt/KIiZ8c9LJ7KJaBztc6UNIYQ7CqdZ9vBR7Q=";
};
npmDepsHash = "sha256-kXt48H+7vxdJ9TfnAIimGMRsh6ZzU8dZ2NX+TKyrUiw=";
};
packages.uml-kitchen = pkgs.rustPlatform.buildRustPackage rec {
pname = "uml-kitchen";
version = "0.3.2";
src = ./.;
cargoSha256 = "sha256-4C8uzaPi5Xks40fFXzDr/lvZOwymlIOHWA+WAq68QkQ=";
umlcafe = self.packages.${system}.uml-cafe;
umlserver = uml-server.outputs.packages.${system}.default;
doCheck = false;
postInstall = ''
mkdir -p $out/var/uml-kitchen/public/ $out/var/uml-kitchen/private/sessions $out/etc/uml-kitchen $out/etc/systemd/system $out/etc/nginx
cp -r $umlcafe/lib/node_modules/uml-cafe/dist/. $out/var/uml-kitchen/public
cp $src/public/umlStandard.yml $out/var/uml-kitchen/public/umlStandard.yml
echo "{
\"web_client_location\":\"$out/var/uml-kitchen/public\",
\"uml_server_location\":\"$umlserver/bin/uml-server\",
\"data_location\":\"$out/var/uml-kitchen\"
}" > $out/etc/uml-kitchen/config.json
echo "[Unit]
Description=${systemdDescription}
After=${systemdAfter}
[Service]
ExecStart=$out/bin/uml-kitchen $out/etc/uml-kitchen/config.json
Type=${systemdServiceConfigType}
[Install]
WantedBy=${systemdWantedBy}" | tee $out/etc/systemd/system/uml-kitchen.service
echo "root $out${nginxRootEnd};
index index.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files ${nginxTryFiles};
# kill cache
add_header Last-Modified \$date_gmt;
add_header Cache-Control 'no-store, no-cache';
if_modified_since off;
expires off;
etag off;
}
location /api/ {
proxy_pass ${nginxApiProxyPass};
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host \$host;
proxy_read_timeout 300; # may need to adjust (too long?)
proxy_connect_timeout 300; # may need to adjust
proxy_send_timeout 300; # may need to adjust
}" > $out/etc/nginx/uml-kitchen
'';
};
nixosModules.uml-kitchen = ({ config, lib, ... }:
with lib;
let
cfg = config.services.uml-kitchen;
in
{
options.services.uml-kitchen = {
enable = mkOption {
type = types.bool;
description = "enable uml-kitchen service";
};
domain = mkOption {
type = types.string;
description = "the domain that will be bound to";
default = "localhost";
};
};
config = mkIf cfg.enable {
# setup systemd service
systemd.services.uml-kitchen = mkif cfg.enable {
after = systemdAfter;
description = systemdDescription;
serviceConfig = {
ExecStart = systemdServiceConfigExecStart self.packages.${system}.uml-kitchen;
Type = systemdServiceConfigType;
};
wantedBy = [ systemdWantedBy ];
};
services.nginx = {
enable = true;
virtualHosts = {
"${config.services.uml-kitchen.domain}" = {
root = "${self.packages.${system}.uml-kitchen}${nginxRootEnd}";
locations = {
"/" = {
tryFiles = nginxTryFiles;
};
"/api/" = {
proxyPass = nginxApiProxyPass;
proxyWebSockets = true;
recommendedProxySettings = true;
};
};
};
};
};
};
});
packages.default = self.packages.${system}.uml-kitchen;
apps.uml-kitchen = {
type = "app";
program = "${self.packages.${system}.uml-kitchen}/bin/uml-kitchen";
};
apps.default = self.apps.${system}.uml-kitchen;
}
);
}
My nixos directory is like so
etc
nixos
flake.nix
flake.lock
configuration.nix
minecraft.nix
uml-kitchen.nix
I’ve succesfully done this with another flake (minecraft) but not my own, and so i’m confused as to why I get this error. I have added the inputs to the module, and the inputs should be inherited from the special args. My system configuration obviously defines the uml-kitchen
flake input so I am a little confused.
Thanks in advance! This is my first time using flakes in a nixos config, as well as making my own nix config so I imagine i could have missed something obvious.