commit 034525f66869cec3941694da62839ec66487d1d1 Author: Jeffrey C. Ollie Date: Sun Dec 3 10:17:55 2023 -0600 first diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d6944e3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/result* diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..dd3fbb1 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..74cb98b --- /dev/null +++ b/flake.nix @@ -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 + ''; + }; + }; + }; +}