From 8772ea1a1f453d7676027dfbe15eb79c8af14c04 Mon Sep 17 00:00:00 2001 From: Sam Lehman Date: Tue, 30 Jan 2024 20:46:53 -0500 Subject: [PATCH] switch devenv -> devshells --- .envrc | 2 +- flake.nix | 105 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 63 insertions(+), 44 deletions(-) diff --git a/.envrc b/.envrc index cffc922..a5dbbcb 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use flake . --impure +use flake . diff --git a/flake.nix b/flake.nix index b9dfcb8..a10a9ab 100644 --- a/flake.nix +++ b/flake.nix @@ -22,8 +22,8 @@ } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { imports = [ - inputs.devenv.flakeModule - #inputs.devshell.flakeModule + #inputs.devenv.flakeModule + inputs.devshell.flakeModule inputs.flake-parts.flakeModules.easyOverlay inputs.hercules-ci-effects.flakeModule #inputs.pre-commit-hooks-nix.flakeModule @@ -54,46 +54,62 @@ pkgs, ... }: { - devenv.shells.default = { - name = "resume.nix"; - #certificates = ["resume.samlehman.dev"]; - #devcontainer = { enable= true; settings= {}; }; - difftastic.enable = true; - enterShell = '' - echo "Welcome to resume.nix!" - ''; - env = {}; - #hosts = {"resume.samlehman.dev" = "127.0.0.1";}; - languages = { - javascript.enable = true; - nix.enable = true; - #texlive = {enable=true; packages=["collection-basic"]; base=pkgs.texlive;}; - }; - packages = with config.packages; [ - pkgs.nix-direnv - pkgs.resumed - pkgs.puppeteer-cli - default - jsonresume-theme-elegant - jsonresume-theme-full - jsonresume-theme-fullmoon - jsonresume-theme-kendall - jsonresume-theme-macchiato - jsonresume-theme-stackoverflow - #config.treefmt.build.wrapper - #config.treefmt.build.programs + #devenv.shells.default = { + # name = "resume.nix"; + # #certificates = ["resume.samlehman.dev"]; + # #devcontainer = { enable= true; settings= {}; }; + # difftastic.enable = true; + # enterShell = '' + # echo "Welcome to resume.nix!" + # ''; + # env = {}; + # #hosts = {"resume.samlehman.dev" = "127.0.0.1";}; + # languages = { + # javascript.enable = true; + # nix.enable = true; + # #texlive = {enable=true; packages=["collection-basic"]; base=pkgs.texlive;}; + # }; + # packages = with config.packages; [ + # pkgs.nix-direnv + # pkgs.resumed + # pkgs.puppeteer-cli + # default + # jsonresume-theme-elegant + # jsonresume-theme-full + # jsonresume-theme-fullmoon + # jsonresume-theme-kendall + # jsonresume-theme-macchiato + # jsonresume-theme-stackoverflow + # #config.treefmt.build.wrapper + # #config.treefmt.build.programs + # ]; + # #pre-commit = {}; #https://github.com/cachix/pre-commit-hooks.nix + # #process = { + # # after = ""; + # # before = ""; + # # implementation = "honcho"; # honcho|overmind|process-compose|hivemind + # # process-compose = {port=9999; tui=true; version="0.5"; }; + # #}; + # starship = { + # enable = true; + # #config = {enable = true; path = "${config.env.DEVENV_ROOT}/starship.toml";}; + # }; + #}; + devshells.default = { + commands = [ + { + name = "build-default"; + command = "nix build"; + } + { + name = "build-html"; + command = "nix build .#jsonresume-html"; + } + { + name = "build-pdf"; + command = "nix build .#jsonresume-pdf"; + } ]; - #pre-commit = {}; #https://github.com/cachix/pre-commit-hooks.nix - #process = { - # after = ""; - # before = ""; - # implementation = "honcho"; # honcho|overmind|process-compose|hivemind - # process-compose = {port=9999; tui=true; version="0.5"; }; - #}; - starship = { - enable = true; - #config = {enable = true; path = "${config.env.DEVENV_ROOT}/starship.toml";}; - }; }; hercules-ci.github-pages = { settings = {contents = config.packages.default;}; @@ -117,6 +133,7 @@ }; packages = let version = "0.1.0"; + defaultTheme = "fullmoon"; builder = theme: let htmlPkgName = "jsonresume-html-${theme}"; htmlPkg = config.packages.${htmlPkgName}; @@ -163,8 +180,8 @@ resume = pkgs.symlinkJoin { name = "resume"; paths = [ - config.packages.jsonresume-html-fullmoon - config.packages.jsonresume-pdf-fullmoon + config.packages.jsonresume-html + config.packages.jsonresume-pdf ]; }; @@ -186,6 +203,7 @@ }; # TODO: Genericize + jsonresume-html = config.packages."jsonresume-html-${defaultTheme}"; jsonresume-html-full = (builder "full").html; jsonresume-html-fullmoon = (builder "fullmoon").html; jsonresume-html-elegant = (builder "elegant").html; @@ -193,6 +211,7 @@ jsonresume-html-macchiato = (builder "macchiato").html; jsonresume-html-stackoverflow = (builder "stackoverflow").html; + jsonresume-pdf = config.packages."jsonresume-pdf-${defaultTheme}"; jsonresume-pdf-full = (builder "full").pdf; jsonresume-pdf-fullmoon = (builder "fullmoon").pdf; jsonresume-pdf-elegant = (builder "elegant").pdf;