This commit is contained in:
Jeffrey C. Ollie 2023-12-03 10:17:55 -06:00
commit 034525f668
Signed by: jeff
GPG key ID: 6F86035A6D97044E
3 changed files with 149 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/result*

60
flake.lock Normal file
View file

@ -0,0 +1,60 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1701253981,
"narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs-unstable": "nixpkgs-unstable"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

88
flake.nix Normal file
View file

@ -0,0 +1,88 @@
{
description = "figureine";
inputs = {
nixpkgs = {
url = "nixpkgs/nixos-unstable";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
...
} @ inputs:
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs {
inherit system;
};
in {
packages = {
figurine = let
pname = "figurine";
version = "1.3.0";
hash = "sha256-1q6Y7oEntd823nWosMcKXi6c3iWsBTxPnSH4tR6+XYs=";
vendorHash = "sha256-mLdAaYkQH2RHcZft27rDW1AoFCWKiUZhh2F0DpqZELw=";
src = pkgs.fetchFromGitHub {
inherit hash;
owner = "arsham";
repo = pname;
rev = "refs/tags/v${version}";
};
in
pkgs.buildGo121Module {
inherit pname src version vendorHash;
meta = {
description = "";
homepage = "";
changelog = "";
license = pkgs.lib.licenses.asl20;
mainProgram = pname;
};
};
};
}
)
// {
nixosModules.figurine = {
config,
lib,
pkgs,
...
}: let
cfg = config.services.figurine;
in {
options = {
services.figurine = lib.mkOption {
type = lib.types.submodule {
options = {
enable = lib.mkEnableOption "Enable figurine";
};
};
};
};
config = lib.mkIf cfg.enable {
environment.etc = {
"fish/conf.d/figurine.fish".text = ''
status is-login; and begin
${self.packages.${pkgs.system}.figurine}/bin/figurine --font 3d.flf ${config.networking.hostName}
end
'';
};
programs.bash.interactiveShellInit = ''
if [ $SHLVL -eq 1 ]
then
${self.packages.${pkgs.system}.figurine}/bin/figurine --font 3d.flf ${config.networking.hostName}
fi
'';
};
};
};
}