NixOS and Home Manager config

feat: define a cyclamen package set and add abaca do it as a standalone package

nel.pet a2affd6d 0a401ba7

verified
+12
flake.nix
··· 14 14 }; 15 15 16 16 outputs = { 17 + self, 17 18 nixpkgs, 18 19 home-manager, 20 + wrappers, 19 21 ... 20 22 } @ inputs: let 21 23 lib = nixpkgs.lib; ··· 38 40 devShells = forAllSystems (system: pkgs: { 39 41 rust = (pkgs.callPackage ./templates/rust/shell.nix { }); 40 42 }); 43 + 44 + legacyPackages = forAllSystems (system: pkgs: (import ./pkgs.nix) pkgs wrappers); 45 + packages = forAllSystems (system: pkgs: lib.filterAttrs 46 + (_: pkg: let 47 + isDerivation = lib.isDerivation pkg; 48 + availableOnHost = lib.meta.availableOn pkgs.stdenv.hostPlatform pkg; 49 + isBroken = pkg.meta.broken or false; 50 + in isDerivation && !isBroken && availableOnHost) 51 + self.legacyPackages.${system} 52 + ); 41 53 42 54 templates = { 43 55 rust = {
+6
modules/home/abaca.nix
··· 1 + { cypkgs, ... }: { 2 + home.packages = [ 3 + cypkgs.abaca 4 + ]; 5 + } 6 +
+5
modules/home/cypkgs.nix
··· 1 + { pkgs, inputs, ...}: { 2 + config._module.args.cypkgs = 3 + (import ./../../pkgs.nix) pkgs inputs.wrappers; 4 + } 5 +
+3 -1
modules/home/default.nix
··· 1 1 {...}: { 2 2 imports = [ 3 + ./abaca.nix 3 4 ./alacritty.nix 5 + ./cypkgs.nix 4 6 ./fonts.nix 5 7 ./git.nix 6 - ./helix/default.nix 8 + ./helix.nix 7 9 ./i18n.nix 8 10 ./kitty/default.nix 9 11 ./vscode.nix
+32
modules/home/helix.nix
··· 1 + { wrappers, ... }: let 2 + helix = wrappers.helix { 3 + settings = { 4 + theme = "catppuccin_mocha"; 5 + editor = { 6 + bufferline = "multiple"; 7 + }; 8 + }; 9 + languages = { 10 + language-server.nixd = { 11 + config = { 12 + nixpkgs = { 13 + expr = "import \"\${(builtins.getFlake (builtins.toString ./.)).inputs.nixpkgs}\" { }"; 14 + }; 15 + options = { 16 + nixos = { 17 + expr = "(let flake = (builtins.getFlake (builtins.toString ./.)); pkgs = import \"\${flake.inputs.nixpkgs}\" { }; in (pkgs.lib.evalModules { modules = (import \"\${flake.inputs.nixpkgs}/nixos/modules/module-list.nix\") ++ [ ({...}: { nixpkgs.hostPlatform = builtins.currentSystem;} ) ] ; })).options"; 18 + }; 19 + home-manager = { 20 + expr = "(let flake = (builtins.getFlake (builtins.toString ./.)); pkgs = import \"\${flake.inputs.nixpkgs}\" { }; lib = import \"\${flake.inputs.home-manager}/modules/lib/stdlib-extended.nix\" pkgs.lib; in (lib.evalModules { modules = (import \"\${flake.inputs.home-manager}/modules/modules.nix\") { inherit lib pkgs; check = false; }; })).options"; 21 + }; 22 + }; 23 + }; 24 + }; 25 + }; 26 + }; 27 + in { 28 + home.packages = [ 29 + helix 30 + ]; 31 + } 32 +
+26 -22
modules/home/helix/default.nix pkgs/ab/abaca/package.nix
··· 1 - { lib, pkgs, wrappers, inputs, ... }: let 1 + { 2 + lib, 3 + pkgs, 4 + wlib, 5 + wrappers, 6 + writeShellApplication, 7 + writeTextDir, 8 + zellij, 9 + bash, 10 + broot, 11 + }: let 2 12 helix = wrappers.helix { 3 13 settings = { 4 14 theme = "catppuccin_mocha"; ··· 16 26 nixos = { 17 27 expr = "(let flake = (builtins.getFlake (builtins.toString ./.)); pkgs = import \"\${flake.inputs.nixpkgs}\" { }; in (pkgs.lib.evalModules { modules = (import \"\${flake.inputs.nixpkgs}/nixos/modules/module-list.nix\") ++ [ ({...}: { nixpkgs.hostPlatform = builtins.currentSystem;} ) ] ; })).options"; 18 28 }; 19 - home_manager = { 29 + home-manager = { 20 30 expr = "(let flake = (builtins.getFlake (builtins.toString ./.)); pkgs = import \"\${flake.inputs.nixpkgs}\" { }; lib = import \"\${flake.inputs.home-manager}/modules/lib/stdlib-extended.nix\" pkgs.lib; in (lib.evalModules { modules = (import \"\${flake.inputs.home-manager}/modules/modules.nix\") { inherit lib pkgs; check = false; }; })).options"; 21 31 }; 22 32 }; ··· 26 36 }; 27 37 # TODO: figure out something better than broot (probably self written). its close but not quite what i want and 28 38 # configuring it is (evidently) a pain in the ass 29 - broot-opener = pkgs.writeShellApplication { 39 + broot-opener = writeShellApplication { 30 40 name = "broot-zellij-hx-opener"; 31 41 text = '' 32 42 # Make sure we are focused on helix ··· 37 47 zellij action write 13 # enter 38 48 ''; 39 49 }; 40 - broot-conf = pkgs.writeTextDir "brootconf/conf.toml" '' 50 + broot-conf = writeTextDir "brootconf/conf.toml" '' 41 51 modal = true 42 52 initial_mode = "command" 43 53 ··· 47 57 invocation = "edit" 48 58 key = "enter" 49 59 shortcut = "e" 50 - external = [ "${lib.getExe pkgs.bash}", "-e", "${lib.getExe broot-opener}", "{file}" ] 60 + external = [ "${lib.getExe bash}", "-e", "${lib.getExe broot-opener}", "{file}" ] 51 61 apply_to = "text_file" 52 62 leave_broot = false 53 63 ''; 54 - abaca-broot = inputs.wrappers.lib.wrapPackage { 64 + abaca-broot = wlib.wrapPackage { 55 65 inherit pkgs; 56 - package = pkgs.broot; 66 + package = broot; 57 67 env = { 58 68 BROOT_CONFIG_DIR = "${broot-conf}/brootconf"; 59 69 }; 60 70 }; 61 - abaca = pkgs.writeShellApplication { 62 - name = "abaca"; 63 - runtimeInputs = [ pkgs.zellij helix abaca-broot ]; 64 - text = '' 65 - exec ${lib.getExe pkgs.zellij} \ 66 - "--config" "${./zellij-config.kdl}" \ 67 - "--layout" "${./layout.kdl}" \ 68 - "$@" 69 - ''; 70 - }; 71 - in { 72 - home.packages = [ 73 - helix 74 - abaca 75 - ]; 71 + in writeShellApplication { 72 + name = "abaca"; 73 + runtimeInputs = [ zellij helix abaca-broot ]; 74 + text = '' 75 + exec ${lib.getExe zellij} \ 76 + "--config" "${./zellij-config.kdl}" \ 77 + "--layout" "${./layout.kdl}" \ 78 + "$@" 79 + ''; 76 80 } 77 81
modules/home/helix/layout.kdl pkgs/ab/abaca/layout.kdl
modules/home/helix/zellij-config.kdl pkgs/ab/abaca/zellij-config.kdl
+25
pkgs.nix
··· 1 + # Logic largely stolen from https://github.com/tgirlcloud/pkgs/blob/6f929dface8c099634067c02e242e0c668c4858b/default.nix 2 + # Thank you idabell <3 3 + 4 + # All configuration is intentionally left provided by the provided nixpkgs instance 5 + nixpkgs: wrappers: let 6 + inherit (builtins) readDir; 7 + inherit (nixpkgs) lib; 8 + inherit (lib) mapAttrs mergeAttrsList mapAttrsToList; 9 + 10 + baseDirectory = ./pkgs; 11 + 12 + packagesForShard = 13 + shard: type: 14 + mapAttrs (name: _: baseDirectory + "/${shard}/${name}/package.nix") ( 15 + readDir (baseDirectory + "/${shard}") 16 + ); 17 + 18 + packagesFiles = mergeAttrsList (mapAttrsToList packagesForShard (readDir baseDirectory)); 19 + 20 + packages = lib.makeScope nixpkgs.newScope (self: { 21 + wlib = wrappers.lib; 22 + wrappers = lib.mapAttrs (name: wrapper: conf: (wrapper.apply (conf // { pkgs = nixpkgs; })).wrapper) wrappers.wrapperModules; 23 + } // (mapAttrs (_: lib.flip self.callPackage { }) packagesFiles)); 24 + in packages 25 +